diff --git a/src/loadpath/static/assets/LayeredGraph3D-DIGrA9CU.js b/src/loadpath/static/assets/LayeredGraph3D-DIGrA9CU.js deleted file mode 100644 index e337116..0000000 --- a/src/loadpath/static/assets/LayeredGraph3D-DIGrA9CU.js +++ /dev/null @@ -1,4116 +0,0 @@ -import{r as Ot,l as oc,n as nr,c as lc,i as cc,a as hc,j as Zn,t as uc}from"./index-CcW4ogPp.js";/** - * @license - * Copyright 2010-2026 Three.js Authors - * SPDX-License-Identifier: MIT - */const La="185",wi={ROTATE:0,DOLLY:1,PAN:2},Ai={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},dc=0,lo=1,fc=2,Ds=1,pc=2,qi=3,Hn=0,zt=1,cn=2,yn=0,Ri=1,co=2,ho=3,uo=4,mc=5,jn=100,_c=101,gc=102,xc=103,vc=104,Mc=200,Sc=201,Ec=202,yc=203,zr=204,Gr=205,bc=206,Tc=207,Ac=208,wc=209,Rc=210,Cc=211,Pc=212,Dc=213,Lc=214,Vr=0,Hr=1,kr=2,Di=3,Wr=4,Xr=5,Yr=6,qr=7,vl=0,Ic=1,Uc=2,fn=0,Ml=1,Sl=2,El=3,yl=4,bl=5,Tl=6,Al=7,wl=300,ii=301,Li=302,ir=303,sr=304,$s=306,Zr=1e3,En=1001,Kr=1002,At=1003,Nc=1004,is=1005,Lt=1006,rr=1007,ti=1008,Wt=1009,Rl=1010,Cl=1011,$i=1012,Ia=1013,mn=1014,un=1015,Tn=1016,Ua=1017,Na=1018,Ji=1020,Pl=35902,Dl=35899,Ll=1021,Il=1022,nn=1023,An=1026,ni=1027,Ul=1028,Fa=1029,si=1030,Oa=1031,Ba=1033,Ls=33776,Is=33777,Us=33778,Ns=33779,$r=35840,Jr=35841,Qr=35842,jr=35843,ea=36196,ta=37492,na=37496,ia=37488,sa=37489,Bs=37490,ra=37491,aa=37808,oa=37809,la=37810,ca=37811,ha=37812,ua=37813,da=37814,fa=37815,pa=37816,ma=37817,_a=37818,ga=37819,xa=37820,va=37821,Ma=36492,Sa=36494,Ea=36495,ya=36283,ba=36284,zs=36285,Ta=36286,Fc=3200,Aa=0,Oc=1,zn="",kt="srgb",Gs="srgb-linear",Vs="linear",Je="srgb",li=7680,fo=519,Bc=512,zc=513,Gc=514,za=515,Vc=516,Hc=517,Ga=518,kc=519,wa=35044,po="300 es",dn=2e3,Qi=2001;function Wc(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Hs(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Xc(){const i=Hs("canvas");return i.style.display="block",i}const mo={};function ks(...i){const e="THREE."+i.shift();console.log(e,...i)}function Nl(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function De(...i){i=Nl(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function We(...i){i=Nl(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Ci(...i){const e=i.join(" ");e in mo||(mo[e]=!0,De(...i))}function Yc(i,e,t){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}const qc={[Vr]:Hr,[kr]:Yr,[Wr]:qr,[Di]:Xr,[Hr]:Vr,[Yr]:kr,[qr]:Wr,[Xr]:Di};class Xn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const s=n[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let r=0,a=s.length;r>8&255]+Pt[i>>16&255]+Pt[i>>24&255]+"-"+Pt[e&255]+Pt[e>>8&255]+"-"+Pt[e>>16&15|64]+Pt[e>>24&255]+"-"+Pt[t&63|128]+Pt[t>>8&255]+"-"+Pt[t>>16&255]+Pt[t>>24&255]+Pt[n&255]+Pt[n>>8&255]+Pt[n>>16&255]+Pt[n>>24&255]).toLowerCase()}function He(i,e,t){return Math.max(e,Math.min(t,i))}function Zc(i,e){return(i%e+e)%e}function ar(i,e,t){return(1-t)*i+t*e}function hn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function je(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const Kc={DEG2RAD:Fs},Ja=class Ja{constructor(e=0,t=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("THREE.Vector2: 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("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6],this.y=s[1]*t+s[4]*n+s[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=He(this.x,e.x,t.x),this.y=He(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=He(this.x,e,t),this.y=He(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(He(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(He(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),s=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*s+e.x,this.y=r*s+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Ja.prototype.isVector2=!0;let we=Ja;class kn{constructor(e=0,t=0,n=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=s}static slerpFlat(e,t,n,s,r,a,o){let c=n[s+0],l=n[s+1],d=n[s+2],m=n[s+3],h=r[a+0],_=r[a+1],v=r[a+2],E=r[a+3];if(m!==E||c!==h||l!==_||d!==v){let p=c*h+l*_+d*v+m*E;p<0&&(h=-h,_=-_,v=-v,E=-E,p=-p);let u=1-o;if(p<.9995){const A=Math.acos(p),R=Math.sin(A);u=Math.sin(u*A)/R,o=Math.sin(o*A)/R,c=c*u+h*o,l=l*u+_*o,d=d*u+v*o,m=m*u+E*o}else{c=c*u+h*o,l=l*u+_*o,d=d*u+v*o,m=m*u+E*o;const A=1/Math.sqrt(c*c+l*l+d*d+m*m);c*=A,l*=A,d*=A,m*=A}}e[t]=c,e[t+1]=l,e[t+2]=d,e[t+3]=m}static multiplyQuaternionsFlat(e,t,n,s,r,a){const o=n[s],c=n[s+1],l=n[s+2],d=n[s+3],m=r[a],h=r[a+1],_=r[a+2],v=r[a+3];return e[t]=o*v+d*m+c*_-l*h,e[t+1]=c*v+d*h+l*m-o*_,e[t+2]=l*v+d*_+o*h-c*m,e[t+3]=d*v-o*m-c*h-l*_,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,s){return this._x=e,this._y=t,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,s=e._y,r=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),d=o(s/2),m=o(r/2),h=c(n/2),_=c(s/2),v=c(r/2);switch(a){case"XYZ":this._x=h*d*m+l*_*v,this._y=l*_*m-h*d*v,this._z=l*d*v+h*_*m,this._w=l*d*m-h*_*v;break;case"YXZ":this._x=h*d*m+l*_*v,this._y=l*_*m-h*d*v,this._z=l*d*v-h*_*m,this._w=l*d*m+h*_*v;break;case"ZXY":this._x=h*d*m-l*_*v,this._y=l*_*m+h*d*v,this._z=l*d*v+h*_*m,this._w=l*d*m-h*_*v;break;case"ZYX":this._x=h*d*m-l*_*v,this._y=l*_*m+h*d*v,this._z=l*d*v-h*_*m,this._w=l*d*m+h*_*v;break;case"YZX":this._x=h*d*m+l*_*v,this._y=l*_*m+h*d*v,this._z=l*d*v-h*_*m,this._w=l*d*m-h*_*v;break;case"XZY":this._x=h*d*m-l*_*v,this._y=l*_*m-h*d*v,this._z=l*d*v+h*_*m,this._w=l*d*m+h*_*v;break;default:De("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,s=Math.sin(n);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],s=t[4],r=t[8],a=t[1],o=t[5],c=t[9],l=t[2],d=t[6],m=t[10],h=n+o+m;if(h>0){const _=.5/Math.sqrt(h+1);this._w=.25/_,this._x=(d-c)*_,this._y=(r-l)*_,this._z=(a-s)*_}else if(n>o&&n>m){const _=2*Math.sqrt(1+n-o-m);this._w=(d-c)/_,this._x=.25*_,this._y=(s+a)/_,this._z=(r+l)/_}else if(o>m){const _=2*Math.sqrt(1+o-n-m);this._w=(r-l)/_,this._x=(s+a)/_,this._y=.25*_,this._z=(c+d)/_}else{const _=2*Math.sqrt(1+m-n-o);this._w=(a-s)/_,this._x=(r+l)/_,this._y=(c+d)/_,this._z=.25*_}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(He(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const s=Math.min(1,t/n);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,s=e._y,r=e._z,a=e._w,o=t._x,c=t._y,l=t._z,d=t._w;return this._x=n*d+a*o+s*l-r*c,this._y=s*d+a*c+r*o-n*l,this._z=r*d+a*l+n*c-s*o,this._w=a*d-n*o-s*c-r*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,s=e._y,r=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,s=-s,r=-r,a=-a,o=-o);let c=1-t;if(o<.9995){const l=Math.acos(o),d=Math.sin(l);c=Math.sin(c*l)/d,t=Math.sin(t*l)/d,this._x=this._x*c+n*t,this._y=this._y*c+s*t,this._z=this._z*c+r*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+s*t,this._z=this._z*c+r*t,this._w=this._w*c+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Qa=class Qa{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: 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("THREE.Vector3: 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(_o.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(_o.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*s,this.y=r[1]*t+r[4]*n+r[7]*s,this.z=r[2]*t+r[5]*n+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,s=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*s+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*s+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*s+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,s=this.z,r=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*s-o*n),d=2*(o*t-r*s),m=2*(r*n-a*t);return this.x=t+c*l+a*m-o*d,this.y=n+c*d+o*l-r*m,this.z=s+c*m+r*d-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*s,this.y=r[1]*t+r[5]*n+r[9]*s,this.z=r[2]*t+r[6]*n+r[10]*s,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=He(this.x,e.x,t.x),this.y=He(this.y,e.y,t.y),this.z=He(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=He(this.x,e,t),this.y=He(this.y,e,t),this.z=He(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(He(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,s=e.y,r=e.z,a=t.x,o=t.y,c=t.z;return this.x=s*c-r*o,this.y=r*a-n*c,this.z=n*o-s*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return or.copy(this).projectOnVector(e),this.sub(or)}reflect(e){return this.sub(or.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(He(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,s=this.z-e.z;return t*t+n*n+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const s=Math.sin(t)*e;return this.x=s*Math.sin(n),this.y=Math.cos(t)*e,this.z=s*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=s,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()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Qa.prototype.isVector3=!0;let I=Qa;const or=new I,_o=new kn,ja=class ja{constructor(e,t,n,s,r,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,a,o,c,l)}set(e,t,n,s,r,a,o,c,l){const d=this.elements;return d[0]=e,d[1]=s,d[2]=o,d[3]=t,d[4]=r,d[5]=c,d[6]=n,d[7]=a,d[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,s=t.elements,r=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],d=n[4],m=n[7],h=n[2],_=n[5],v=n[8],E=s[0],p=s[3],u=s[6],A=s[1],R=s[4],M=s[7],T=s[2],S=s[5],w=s[8];return r[0]=a*E+o*A+c*T,r[3]=a*p+o*R+c*S,r[6]=a*u+o*M+c*w,r[1]=l*E+d*A+m*T,r[4]=l*p+d*R+m*S,r[7]=l*u+d*M+m*w,r[2]=h*E+_*A+v*T,r[5]=h*p+_*R+v*S,r[8]=h*u+_*M+v*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],d=e[8];return t*a*d-t*o*l-n*r*d+n*o*c+s*r*l-s*a*c}invert(){const e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],d=e[8],m=d*a-o*l,h=o*c-d*r,_=l*r-a*c,v=t*m+n*h+s*_;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/v;return e[0]=m*E,e[1]=(s*l-d*n)*E,e[2]=(o*n-s*a)*E,e[3]=h*E,e[4]=(d*t-s*c)*E,e[5]=(s*r-o*t)*E,e[6]=_*E,e[7]=(n*c-l*t)*E,e[8]=(a*t-n*r)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,s,r,a,o){const c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-s*l,s*c,-s*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return Ci("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(lr.makeScale(e,t)),this}rotate(e){return Ci("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(lr.makeRotation(-e)),this}translate(e,t){return Ci("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(lr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let s=0;s<9;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};ja.prototype.isMatrix3=!0;let Fe=ja;const lr=new Fe,go=new Fe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),xo=new Fe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function $c(){const i={enabled:!0,workingColorSpace:Gs,spaces:{},convert:function(s,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===Je&&(s.r=bn(s.r),s.g=bn(s.g),s.b=bn(s.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Je&&(s.r=Pi(s.r),s.g=Pi(s.g),s.b=Pi(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===zn?Vs:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,a){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return Ci("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Ci("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(s,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Gs]:{primaries:e,whitePoint:n,transfer:Vs,toXYZ:go,fromXYZ:xo,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:kt},outputColorSpaceConfig:{drawingBufferColorSpace:kt}},[kt]:{primaries:e,whitePoint:n,transfer:Je,toXYZ:go,fromXYZ:xo,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:kt}}}),i}const Xe=$c();function bn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Pi(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ci;class Jc{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ci===void 0&&(ci=Hs("canvas")),ci.width=e.width,ci.height=e.height;const s=ci.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=ci}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Hs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const s=n.getImageData(0,0,e.width,e.height),r=s.data;for(let a=0;a1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(hr).x}get height(){return this.source.getSize(hr).y}get depth(){return this.source.getSize(hr).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){De(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){De(`Texture.setValues(): property '${t}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==wl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Zr:e.x=e.x-Math.floor(e.x);break;case En:e.x=e.x<0?0:1;break;case Kr: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 Zr:e.y=e.y-Math.floor(e.y);break;case En:e.y=e.y<0?0:1;break;case Kr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}It.DEFAULT_IMAGE=null;It.DEFAULT_MAPPING=wl;It.DEFAULT_ANISOTROPY=1;const eo=class eo{constructor(e=0,t=0,n=0,s=1){this.x=e,this.y=t,this.z=n,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,s){return this.x=e,this.y=t,this.z=n,this.w=s,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("THREE.Vector4: 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("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,s=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*s+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*s+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*s+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*s+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,s,r;const c=e.elements,l=c[0],d=c[4],m=c[8],h=c[1],_=c[5],v=c[9],E=c[2],p=c[6],u=c[10];if(Math.abs(d-h)<.01&&Math.abs(m-E)<.01&&Math.abs(v-p)<.01){if(Math.abs(d+h)<.1&&Math.abs(m+E)<.1&&Math.abs(v+p)<.1&&Math.abs(l+_+u-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const R=(l+1)/2,M=(_+1)/2,T=(u+1)/2,S=(d+h)/4,w=(m+E)/4,g=(v+p)/4;return R>M&&R>T?R<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(R),s=S/n,r=w/n):M>T?M<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(M),n=S/s,r=g/s):T<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(T),n=w/r,s=g/r),this.set(n,s,r,t),this}let A=Math.sqrt((p-v)*(p-v)+(m-E)*(m-E)+(h-d)*(h-d));return Math.abs(A)<.001&&(A=1),this.x=(p-v)/A,this.y=(m-E)/A,this.z=(h-d)/A,this.w=Math.acos((l+_+u-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=He(this.x,e.x,t.x),this.y=He(this.y,e.y,t.y),this.z=He(this.z,e.z,t.z),this.w=He(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=He(this.x,e,t),this.y=He(this.y,e,t),this.z=He(this.z,e,t),this.w=He(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(He(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};eo.prototype.isVector4=!0;let ht=eo;class eh extends Xn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Lt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ht(0,0,e,t),this.scissorTest=!1,this.viewport=new ht(0,0,e,t),this.textures=[];const s={width:e,height:t,depth:n.depth},r=new It(s),a=n.count;for(let o=0;o1);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.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(o=>({...o})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,d=c.length;l0){s.children=[];for(let o=0;o0){s.animations=[];for(let o=0;o0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),d.length>0&&(n.images=d),m.length>0&&(n.shapes=m),h.length>0&&(n.skeletons=h),_.length>0&&(n.animations=_),v.length>0&&(n.nodes=v)}return n.object=s,n;function a(o){const c=[];for(const l in o){const d=o[l];delete d.metadata,c.push(d)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n_+v?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&h<=_-v&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(s=t.getPose(e.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(lh)))}return o!==null&&(o.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Zi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Ol={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},In={h:0,s:0,l:0},as={h:0,s:0,l:0};function fr(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Ie{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=kt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Xe.colorSpaceToWorking(this,t),this}setRGB(e,t,n,s=Xe.workingColorSpace){return this.r=e,this.g=t,this.b=n,Xe.colorSpaceToWorking(this,s),this}setHSL(e,t,n,s=Xe.workingColorSpace){if(e=Zc(e,1),t=He(t,0,1),n=He(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=fr(a,r,e+1/3),this.g=fr(a,r,e),this.b=fr(a,r,e-1/3)}return Xe.colorSpaceToWorking(this,s),this}setStyle(e,t=kt){function n(r){r!==void 0&&parseFloat(r)<1&&De("Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=s[1],o=s[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:De("Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,16),t);De("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=kt){const n=Ol[e.toLowerCase()];return n!==void 0?this.setHex(n,t):De("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=bn(e.r),this.g=bn(e.g),this.b=bn(e.b),this}copyLinearToSRGB(e){return this.r=Pi(e.r),this.g=Pi(e.g),this.b=Pi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=kt){return Xe.workingToColorSpace(Dt.copy(this),e),Math.round(He(Dt.r*255,0,255))*65536+Math.round(He(Dt.g*255,0,255))*256+Math.round(He(Dt.b*255,0,255))}getHexString(e=kt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Xe.workingColorSpace){Xe.workingToColorSpace(Dt.copy(this),t);const n=Dt.r,s=Dt.g,r=Dt.b,a=Math.max(n,s,r),o=Math.min(n,s,r);let c,l;const d=(o+a)/2;if(o===a)c=0,l=0;else{const m=a-o;switch(l=d<=.5?m/(a+o):m/(2-a-o),a){case n:c=(s-r)/m+(s0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const jt=new I,xn=new I,pr=new I,vn=new I,fi=new I,pi=new I,Ao=new I,mr=new I,_r=new I,gr=new I,xr=new ht,vr=new ht,Mr=new ht;class Zt{constructor(e=new I,t=new I,n=new I){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,s){s.subVectors(n,t),jt.subVectors(e,t),s.cross(jt);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,n,s,r){jt.subVectors(s,t),xn.subVectors(n,t),pr.subVectors(e,t);const a=jt.dot(jt),o=jt.dot(xn),c=jt.dot(pr),l=xn.dot(xn),d=xn.dot(pr),m=a*l-o*o;if(m===0)return r.set(0,0,0),null;const h=1/m,_=(l*c-o*d)*h,v=(a*d-o*c)*h;return r.set(1-_-v,v,_)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,vn)===null?!1:vn.x>=0&&vn.y>=0&&vn.x+vn.y<=1}static getInterpolation(e,t,n,s,r,a,o,c){return this.getBarycoord(e,t,n,s,vn)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,vn.x),c.addScaledVector(a,vn.y),c.addScaledVector(o,vn.z),c)}static getInterpolatedAttribute(e,t,n,s,r,a){return xr.setScalar(0),vr.setScalar(0),Mr.setScalar(0),xr.fromBufferAttribute(e,t),vr.fromBufferAttribute(e,n),Mr.fromBufferAttribute(e,s),a.setScalar(0),a.addScaledVector(xr,r.x),a.addScaledVector(vr,r.y),a.addScaledVector(Mr,r.z),a}static isFrontFacing(e,t,n,s){return jt.subVectors(n,t),xn.subVectors(e,t),jt.cross(xn).dot(s)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,s){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,n,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,s),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 jt.subVectors(this.c,this.b),xn.subVectors(this.a,this.b),jt.cross(xn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Zt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Zt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,s,r){return Zt.getInterpolation(e,this.a,this.b,this.c,t,n,s,r)}containsPoint(e){return Zt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Zt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,s=this.b,r=this.c;let a,o;fi.subVectors(s,n),pi.subVectors(r,n),mr.subVectors(e,n);const c=fi.dot(mr),l=pi.dot(mr);if(c<=0&&l<=0)return t.copy(n);_r.subVectors(e,s);const d=fi.dot(_r),m=pi.dot(_r);if(d>=0&&m<=d)return t.copy(s);const h=c*m-d*l;if(h<=0&&c>=0&&d<=0)return a=c/(c-d),t.copy(n).addScaledVector(fi,a);gr.subVectors(e,r);const _=fi.dot(gr),v=pi.dot(gr);if(v>=0&&_<=v)return t.copy(r);const E=_*l-c*v;if(E<=0&&l>=0&&v<=0)return o=l/(l-v),t.copy(n).addScaledVector(pi,o);const p=d*v-_*m;if(p<=0&&m-d>=0&&_-v>=0)return Ao.subVectors(r,s),o=(m-d)/(m-d+(_-v)),t.copy(s).addScaledVector(Ao,o);const u=1/(p+E+h);return a=E*u,o=h*u,t.copy(n).addScaledVector(fi,a).addScaledVector(pi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Ni{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,en),en.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bi),ls.subVectors(this.max,Bi),mi.subVectors(e.a,Bi),_i.subVectors(e.b,Bi),gi.subVectors(e.c,Bi),Un.subVectors(_i,mi),Nn.subVectors(gi,_i),Kn.subVectors(mi,gi);let t=[0,-Un.z,Un.y,0,-Nn.z,Nn.y,0,-Kn.z,Kn.y,Un.z,0,-Un.x,Nn.z,0,-Nn.x,Kn.z,0,-Kn.x,-Un.y,Un.x,0,-Nn.y,Nn.x,0,-Kn.y,Kn.x,0];return!Sr(t,mi,_i,gi,ls)||(t=[1,0,0,0,1,0,0,0,1],!Sr(t,mi,_i,gi,ls))?!1:(cs.crossVectors(Un,Nn),t=[cs.x,cs.y,cs.z],Sr(t,mi,_i,gi,ls))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,en).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(en).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:(Mn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Mn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Mn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Mn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Mn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Mn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Mn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Mn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Mn),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Mn=[new I,new I,new I,new I,new I,new I,new I,new I],en=new I,os=new Ni,mi=new I,_i=new I,gi=new I,Un=new I,Nn=new I,Kn=new I,Bi=new I,ls=new I,cs=new I,$n=new I;function Sr(i,e,t,n,s){for(let r=0,a=i.length-3;r<=a;r+=3){$n.fromArray(i,r);const o=s.x*Math.abs($n.x)+s.y*Math.abs($n.y)+s.z*Math.abs($n.z),c=e.dot($n),l=t.dot($n),d=n.dot($n);if(Math.max(-Math.max(c,l,d),Math.min(c,l,d))>o)return!1}return!0}const vt=new I,hs=new we;let hh=0;class sn extends Xn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:hh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=wa,this.updateRanges=[],this.gpuType=un,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let s=0,r=this.itemSize;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;zi.subVectors(e,this.center);const t=zi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(zi,s/n),this.radius+=s}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):(Er.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zi.copy(e.center).add(Er)),this.expandByPoint(zi.copy(e.center).sub(Er))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let dh=0;const Yt=new at,yr=new Et,xi=new I,Ht=new Ni,Gi=new Ni,Tt=new I;class wt extends Xn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:dh++}),this.uuid=Vn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Wc(e)?zl:Bl)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new Fe().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Yt.makeRotationFromQuaternion(e),this.applyMatrix4(Yt),this}rotateX(e){return Yt.makeRotationX(e),this.applyMatrix4(Yt),this}rotateY(e){return Yt.makeRotationY(e),this.applyMatrix4(Yt),this}rotateZ(e){return Yt.makeRotationZ(e),this.applyMatrix4(Yt),this}translate(e,t,n){return Yt.makeTranslation(e,t,n),this.applyMatrix4(Yt),this}scale(e,t,n){return Yt.makeScale(e,t,n),this.applyMatrix4(Yt),this}lookAt(e){return yr.lookAt(e),yr.updateMatrix(),this.applyMatrix4(yr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(xi).negate(),this.translate(xi.x,xi.y,xi.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let s=0,r=e.length;st.count&&De("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ni);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){We("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,s=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const s={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],d=[];for(let m=0,h=l.length;m0&&(s[c]=d,r=!0)}r&&(e.data.morphAttributes=s,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=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const s=e.attributes;for(const l in s){const d=s[l];this.setAttribute(l,d.clone(t))}const r=e.morphAttributes;for(const l in r){const d=[],m=r[l];for(let h=0,_=m.length;h<_;h++)d.push(m[h].clone(t));this.morphAttributes[l]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,d=a.length;l0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){De(`Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){De(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector2&&n&&n.isVector2||s&&s.isEuler&&n&&n.isEuler||s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ri&&(n.blending=this.blending),this.side!==Hn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==zr&&(n.blendSrc=this.blendSrc),this.blendDst!==Gr&&(n.blendDst=this.blendDst),this.blendEquation!==jn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Di&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==fo&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==li&&(n.stencilFail=this.stencilFail),this.stencilZFail!==li&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==li&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){const a=[];for(const o in r){const c=r[o];delete c.metadata,a.push(c)}return a}if(t){const r=s(e.textures),a=s(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ie().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new we().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new we().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const s=t.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Gl extends ri{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ie(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let vi;const Vi=new I,Mi=new I,Si=new I,Ei=new we,Hi=new we,Vl=new at,us=new I,ki=new I,ds=new I,wo=new we,br=new we,Ro=new we;class mh extends Et{constructor(e=new Gl){if(super(),this.isSprite=!0,this.type="Sprite",vi===void 0){vi=new wt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new fh(t,5);vi.setIndex([0,1,2,0,2,3]),vi.setAttribute("position",new Ws(n,3,0,!1)),vi.setAttribute("uv",new Ws(n,2,3,!1))}this.geometry=vi,this.material=e,this.center=new we(.5,.5),this.count=1}raycast(e,t){e.camera===null&&We('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Mi.setFromMatrixScale(this.matrixWorld),Vl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Si.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Mi.multiplyScalar(-Si.z);const n=this.material.rotation;let s,r;n!==0&&(r=Math.cos(n),s=Math.sin(n));const a=this.center;fs(us.set(-.5,-.5,0),Si,a,Mi,s,r),fs(ki.set(.5,-.5,0),Si,a,Mi,s,r),fs(ds.set(.5,.5,0),Si,a,Mi,s,r),wo.set(0,0),br.set(1,0),Ro.set(1,1);let o=e.ray.intersectTriangle(us,ki,ds,!1,Vi);if(o===null&&(fs(ki.set(-.5,.5,0),Si,a,Mi,s,r),br.set(0,1),o=e.ray.intersectTriangle(us,ds,ki,!1,Vi),o===null))return;const c=e.ray.origin.distanceTo(Vi);ce.far||t.push({distance:c,point:Vi.clone(),uv:Zt.getInterpolation(Vi,us,ki,ds,wo,br,Ro,new we),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 fs(i,e,t,n,s,r){Ei.subVectors(i,t).addScalar(.5).multiply(n),s!==void 0?(Hi.x=r*Ei.x-s*Ei.y,Hi.y=s*Ei.x+r*Ei.y):Hi.copy(Ei),i.copy(e),i.x+=Hi.x,i.y+=Hi.y,i.applyMatrix4(Vl)}const Sn=new I,Tr=new I,ps=new I,Fn=new I,Ar=new I,ms=new I,wr=new I;class Qs{constructor(e=new I,t=new I(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,Sn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Sn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Sn.copy(this.origin).addScaledVector(this.direction,t),Sn.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){Tr.copy(e).add(t).multiplyScalar(.5),ps.copy(t).sub(e).normalize(),Fn.copy(this.origin).sub(Tr);const r=e.distanceTo(t)*.5,a=-this.direction.dot(ps),o=Fn.dot(this.direction),c=-Fn.dot(ps),l=Fn.lengthSq(),d=Math.abs(1-a*a);let m,h,_,v;if(d>0)if(m=a*c-o,h=a*o-c,v=r*d,m>=0)if(h>=-v)if(h<=v){const E=1/d;m*=E,h*=E,_=m*(m+a*h+2*o)+h*(a*m+h+2*c)+l}else h=r,m=Math.max(0,-(a*h+o)),_=-m*m+h*(h+2*c)+l;else h=-r,m=Math.max(0,-(a*h+o)),_=-m*m+h*(h+2*c)+l;else h<=-v?(m=Math.max(0,-(-a*r+o)),h=m>0?-r:Math.min(Math.max(-r,-c),r),_=-m*m+h*(h+2*c)+l):h<=v?(m=0,h=Math.min(Math.max(-r,-c),r),_=h*(h+2*c)+l):(m=Math.max(0,-(a*r+o)),h=m>0?r:Math.min(Math.max(-r,-c),r),_=-m*m+h*(h+2*c)+l);else h=a>0?-r:r,m=Math.max(0,-(a*h+o)),_=-m*m+h*(h+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,m),s&&s.copy(Tr).addScaledVector(ps,h),_}intersectSphere(e,t){Sn.subVectors(e.center,this.origin);const n=Sn.dot(this.direction),s=Sn.dot(Sn)-n*n,r=e.radius*e.radius;if(s>r)return null;const a=Math.sqrt(r-s),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,s,r,a,o,c;const l=1/this.direction.x,d=1/this.direction.y,m=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,s=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,s=(e.min.x-h.x)*l),d>=0?(r=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(r=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),n>a||r>s||((r>n||isNaN(n))&&(n=r),(a=0?(o=(e.min.z-h.z)*m,c=(e.max.z-h.z)*m):(o=(e.max.z-h.z)*m,c=(e.min.z-h.z)*m),n>c||o>s)||((o>n||n!==n)&&(n=o),(c=0?n:s,t)}intersectsBox(e){return this.intersectBox(e,Sn)!==null}intersectTriangle(e,t,n,s,r){Ar.subVectors(t,e),ms.subVectors(n,e),wr.crossVectors(Ar,ms);let a=this.direction.dot(wr),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Fn.subVectors(this.origin,e);const c=o*this.direction.dot(ms.crossVectors(Fn,ms));if(c<0)return null;const l=o*this.direction.dot(Ar.cross(Fn));if(l<0||c+l>a)return null;const d=-o*Fn.dot(wr);return d<0?null:this.at(d/a,r)}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 Xs extends ri{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ie(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wn,this.combine=vl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Co=new at,Jn=new Qs,_s=new Js,Po=new I,gs=new I,xs=new I,vs=new I,Rr=new I,Ms=new I,Do=new I,Ss=new I;class Kt extends Et{constructor(e=new wt,t=new Xs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r(e.far-e.near)**2))&&(Co.copy(r).invert(),Jn.copy(e.ray).applyMatrix4(Co),!(n.boundingBox!==null&&Jn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Jn)))}_computeIntersections(e,t,n){let s;const r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,d=r.attributes.uv1,m=r.attributes.normal,h=r.groups,_=r.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,E=h.length;vt.far?null:{distance:l,point:Ss.clone(),object:i}}function Es(i,e,t,n,s,r,a,o,c,l){i.getVertexPosition(o,gs),i.getVertexPosition(c,xs),i.getVertexPosition(l,vs);const d=_h(i,e,t,n,gs,xs,vs,Do);if(d){const m=new I;Zt.getBarycoord(Do,gs,xs,vs,m),s&&(d.uv=Zt.getInterpolatedAttribute(s,o,c,l,m,new we)),r&&(d.uv1=Zt.getInterpolatedAttribute(r,o,c,l,m,new we)),a&&(d.normal=Zt.getInterpolatedAttribute(a,o,c,l,m,new I),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:c,c:l,normal:new I,materialIndex:0};Zt.getNormal(gs,xs,vs,h.normal),d.face=h,d.barycoord=m}return d}class gh extends It{constructor(e=null,t=1,n=1,s,r,a,o,c,l=At,d=At,m,h){super(null,a,o,c,l,d,s,r,m,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Cr=new I,xh=new I,vh=new Fe;class Bn{constructor(e=new I(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,s){return this.normal.set(e,t,n),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const s=Cr.subVectors(n,t).cross(xh.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,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,n=!0){const s=e.delta(Cr),r=this.normal.dot(s);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/r;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(s,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||vh.getNormalMatrix(e),s=this.coplanarPoint(Cr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),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 Qn=new Js,Mh=new we(.5,.5),ys=new I;class Wa{constructor(e=new Bn,t=new Bn,n=new Bn,s=new Bn,r=new Bn,a=new Bn){this.planes=[e,t,n,s,r,a]}set(e,t,n,s,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(s),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=dn,n=!1){const s=this.planes,r=e.elements,a=r[0],o=r[1],c=r[2],l=r[3],d=r[4],m=r[5],h=r[6],_=r[7],v=r[8],E=r[9],p=r[10],u=r[11],A=r[12],R=r[13],M=r[14],T=r[15];if(s[0].setComponents(l-a,_-d,u-v,T-A).normalize(),s[1].setComponents(l+a,_+d,u+v,T+A).normalize(),s[2].setComponents(l+o,_+m,u+E,T+R).normalize(),s[3].setComponents(l-o,_-m,u-E,T-R).normalize(),n)s[4].setComponents(c,h,p,M).normalize(),s[5].setComponents(l-c,_-h,u-p,T-M).normalize();else if(s[4].setComponents(l-c,_-h,u-p,T-M).normalize(),t===dn)s[5].setComponents(l+c,_+h,u+p,T+M).normalize();else if(t===Qi)s[5].setComponents(c,h,p,M).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(),Qn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qn)}intersectsSprite(e){Qn.center.set(0,0,0);const t=Mh.distanceTo(e.center);return Qn.radius=.7071067811865476+t,Qn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qn)}intersectsSphere(e){const t=this.planes,n=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,ys.y=s.normal.y>0?e.max.y:e.min.y,ys.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(ys)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Ys extends ri{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ie(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const qs=new I,Zs=new I,Lo=new at,Wi=new Qs,bs=new Js,Pr=new I,Io=new I;class Hl extends Et{constructor(e=new wt,t=new Ys){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let s=1,r=t.count;s0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;rn)return;Pr.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Pr);if(!(le.far))return{distance:l,point:Io.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const Uo=new I,No=new I;class Fo extends Hl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let s=0,r=t.count;s0?1:-1,d.push(te.x,te.y,te.z),m.push(de/w),m.push(1-he/g),Y+=1}}for(let he=0;he0&&R(!0),t>0&&R(!1)),this.setIndex(d),this.setAttribute("position",new gt(m,3)),this.setAttribute("normal",new gt(h,3)),this.setAttribute("uv",new gt(_,2));function A(){const M=new I,T=new I;let S=0;const w=(t-e)/n;for(let g=0;g<=r;g++){const b=[],L=g/r,D=L*(t-e)+e;for(let B=0;B<=s;B++){const Z=B/s,W=Z*c+o,O=Math.sin(W),H=Math.cos(W);T.x=D*O,T.y=-L*n+p,T.z=D*H,m.push(T.x,T.y,T.z),M.set(O,w,H).normalize(),h.push(M.x,M.y,M.z),_.push(Z,1-L),b.push(v++)}E.push(b)}for(let g=0;g0||b!==0)&&(d.push(L,D,Z),S+=3),(t>0||b!==r-1)&&(d.push(D,B,Z),S+=3)}l.addGroup(u,S,0),u+=S}function R(M){const T=v,S=new we,w=new I;let g=0;const b=M===!0?e:t,L=M===!0?1:-1;for(let B=1;B<=s;B++)m.push(0,p*L,0),h.push(0,L,0),_.push(.5,.5),v++;const D=v;for(let B=0;B<=s;B++){const W=B/s*c+o,O=Math.cos(W),H=Math.sin(W);w.x=b*H,w.y=p*L,w.z=b*O,m.push(w.x,w.y,w.z),h.push(0,L,0),S.x=O*.5+.5,S.y=H*.5*L+.5,_.push(S.x,S.y),v++}for(let B=0;B0)&&_.push(R,M,S),(u!==n-1||c0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const s=e.uniforms[n];switch(this.uniforms[n]={},s.type){case"t":this.uniforms[n].value=t[s.value]||null;break;case"c":this.uniforms[n].value=new Ie().setHex(s.value);break;case"v2":this.uniforms[n].value=new we().fromArray(s.value);break;case"v3":this.uniforms[n].value=new I().fromArray(s.value);break;case"v4":this.uniforms[n].value=new ht().fromArray(s.value);break;case"m3":this.uniforms[n].value=new Fe().fromArray(s.value);break;case"m4":this.uniforms[n].value=new at().fromArray(s.value);break;default:this.uniforms[n].value=s.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class wh extends _n{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Rh extends ri{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ie(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ie(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Aa,this.normalScale=new we(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wn,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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 Ch extends ri{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Fc,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 Ph extends ri{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}}class Dh extends Ys{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}}class Za extends Et{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ie(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class Lh extends Za{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Et.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ie(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const Dr=new at,zo=new I,Go=new I;class Ih{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new we(512,512),this.mapType=Wt,this.map=null,this.mapPass=null,this.matrix=new at,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Wa,this._frameExtents=new we(1,1),this._viewportCount=1,this._viewports=[new ht(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;zo.setFromMatrixPosition(e.matrixWorld),t.position.copy(zo),Go.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Go),t.updateMatrixWorld(),Dr.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Dr,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Qi||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Dr)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const As=new I,ws=new kn,an=new I;class Yl extends Et{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new at,this.projectionMatrix=new at,this.projectionMatrixInverse=new at,this.coordinateSystem=dn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(As,ws,an),an.x===1&&an.y===1&&an.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(As,ws,an.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(As,ws,an),an.x===1&&an.y===1&&an.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(As,ws,an.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const On=new I,Vo=new we,Ho=new we;class qt extends Yl{constructor(e=50,t=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=s,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=Ra*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Fs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ra*2*Math.atan(Math.tan(Fs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){On.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(On.x,On.y).multiplyScalar(-e/On.z),On.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(On.x,On.y).multiplyScalar(-e/On.z)}getViewSize(e,t){return this.getViewBounds(e,Vo,Ho),t.subVectors(Ho,Vo)}setViewOffset(e,t,n,s,r,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=n,this.view.offsetY=s,this.view.width=r,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(Fs*.5*this.fov)/this.zoom,n=2*t,s=this.aspect*n,r=-.5*s;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*s/c,t-=a.offsetY*n/l,s*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),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}}class Ka extends Yl{constructor(e=-1,t=1,n=1,s=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=s,this.near=r,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,n,s,r,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=n,this.view.offsetY=s,this.view.width=r,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),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=s+t,c=s-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=d*this.view.offsetY,c=o-d*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),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}}class Uh extends Ih{constructor(){super(new Ka(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Nh extends Za{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Et.DEFAULT_UP),this.updateMatrix(),this.target=new Et,this.shadow=new Uh}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Fh extends Za{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}const yi=-90,bi=1;class Oh extends Et{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new qt(yi,bi,e,t);s.layers=this.layers,this.add(s);const r=new qt(yi,bi,e,t);r.layers=this.layers,this.add(r);const a=new qt(yi,bi,e,t);a.layers=this.layers,this.add(a);const o=new qt(yi,bi,e,t);o.layers=this.layers,this.add(o);const c=new qt(yi,bi,e,t);c.layers=this.layers,this.add(c);const l=new qt(yi,bi,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,s,r,a,o,c]=t;for(const l of t)this.remove(l);if(e===dn)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Qi)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,c,l,d]=this.children,m=e.getRenderTarget(),h=e.getActiveCubeFace(),_=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const E=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let p=!1;e.isWebGLRenderer===!0?p=e.state.buffers.depth.getReversed():p=e.reversedDepthBuffer,e.setRenderTarget(n,0,s),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(n,1,s),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,s),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,s),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,s),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=E,e.setRenderTarget(n,5,s),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(m,h,_),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}}class Bh extends qt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const ko=new at;class zh{constructor(e,t,n=0,s=1/0){this.ray=new Qs(e,t),this.near=n,this.far=s,this.camera=null,this.layers=new Ha,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):We("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return ko.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ko),this}intersectObject(e,t=!0,n=[]){return Ca(e,this,n,t),n.sort(Wo),n}intersectObjects(e,t=!0,n=[]){for(let s=0,r=e.length;s_.start-v.start);let h=0;for(let _=1;_ 0 - vec4 plane; - #ifdef ALPHA_TO_COVERAGE - float distanceToPlane, distanceGradient; - float clipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - if ( clipOpacity == 0.0 ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - float unionClipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - } - #pragma unroll_loop_end - clipOpacity *= 1.0 - unionClipOpacity; - #endif - diffuseColor.a *= clipOpacity; - if ( diffuseColor.a == 0.0 ) discard; - #else - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif - #endif -#endif`,ru=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,au=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,ou=`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,lu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#endif`,cu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#endif`,hu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) - varying vec4 vColor; -#endif`,uu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) - vColor = vec4( 1.0 ); -#endif -#ifdef USE_COLOR_ALPHA - vColor *= color; -#elif defined( USE_COLOR ) - vColor.rgb *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.rgb *= instanceColor.rgb; -#endif -#ifdef USE_BATCHING_COLOR - vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); -#endif`,du=`#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); -} -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; -}; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; -}; -#ifdef USE_ALPHAHASH - varying vec3 vPosition; -#endif -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); -} -#define inverseTransformDirection transformDirectionByInverseViewMatrix -vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) { - return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz ); -} -vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) { - return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz ); -} -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`,fu=`#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define cubeUV_r0 1.0 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= cubeUV_r1 ) { - mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; - } else if ( roughness >= cubeUV_r4 ) { - mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; - } else if ( roughness >= cubeUV_r5 ) { - mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; - } else if ( roughness >= cubeUV_r6 ) { - mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`,pu=`vec3 transformedNormal = objectNormal; -#ifdef USE_TANGENT - vec3 transformedTangent = objectTangent; -#endif -#ifdef USE_BATCHING - mat3 bm = mat3( batchingMatrix ); - transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); - transformedNormal = bm * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = bm * transformedTangent; - #endif -#endif -#ifdef USE_INSTANCING - mat3 im = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); - transformedNormal = im * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = im * transformedTangent; - #endif -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; -#endif`,mu=`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,_u=`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,gu=`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE - emissiveColor = sRGBTransferEOTF( emissiveColor ); - #endif - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,xu=`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,vu="gl_FragColor = linearToOutputTexel( gl_FragColor );",Mu=`vec4 LinearTransferOETF( in vec4 value ) { - return value; -} -vec4 sRGBTransferEOTF( in vec4 value ) { - return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); -} -vec4 sRGBTransferOETF( in vec4 value ) { - return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,Su=`#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 = transformNormalByInverseViewMatrix( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, envMapRotation * reflectVec ); - #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 -#endif`,Eu=`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform mat3 envMapRotation; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif -#endif`,yu=`#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`,bu=`#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`,Tu=`#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 = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`,Au=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,wu=`#ifdef USE_FOG - varying float vFogDepth; -#endif`,Ru=`#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`,Cu=`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,Pu=`#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 -}`,Du=`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,Lu=`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,Iu=`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Uu=`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -#if defined( USE_LIGHT_PROBES ) - uniform vec3 lightProbe[ 9 ]; -#endif -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometryPosition; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometryPosition; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif -#include `,Nu=`#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); - reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - #ifdef USE_ANISOTROPY - vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 bentNormal = cross( bitangent, viewDir ); - bentNormal = normalize( cross( bentNormal, bitangent ) ); - bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); - return getIBLRadiance( viewDir, bentNormal, roughness ); - #else - return vec3( 0.0 ); - #endif - } - #endif -#endif`,Fu=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,Ou=`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Bu=`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,zu=`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Gu=`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -material.metalness = metalnessFactor; -vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - material.ior = ior; - #ifdef USE_SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULAR_COLORMAP - specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; - material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = vec3( 0.04 ); - material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_DISPERSION - material.dispersion = dispersion; -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEEN_COLORMAP - material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); - #ifdef USE_SHEEN_ROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; - #endif -#endif -#ifdef USE_ANISOTROPY - #ifdef USE_ANISOTROPYMAP - mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); - vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; - vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; - #else - vec2 anisotropyV = anisotropyVector; - #endif - material.anisotropy = length( anisotropyV ); - if( material.anisotropy == 0.0 ) { - anisotropyV = vec2( 1.0, 0.0 ); - } else { - anisotropyV /= material.anisotropy; - material.anisotropy = saturate( material.anisotropy ); - } - material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); - material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; - material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,Vu=`uniform sampler2D dfgLUT; -struct PhysicalMaterial { - vec3 diffuseColor; - vec3 diffuseContribution; - vec3 specularColor; - vec3 specularColorBlended; - float roughness; - float metalness; - float specularF90; - float dispersion; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - vec3 iridescenceFresnelDielectric; - vec3 iridescenceFresnelMetallic; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif - #ifdef IOR - float ior; - #endif - #ifdef USE_TRANSMISSION - float transmission; - float transmissionAlpha; - float thickness; - float attenuationDistance; - vec3 attenuationColor; - #endif - #ifdef USE_ANISOTROPY - float anisotropy; - float alphaT; - vec3 anisotropyT; - vec3 anisotropyB; - #endif -}; -vec3 clearcoatSpecularDirect = vec3( 0.0 ); -vec3 clearcoatSpecularIndirect = vec3( 0.0 ); -vec3 sheenSpecularDirect = vec3( 0.0 ); -vec3 sheenSpecularIndirect = vec3(0.0 ); -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -#ifdef USE_ANISOTROPY - float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { - float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); - float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); - } - 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.specularColorBlended; - 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 * transpose( 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 rInv = 1.0 / ( roughness + 0.1 ); - float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; - float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; - float DG = exp( a * dotNV + b ); - return saturate( DG ); -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; - 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 - float dotNV = saturate( dot( normal, viewDir ) ); - vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; - #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; -} -vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { - vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; - vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; - vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; - vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; - float Ess_V = dfgV.x + dfgV.y; - float Ess_L = dfgL.x + dfgL.y; - float Ems_V = 1.0 - Ess_V; - float Ems_L = 1.0 - Ess_L; - vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; - vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); - float compensationFactor = Ems_V * Ems_L; - vec3 multiScatter = Fms * compensationFactor; - return singleScatter + multiScatter; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometryNormal; - vec3 viewDir = geometryViewDir; - vec3 position = geometryPosition; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - #ifdef USE_CLEARCOAT - vec3 Ncc = geometryClearcoatNormal; - vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); - vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); - vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); - mat3 mInvClearcoat = mat3( - vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), - vec3( 0, 1, 0 ), - vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) - ); - vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; - clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); - #endif - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - - sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); - - float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); - - float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); - - irradiance *= sheenEnergyComp; - - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); - #ifdef USE_SHEEN - float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; - diffuse *= sheenEnergyComp; - #endif - reflectedLight.indirectDiffuse += diffuse; -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; - #endif - vec3 singleScatteringDielectric = vec3( 0.0 ); - vec3 multiScatteringDielectric = vec3( 0.0 ); - vec3 singleScatteringMetallic = vec3( 0.0 ); - vec3 multiScatteringMetallic = vec3( 0.0 ); - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); - computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); - #else - computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); - computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); - #endif - vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); - vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); - vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; - vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - vec3 indirectSpecular = radiance * singleScattering; - indirectSpecular += multiScattering * cosineWeightedIrradiance; - vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; - #ifdef USE_SHEEN - float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; - indirectSpecular *= sheenEnergyComp; - indirectDiffuse *= sheenEnergyComp; - #endif - reflectedLight.indirectSpecular += indirectSpecular; - reflectedLight.indirectDiffuse += indirectDiffuse; -} -#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 ); -}`,Hu=` -vec3 geometryPosition = - vViewPosition; -vec3 geometryNormal = normal; -vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -vec3 geometryClearcoatNormal = vec3( 0.0 ); -#ifdef USE_CLEARCOAT - geometryClearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometryViewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); - material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometryPosition, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometryPosition, directLight ); - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - #if defined( USE_LIGHT_PROBES ) - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - #endif - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - } - #pragma unroll_loop_end - #endif - #ifdef USE_LIGHT_PROBES_GRID - vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz; - vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix ); - irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal ); - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,ku=`#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( ENVMAP_TYPE_CUBE_UV ) - #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) - iblIrradiance += getIBLIrradiance( geometryNormal ); - #endif - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,Wu=`#if defined( RE_IndirectDiffuse ) - #if defined( LAMBERT ) || defined( PHONG ) - irradiance += iblIrradiance; - #endif - RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,Xu=`#ifdef USE_LIGHT_PROBES_GRID -uniform highp sampler3D probesSH; -uniform vec3 probesMin; -uniform vec3 probesMax; -uniform vec3 probesResolution; -vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { - vec3 res = probesResolution; - vec3 gridRange = probesMax - probesMin; - vec3 resMinusOne = res - 1.0; - vec3 probeSpacing = gridRange / resMinusOne; - vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5; - vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 ); - uvw = uvw * resMinusOne / res + 0.5 / res; - float nz = res.z; - float paddedSlices = nz + 2.0; - float atlasDepth = 7.0 * paddedSlices; - float uvZBase = uvw.z * nz + 1.0; - vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) ); - vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) ); - vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) ); - vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) ); - vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) ); - vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) ); - vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) ); - vec3 c0 = s0.xyz; - vec3 c1 = vec3( s0.w, s1.xy ); - vec3 c2 = vec3( s1.zw, s2.x ); - vec3 c3 = s2.yzw; - vec3 c4 = s3.xyz; - vec3 c5 = vec3( s3.w, s4.xy ); - vec3 c6 = vec3( s4.zw, s5.x ); - vec3 c7 = s5.yzw; - vec3 c8 = s6.xyz; - float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z; - vec3 result = c0 * 0.886227; - result += c1 * 2.0 * 0.511664 * y; - result += c2 * 2.0 * 0.511664 * z; - result += c3 * 2.0 * 0.511664 * x; - result += c4 * 2.0 * 0.429043 * x * y; - result += c5 * 2.0 * 0.429043 * y * z; - result += c6 * ( 0.743125 * z * z - 0.247708 ); - result += c7 * 2.0 * 0.429043 * x * z; - result += c8 * 0.429043 * ( x * x - y * y ); - return max( result, vec3( 0.0 ) ); -} -#endif`,Yu=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) - gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,qu=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,Zu=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER - varying float vFragDepth; - varying float vIsPerspective; -#endif`,Ku=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,$u=`#ifdef USE_MAP - vec4 sampledDiffuseColor = texture2D( map, vMapUv ); - #ifdef DECODE_VIDEO_TEXTURE - sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); - #endif - diffuseColor *= sampledDiffuseColor; -#endif`,Ju=`#ifdef USE_MAP - uniform sampler2D map; -#endif`,Qu=`#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`,ju=`#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`,ed=`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,td=`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,nd=`#ifdef USE_INSTANCING_MORPH - float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; - } -#endif`,id=`#if defined( USE_MORPHCOLORS ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`,sd=`#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } -#endif`,rd=`#ifdef USE_MORPHTARGETS - #ifndef USE_INSTANCING_MORPH - uniform float morphTargetBaseInfluence; - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - #endif - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } -#endif`,ad=`#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } -#endif`,od=`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 - #ifdef DOUBLE_SIDED - 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 - #ifdef DOUBLE_SIDED - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - #endif -#endif -vec3 nonPerturbedNormal = normal;`,ld=`#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; - #if defined( USE_PACKED_NORMALMAP ) - mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) ); - #endif - mapN.xy *= normalScale; - normal = normalize( tbn * mapN ); -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,cd=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,hd=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,ud=`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #ifdef FLIP_SIDED - vBitangent = - vBitangent; - #endif - #endif -#endif`,dd=`#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`,fd=`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,pd=`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,md=`#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`,_d=`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,gd=`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,xd=`vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; -const float Inv255 = 1. / 255.; -const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); -const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); -const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); -const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); -vec4 packDepthToRGBA( const in float v ) { - if( v <= 0.0 ) - return vec4( 0., 0., 0., 0. ); - if( v >= 1.0 ) - return vec4( 1., 1., 1., 1. ); - float vuf; - float af = modf( v * PackFactors.a, vuf ); - float bf = modf( vuf * ShiftRight8, vuf ); - float gf = modf( vuf * ShiftRight8, vuf ); - return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); -} -vec3 packDepthToRGB( const in float v ) { - if( v <= 0.0 ) - return vec3( 0., 0., 0. ); - if( v >= 1.0 ) - return vec3( 1., 1., 1. ); - float vuf; - float bf = modf( v * PackFactors.b, vuf ); - float gf = modf( vuf * ShiftRight8, vuf ); - return vec3( vuf * Inv255, gf * PackUpscale, bf ); -} -vec2 packDepthToRG( const in float v ) { - if( v <= 0.0 ) - return vec2( 0., 0. ); - if( v >= 1.0 ) - return vec2( 1., 1. ); - float vuf; - float gf = modf( v * 256., vuf ); - return vec2( vuf * Inv255, gf ); -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors4 ); -} -float unpackRGBToDepth( const in vec3 v ) { - return dot( v, UnpackFactors3 ); -} -float unpackRGToDepth( const in vec2 v ) { - return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; -} -vec4 pack2HalfToRGBA( const in vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( const in vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { - #ifdef USE_REVERSED_DEPTH_BUFFER - - return depth * ( far - near ) - far; - #else - return depth * ( near - far ) - near; - #endif -} -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 ) { - - #ifdef USE_REVERSED_DEPTH_BUFFER - return ( near * far ) / ( ( near - far ) * depth - near ); - #else - return ( near * far ) / ( ( far - near ) * depth - far ); - #endif -}`,vd=`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,Md=`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_BATCHING - mvPosition = batchingMatrix * mvPosition; -#endif -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,Sd=`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,Ed=`#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`,yd=`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,bd=`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,Td=`#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 - #if defined( SHADOWMAP_TYPE_PCF ) - uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - #else - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - #if defined( SHADOWMAP_TYPE_PCF ) - uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - #else - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - struct SpotLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #if defined( SHADOWMAP_TYPE_PCF ) - uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - #elif defined( SHADOWMAP_TYPE_BASIC ) - uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - #if defined( SHADOWMAP_TYPE_PCF ) - float interleavedGradientNoise( vec2 position ) { - return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); - } - vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { - const float goldenAngle = 2.399963229728653; - float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); - float theta = float( sampleIndex ) * goldenAngle + phi; - return vec2( cos( theta ), sin( theta ) ) * r; - } - #endif - #if defined( SHADOWMAP_TYPE_PCF ) - float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; - bool frustumTest = inFrustum && shadowCoord.z <= 1.0; - if ( frustumTest ) { - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float radius = shadowRadius * texelSize.x; - float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; - shadow = ( - texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + - texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + - texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + - texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + - texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) - ) * 0.2; - } - return mix( 1.0, shadow, shadowIntensity ); - } - #elif defined( SHADOWMAP_TYPE_VSM ) - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - #ifdef USE_REVERSED_DEPTH_BUFFER - shadowCoord.z -= shadowBias; - #else - shadowCoord.z += shadowBias; - #endif - 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 ) { - vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; - float mean = distribution.x; - float variance = distribution.y * distribution.y; - #ifdef USE_REVERSED_DEPTH_BUFFER - float hard_shadow = step( mean, shadowCoord.z ); - #else - float hard_shadow = step( shadowCoord.z, mean ); - #endif - - if ( hard_shadow == 1.0 ) { - shadow = 1.0; - } else { - variance = max( variance, 0.0000001 ); - float d = shadowCoord.z - mean; - float p_max = variance / ( variance + d * d ); - p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); - shadow = max( hard_shadow, p_max ); - } - } - return mix( 1.0, shadow, shadowIntensity ); - } - #else - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - #ifdef USE_REVERSED_DEPTH_BUFFER - shadowCoord.z -= shadowBias; - #else - shadowCoord.z += shadowBias; - #endif - 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 ) { - float depth = texture2D( shadowMap, shadowCoord.xy ).r; - #ifdef USE_REVERSED_DEPTH_BUFFER - shadow = step( depth, shadowCoord.z ); - #else - shadow = step( shadowCoord.z, depth ); - #endif - } - return mix( 1.0, shadow, shadowIntensity ); - } - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #if defined( SHADOWMAP_TYPE_PCF ) - float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - float shadow = 1.0; - vec3 lightToPosition = shadowCoord.xyz; - vec3 bd3D = normalize( lightToPosition ); - vec3 absVec = abs( lightToPosition ); - float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); - if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { - #ifdef USE_REVERSED_DEPTH_BUFFER - float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); - dp -= shadowBias; - #else - float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); - dp += shadowBias; - #endif - float texelSize = shadowRadius / shadowMapSize.x; - vec3 absDir = abs( bd3D ); - vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); - tangent = normalize( cross( bd3D, tangent ) ); - vec3 bitangent = cross( bd3D, tangent ); - float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; - vec2 sample0 = vogelDiskSample( 0, 5, phi ); - vec2 sample1 = vogelDiskSample( 1, 5, phi ); - vec2 sample2 = vogelDiskSample( 2, 5, phi ); - vec2 sample3 = vogelDiskSample( 3, 5, phi ); - vec2 sample4 = vogelDiskSample( 4, 5, phi ); - shadow = ( - texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + - texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + - texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + - texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + - texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) - ) * 0.2; - } - return mix( 1.0, shadow, shadowIntensity ); - } - #elif defined( SHADOWMAP_TYPE_BASIC ) - float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - float shadow = 1.0; - vec3 lightToPosition = shadowCoord.xyz; - vec3 absVec = abs( lightToPosition ); - float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); - if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { - float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); - dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - float depth = textureCube( shadowMap, bd3D ).r; - #ifdef USE_REVERSED_DEPTH_BUFFER - depth = 1.0 - depth; - #endif - shadow = step( dp, depth ); - } - return mix( 1.0, shadow, shadowIntensity ); - } - #endif - #endif -#endif`,Ad=`#if NUM_SPOT_LIGHT_COORDS > 0 - uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`,wd=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) - #ifdef HAS_NORMAL - vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); - #else - vec3 shadowWorldNormal = vec3( 0.0 ); - #endif - 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`,Rd=`float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`,Cd=`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,Pd=`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - mat4 getBoneMatrix( const in float i ) { - int size = textureSize( boneTexture, 0 ).x; - int j = int( i ) * 4; - int x = j % size; - int y = j / size; - vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); - vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); - vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); - vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); - return mat4( v1, v2, v3, v4 ); - } -#endif`,Dd=`#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`,Ld=`#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`,Id=`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,Ud=`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,Nd=`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,Fd=`#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return saturate( toneMappingExposure * color ); -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 CineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -vec3 RRTAndODTFit( vec3 v ) { - vec3 a = v * ( v + 0.0245786 ) - 0.000090537; - vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; - return a / b; -} -vec3 ACESFilmicToneMapping( vec3 color ) { - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( - vec3( 1.6605, - 0.1246, - 0.0182 ), - vec3( - 0.5876, 1.1329, - 0.1006 ), - vec3( - 0.0728, - 0.0083, 1.1187 ) -); -const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( - vec3( 0.6274, 0.0691, 0.0164 ), - vec3( 0.3293, 0.9195, 0.0880 ), - vec3( 0.0433, 0.0113, 0.8956 ) -); -vec3 agxDefaultContrastApprox( vec3 x ) { - vec3 x2 = x * x; - vec3 x4 = x2 * x2; - return + 15.5 * x4 * x2 - - 40.14 * x4 * x - + 31.96 * x4 - - 6.868 * x2 * x - + 0.4298 * x2 - + 0.1191 * x - - 0.00232; -} -vec3 AgXToneMapping( vec3 color ) { - const mat3 AgXInsetMatrix = mat3( - vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), - vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), - vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) - ); - const mat3 AgXOutsetMatrix = mat3( - vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), - vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), - vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) - ); - const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; - color *= toneMappingExposure; - color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; - color = AgXInsetMatrix * color; - color = max( color, 1e-10 ); color = log2( color ); - color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); - color = clamp( color, 0.0, 1.0 ); - color = agxDefaultContrastApprox( color ); - color = AgXOutsetMatrix * color; - color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); - color = LINEAR_REC2020_TO_LINEAR_SRGB * color; - color = clamp( color, 0.0, 1.0 ); - return color; -} -vec3 NeutralToneMapping( vec3 color ) { - const float StartCompression = 0.8 - 0.04; - const float Desaturation = 0.15; - color *= toneMappingExposure; - float x = min( color.r, min( color.g, color.b ) ); - float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; - color -= offset; - float peak = max( color.r, max( color.g, color.b ) ); - if ( peak < StartCompression ) return color; - float d = 1. - StartCompression; - float newPeak = 1. - d * d / ( peak + d - StartCompression ); - color *= newPeak / peak; - float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); - return mix( color, vec3( newPeak ), g ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,Od=`#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 = transformNormalByInverseViewMatrix( normal, viewMatrix ); - vec4 transmitted = getIBLVolumeRefraction( - n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,Bd=`#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - float w0( float a ) { - return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); - } - float w1( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); - } - float w2( float a ){ - return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); - } - float w3( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * a ); - } - float g0( float a ) { - return w0( a ) + w1( a ); - } - float g1( float a ) { - return w2( a ) + w3( a ); - } - float h0( float a ) { - return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); - } - float h1( float a ) { - return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); - } - vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { - uv = uv * texelSize.zw + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - float g0x = g0( fuv.x ); - float g1x = g1( fuv.x ); - float h0x = h0( fuv.x ); - float h1x = h1( fuv.x ); - float h0y = h0( fuv.y ); - float h1y = h1( fuv.y ); - vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + - g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); - } - vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { - vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); - vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); - vec2 fLodSizeInv = 1.0 / fLodSize; - vec2 cLodSizeInv = 1.0 / cLodSize; - vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); - vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); - return mix( fSample, cSample, fract( lod ) ); - } - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); - } - vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( isinf( attenuationDistance ) ) { - return vec3( 1.0 ); - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec4 transmittedLight; - vec3 transmittance; - #ifdef USE_DISPERSION - float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; - vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); - for ( int i = 0; i < 3; i ++ ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); - transmittedLight[ i ] = transmissionSample[ i ]; - transmittedLight.a += transmissionSample.a; - transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; - } - transmittedLight.a /= 3.0; - #else - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - #endif - vec3 attenuatedColor = transmittance * transmittedLight.rgb; - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; - return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); - } -#endif`,zd=`#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`,Gd=`#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`,Vd=`#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`,Hd=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 - vec4 worldPosition = vec4( transformed, 1.0 ); - #ifdef USE_BATCHING - worldPosition = batchingMatrix * worldPosition; - #endif - #ifdef USE_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`;const kd=`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,Wd=`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,Xd=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,Yd=`#ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; -#elif defined( ENVMAP_TYPE_CUBE_UV ) - uniform sampler2D envMap; -#endif -uniform float backgroundBlurriness; -uniform float backgroundIntensity; -uniform mat3 backgroundRotation; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,qd=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,Zd=`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 -}`,Kd=`#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,$d=`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - vec4 diffuseColor = vec4( 1.0 ); - #include - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - #ifdef USE_REVERSED_DEPTH_BUFFER - float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; - #else - float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; - #endif - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #elif DEPTH_PACKING == 3202 - gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); - #elif DEPTH_PACKING == 3203 - gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); - #endif -}`,Jd=`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,Qd=`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); -}`,jd=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,ef=`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,tf=`uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,nf=`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,sf=`#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,rf=`uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`,af=`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,of=`#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 -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,lf=`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`,cf=`#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`,hf=`#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`,uf=`#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 -void main() { - vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); - #include - #include - #include - #include - gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,df=`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,ff=`#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 -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,pf=`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,mf=`#define STANDARD -#ifdef PHYSICAL - #define IOR - #define USE_SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef USE_SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULAR_COLORMAP - uniform sampler2D specularColorMap; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_DISPERSION - uniform float dispersion; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEEN_COLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEEN_ROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -#ifdef USE_ANISOTROPY - uniform vec2 anisotropyVector; - #ifdef USE_ANISOTROPYMAP - uniform sampler2D anisotropyMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - - outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; - - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,_f=`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,gf=`#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 -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,xf=`uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV - varying vec2 vUv; - uniform mat3 uvTransform; -#endif -void main() { - #ifdef USE_POINTS_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #include - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`,vf=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,Mf=`#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,Sf=`uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include - #include -}`,Ef=`uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix[ 3 ]; - vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`,yf=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`,ze={alphahash_fragment:kh,alphahash_pars_fragment:Wh,alphamap_fragment:Xh,alphamap_pars_fragment:Yh,alphatest_fragment:qh,alphatest_pars_fragment:Zh,aomap_fragment:Kh,aomap_pars_fragment:$h,batching_pars_vertex:Jh,batching_vertex:Qh,begin_vertex:jh,beginnormal_vertex:eu,bsdfs:tu,iridescence_fragment:nu,bumpmap_pars_fragment:iu,clipping_planes_fragment:su,clipping_planes_pars_fragment:ru,clipping_planes_pars_vertex:au,clipping_planes_vertex:ou,color_fragment:lu,color_pars_fragment:cu,color_pars_vertex:hu,color_vertex:uu,common:du,cube_uv_reflection_fragment:fu,defaultnormal_vertex:pu,displacementmap_pars_vertex:mu,displacementmap_vertex:_u,emissivemap_fragment:gu,emissivemap_pars_fragment:xu,colorspace_fragment:vu,colorspace_pars_fragment:Mu,envmap_fragment:Su,envmap_common_pars_fragment:Eu,envmap_pars_fragment:yu,envmap_pars_vertex:bu,envmap_physical_pars_fragment:Nu,envmap_vertex:Tu,fog_vertex:Au,fog_pars_vertex:wu,fog_fragment:Ru,fog_pars_fragment:Cu,gradientmap_pars_fragment:Pu,lightmap_pars_fragment:Du,lights_lambert_fragment:Lu,lights_lambert_pars_fragment:Iu,lights_pars_begin:Uu,lights_toon_fragment:Fu,lights_toon_pars_fragment:Ou,lights_phong_fragment:Bu,lights_phong_pars_fragment:zu,lights_physical_fragment:Gu,lights_physical_pars_fragment:Vu,lights_fragment_begin:Hu,lights_fragment_maps:ku,lights_fragment_end:Wu,lightprobes_pars_fragment:Xu,logdepthbuf_fragment:Yu,logdepthbuf_pars_fragment:qu,logdepthbuf_pars_vertex:Zu,logdepthbuf_vertex:Ku,map_fragment:$u,map_pars_fragment:Ju,map_particle_fragment:Qu,map_particle_pars_fragment:ju,metalnessmap_fragment:ed,metalnessmap_pars_fragment:td,morphinstance_vertex:nd,morphcolor_vertex:id,morphnormal_vertex:sd,morphtarget_pars_vertex:rd,morphtarget_vertex:ad,normal_fragment_begin:od,normal_fragment_maps:ld,normal_pars_fragment:cd,normal_pars_vertex:hd,normal_vertex:ud,normalmap_pars_fragment:dd,clearcoat_normal_fragment_begin:fd,clearcoat_normal_fragment_maps:pd,clearcoat_pars_fragment:md,iridescence_pars_fragment:_d,opaque_fragment:gd,packing:xd,premultiplied_alpha_fragment:vd,project_vertex:Md,dithering_fragment:Sd,dithering_pars_fragment:Ed,roughnessmap_fragment:yd,roughnessmap_pars_fragment:bd,shadowmap_pars_fragment:Td,shadowmap_pars_vertex:Ad,shadowmap_vertex:wd,shadowmask_pars_fragment:Rd,skinbase_vertex:Cd,skinning_pars_vertex:Pd,skinning_vertex:Dd,skinnormal_vertex:Ld,specularmap_fragment:Id,specularmap_pars_fragment:Ud,tonemapping_fragment:Nd,tonemapping_pars_fragment:Fd,transmission_fragment:Od,transmission_pars_fragment:Bd,uv_pars_fragment:zd,uv_pars_vertex:Gd,uv_vertex:Vd,worldpos_vertex:Hd,background_vert:kd,background_frag:Wd,backgroundCube_vert:Xd,backgroundCube_frag:Yd,cube_vert:qd,cube_frag:Zd,depth_vert:Kd,depth_frag:$d,distance_vert:Jd,distance_frag:Qd,equirect_vert:jd,equirect_frag:ef,linedashed_vert:tf,linedashed_frag:nf,meshbasic_vert:sf,meshbasic_frag:rf,meshlambert_vert:af,meshlambert_frag:of,meshmatcap_vert:lf,meshmatcap_frag:cf,meshnormal_vert:hf,meshnormal_frag:uf,meshphong_vert:df,meshphong_frag:ff,meshphysical_vert:pf,meshphysical_frag:mf,meshtoon_vert:_f,meshtoon_frag:gf,points_vert:xf,points_frag:vf,shadow_vert:Mf,shadow_frag:Sf,sprite_vert:Ef,sprite_frag:yf},pe={common:{diffuse:{value:new Ie(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Fe},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Fe}},envmap:{envMap:{value:null},envMapRotation:{value:new Fe},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Fe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Fe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Fe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Fe},normalScale:{value:new we(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Fe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Fe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Fe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Fe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ie(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new I},probesMax:{value:new I},probesResolution:{value:new I}},points:{diffuse:{value:new Ie(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0},uvTransform:{value:new Fe}},sprite:{diffuse:{value:new Ie(16777215)},opacity:{value:1},center:{value:new we(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Fe},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0}}},ln={basic:{uniforms:Nt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.fog]),vertexShader:ze.meshbasic_vert,fragmentShader:ze.meshbasic_frag},lambert:{uniforms:Nt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Ie(0)},envMapIntensity:{value:1}}]),vertexShader:ze.meshlambert_vert,fragmentShader:ze.meshlambert_frag},phong:{uniforms:Nt([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Ie(0)},specular:{value:new Ie(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:ze.meshphong_vert,fragmentShader:ze.meshphong_frag},standard:{uniforms:Nt([pe.common,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.roughnessmap,pe.metalnessmap,pe.fog,pe.lights,{emissive:{value:new Ie(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag},toon:{uniforms:Nt([pe.common,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.gradientmap,pe.fog,pe.lights,{emissive:{value:new Ie(0)}}]),vertexShader:ze.meshtoon_vert,fragmentShader:ze.meshtoon_frag},matcap:{uniforms:Nt([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,{matcap:{value:null}}]),vertexShader:ze.meshmatcap_vert,fragmentShader:ze.meshmatcap_frag},points:{uniforms:Nt([pe.points,pe.fog]),vertexShader:ze.points_vert,fragmentShader:ze.points_frag},dashed:{uniforms:Nt([pe.common,pe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ze.linedashed_vert,fragmentShader:ze.linedashed_frag},depth:{uniforms:Nt([pe.common,pe.displacementmap]),vertexShader:ze.depth_vert,fragmentShader:ze.depth_frag},normal:{uniforms:Nt([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,{opacity:{value:1}}]),vertexShader:ze.meshnormal_vert,fragmentShader:ze.meshnormal_frag},sprite:{uniforms:Nt([pe.sprite,pe.fog]),vertexShader:ze.sprite_vert,fragmentShader:ze.sprite_frag},background:{uniforms:{uvTransform:{value:new Fe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ze.background_vert,fragmentShader:ze.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Fe}},vertexShader:ze.backgroundCube_vert,fragmentShader:ze.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ze.cube_vert,fragmentShader:ze.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ze.equirect_vert,fragmentShader:ze.equirect_frag},distance:{uniforms:Nt([pe.common,pe.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ze.distance_vert,fragmentShader:ze.distance_frag},shadow:{uniforms:Nt([pe.lights,pe.fog,{color:{value:new Ie(0)},opacity:{value:1}}]),vertexShader:ze.shadow_vert,fragmentShader:ze.shadow_frag}};ln.physical={uniforms:Nt([ln.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Fe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Fe},clearcoatNormalScale:{value:new we(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Fe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Fe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Fe},sheen:{value:0},sheenColor:{value:new Ie(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Fe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Fe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Fe},transmissionSamplerSize:{value:new we},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Fe},attenuationDistance:{value:0},attenuationColor:{value:new Ie(0)},specularColor:{value:new Ie(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Fe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Fe},anisotropyVector:{value:new we},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Fe}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag};const Rs={r:0,b:0,g:0},bf=new at,Zl=new Fe;Zl.set(-1,0,0,0,1,0,0,0,1);function Tf(i,e,t,n,s,r){const a=new Ie(0);let o=s===!0?0:1,c,l,d=null,m=0,h=null;function _(A){let R=A.isScene===!0?A.background:null;if(R&&R.isTexture){const M=A.backgroundBlurriness>0;R=e.get(R,M)}return R}function v(A){let R=!1;const M=_(A);M===null?p(a,o):M&&M.isColor&&(p(M,1),R=!0);const T=i.xr.getEnvironmentBlendMode();T==="additive"?t.buffers.color.setClear(0,0,0,1,r):T==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(i.autoClear||R)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function E(A,R){const M=_(R);M&&(M.isCubeTexture||M.mapping===$s)?(l===void 0&&(l=new Kt(new ji(1,1,1),new _n({name:"BackgroundCubeMaterial",uniforms:Ui(ln.backgroundCube.uniforms),vertexShader:ln.backgroundCube.vertexShader,fragmentShader:ln.backgroundCube.fragmentShader,side:zt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(T,S,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=R.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(bf.makeRotationFromEuler(R.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(Zl),l.material.toneMapped=Xe.getTransfer(M.colorSpace)!==Je,(d!==M||m!==M.version||h!==i.toneMapping)&&(l.material.needsUpdate=!0,d=M,m=M.version,h=i.toneMapping),l.layers.enableAll(),A.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new Kt(new es(2,2),new _n({name:"BackgroundMaterial",uniforms:Ui(ln.background.uniforms),vertexShader:ln.background.vertexShader,fragmentShader:ln.background.fragmentShader,side:Hn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,c.material.toneMapped=Xe.getTransfer(M.colorSpace)!==Je,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(d!==M||m!==M.version||h!==i.toneMapping)&&(c.material.needsUpdate=!0,d=M,m=M.version,h=i.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function p(A,R){A.getRGB(Rs,Xl(i)),t.buffers.color.setClear(Rs.r,Rs.g,Rs.b,R,r)}function u(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(A,R=1){a.set(A),o=R,p(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(A){o=A,p(a,o)},render:v,addToRenderList:E,dispose:u}}function Af(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=h(null);let r=s,a=!1;function o(D,B,Z,W,O){let H=!1;const Y=m(D,W,Z,B);r!==Y&&(r=Y,l(r.object)),H=_(D,W,Z,O),H&&v(D,W,Z,O),O!==null&&e.update(O,i.ELEMENT_ARRAY_BUFFER),(H||a)&&(a=!1,M(D,B,Z,W),O!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(O).buffer))}function c(){return i.createVertexArray()}function l(D){return i.bindVertexArray(D)}function d(D){return i.deleteVertexArray(D)}function m(D,B,Z,W){const O=W.wireframe===!0;let H=n[B.id];H===void 0&&(H={},n[B.id]=H);const Y=D.isInstancedMesh===!0?D.id:0;let ee=H[Y];ee===void 0&&(ee={},H[Y]=ee);let te=ee[Z.id];te===void 0&&(te={},ee[Z.id]=te);let he=te[O];return he===void 0&&(he=h(c()),te[O]=he),he}function h(D){const B=[],Z=[],W=[];for(let O=0;O=0){const me=O[te];let de=H[te];if(de===void 0&&(te==="instanceMatrix"&&D.instanceMatrix&&(de=D.instanceMatrix),te==="instanceColor"&&D.instanceColor&&(de=D.instanceColor)),me===void 0||me.attribute!==de||de&&me.data!==de.data)return!0;Y++}return r.attributesNum!==Y||r.index!==W}function v(D,B,Z,W){const O={},H=B.attributes;let Y=0;const ee=Z.getAttributes();for(const te in ee)if(ee[te].location>=0){let me=H[te];me===void 0&&(te==="instanceMatrix"&&D.instanceMatrix&&(me=D.instanceMatrix),te==="instanceColor"&&D.instanceColor&&(me=D.instanceColor));const de={};de.attribute=me,me&&me.data&&(de.data=me.data),O[te]=de,Y++}r.attributes=O,r.attributesNum=Y,r.index=W}function E(){const D=r.newAttributes;for(let B=0,Z=D.length;B=0){let he=O[ee];if(he===void 0&&(ee==="instanceMatrix"&&D.instanceMatrix&&(he=D.instanceMatrix),ee==="instanceColor"&&D.instanceColor&&(he=D.instanceColor)),he!==void 0){const me=he.normalized,de=he.itemSize,Ye=e.get(he);if(Ye===void 0)continue;const st=Ye.buffer,qe=Ye.type,j=Ye.bytesPerElement,ae=qe===i.INT||qe===i.UNSIGNED_INT||he.gpuType===Ia;if(he.isInterleavedBufferAttribute){const ne=he.data,Ae=ne.stride,Ue=he.offset;if(ne.isInstancedInterleavedBuffer){for(let Re=0;Re0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const d=c(l);d!==l&&(De("WebGLRenderer:",l,"not supported, using",d,"instead."),l=d);const m=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&De("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const _=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=i.getParameter(i.MAX_TEXTURE_SIZE),p=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),u=i.getParameter(i.MAX_VERTEX_ATTRIBS),A=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),R=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),T=i.getParameter(i.MAX_SAMPLES),S=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:m,reversedDepthBuffer:h,maxTextures:_,maxVertexTextures:v,maxTextureSize:E,maxCubemapSize:p,maxAttributes:u,maxVertexUniforms:A,maxVaryings:R,maxFragmentUniforms:M,maxSamples:T,samples:S}}function Cf(i){const e=this;let t=null,n=0,s=!1,r=!1;const a=new Bn,o=new Fe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(m,h){const _=m.length!==0||h||n!==0||s;return s=h,n=m.length,_},this.beginShadows=function(){r=!0,d(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(m,h){t=d(m,h,0)},this.setState=function(m,h,_){const v=m.clippingPlanes,E=m.clipIntersection,p=m.clipShadows,u=i.get(m);if(!s||v===null||v.length===0||r&&!p)r?d(null):l();else{const A=r?0:n,R=A*4;let M=u.clippingState||null;c.value=M,M=d(v,h,R,_);for(let T=0;T!==R;++T)M[T]=t[T];u.clippingState=M,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=A}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(m,h,_,v){const E=m!==null?m.length:0;let p=null;if(E!==0){if(p=c.value,v!==!0||p===null){const u=_+E*4,A=h.matrixWorldInverse;o.getNormalMatrix(A),(p===null||p.length0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=jo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Qo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?T:0,T,T),m.setRenderTarget(s),u&&m.render(E,c),m.render(e,c)}m.toneMapping=_,m.autoClear=h,e.background=A}_textureToCubeUV(e,t){const n=this._renderer,s=e.mapping===ii||e.mapping===Li;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=jo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Qo());const r=s?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;const o=r.uniforms;o.envMap.value=e;const c=this._cubeSize;Ti(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Xi)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const s=this._lodMeshes.length;for(let r=1;rv-Gn?n-v+Gn:0),u=4*(this._cubeSize-E);c.envMap.value=e.texture,c.roughness.value=_,c.mipInt.value=v-t,Ti(r,p,u,3*E,2*E),s.setRenderTarget(r),s.render(o,Xi),c.envMap.value=r.texture,c.roughness.value=0,c.mipInt.value=v-n,Ti(e,p,u,3*E,2*E),s.setRenderTarget(e),s.render(o,Xi)}_blur(e,t,n,s,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,s,"latitudinal",r),this._halfBlur(a,e,n,n,s,"longitudinal",r)}_halfBlur(e,t,n,s,r,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&We("blur direction must be either latitudinal or longitudinal!");const d=3,m=this._lodMeshes[s];m.material=l;const h=l.uniforms,_=this._sizeLods[n]-1,v=isFinite(r)?Math.PI/(2*_):2*Math.PI/(2*ei-1),E=r/v,p=isFinite(r)?1+Math.floor(d*E):ei;p>ei&&De(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${ei}`);const u=[];let A=0;for(let w=0;wR-Gn?s-R+Gn:0),S=4*(this._cubeSize-M);Ti(t,T,S,3*M,2*M),c.setRenderTarget(t),c.render(m,Xi)}}function Lf(i){const e=[],t=[],n=[];let s=i;const r=i-Gn+1+Zo.length;for(let a=0;ai-Gn?c=Zo[a-i+Gn-1]:a===0&&(c=0),t.push(c);const l=1/(o-2),d=-l,m=1+l,h=[d,d,m,d,m,m,d,d,m,m,d,m],_=6,v=6,E=3,p=2,u=1,A=new Float32Array(E*v*_),R=new Float32Array(p*v*_),M=new Float32Array(u*v*_);for(let S=0;S<_;S++){const w=S%3*2/3-1,g=S>2?0:-1,b=[w,g,0,w+2/3,g,0,w+2/3,g+1,0,w,g,0,w+2/3,g+1,0,w,g+1,0];A.set(b,E*v*S),R.set(h,p*v*S);const L=[S,S,S,S,S,S];M.set(L,u*v*S)}const T=new wt;T.setAttribute("position",new sn(A,E)),T.setAttribute("uv",new sn(R,p)),T.setAttribute("faceIndex",new sn(M,u)),n.push(new Kt(T,null)),s>Gn&&s--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Jo(i,e,t){const n=new pn(i,e,t);return n.texture.mapping=$s,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ti(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function If(i,e,t){return new _n({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Pf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:js(),fragmentShader:` - - precision highp float; - precision highp int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform float roughness; - uniform float mipInt; - - #define ENVMAP_TYPE_CUBE_UV - #include - - #define PI 3.14159265359 - - // Van der Corput radical inverse - float radicalInverse_VdC(uint bits) { - bits = (bits << 16u) | (bits >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - return float(bits) * 2.3283064365386963e-10; // / 0x100000000 - } - - // Hammersley sequence - vec2 hammersley(uint i, uint N) { - return vec2(float(i) / float(N), radicalInverse_VdC(i)); - } - - // GGX VNDF importance sampling (Eric Heitz 2018) - // "Sampling the GGX Distribution of Visible Normals" - // https://jcgt.org/published/0007/04/01/ - vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { - float alpha = roughness * roughness; - - // Section 4.1: Orthonormal basis - vec3 T1 = vec3(1.0, 0.0, 0.0); - vec3 T2 = cross(V, T1); - - // Section 4.2: Parameterization of projected area - float r = sqrt(Xi.x); - float phi = 2.0 * PI * Xi.y; - float t1 = r * cos(phi); - float t2 = r * sin(phi); - float s = 0.5 * (1.0 + V.z); - t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; - - // Section 4.3: Reprojection onto hemisphere - vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; - - // Section 3.4: Transform back to ellipsoid configuration - return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); - } - - void main() { - vec3 N = normalize(vOutputDirection); - vec3 V = N; // Assume view direction equals normal for pre-filtering - - vec3 prefilteredColor = vec3(0.0); - float totalWeight = 0.0; - - // For very low roughness, just sample the environment directly - if (roughness < 0.001) { - gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); - return; - } - - // Tangent space basis for VNDF sampling - vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); - vec3 tangent = normalize(cross(up, N)); - vec3 bitangent = cross(N, tangent); - - for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { - vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); - - // For PMREM, V = N, so in tangent space V is always (0, 0, 1) - vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); - - // Transform H back to world space - vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); - vec3 L = normalize(2.0 * dot(V, H) * H - V); - - float NdotL = max(dot(N, L), 0.0); - - if(NdotL > 0.0) { - // Sample environment at fixed mip level - // VNDF importance sampling handles the distribution filtering - vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); - - // Weight by NdotL for the split-sum approximation - // VNDF PDF naturally accounts for the visible microfacet distribution - prefilteredColor += sampleColor * NdotL; - totalWeight += NdotL; - } - } - - if (totalWeight > 0.0) { - prefilteredColor = prefilteredColor / totalWeight; - } - - gl_FragColor = vec4(prefilteredColor, 1.0); - } - `,blending:yn,depthTest:!1,depthWrite:!1})}function Uf(i,e,t){const n=new Float32Array(ei),s=new I(0,1,0);return new _n({name:"SphericalGaussianBlur",defines:{n:ei,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:js(),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:yn,depthTest:!1,depthWrite:!1})}function Qo(){return new _n({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:js(),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:yn,depthTest:!1,depthWrite:!1})}function jo(){return new _n({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:js(),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:yn,depthTest:!1,depthWrite:!1})}function js(){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 ); - - } - `}class Kl extends pn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},s=[n,n,n,n,n,n];this.texture=new kl(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `,fragmentShader:` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `},s=new ji(5,5,5),r=new _n({name:"CubemapFromEquirect",uniforms:Ui(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:zt,blending:yn});r.uniforms.tEquirect.value=t;const a=new Kt(s,r),o=t.minFilter;return t.minFilter===ti&&(t.minFilter=Lt),new Oh(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,s=!0){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,s);e.setRenderTarget(r)}}function Nf(i){let e=new WeakMap,t=new WeakMap,n=null;function s(h,_=!1){return h==null?null:_?a(h):r(h)}function r(h){if(h&&h.isTexture){const _=h.mapping;if(_===ir||_===sr)if(e.has(h)){const v=e.get(h).texture;return o(v,h.mapping)}else{const v=h.image;if(v&&v.height>0){const E=new Kl(v.height);return E.fromEquirectangularTexture(i,h),e.set(h,E),h.addEventListener("dispose",l),o(E.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const _=h.mapping,v=_===ir||_===sr,E=_===ii||_===Li;if(v||E){let p=t.get(h);const u=p!==void 0?p.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==u)return n===null&&(n=new $o(i)),p=v?n.fromEquirectangular(h,p):n.fromCubemap(h,p),p.texture.pmremVersion=h.pmremVersion,t.set(h,p),p.texture;if(p!==void 0)return p.texture;{const A=h.image;return v&&A&&A.height>0||E&&A&&c(A)?(n===null&&(n=new $o(i)),p=v?n.fromEquirectangular(h):n.fromCubemap(h),p.texture.pmremVersion=h.pmremVersion,t.set(h,p),h.addEventListener("dispose",d),p.texture):null}}}return h}function o(h,_){return _===ir?h.mapping=ii:_===sr&&(h.mapping=Li),h}function c(h){let _=0;const v=6;for(let E=0;E=65535?zl:Bl)(h,1);p.version=E;const u=r.get(m);u&&e.remove(u),r.set(m,p)}function d(m){const h=r.get(m);if(h){const _=m.index;_!==null&&h.version<_.version&&l(m)}else l(m);return r.get(m)}return{get:o,update:c,getWireframeAttribute:d}}function Bf(i,e,t){let n;function s(m){n=m}let r,a;function o(m){r=m.type,a=m.bytesPerElement}function c(m,h){i.drawElements(n,h,r,m*a),t.update(h,n,1)}function l(m,h,_){_!==0&&(i.drawElementsInstanced(n,h,r,m*a,_),t.update(h,n,_))}function d(m,h,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,h,0,r,m,0,_);let E=0;for(let p=0;p<_;p++)E+=h[p];t.update(E,n,1)}this.setMode=s,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=d}function zf(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(r/3);break;case i.LINES:t.lines+=o*(r/2);break;case i.LINE_STRIP:t.lines+=o*(r-1);break;case i.LINE_LOOP:t.lines+=o*r;break;case i.POINTS:t.points+=o*r;break;default:We("WebGLInfo: Unknown draw mode:",a);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:n}}function Gf(i,e,t){const n=new WeakMap,s=new ht;function r(a,o,c){const l=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,m=d!==void 0?d.length:0;let h=n.get(o);if(h===void 0||h.count!==m){let b=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",b)};h!==void 0&&h.texture.dispose();const _=o.morphAttributes.position!==void 0,v=o.morphAttributes.normal!==void 0,E=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],u=o.morphAttributes.normal||[],A=o.morphAttributes.color||[];let R=0;_===!0&&(R=1),v===!0&&(R=2),E===!0&&(R=3);let M=o.attributes.position.count*R,T=1;M>e.maxTextureSize&&(T=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const S=new Float32Array(M*T*4*m),w=new Fl(S,M,T,m);w.type=un,w.needsUpdate=!0;const g=R*4;for(let L=0;L - #include - - void main() { - gl_FragColor = texture2D( tDiffuse, vUv ); - - #ifdef LINEAR_TONE_MAPPING - gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); - #elif defined( REINHARD_TONE_MAPPING ) - gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); - #elif defined( CINEON_TONE_MAPPING ) - gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); - #elif defined( ACES_FILMIC_TONE_MAPPING ) - gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); - #elif defined( AGX_TONE_MAPPING ) - gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); - #elif defined( NEUTRAL_TONE_MAPPING ) - gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); - #elif defined( CUSTOM_TONE_MAPPING ) - gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); - #endif - - #ifdef SRGB_TRANSFER - gl_FragColor = sRGBTransferOETF( gl_FragColor ); - #endif - }`,depthTest:!1,depthWrite:!1}),d=new Kt(c,l),m=new Ka(-1,1,1,-1,0,1);let h=null,_=null,v=!1,E,p=null,u=[],A=!1;this.setSize=function(R,M){a.setSize(R,M),o.setSize(R,M);for(let T=0;T0&&u[0].isRenderPass===!0;const M=a.width,T=a.height;for(let S=0;S0)return i;const s=e*t;let r=el[s];if(r===void 0&&(r=new Float32Array(s),el[s]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(r,o)}return r}function yt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t0&&(this.seq=s.concat(r))}setValue(e,t,n,s){const r=this.map[t];r!==void 0&&r.setValue(e,n,s)}setOptional(e,t,n){const s=t[n];s!==void 0&&this.setValue(e,n,s)}static upload(e,t,n,s){for(let r=0,a=t.length;r!==a;++r){const o=t[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,s)}}static seqWithValue(e,t){const n=[];for(let s=0,r=e.length;s!==r;++s){const a=e[s];a.id in t&&n.push(a)}return n}}function al(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Up=37297;let Np=0;function Fp(i,e){const t=i.split(` -`),n=[],s=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=s;a":" "} ${o}: ${t[a]}`)}return n.join(` -`)}const ol=new Fe;function Op(i){Xe._getMatrix(ol,Xe.workingColorSpace,i);const e=`mat3( ${ol.elements.map(t=>t.toFixed(4))} )`;switch(Xe.getTransfer(i)){case Vs:return[e,"LinearTransferOETF"];case Je:return[e,"sRGBTransferOETF"];default:return De("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ll(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=(i.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const o=parseInt(a[1]);return t.toUpperCase()+` - -`+r+` - -`+Fp(i.getShaderSource(e),o)}else return r}function Bp(i,e){const t=Op(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` -`)}const zp={[Ml]:"Linear",[Sl]:"Reinhard",[El]:"Cineon",[yl]:"ACESFilmic",[Tl]:"AgX",[Al]:"Neutral",[bl]:"Custom"};function Gp(i,e){const t=zp[e];return t===void 0?(De("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Cs=new I;function Vp(){Xe.getLuminanceCoefficients(Cs);const i=Cs.x.toFixed(4),e=Cs.y.toFixed(4),t=Cs.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` -`)}function Hp(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ki).join(` -`)}function kp(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function Wp(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function Da(i){return i.replace(Xp,qp)}const Yp=new Map;function qp(i,e){let t=ze[e];if(t===void 0){const n=Yp.get(e);if(n!==void 0)t=ze[n],De('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return Da(t)}const Zp=/#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 ul(i){return i.replace(Zp,Kp)}function Kp(i,e,t,n){let s="";for(let r=parseInt(e);r0&&(p+=` -`),u=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(Ki).join(` -`),u.length>0&&(u+=` -`)):(p=[dl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",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 "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",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?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Ki).join(` -`),u=[dl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+d:"",t.envMap?"#define "+m:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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.dispersion?"#define USE_DISPERSION":"",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||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==fn?"#define TONE_MAPPING":"",t.toneMapping!==fn?ze.tonemapping_pars_fragment:"",t.toneMapping!==fn?Gp("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ze.colorspace_pars_fragment,Bp("linearToOutputTexel",t.outputColorSpace),Vp(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(Ki).join(` -`)),a=Da(a),a=cl(a,t),a=hl(a,t),o=Da(o),o=cl(o,t),o=hl(o,t),a=ul(a),o=ul(o),t.isRawShaderMaterial!==!0&&(A=`#version 300 es -`,p=[_,"#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+p,u=["#define varying in",t.glslVersion===po?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===po?"":"#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(` -`)+` -`+u);const R=A+p+a,M=A+u+o,T=al(s,s.VERTEX_SHADER,R),S=al(s,s.FRAGMENT_SHADER,M);s.attachShader(E,T),s.attachShader(E,S),t.index0AttributeName!==void 0?s.bindAttribLocation(E,0,t.index0AttributeName):t.hasPositionAttribute===!0&&s.bindAttribLocation(E,0,"position"),s.linkProgram(E);function w(D){if(i.debug.checkShaderErrors){const B=s.getProgramInfoLog(E)||"",Z=s.getShaderInfoLog(T)||"",W=s.getShaderInfoLog(S)||"",O=B.trim(),H=Z.trim(),Y=W.trim();let ee=!0,te=!0;if(s.getProgramParameter(E,s.LINK_STATUS)===!1)if(ee=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,E,T,S);else{const he=ll(s,T,"vertex"),me=ll(s,S,"fragment");We("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(E,s.VALIDATE_STATUS)+` - -Material Name: `+D.name+` -Material Type: `+D.type+` - -Program Info Log: `+O+` -`+he+` -`+me)}else O!==""?De("WebGLProgram: Program Info Log:",O):(H===""||Y==="")&&(te=!1);te&&(D.diagnostics={runnable:ee,programLog:O,vertexShader:{log:H,prefix:p},fragmentShader:{log:Y,prefix:u}})}s.deleteShader(T),s.deleteShader(S),g=new Os(s,E),b=Wp(s,E)}let g;this.getUniforms=function(){return g===void 0&&w(this),g};let b;this.getAttributes=function(){return b===void 0&&w(this),b};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=s.getProgramParameter(E,Up)),L},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Np++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=T,this.fragmentShader=S,this}let am=0;class om{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const s=this._getShaderCacheForMaterial(e);return s.has(t)===!1&&(s.add(t),t.usedTimes++),s.has(n)===!1&&(s.add(n),n.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new lm(e),t.set(e,n)),n}}class lm{constructor(e){this.id=am++,this.code=e,this.usedTimes=0}}function cm(i){return i===si||i===Bs||i===zs}function hm(i,e,t,n,s,r){const a=new Ha,o=new om,c=new Set,l=[],d=new Map,m=n.logarithmicDepthBuffer;let h=n.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(g){return c.add(g),g===0?"uv":`uv${g}`}function E(g,b,L,D,B,Z){const W=D.fog,O=B.geometry,H=g.isMeshStandardMaterial||g.isMeshLambertMaterial||g.isMeshPhongMaterial?D.environment:null,Y=g.isMeshStandardMaterial||g.isMeshLambertMaterial&&!g.envMap||g.isMeshPhongMaterial&&!g.envMap,ee=e.get(g.envMap||H,Y),te=ee&&ee.mapping===$s?ee.image.height:null,he=_[g.type];g.precision!==null&&(h=n.getMaxPrecision(g.precision),h!==g.precision&&De("WebGLProgram.getParameters:",g.precision,"not supported, using",h,"instead."));const me=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,de=me!==void 0?me.length:0;let Ye=0;O.morphAttributes.position!==void 0&&(Ye=1),O.morphAttributes.normal!==void 0&&(Ye=2),O.morphAttributes.color!==void 0&&(Ye=3);let st,qe,j,ae;if(he){const J=ln[he];st=J.vertexShader,qe=J.fragmentShader}else{st=g.vertexShader,qe=g.fragmentShader;const J=o.getVertexShaderStage(g),Te=o.getFragmentShaderStage(g);o.update(g,J,Te),j=J.id,ae=Te.id}const ne=i.getRenderTarget(),Ae=i.state.buffers.depth.getReversed(),Ue=B.isInstancedMesh===!0,Re=B.isBatchedMesh===!0,rt=!!g.map,Ge=!!g.matcap,Ze=!!ee,ke=!!g.aoMap,Be=!!g.lightMap,ot=!!g.bumpMap&&g.wireframe===!1,ut=!!g.normalMap,ft=!!g.displacementMap,pt=!!g.emissiveMap,lt=!!g.metalnessMap,ct=!!g.roughnessMap,U=g.anisotropy>0,Rt=g.clearcoat>0,$e=g.dispersion>0,y=g.iridescence>0,f=g.sheen>0,F=g.transmission>0,z=U&&!!g.anisotropyMap,K=Rt&&!!g.clearcoatMap,se=Rt&&!!g.clearcoatNormalMap,ie=Rt&&!!g.clearcoatRoughnessMap,q=y&&!!g.iridescenceMap,Q=y&&!!g.iridescenceThicknessMap,oe=f&&!!g.sheenColorMap,Se=f&&!!g.sheenRoughnessMap,ue=!!g.specularMap,le=!!g.specularColorMap,Ee=!!g.specularIntensityMap,Ce=F&&!!g.transmissionMap,Ne=F&&!!g.thicknessMap,P=!!g.gradientMap,re=!!g.alphaMap,$=g.alphaTest>0,ce=!!g.alphaHash,fe=!!g.extensions;let C=fn;g.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(C=i.toneMapping);const X={shaderID:he,shaderType:g.type,shaderName:g.name,vertexShader:st,fragmentShader:qe,defines:g.defines,customVertexShaderID:j,customFragmentShaderID:ae,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:h,batching:Re,batchingColor:Re&&B._colorsTexture!==null,instancing:Ue,instancingColor:Ue&&B.instanceColor!==null,instancingMorph:Ue&&B.morphTexture!==null,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:Xe.workingColorSpace,alphaToCoverage:!!g.alphaToCoverage,map:rt,matcap:Ge,envMap:Ze,envMapMode:Ze&&ee.mapping,envMapCubeUVHeight:te,aoMap:ke,lightMap:Be,bumpMap:ot,normalMap:ut,displacementMap:ft,emissiveMap:pt,normalMapObjectSpace:ut&&g.normalMapType===Oc,normalMapTangentSpace:ut&&g.normalMapType===Aa,packedNormalMap:ut&&g.normalMapType===Aa&&cm(g.normalMap.format),metalnessMap:lt,roughnessMap:ct,anisotropy:U,anisotropyMap:z,clearcoat:Rt,clearcoatMap:K,clearcoatNormalMap:se,clearcoatRoughnessMap:ie,dispersion:$e,iridescence:y,iridescenceMap:q,iridescenceThicknessMap:Q,sheen:f,sheenColorMap:oe,sheenRoughnessMap:Se,specularMap:ue,specularColorMap:le,specularIntensityMap:Ee,transmission:F,transmissionMap:Ce,thicknessMap:Ne,gradientMap:P,opaque:g.transparent===!1&&g.blending===Ri&&g.alphaToCoverage===!1,alphaMap:re,alphaTest:$,alphaHash:ce,combine:g.combine,mapUv:rt&&v(g.map.channel),aoMapUv:ke&&v(g.aoMap.channel),lightMapUv:Be&&v(g.lightMap.channel),bumpMapUv:ot&&v(g.bumpMap.channel),normalMapUv:ut&&v(g.normalMap.channel),displacementMapUv:ft&&v(g.displacementMap.channel),emissiveMapUv:pt&&v(g.emissiveMap.channel),metalnessMapUv:lt&&v(g.metalnessMap.channel),roughnessMapUv:ct&&v(g.roughnessMap.channel),anisotropyMapUv:z&&v(g.anisotropyMap.channel),clearcoatMapUv:K&&v(g.clearcoatMap.channel),clearcoatNormalMapUv:se&&v(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ie&&v(g.clearcoatRoughnessMap.channel),iridescenceMapUv:q&&v(g.iridescenceMap.channel),iridescenceThicknessMapUv:Q&&v(g.iridescenceThicknessMap.channel),sheenColorMapUv:oe&&v(g.sheenColorMap.channel),sheenRoughnessMapUv:Se&&v(g.sheenRoughnessMap.channel),specularMapUv:ue&&v(g.specularMap.channel),specularColorMapUv:le&&v(g.specularColorMap.channel),specularIntensityMapUv:Ee&&v(g.specularIntensityMap.channel),transmissionMapUv:Ce&&v(g.transmissionMap.channel),thicknessMapUv:Ne&&v(g.thicknessMap.channel),alphaMapUv:re&&v(g.alphaMap.channel),vertexTangents:!!O.attributes.tangent&&(ut||U),vertexNormals:!!O.attributes.normal,vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!O.attributes.uv&&(rt||re),fog:!!W,useFog:g.fog===!0,fogExp2:!!W&&W.isFogExp2,flatShading:g.wireframe===!1&&(g.flatShading===!0||O.attributes.normal===void 0&&ut===!1&&(g.isMeshLambertMaterial||g.isMeshPhongMaterial||g.isMeshStandardMaterial||g.isMeshPhysicalMaterial)),sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:m,reversedDepthBuffer:Ae,skinning:B.isSkinnedMesh===!0,hasPositionAttribute:O.attributes.position!==void 0,morphTargets:O.morphAttributes.position!==void 0,morphNormals:O.morphAttributes.normal!==void 0,morphColors:O.morphAttributes.color!==void 0,morphTargetsCount:de,morphTextureStride:Ye,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,numLightProbes:b.numLightProbes,numLightProbeGrids:Z.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:g.dithering,shadowMapEnabled:i.shadowMap.enabled&&L.length>0,shadowMapType:i.shadowMap.type,toneMapping:C,decodeVideoTexture:rt&&g.map.isVideoTexture===!0&&Xe.getTransfer(g.map.colorSpace)===Je,decodeVideoTextureEmissive:pt&&g.emissiveMap.isVideoTexture===!0&&Xe.getTransfer(g.emissiveMap.colorSpace)===Je,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===cn,flipSided:g.side===zt,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionClipCullDistance:fe&&g.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(fe&&g.extensions.multiDraw===!0||Re)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return X.vertexUv1s=c.has(1),X.vertexUv2s=c.has(2),X.vertexUv3s=c.has(3),c.clear(),X}function p(g){const b=[];if(g.shaderID?b.push(g.shaderID):(b.push(g.customVertexShaderID),b.push(g.customFragmentShaderID)),g.defines!==void 0)for(const L in g.defines)b.push(L),b.push(g.defines[L]);return g.isRawShaderMaterial===!1&&(u(b,g),A(b,g),b.push(i.outputColorSpace)),b.push(g.customProgramCacheKey),b.join()}function u(g,b){g.push(b.precision),g.push(b.outputColorSpace),g.push(b.envMapMode),g.push(b.envMapCubeUVHeight),g.push(b.mapUv),g.push(b.alphaMapUv),g.push(b.lightMapUv),g.push(b.aoMapUv),g.push(b.bumpMapUv),g.push(b.normalMapUv),g.push(b.displacementMapUv),g.push(b.emissiveMapUv),g.push(b.metalnessMapUv),g.push(b.roughnessMapUv),g.push(b.anisotropyMapUv),g.push(b.clearcoatMapUv),g.push(b.clearcoatNormalMapUv),g.push(b.clearcoatRoughnessMapUv),g.push(b.iridescenceMapUv),g.push(b.iridescenceThicknessMapUv),g.push(b.sheenColorMapUv),g.push(b.sheenRoughnessMapUv),g.push(b.specularMapUv),g.push(b.specularColorMapUv),g.push(b.specularIntensityMapUv),g.push(b.transmissionMapUv),g.push(b.thicknessMapUv),g.push(b.combine),g.push(b.fogExp2),g.push(b.sizeAttenuation),g.push(b.morphTargetsCount),g.push(b.morphAttributeCount),g.push(b.numDirLights),g.push(b.numPointLights),g.push(b.numSpotLights),g.push(b.numSpotLightMaps),g.push(b.numHemiLights),g.push(b.numRectAreaLights),g.push(b.numDirLightShadows),g.push(b.numPointLightShadows),g.push(b.numSpotLightShadows),g.push(b.numSpotLightShadowsWithMaps),g.push(b.numLightProbes),g.push(b.shadowMapType),g.push(b.toneMapping),g.push(b.numClippingPlanes),g.push(b.numClipIntersection),g.push(b.depthPacking)}function A(g,b){a.disableAll(),b.instancing&&a.enable(0),b.instancingColor&&a.enable(1),b.instancingMorph&&a.enable(2),b.matcap&&a.enable(3),b.envMap&&a.enable(4),b.normalMapObjectSpace&&a.enable(5),b.normalMapTangentSpace&&a.enable(6),b.clearcoat&&a.enable(7),b.iridescence&&a.enable(8),b.alphaTest&&a.enable(9),b.vertexColors&&a.enable(10),b.vertexAlphas&&a.enable(11),b.vertexUv1s&&a.enable(12),b.vertexUv2s&&a.enable(13),b.vertexUv3s&&a.enable(14),b.vertexTangents&&a.enable(15),b.anisotropy&&a.enable(16),b.alphaHash&&a.enable(17),b.batching&&a.enable(18),b.dispersion&&a.enable(19),b.batchingColor&&a.enable(20),b.gradientMap&&a.enable(21),b.packedNormalMap&&a.enable(22),b.vertexNormals&&a.enable(23),g.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.reversedDepthBuffer&&a.enable(4),b.skinning&&a.enable(5),b.morphTargets&&a.enable(6),b.morphNormals&&a.enable(7),b.morphColors&&a.enable(8),b.premultipliedAlpha&&a.enable(9),b.shadowMapEnabled&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),b.decodeVideoTexture&&a.enable(19),b.decodeVideoTextureEmissive&&a.enable(20),b.alphaToCoverage&&a.enable(21),b.numLightProbeGrids>0&&a.enable(22),b.hasPositionAttribute&&a.enable(23),g.push(a.mask)}function R(g){const b=_[g.type];let L;if(b){const D=ln[b];L=bh.clone(D.uniforms)}else L=g.uniforms;return L}function M(g,b){let L=d.get(b);return L!==void 0?++L.usedTimes:(L=new rm(i,b,g,s),l.push(L),d.set(b,L)),L}function T(g){if(--g.usedTimes===0){const b=l.indexOf(g);l[b]=l[l.length-1],l.pop(),d.delete(g.cacheKey),g.destroy()}}function S(g){o.remove(g)}function w(){o.dispose()}return{getParameters:E,getProgramCacheKey:p,getUniforms:R,acquireProgram:M,releaseProgram:T,releaseShaderCache:S,programs:l,dispose:w}}function um(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function s(a,o,c){i.get(a)[o]=c}function r(){i=new WeakMap}return{has:e,get:t,remove:n,update:s,dispose:r}}function dm(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function fl(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function pl(){const i=[];let e=0;const t=[],n=[],s=[];function r(){e=0,t.length=0,n.length=0,s.length=0}function a(h){let _=0;return h.isInstancedMesh&&(_+=2),h.isSkinnedMesh&&(_+=1),_}function o(h,_,v,E,p,u){let A=i[e];return A===void 0?(A={id:h.id,object:h,geometry:_,material:v,materialVariant:a(h),groupOrder:E,renderOrder:h.renderOrder,z:p,group:u},i[e]=A):(A.id=h.id,A.object=h,A.geometry=_,A.material=v,A.materialVariant=a(h),A.groupOrder=E,A.renderOrder=h.renderOrder,A.z=p,A.group=u),e++,A}function c(h,_,v,E,p,u){const A=o(h,_,v,E,p,u);v.transmission>0?n.push(A):v.transparent===!0?s.push(A):t.push(A)}function l(h,_,v,E,p,u){const A=o(h,_,v,E,p,u);v.transmission>0?n.unshift(A):v.transparent===!0?s.unshift(A):t.unshift(A)}function d(h,_,v){t.length>1&&t.sort(h||dm),n.length>1&&n.sort(_||fl),s.length>1&&s.sort(_||fl),v&&(t.reverse(),n.reverse(),s.reverse())}function m(){for(let h=e,_=i.length;h<_;h++){const v=i[h];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:n,transparent:s,init:r,push:c,unshift:l,finish:m,sort:d}}function fm(){let i=new WeakMap;function e(n,s){const r=i.get(n);let a;return r===void 0?(a=new pl,i.set(n,[a])):s>=r.length?(a=new pl,r.push(a)):a=r[s],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function pm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new Ie};break;case"SpotLight":t={position:new I,direction:new I,color:new Ie,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new Ie,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new Ie,groundColor:new Ie};break;case"RectAreaLight":t={color:new Ie,position:new I,halfWidth:new I,halfHeight:new I};break}return i[e.id]=t,t}}}function mm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let _m=0;function gm(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function xm(i){const e=new pm,t=mm(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new I);const s=new I,r=new at,a=new at;function o(l){let d=0,m=0,h=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let _=0,v=0,E=0,p=0,u=0,A=0,R=0,M=0,T=0,S=0,w=0;l.sort(gm);for(let b=0,L=l.length;b0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=pe.LTC_FLOAT_1,n.rectAreaLTC2=pe.LTC_FLOAT_2):(n.rectAreaLTC1=pe.LTC_HALF_1,n.rectAreaLTC2=pe.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=m,n.ambient[2]=h;const g=n.hash;(g.directionalLength!==_||g.pointLength!==v||g.spotLength!==E||g.rectAreaLength!==p||g.hemiLength!==u||g.numDirectionalShadows!==A||g.numPointShadows!==R||g.numSpotShadows!==M||g.numSpotMaps!==T||g.numLightProbes!==w)&&(n.directional.length=_,n.spot.length=E,n.rectArea.length=p,n.point.length=v,n.hemi.length=u,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=R,n.pointShadowMap.length=R,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=R,n.spotLightMatrix.length=M+T-S,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=S,n.numLightProbes=w,g.directionalLength=_,g.pointLength=v,g.spotLength=E,g.rectAreaLength=p,g.hemiLength=u,g.numDirectionalShadows=A,g.numPointShadows=R,g.numSpotShadows=M,g.numSpotMaps=T,g.numLightProbes=w,n.version=_m++)}function c(l,d){let m=0,h=0,_=0,v=0,E=0;const p=d.matrixWorldInverse;for(let u=0,A=l.length;u=a.length?(o=new ml(i),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Mm=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,Sm=`uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); - gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); -}`,Em=[new I(1,0,0),new I(-1,0,0),new I(0,1,0),new I(0,-1,0),new I(0,0,1),new I(0,0,-1)],ym=[new I(0,-1,0),new I(0,-1,0),new I(0,0,1),new I(0,0,-1),new I(0,-1,0),new I(0,-1,0)],_l=new at,Yi=new I,Or=new I;function bm(i,e,t){let n=new Wa;const s=new we,r=new we,a=new ht,o=new Ch,c=new Ph,l={},d=t.maxTextureSize,m={[Hn]:zt,[zt]:Hn,[cn]:cn},h=new _n({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new we},radius:{value:4}},vertexShader:Mm,fragmentShader:Sm}),_=h.clone();_.defines.HORIZONTAL_PASS=1;const v=new wt;v.setAttribute("position",new sn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Kt(v,h),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ds;let u=this.type;this.render=function(S,w,g){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||S.length===0)return;this.type===pc&&(De("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Ds);const b=i.getRenderTarget(),L=i.getActiveCubeFace(),D=i.getActiveMipmapLevel(),B=i.state;B.setBlending(yn),B.buffers.depth.getReversed()===!0?B.buffers.color.setClear(0,0,0,0):B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const Z=u!==this.type;Z&&w.traverse(function(W){W.material&&(Array.isArray(W.material)?W.material.forEach(O=>O.needsUpdate=!0):W.material.needsUpdate=!0)});for(let W=0,O=S.length;Wd||s.y>d)&&(s.x>d&&(r.x=Math.floor(d/ee.x),s.x=r.x*ee.x,Y.mapSize.x=r.x),s.y>d&&(r.y=Math.floor(d/ee.y),s.y=r.y*ee.y,Y.mapSize.y=r.y));const te=i.state.buffers.depth.getReversed();if(Y.camera._reversedDepth=te,Y.map===null||Z===!0){if(Y.map!==null&&(Y.map.depthTexture!==null&&(Y.map.depthTexture.dispose(),Y.map.depthTexture=null),Y.map.dispose()),this.type===qi){if(H.isPointLight){De("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Y.map=new pn(s.x,s.y,{format:si,type:Tn,minFilter:Lt,magFilter:Lt,generateMipmaps:!1}),Y.map.texture.name=H.name+".shadowMap",Y.map.depthTexture=new Ii(s.x,s.y,un),Y.map.depthTexture.name=H.name+".shadowMapDepth",Y.map.depthTexture.format=An,Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=At,Y.map.depthTexture.magFilter=At}else H.isPointLight?(Y.map=new Kl(s.x),Y.map.depthTexture=new Eh(s.x,mn)):(Y.map=new pn(s.x,s.y),Y.map.depthTexture=new Ii(s.x,s.y,mn)),Y.map.depthTexture.name=H.name+".shadowMap",Y.map.depthTexture.format=An,this.type===Ds?(Y.map.depthTexture.compareFunction=te?Ga:za,Y.map.depthTexture.minFilter=Lt,Y.map.depthTexture.magFilter=Lt):(Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=At,Y.map.depthTexture.magFilter=At);Y.camera.updateProjectionMatrix()}const he=Y.map.isWebGLCubeRenderTarget?6:1;for(let me=0;me0||w.map&&w.alphaTest>0||w.alphaToCoverage===!0){const B=L.uuid,Z=w.uuid;let W=l[B];W===void 0&&(W={},l[B]=W);let O=W[Z];O===void 0&&(O=L.clone(),W[Z]=O,w.addEventListener("dispose",T)),L=O}if(L.visible=w.visible,L.wireframe=w.wireframe,b===qi?L.side=w.shadowSide!==null?w.shadowSide:w.side:L.side=w.shadowSide!==null?w.shadowSide:m[w.side],L.alphaMap=w.alphaMap,L.alphaTest=w.alphaToCoverage===!0?.5:w.alphaTest,L.map=w.map,L.clipShadows=w.clipShadows,L.clippingPlanes=w.clippingPlanes,L.clipIntersection=w.clipIntersection,L.displacementMap=w.displacementMap,L.displacementScale=w.displacementScale,L.displacementBias=w.displacementBias,L.wireframeLinewidth=w.wireframeLinewidth,L.linewidth=w.linewidth,g.isPointLight===!0&&L.isMeshDistanceMaterial===!0){const B=i.properties.get(L);B.light=g}return L}function M(S,w,g,b,L){if(S.visible===!1)return;if(S.layers.test(w.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&L===qi)&&(!S.frustumCulled||n.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,S.matrixWorld);const Z=e.update(S),W=S.material;if(Array.isArray(W)){const O=Z.groups;for(let H=0,Y=O.length;H=1):te.indexOf("OpenGL ES")!==-1&&(ee=parseFloat(/^OpenGL ES (\d)/.exec(te)[1]),Y=ee>=2);let he=null,me={};const de=i.getParameter(i.SCISSOR_BOX),Ye=i.getParameter(i.VIEWPORT),st=new ht().fromArray(de),qe=new ht().fromArray(Ye);function j(P,re,$,ce){const fe=new Uint8Array(4),C=i.createTexture();i.bindTexture(P,C),i.texParameteri(P,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(P,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let X=0;X<$;X++)P===i.TEXTURE_3D||P===i.TEXTURE_2D_ARRAY?i.texImage3D(re,0,i.RGBA,1,1,ce,0,i.RGBA,i.UNSIGNED_BYTE,fe):i.texImage2D(re+X,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,fe);return C}const ae={};ae[i.TEXTURE_2D]=j(i.TEXTURE_2D,i.TEXTURE_2D,1),ae[i.TEXTURE_CUBE_MAP]=j(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ae[i.TEXTURE_2D_ARRAY]=j(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ae[i.TEXTURE_3D]=j(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ne(i.DEPTH_TEST),a.setFunc(Di),ot(!1),ut(lo),ne(i.CULL_FACE),ke(yn);function ne(P){d[P]!==!0&&(i.enable(P),d[P]=!0)}function Ae(P){d[P]!==!1&&(i.disable(P),d[P]=!1)}function Ue(P,re){return h[P]!==re?(i.bindFramebuffer(P,re),h[P]=re,P===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=re),P===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=re),!0):!1}function Re(P,re){let $=v,ce=!1;if(P){$=_.get(re),$===void 0&&($=[],_.set(re,$));const fe=P.textures;if($.length!==fe.length||$[0]!==i.COLOR_ATTACHMENT0){for(let C=0,X=fe.length;C"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new we,d=new WeakMap,m=new Set;let h;const _=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function E(y,f){return v?new OffscreenCanvas(y,f):Hs("canvas")}function p(y,f,F){let z=1;const K=$e(y);if((K.width>F||K.height>F)&&(z=F/Math.max(K.width,K.height)),z<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const se=Math.floor(z*K.width),ie=Math.floor(z*K.height);h===void 0&&(h=E(se,ie));const q=f?E(se,ie):h;return q.width=se,q.height=ie,q.getContext("2d").drawImage(y,0,0,se,ie),De("WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+se+"x"+ie+")."),q}else return"data"in y&&De("WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),y;return y}function u(y){return y.generateMipmaps}function A(y){i.generateMipmap(y)}function R(y){return y.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:y.isWebGL3DRenderTarget?i.TEXTURE_3D:y.isWebGLArrayRenderTarget||y.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(y,f,F,z,K,se=!1){if(y!==null){if(i[y]!==void 0)return i[y];De("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let ie;z&&(ie=e.get("EXT_texture_norm16"),ie||De("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let q=f;if(f===i.RED&&(F===i.FLOAT&&(q=i.R32F),F===i.HALF_FLOAT&&(q=i.R16F),F===i.UNSIGNED_BYTE&&(q=i.R8),F===i.UNSIGNED_SHORT&&ie&&(q=ie.R16_EXT),F===i.SHORT&&ie&&(q=ie.R16_SNORM_EXT)),f===i.RED_INTEGER&&(F===i.UNSIGNED_BYTE&&(q=i.R8UI),F===i.UNSIGNED_SHORT&&(q=i.R16UI),F===i.UNSIGNED_INT&&(q=i.R32UI),F===i.BYTE&&(q=i.R8I),F===i.SHORT&&(q=i.R16I),F===i.INT&&(q=i.R32I)),f===i.RG&&(F===i.FLOAT&&(q=i.RG32F),F===i.HALF_FLOAT&&(q=i.RG16F),F===i.UNSIGNED_BYTE&&(q=i.RG8),F===i.UNSIGNED_SHORT&&ie&&(q=ie.RG16_EXT),F===i.SHORT&&ie&&(q=ie.RG16_SNORM_EXT)),f===i.RG_INTEGER&&(F===i.UNSIGNED_BYTE&&(q=i.RG8UI),F===i.UNSIGNED_SHORT&&(q=i.RG16UI),F===i.UNSIGNED_INT&&(q=i.RG32UI),F===i.BYTE&&(q=i.RG8I),F===i.SHORT&&(q=i.RG16I),F===i.INT&&(q=i.RG32I)),f===i.RGB_INTEGER&&(F===i.UNSIGNED_BYTE&&(q=i.RGB8UI),F===i.UNSIGNED_SHORT&&(q=i.RGB16UI),F===i.UNSIGNED_INT&&(q=i.RGB32UI),F===i.BYTE&&(q=i.RGB8I),F===i.SHORT&&(q=i.RGB16I),F===i.INT&&(q=i.RGB32I)),f===i.RGBA_INTEGER&&(F===i.UNSIGNED_BYTE&&(q=i.RGBA8UI),F===i.UNSIGNED_SHORT&&(q=i.RGBA16UI),F===i.UNSIGNED_INT&&(q=i.RGBA32UI),F===i.BYTE&&(q=i.RGBA8I),F===i.SHORT&&(q=i.RGBA16I),F===i.INT&&(q=i.RGBA32I)),f===i.RGB&&(F===i.UNSIGNED_SHORT&&ie&&(q=ie.RGB16_EXT),F===i.SHORT&&ie&&(q=ie.RGB16_SNORM_EXT),F===i.UNSIGNED_INT_5_9_9_9_REV&&(q=i.RGB9_E5),F===i.UNSIGNED_INT_10F_11F_11F_REV&&(q=i.R11F_G11F_B10F)),f===i.RGBA){const Q=se?Vs:Xe.getTransfer(K);F===i.FLOAT&&(q=i.RGBA32F),F===i.HALF_FLOAT&&(q=i.RGBA16F),F===i.UNSIGNED_BYTE&&(q=Q===Je?i.SRGB8_ALPHA8:i.RGBA8),F===i.UNSIGNED_SHORT&&ie&&(q=ie.RGBA16_EXT),F===i.SHORT&&ie&&(q=ie.RGBA16_SNORM_EXT),F===i.UNSIGNED_SHORT_4_4_4_4&&(q=i.RGBA4),F===i.UNSIGNED_SHORT_5_5_5_1&&(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function T(y,f){let F;return y?f===null||f===mn||f===Ji?F=i.DEPTH24_STENCIL8:f===un?F=i.DEPTH32F_STENCIL8:f===$i&&(F=i.DEPTH24_STENCIL8,De("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):f===null||f===mn||f===Ji?F=i.DEPTH_COMPONENT24:f===un?F=i.DEPTH_COMPONENT32F:f===$i&&(F=i.DEPTH_COMPONENT16),F}function S(y,f){return u(y)===!0||y.isFramebufferTexture&&y.minFilter!==At&&y.minFilter!==Lt?Math.log2(Math.max(f.width,f.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?f.mipmaps.length:1}function w(y){const f=y.target;f.removeEventListener("dispose",w),b(f),f.isVideoTexture&&d.delete(f),f.isHTMLTexture&&m.delete(f)}function g(y){const f=y.target;f.removeEventListener("dispose",g),D(f)}function b(y){const f=n.get(y);if(f.__webglInit===void 0)return;const F=y.source,z=_.get(F);if(z){const K=z[f.__cacheKey];K.usedTimes--,K.usedTimes===0&&L(y),Object.keys(z).length===0&&_.delete(F)}n.remove(y)}function L(y){const f=n.get(y);i.deleteTexture(f.__webglTexture);const F=y.source,z=_.get(F);delete z[f.__cacheKey],a.memory.textures--}function D(y){const f=n.get(y);if(y.depthTexture&&(y.depthTexture.dispose(),n.remove(y.depthTexture)),y.isWebGLCubeRenderTarget)for(let z=0;z<6;z++){if(Array.isArray(f.__webglFramebuffer[z]))for(let K=0;K=s.maxTextures&&De("WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+s.maxTextures),B+=1,y}function Y(y){const f=[];return f.push(y.wrapS),f.push(y.wrapT),f.push(y.wrapR||0),f.push(y.magFilter),f.push(y.minFilter),f.push(y.anisotropy),f.push(y.internalFormat),f.push(y.format),f.push(y.type),f.push(y.generateMipmaps),f.push(y.premultiplyAlpha),f.push(y.flipY),f.push(y.unpackAlignment),f.push(y.colorSpace),f.join()}function ee(y,f){const F=n.get(y);if(y.isVideoTexture&&U(y),y.isRenderTargetTexture===!1&&y.isExternalTexture!==!0&&y.version>0&&F.__version!==y.version){const z=y.image;if(z===null)De("WebGLRenderer: Texture marked for update but no image data found.");else if(z.complete===!1)De("WebGLRenderer: Texture marked for update but image is incomplete");else{Ae(F,y,f);return}}else y.isExternalTexture&&(F.__webglTexture=y.sourceTexture?y.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,F.__webglTexture,i.TEXTURE0+f)}function te(y,f){const F=n.get(y);if(y.isRenderTargetTexture===!1&&y.version>0&&F.__version!==y.version){Ae(F,y,f);return}else y.isExternalTexture&&(F.__webglTexture=y.sourceTexture?y.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,F.__webglTexture,i.TEXTURE0+f)}function he(y,f){const F=n.get(y);if(y.isRenderTargetTexture===!1&&y.version>0&&F.__version!==y.version){Ae(F,y,f);return}t.bindTexture(i.TEXTURE_3D,F.__webglTexture,i.TEXTURE0+f)}function me(y,f){const F=n.get(y);if(y.isCubeDepthTexture!==!0&&y.version>0&&F.__version!==y.version){Ue(F,y,f);return}t.bindTexture(i.TEXTURE_CUBE_MAP,F.__webglTexture,i.TEXTURE0+f)}const de={[Zr]:i.REPEAT,[En]:i.CLAMP_TO_EDGE,[Kr]:i.MIRRORED_REPEAT},Ye={[At]:i.NEAREST,[Nc]:i.NEAREST_MIPMAP_NEAREST,[is]:i.NEAREST_MIPMAP_LINEAR,[Lt]:i.LINEAR,[rr]:i.LINEAR_MIPMAP_NEAREST,[ti]:i.LINEAR_MIPMAP_LINEAR},st={[Bc]:i.NEVER,[kc]:i.ALWAYS,[zc]:i.LESS,[za]:i.LEQUAL,[Gc]:i.EQUAL,[Ga]:i.GEQUAL,[Vc]:i.GREATER,[Hc]:i.NOTEQUAL};function qe(y,f){if(f.type===un&&e.has("OES_texture_float_linear")===!1&&(f.magFilter===Lt||f.magFilter===rr||f.magFilter===is||f.magFilter===ti||f.minFilter===Lt||f.minFilter===rr||f.minFilter===is||f.minFilter===ti)&&De("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,de[f.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,de[f.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,de[f.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,Ye[f.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,Ye[f.minFilter]),f.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,st[f.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(f.magFilter===At||f.minFilter!==is&&f.minFilter!==ti||f.type===un&&e.has("OES_texture_float_linear")===!1)return;if(f.anisotropy>1||n.get(f).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");i.texParameterf(y,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(f.anisotropy,s.getMaxAnisotropy())),n.get(f).__currentAnisotropy=f.anisotropy}}}function j(y,f){let F=!1;y.__webglInit===void 0&&(y.__webglInit=!0,f.addEventListener("dispose",w));const z=f.source;let K=_.get(z);K===void 0&&(K={},_.set(z,K));const se=Y(f);if(se!==y.__cacheKey){K[se]===void 0&&(K[se]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,F=!0),K[se].usedTimes++;const ie=K[y.__cacheKey];ie!==void 0&&(K[y.__cacheKey].usedTimes--,ie.usedTimes===0&&L(f)),y.__cacheKey=se,y.__webglTexture=K[se].texture}return F}function ae(y,f,F){return Math.floor(Math.floor(y/F)/f)}function ne(y,f,F,z){const se=y.updateRanges;if(se.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,f.width,f.height,F,z,f.data);else{se.sort((Se,ue)=>Se.start-ue.start);let ie=0;for(let Se=1;Se0){Ce&&Ne&&t.texStorage2D(i.TEXTURE_2D,re,ue,Ee[0].width,Ee[0].height);for(let $=0,ce=Ee.length;$0){const fe=qo(le.width,le.height,f.format,f.type);for(const C of f.layerUpdates){const X=le.data.subarray(C*fe/le.data.BYTES_PER_ELEMENT,(C+1)*fe/le.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,$,0,0,C,le.width,le.height,1,oe,X)}f.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,$,0,0,0,le.width,le.height,Q.depth,oe,le.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,$,ue,le.width,le.height,Q.depth,0,le.data,0,0);else De("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ce?P&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,$,0,0,0,le.width,le.height,Q.depth,oe,Se,le.data):t.texImage3D(i.TEXTURE_2D_ARRAY,$,ue,le.width,le.height,Q.depth,0,oe,Se,le.data)}else{Ce&&Ne&&t.texStorage2D(i.TEXTURE_2D,re,ue,Ee[0].width,Ee[0].height);for(let $=0,ce=Ee.length;$0){const $=qo(Q.width,Q.height,f.format,f.type);for(const ce of f.layerUpdates){const fe=Q.data.subarray(ce*$/Q.data.BYTES_PER_ELEMENT,(ce+1)*$/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,ce,Q.width,Q.height,1,oe,Se,fe)}f.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,oe,Se,Q.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,ue,Q.width,Q.height,Q.depth,0,oe,Se,Q.data);else if(f.isData3DTexture)Ce?(Ne&&t.texStorage3D(i.TEXTURE_3D,re,ue,Q.width,Q.height,Q.depth),P&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,oe,Se,Q.data)):t.texImage3D(i.TEXTURE_3D,0,ue,Q.width,Q.height,Q.depth,0,oe,Se,Q.data);else if(f.isFramebufferTexture){if(Ne)if(Ce)t.texStorage2D(i.TEXTURE_2D,re,ue,Q.width,Q.height);else{let $=Q.width,ce=Q.height;for(let fe=0;fe>=1,ce>>=1}}else if(f.isHTMLTexture){if("texElementImage2D"in i){const $=i.canvas;if($.hasAttribute("layoutsubtree")||$.setAttribute("layoutsubtree","true"),Q.parentNode!==$){$.appendChild(Q),m.add(f),$.onpaint=ce=>{const fe=ce.changedElements;for(const C of m)fe.includes(C.image)&&(C.needsUpdate=!0)},$.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Q);else{const fe=i.RGBA,C=i.RGBA,X=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,fe,C,X,Q)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Ee.length>0){if(Ce&&Ne){const $=$e(Ee[0]);t.texStorage2D(i.TEXTURE_2D,re,ue,$.width,$.height)}for(let $=0,ce=Ee.length;$0&&ce++;const C=$e(ue[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ce,Ne,C.width,C.height)}for(let C=0;C<6;C++)if(Se){P?$&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+C,0,0,0,ue[C].width,ue[C].height,Ee,Ce,ue[C].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+C,0,Ne,ue[C].width,ue[C].height,0,Ee,Ce,ue[C].data);for(let X=0;X>se),le=Math.max(1,f.height>>se);K===i.TEXTURE_3D||K===i.TEXTURE_2D_ARRAY?t.texImage3D(K,se,Q,ue,le,f.depth,0,ie,q,null):t.texImage2D(K,se,Q,ue,le,0,ie,q,null)}t.bindFramebuffer(i.FRAMEBUFFER,y),ct(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,z,K,Se.__webglTexture,0,lt(f)):(K===i.TEXTURE_2D||K>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,z,K,Se.__webglTexture,se),t.bindFramebuffer(i.FRAMEBUFFER,null)}function rt(y,f,F){if(i.bindRenderbuffer(i.RENDERBUFFER,y),f.depthBuffer){const z=f.depthTexture,K=z&&z.isDepthTexture?z.type:null,se=T(f.stencilBuffer,K),ie=f.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;ct(f)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,lt(f),se,f.width,f.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,lt(f),se,f.width,f.height):i.renderbufferStorage(i.RENDERBUFFER,se,f.width,f.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ie,i.RENDERBUFFER,y)}else{const z=f.textures;for(let K=0;K{delete f.__boundDepthTexture,delete f.__depthDisposeCallback,z.removeEventListener("dispose",K)};z.addEventListener("dispose",K),f.__depthDisposeCallback=K}f.__boundDepthTexture=z}if(y.depthTexture&&!f.__autoAllocateDepthBuffer)if(F)for(let z=0;z<6;z++)Ge(f.__webglFramebuffer[z],y,z);else{const z=y.texture.mipmaps;z&&z.length>0?Ge(f.__webglFramebuffer[0],y,0):Ge(f.__webglFramebuffer,y,0)}else if(F){f.__webglDepthbuffer=[];for(let z=0;z<6;z++)if(t.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer[z]),f.__webglDepthbuffer[z]===void 0)f.__webglDepthbuffer[z]=i.createRenderbuffer(),rt(f.__webglDepthbuffer[z],y,!1);else{const K=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,se=f.__webglDepthbuffer[z];i.bindRenderbuffer(i.RENDERBUFFER,se),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,se)}}else{const z=y.texture.mipmaps;if(z&&z.length>0?t.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer),f.__webglDepthbuffer===void 0)f.__webglDepthbuffer=i.createRenderbuffer(),rt(f.__webglDepthbuffer,y,!1);else{const K=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,se=f.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,se),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,se)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ke(y,f,F){const z=n.get(y);f!==void 0&&Re(z.__webglFramebuffer,y,y.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),F!==void 0&&Ze(y)}function Be(y){const f=y.texture,F=n.get(y),z=n.get(f);y.addEventListener("dispose",g);const K=y.textures,se=y.isWebGLCubeRenderTarget===!0,ie=K.length>1;if(ie||(z.__webglTexture===void 0&&(z.__webglTexture=i.createTexture()),z.__version=f.version,a.memory.textures++),se){F.__webglFramebuffer=[];for(let q=0;q<6;q++)if(f.mipmaps&&f.mipmaps.length>0){F.__webglFramebuffer[q]=[];for(let Q=0;Q0){F.__webglFramebuffer=[];for(let q=0;q0&&ct(y)===!1){F.__webglMultisampledFramebuffer=i.createFramebuffer(),F.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let q=0;q0)for(let Q=0;Q0)for(let Q=0;Q0){if(ct(y)===!1){const f=y.textures,F=y.width,z=y.height;let K=i.COLOR_BUFFER_BIT;const se=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ie=n.get(y),q=f.length>1;if(q)for(let oe=0;oe0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ie.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ie.__webglFramebuffer);for(let oe=0;oe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&f.__useRenderToTexture!==!1}function U(y){const f=a.render.frame;d.get(y)!==f&&(d.set(y,f),y.update())}function Rt(y,f){const F=y.colorSpace,z=y.format,K=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||F!==Gs&&F!==zn&&(Xe.getTransfer(F)===Je?(z!==nn||K!==Wt)&&De("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):We("WebGLTextures: Unsupported texture color space:",F)),f}function $e(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(l.width=y.naturalWidth||y.width,l.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(l.width=y.displayWidth,l.height=y.displayHeight):(l.width=y.width,l.height=y.height),l}this.allocateTextureUnit=H,this.resetTextureUnits=Z,this.getTextureUnits=W,this.setTextureUnits=O,this.setTexture2D=ee,this.setTexture2DArray=te,this.setTexture3D=he,this.setTextureCube=me,this.rebindTextures=ke,this.setupRenderTarget=Be,this.updateRenderTargetMipmap=ot,this.updateMultisampleRenderTarget=pt,this.setupDepthRenderbuffer=Ze,this.setupFrameBufferTexture=Re,this.useMultisampledRTT=ct,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function wm(i,e){function t(n,s=zn){let r;const a=Xe.getTransfer(s);if(n===Wt)return i.UNSIGNED_BYTE;if(n===Ua)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Na)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Pl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Dl)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Rl)return i.BYTE;if(n===Cl)return i.SHORT;if(n===$i)return i.UNSIGNED_SHORT;if(n===Ia)return i.INT;if(n===mn)return i.UNSIGNED_INT;if(n===un)return i.FLOAT;if(n===Tn)return i.HALF_FLOAT;if(n===Ll)return i.ALPHA;if(n===Il)return i.RGB;if(n===nn)return i.RGBA;if(n===An)return i.DEPTH_COMPONENT;if(n===ni)return i.DEPTH_STENCIL;if(n===Ul)return i.RED;if(n===Fa)return i.RED_INTEGER;if(n===si)return i.RG;if(n===Oa)return i.RG_INTEGER;if(n===Ba)return i.RGBA_INTEGER;if(n===Ls||n===Is||n===Us||n===Ns)if(a===Je)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Ls)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Is)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Us)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ns)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Ls)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Is)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Us)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ns)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===$r||n===Jr||n===Qr||n===jr)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===$r)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Jr)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Qr)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===jr)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ea||n===ta||n===na||n===ia||n===sa||n===Bs||n===ra)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===ea||n===ta)return a===Je?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===na)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===ia)return r.COMPRESSED_R11_EAC;if(n===sa)return r.COMPRESSED_SIGNED_R11_EAC;if(n===Bs)return r.COMPRESSED_RG11_EAC;if(n===ra)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===aa||n===oa||n===la||n===ca||n===ha||n===ua||n===da||n===fa||n===pa||n===ma||n===_a||n===ga||n===xa||n===va)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===aa)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===oa)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===la)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ca)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ha)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ua)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===da)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===fa)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===pa)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ma)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===_a)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ga)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===xa)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===va)return a===Je?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ma||n===Sa||n===Ea)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Ma)return a===Je?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Sa)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ea)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ya||n===ba||n===zs||n===Ta)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===ya)return r.COMPRESSED_RED_RGTC1_EXT;if(n===ba)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===zs)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ta)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ji?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Rm=` -void main() { - - gl_Position = vec4( position, 1.0 ); - -}`,Cm=` -uniform sampler2DArray depthColor; -uniform float depthWidth; -uniform float depthHeight; - -void main() { - - vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); - - if ( coord.x >= 1.0 ) { - - gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; - - } else { - - gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; - - } - -}`;class Pm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Wl(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new _n({vertexShader:Rm,fragmentShader:Cm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Kt(new es(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Dm extends Xn{constructor(e,t){super();const n=this;let s=null,r=1,a=null,o="local-floor",c=1,l=null,d=null,m=null,h=null,_=null,v=null;const E=typeof XRWebGLBinding<"u",p=new Pm,u={},A=t.getContextAttributes();let R=null,M=null;const T=[],S=[],w=new we;let g=null;const b=new qt;b.viewport=new ht;const L=new qt;L.viewport=new ht;const D=[b,L],B=new Bh;let Z=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ae=T[j];return ae===void 0&&(ae=new dr,T[j]=ae),ae.getTargetRaySpace()},this.getControllerGrip=function(j){let ae=T[j];return ae===void 0&&(ae=new dr,T[j]=ae),ae.getGripSpace()},this.getHand=function(j){let ae=T[j];return ae===void 0&&(ae=new dr,T[j]=ae),ae.getHandSpace()};function O(j){const ae=S.indexOf(j.inputSource);if(ae===-1)return;const ne=T[ae];ne!==void 0&&(ne.update(j.inputSource,j.frame,l||a),ne.dispatchEvent({type:j.type,data:j.inputSource}))}function H(){s.removeEventListener("select",O),s.removeEventListener("selectstart",O),s.removeEventListener("selectend",O),s.removeEventListener("squeeze",O),s.removeEventListener("squeezestart",O),s.removeEventListener("squeezeend",O),s.removeEventListener("end",H),s.removeEventListener("inputsourceschange",Y);for(let j=0;j=0&&(S[Ae]=null,T[Ae].disconnect(ne))}for(let ae=0;ae=S.length){S.push(ne),Ae=Re;break}else if(S[Re]===null){S[Re]=ne,Ae=Re;break}if(Ae===-1)break}const Ue=T[Ae];Ue&&Ue.connect(ne)}}const ee=new I,te=new I;function he(j,ae,ne){ee.setFromMatrixPosition(ae.matrixWorld),te.setFromMatrixPosition(ne.matrixWorld);const Ae=ee.distanceTo(te),Ue=ae.projectionMatrix.elements,Re=ne.projectionMatrix.elements,rt=Ue[14]/(Ue[10]-1),Ge=Ue[14]/(Ue[10]+1),Ze=(Ue[9]+1)/Ue[5],ke=(Ue[9]-1)/Ue[5],Be=(Ue[8]-1)/Ue[0],ot=(Re[8]+1)/Re[0],ut=rt*Be,ft=rt*ot,pt=Ae/(-Be+ot),lt=pt*-Be;if(ae.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(lt),j.translateZ(pt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert(),Ue[10]===-1)j.projectionMatrix.copy(ae.projectionMatrix),j.projectionMatrixInverse.copy(ae.projectionMatrixInverse);else{const ct=rt+pt,U=Ge+pt,Rt=ut-lt,$e=ft+(Ae-lt),y=Ze*Ge/U*ct,f=ke*Ge/U*ct;j.projectionMatrix.makePerspective(Rt,$e,y,f,ct,U),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}}function me(j,ae){ae===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ae.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(s===null)return;let ae=j.near,ne=j.far;p.texture!==null&&(p.depthNear>0&&(ae=p.depthNear),p.depthFar>0&&(ne=p.depthFar)),B.near=L.near=b.near=ae,B.far=L.far=b.far=ne,(Z!==B.near||W!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),Z=B.near,W=B.far),B.layers.mask=j.layers.mask|6,b.layers.mask=B.layers.mask&-5,L.layers.mask=B.layers.mask&-3;const Ae=j.parent,Ue=B.cameras;me(B,Ae);for(let Re=0;Re0&&(p.alphaTest.value=u.alphaTest);const A=e.get(u),R=A.envMap,M=A.envMapRotation;R&&(p.envMap.value=R,p.envMapRotation.value.setFromMatrix4(Lm.makeRotationFromEuler(M)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&p.envMapRotation.value.premultiply(ec),p.reflectivity.value=u.reflectivity,p.ior.value=u.ior,p.refractionRatio.value=u.refractionRatio),u.lightMap&&(p.lightMap.value=u.lightMap,p.lightMapIntensity.value=u.lightMapIntensity,t(u.lightMap,p.lightMapTransform)),u.aoMap&&(p.aoMap.value=u.aoMap,p.aoMapIntensity.value=u.aoMapIntensity,t(u.aoMap,p.aoMapTransform))}function a(p,u){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,u.map&&(p.map.value=u.map,t(u.map,p.mapTransform))}function o(p,u){p.dashSize.value=u.dashSize,p.totalSize.value=u.dashSize+u.gapSize,p.scale.value=u.scale}function c(p,u,A,R){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,p.size.value=u.size*A,p.scale.value=R*.5,u.map&&(p.map.value=u.map,t(u.map,p.uvTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,t(u.alphaMap,p.alphaMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest)}function l(p,u){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,p.rotation.value=u.rotation,u.map&&(p.map.value=u.map,t(u.map,p.mapTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,t(u.alphaMap,p.alphaMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest)}function d(p,u){p.specular.value.copy(u.specular),p.shininess.value=Math.max(u.shininess,1e-4)}function m(p,u){u.gradientMap&&(p.gradientMap.value=u.gradientMap)}function h(p,u){p.metalness.value=u.metalness,u.metalnessMap&&(p.metalnessMap.value=u.metalnessMap,t(u.metalnessMap,p.metalnessMapTransform)),p.roughness.value=u.roughness,u.roughnessMap&&(p.roughnessMap.value=u.roughnessMap,t(u.roughnessMap,p.roughnessMapTransform)),u.envMap&&(p.envMapIntensity.value=u.envMapIntensity)}function _(p,u,A){p.ior.value=u.ior,u.sheen>0&&(p.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),p.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(p.sheenColorMap.value=u.sheenColorMap,t(u.sheenColorMap,p.sheenColorMapTransform)),u.sheenRoughnessMap&&(p.sheenRoughnessMap.value=u.sheenRoughnessMap,t(u.sheenRoughnessMap,p.sheenRoughnessMapTransform))),u.clearcoat>0&&(p.clearcoat.value=u.clearcoat,p.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(p.clearcoatMap.value=u.clearcoatMap,t(u.clearcoatMap,p.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,t(u.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(p.clearcoatNormalMap.value=u.clearcoatNormalMap,t(u.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===zt&&p.clearcoatNormalScale.value.negate())),u.dispersion>0&&(p.dispersion.value=u.dispersion),u.iridescence>0&&(p.iridescence.value=u.iridescence,p.iridescenceIOR.value=u.iridescenceIOR,p.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(p.iridescenceMap.value=u.iridescenceMap,t(u.iridescenceMap,p.iridescenceMapTransform)),u.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=u.iridescenceThicknessMap,t(u.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),u.transmission>0&&(p.transmission.value=u.transmission,p.transmissionSamplerMap.value=A.texture,p.transmissionSamplerSize.value.set(A.width,A.height),u.transmissionMap&&(p.transmissionMap.value=u.transmissionMap,t(u.transmissionMap,p.transmissionMapTransform)),p.thickness.value=u.thickness,u.thicknessMap&&(p.thicknessMap.value=u.thicknessMap,t(u.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=u.attenuationDistance,p.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(p.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(p.anisotropyMap.value=u.anisotropyMap,t(u.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=u.specularIntensity,p.specularColor.value.copy(u.specularColor),u.specularColorMap&&(p.specularColorMap.value=u.specularColorMap,t(u.specularColorMap,p.specularColorMapTransform)),u.specularIntensityMap&&(p.specularIntensityMap.value=u.specularIntensityMap,t(u.specularIntensityMap,p.specularIntensityMapTransform))}function v(p,u){u.matcap&&(p.matcap.value=u.matcap)}function E(p,u){const A=e.get(u).light;p.referencePosition.value.setFromMatrixPosition(A.matrixWorld),p.nearDistance.value=A.shadow.camera.near,p.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function Um(i,e,t,n){let s={},r={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(M,T){const S=T.program;n.uniformBlockBinding(M,S)}function l(M,T){let S=s[M.id];S===void 0&&(p(M),S=d(M),s[M.id]=S,M.addEventListener("dispose",A));const w=T.program;n.updateUBOMapping(M,w);const g=e.render.frame;r[M.id]!==g&&(h(M),r[M.id]=g)}function d(M){const T=m();M.__bindingPointIndex=T;const S=i.createBuffer(),w=M.__size,g=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,w,g),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,T,S),S}function m(){for(let M=0;M0&&(S+=w-g),M.__size=S,M.__cache={},this}function u(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?De("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(T.boundary=16,T.storage=M.byteLength):De("WebGLRenderer: Unsupported uniform value type.",M),T}function A(M){const T=M.target;T.removeEventListener("dispose",A);const S=a.indexOf(T.__bindingPointIndex);a.splice(S,1),i.deleteBuffer(s[T.id]),delete s[T.id],delete r[T.id]}function R(){for(const M in s)i.deleteBuffer(s[M]);a=[],s={},r={}}return{bind:c,update:l,dispose:R}}const Nm=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let on=null;function Fm(){return on===null&&(on=new gh(Nm,16,16,si,Tn),on.name="DFG_LUT",on.minFilter=Lt,on.magFilter=Lt,on.wrapS=En,on.wrapT=En,on.generateMipmaps=!1,on.needsUpdate=!0),on}class Om{constructor(e={}){const{canvas:t=Xc(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:h=!1,outputBufferType:_=Wt}=e;this.isWebGLRenderer=!0;let v;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");v=n.getContextAttributes().alpha}else v=a;const E=_,p=new Set([Ba,Oa,Fa]),u=new Set([Wt,mn,$i,Ji,Ua,Na]),A=new Uint32Array(4),R=new Int32Array(4),M=new I;let T=null,S=null;const w=[],g=[];let b=null;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.toneMapping=fn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const L=this;let D=!1,B=null,Z=null,W=null,O=null;this._outputColorSpace=kt;let H=0,Y=0,ee=null,te=-1,he=null;const me=new ht,de=new ht;let Ye=null;const st=new Ie(0);let qe=0,j=t.width,ae=t.height,ne=1,Ae=null,Ue=null;const Re=new ht(0,0,j,ae),rt=new ht(0,0,j,ae);let Ge=!1;const Ze=new Wa;let ke=!1,Be=!1;const ot=new at,ut=new I,ft=new ht,pt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let lt=!1;function ct(){return ee===null?ne:1}let U=n;function Rt(x,N){return t.getContext(x,N)}try{const x={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:d,failIfMajorPerformanceCaveat:m};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${La}`),t.addEventListener("webglcontextlost",Te,!1),t.addEventListener("webglcontextrestored",Pe,!1),t.addEventListener("webglcontextcreationerror",Le,!1),U===null){const N="webgl2";if(U=Rt(N,x),U===null)throw Rt(N)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(x){throw We("WebGLRenderer: "+x.message),x}let $e,y,f,F,z,K,se,ie,q,Q,oe,Se,ue,le,Ee,Ce,Ne,P,re,$,ce,fe,C;function X(){$e=new Ff(U),$e.init(),ce=new wm(U,$e),y=new Rf(U,$e,e,ce),f=new Tm(U,$e),y.reversedDepthBuffer&&h&&f.buffers.depth.setReversed(!0),Z=U.createFramebuffer(),W=U.createFramebuffer(),O=U.createFramebuffer(),F=new zf(U),z=new um,K=new Am(U,$e,f,z,y,ce,F),se=new Nf(L),ie=new Hh(U),fe=new Af(U,ie),q=new Of(U,ie,F,fe),Q=new Vf(U,q,ie,fe,F),P=new Gf(U,y,K),Ee=new Cf(z),oe=new hm(L,se,$e,y,fe,Ee),Se=new Im(L,z),ue=new fm,le=new vm($e),Ne=new Tf(L,se,f,Q,v,c),Ce=new bm(L,Q,y),C=new Um(U,F,y,f),re=new wf(U,$e,F),$=new Bf(U,$e,F),F.programs=oe.programs,L.capabilities=y,L.extensions=$e,L.properties=z,L.renderLists=ue,L.shadowMap=Ce,L.state=f,L.info=F}X(),E!==Wt&&(b=new kf(E,t.width,t.height,o,s,r));const J=new Dm(L,U);this.xr=J,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){const x=$e.get("WEBGL_lose_context");x&&x.loseContext()},this.forceContextRestore=function(){const x=$e.get("WEBGL_lose_context");x&&x.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(x){x!==void 0&&(ne=x,this.setSize(j,ae,!1))},this.getSize=function(x){return x.set(j,ae)},this.setSize=function(x,N,k=!0){if(J.isPresenting){De("WebGLRenderer: Can't change size while VR device is presenting.");return}j=x,ae=N,t.width=Math.floor(x*ne),t.height=Math.floor(N*ne),k===!0&&(t.style.width=x+"px",t.style.height=N+"px"),b!==null&&b.setSize(t.width,t.height),this.setViewport(0,0,x,N)},this.getDrawingBufferSize=function(x){return x.set(j*ne,ae*ne).floor()},this.setDrawingBufferSize=function(x,N,k){j=x,ae=N,ne=k,t.width=Math.floor(x*k),t.height=Math.floor(N*k),this.setViewport(0,0,x,N)},this.setEffects=function(x){if(E===Wt){We("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(x){for(let N=0;N{function ge(){if(G.forEach(function(ve){z.get(ve).currentProgram.isReady()&&G.delete(ve)}),G.size===0){V(x);return}setTimeout(ge,10)}$e.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let wn=null;function Yn(x){wn&&wn(x)}function tr(){Jt.stop()}function Rn(){Jt.start()}const Jt=new ql;Jt.setAnimationLoop(Yn),typeof self<"u"&&Jt.setContext(self),this.setAnimationLoop=function(x){wn=x,J.setAnimationLoop(x),x===null?Jt.stop():Jt.start()},J.addEventListener("sessionstart",tr),J.addEventListener("sessionend",Rn),this.render=function(x,N){if(N!==void 0&&N.isCamera!==!0){We("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;B!==null&&B.renderStart(x,N);const k=J.enabled===!0&&J.isPresenting===!0,G=b!==null&&(ee===null||k)&&b.begin(L,ee);if(x.matrixWorldAutoUpdate===!0&&x.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),J.enabled===!0&&J.isPresenting===!0&&(b===null||b.isCompositing()===!1)&&(J.cameraAutoUpdate===!0&&J.updateCamera(N),N=J.getCamera()),x.isScene===!0&&x.onBeforeRender(L,x,N,ee),S=le.get(x,g.length),S.init(N),S.state.textureUnits=K.getTextureUnits(),g.push(S),ot.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Ze.setFromProjectionMatrix(ot,dn,N.reversedDepth),Be=this.localClippingEnabled,ke=Ee.init(this.clippingPlanes,Be),T=ue.get(x,w.length),T.init(),w.push(T),J.enabled===!0&&J.isPresenting===!0){const ve=L.xr.getDepthSensingMesh();ve!==null&&qn(ve,N,-1/0,L.sortObjects)}qn(x,N,0,L.sortObjects),T.finish(),L.sortObjects===!0&&T.sort(Ae,Ue,N.reversedDepth),lt=J.enabled===!1||J.isPresenting===!1||J.hasDepthSensing()===!1,lt&&Ne.addToRenderList(T,x),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ke===!0&&Ee.beginShadows();const V=S.state.shadowsArray;if(Ce.render(V,x,N),ke===!0&&Ee.endShadows(),(G&&b.hasRenderPass())===!1){const ve=T.opaque,_e=T.transmissive;if(S.setupLights(),N.isArrayCamera){const Me=N.cameras;if(_e.length>0)for(let ye=0,Oe=Me.length;ye0&&io(ve,_e,x,N),lt&&Ne.render(x),no(T,x,N)}ee!==null&&Y===0&&(K.updateMultisampleRenderTarget(ee),K.updateRenderTargetMipmap(ee)),G&&b.end(L),x.isScene===!0&&x.onAfterRender(L,x,N),fe.resetDefaultState(),te=-1,he=null,g.pop(),g.length>0?(S=g[g.length-1],K.setTextureUnits(S.state.textureUnits),ke===!0&&Ee.setGlobalState(L.clippingPlanes,S.state.camera)):S=null,w.pop(),w.length>0?T=w[w.length-1]:T=null,B!==null&&B.renderEnd()};function qn(x,N,k,G){if(x.visible===!1)return;if(x.layers.test(N.layers)){if(x.isGroup)k=x.renderOrder;else if(x.isLOD)x.autoUpdate===!0&&x.update(N);else if(x.isLightProbeGrid)S.pushLightProbeGrid(x);else if(x.isLight)S.pushLight(x),x.castShadow&&S.pushShadow(x);else if(x.isSprite){if(!x.frustumCulled||Ze.intersectsSprite(x)){G&&ft.setFromMatrixPosition(x.matrixWorld).applyMatrix4(ot);const ve=Q.update(x),_e=x.material;_e.visible&&T.push(x,ve,_e,k,ft.z,null)}}else if((x.isMesh||x.isLine||x.isPoints)&&(!x.frustumCulled||Ze.intersectsObject(x))){const ve=Q.update(x),_e=x.material;if(G&&(x.boundingSphere!==void 0?(x.boundingSphere===null&&x.computeBoundingSphere(),ft.copy(x.boundingSphere.center)):(ve.boundingSphere===null&&ve.computeBoundingSphere(),ft.copy(ve.boundingSphere.center)),ft.applyMatrix4(x.matrixWorld).applyMatrix4(ot)),Array.isArray(_e)){const Me=ve.groups;for(let ye=0,Oe=Me.length;ye0&&ts(V,N,k),ge.length>0&&ts(ge,N,k),ve.length>0&&ts(ve,N,k),f.buffers.depth.setTest(!0),f.buffers.depth.setMask(!0),f.buffers.color.setMask(!0),f.setPolygonOffset(!1)}function io(x,N,k,G){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[G.id]===void 0){const be=$e.has("EXT_color_buffer_half_float")||$e.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[G.id]=new pn(1,1,{generateMipmaps:!0,type:be?Tn:Wt,minFilter:ti,samples:Math.max(4,y.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Xe.workingColorSpace})}const ge=S.state.transmissionRenderTarget[G.id],ve=G.viewport||me;ge.setSize(ve.z*L.transmissionResolutionScale,ve.w*L.transmissionResolutionScale);const _e=L.getRenderTarget(),Me=L.getActiveCubeFace(),ye=L.getActiveMipmapLevel();L.setRenderTarget(ge),L.getClearColor(st),qe=L.getClearAlpha(),qe<1&&L.setClearColor(16777215,.5),L.clear(),lt&&Ne.render(k);const Oe=L.toneMapping;L.toneMapping=fn;const Ve=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),S.setupLightsView(G),ke===!0&&Ee.setGlobalState(L.clippingPlanes,G),ts(x,k,G),K.updateMultisampleRenderTarget(ge),K.updateRenderTargetMipmap(ge),$e.has("WEBGL_multisampled_render_to_texture")===!1){let be=!1;for(let Qe=0,mt=N.length;Qe0,G.currentProgram=Ve,G.uniformsList=null,Ve}function ro(x){if(x.uniformsList===null){const N=x.currentProgram.getUniforms();x.uniformsList=Os.seqWithValue(N.seq,x.uniforms)}return x.uniformsList}function ao(x,N){const k=z.get(x);k.outputColorSpace=N.outputColorSpace,k.batching=N.batching,k.batchingColor=N.batchingColor,k.instancing=N.instancing,k.instancingColor=N.instancingColor,k.instancingMorph=N.instancingMorph,k.skinning=N.skinning,k.morphTargets=N.morphTargets,k.morphNormals=N.morphNormals,k.morphColors=N.morphColors,k.morphTargetsCount=N.morphTargetsCount,k.numClippingPlanes=N.numClippingPlanes,k.numIntersection=N.numClipIntersection,k.vertexAlphas=N.vertexAlphas,k.vertexTangents=N.vertexTangents,k.toneMapping=N.toneMapping}function ic(x,N){if(x.length===0)return null;if(x.length===1)return x[0].texture!==null?x[0]:null;M.setFromMatrixPosition(N.matrixWorld);for(let k=0,G=x.length;k0),be=!!k.morphAttributes.position,Qe=!!k.morphAttributes.normal,mt=!!k.morphAttributes.color;let dt=fn;G.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(dt=L.toneMapping);const tt=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,Ct=tt!==void 0?tt.length:0,xe=z.get(G),Gt=S.state.lights;if(ke===!0&&(Be===!0||x!==he)){const it=x===he&&G.id===te;Ee.setState(G,x,it)}let Ke=!1;G.version===xe.__version?(xe.needsLights&&xe.lightsStateVersion!==Gt.state.version||xe.outputColorSpace!==_e||V.isBatchedMesh&&xe.batching===!1||!V.isBatchedMesh&&xe.batching===!0||V.isBatchedMesh&&xe.batchingColor===!0&&V.colorTexture===null||V.isBatchedMesh&&xe.batchingColor===!1&&V.colorTexture!==null||V.isInstancedMesh&&xe.instancing===!1||!V.isInstancedMesh&&xe.instancing===!0||V.isSkinnedMesh&&xe.skinning===!1||!V.isSkinnedMesh&&xe.skinning===!0||V.isInstancedMesh&&xe.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&xe.instancingColor===!1&&V.instanceColor!==null||V.isInstancedMesh&&xe.instancingMorph===!0&&V.morphTexture===null||V.isInstancedMesh&&xe.instancingMorph===!1&&V.morphTexture!==null||xe.envMap!==ye||G.fog===!0&&xe.fog!==ge||xe.numClippingPlanes!==void 0&&(xe.numClippingPlanes!==Ee.numPlanes||xe.numIntersection!==Ee.numIntersection)||xe.vertexAlphas!==Oe||xe.vertexTangents!==Ve||xe.morphTargets!==be||xe.morphNormals!==Qe||xe.morphColors!==mt||xe.toneMapping!==dt||xe.morphTargetsCount!==Ct||!!xe.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(Ke=!0):(Ke=!0,xe.__version=G.version);let Xt=xe.currentProgram;Ke===!0&&(Xt=ns(G,N,V),B&&G.isNodeMaterial&&B.onUpdateProgram(G,Xt,xe));let rn=!1,Cn=!1,ai=!1;const nt=Xt.getUniforms(),_t=xe.uniforms;if(f.useProgram(Xt.program)&&(rn=!0,Cn=!0,ai=!0),G.id!==te&&(te=G.id,Cn=!0),xe.needsLights){const it=ic(S.state.lightProbeGridArray,V);xe.lightProbeGrid!==it&&(xe.lightProbeGrid=it,Cn=!0)}if(rn||he!==x){f.buffers.depth.getReversed()&&x.reversedDepth!==!0&&(x._reversedDepth=!0,x.updateProjectionMatrix()),nt.setValue(U,"projectionMatrix",x.projectionMatrix),nt.setValue(U,"viewMatrix",x.matrixWorldInverse);const Dn=nt.map.cameraPosition;Dn!==void 0&&Dn.setValue(U,ut.setFromMatrixPosition(x.matrixWorld)),y.logarithmicDepthBuffer&&nt.setValue(U,"logDepthBufFC",2/(Math.log(x.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&nt.setValue(U,"isOrthographic",x.isOrthographicCamera===!0),he!==x&&(he=x,Cn=!0,ai=!0)}if(xe.needsLights&&(Gt.state.directionalShadowMap.length>0&&nt.setValue(U,"directionalShadowMap",Gt.state.directionalShadowMap,K),Gt.state.spotShadowMap.length>0&&nt.setValue(U,"spotShadowMap",Gt.state.spotShadowMap,K),Gt.state.pointShadowMap.length>0&&nt.setValue(U,"pointShadowMap",Gt.state.pointShadowMap,K)),V.isSkinnedMesh){nt.setOptional(U,V,"bindMatrix"),nt.setOptional(U,V,"bindMatrixInverse");const it=V.skeleton;it&&(it.boneTexture===null&&it.computeBoneTexture(),nt.setValue(U,"boneTexture",it.boneTexture,K))}V.isBatchedMesh&&(nt.setOptional(U,V,"batchingTexture"),nt.setValue(U,"batchingTexture",V._matricesTexture,K),nt.setOptional(U,V,"batchingIdTexture"),nt.setValue(U,"batchingIdTexture",V._indirectTexture,K),nt.setOptional(U,V,"batchingColorTexture"),V._colorsTexture!==null&&nt.setValue(U,"batchingColorTexture",V._colorsTexture,K));const Pn=k.morphAttributes;if((Pn.position!==void 0||Pn.normal!==void 0||Pn.color!==void 0)&&P.update(V,k,Xt),(Cn||xe.receiveShadow!==V.receiveShadow)&&(xe.receiveShadow=V.receiveShadow,nt.setValue(U,"receiveShadow",V.receiveShadow)),(G.isMeshStandardMaterial||G.isMeshLambertMaterial||G.isMeshPhongMaterial)&&G.envMap===null&&N.environment!==null&&(_t.envMapIntensity.value=N.environmentIntensity),_t.dfgLUT!==void 0&&(_t.dfgLUT.value=Fm()),Cn){if(nt.setValue(U,"toneMappingExposure",L.toneMappingExposure),xe.needsLights&&rc(_t,ai),ge&&G.fog===!0&&Se.refreshFogUniforms(_t,ge),Se.refreshMaterialUniforms(_t,G,ne,ae,S.state.transmissionRenderTarget[x.id]),xe.needsLights&&xe.lightProbeGrid){const it=xe.lightProbeGrid;_t.probesSH.value=it.texture,_t.probesMin.value.copy(it.boundingBox.min),_t.probesMax.value.copy(it.boundingBox.max),_t.probesResolution.value.copy(it.resolution)}Os.upload(U,ro(xe),_t,K)}if(G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(Os.upload(U,ro(xe),_t,K),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&nt.setValue(U,"center",V.center),nt.setValue(U,"modelViewMatrix",V.modelViewMatrix),nt.setValue(U,"normalMatrix",V.normalMatrix),nt.setValue(U,"modelMatrix",V.matrixWorld),G.uniformsGroups!==void 0){const it=G.uniformsGroups;for(let Dn=0,oi=it.length;Dn0&&K.useMultisampledRTT(x)===!1?G=z.get(x).__webglMultisampledFramebuffer:Array.isArray(ye)?G=ye[k]:G=ye,me.copy(x.viewport),de.copy(x.scissor),Ye=x.scissorTest}else me.copy(Re).multiplyScalar(ne).floor(),de.copy(rt).multiplyScalar(ne).floor(),Ye=Ge;if(k!==0&&(G=Z),f.bindFramebuffer(U.FRAMEBUFFER,G)&&f.drawBuffers(x,G),f.viewport(me),f.scissor(de),f.setScissorTest(Ye),V){const _e=z.get(x.texture);U.framebufferTexture2D(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_CUBE_MAP_POSITIVE_X+N,_e.__webglTexture,k)}else if(ge){const _e=N;for(let Me=0;Me1&&U.readBuffer(U.COLOR_ATTACHMENT0+_e),!y.textureFormatReadable(Oe)){We("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!y.textureTypeReadable(Ve)){We("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=x.width-G&&k>=0&&k<=x.height-V&&U.readPixels(N,k,G,V,ce.convert(Oe),ce.convert(Ve),ge)}finally{const ye=ee!==null?z.get(ee).__webglFramebuffer:null;f.bindFramebuffer(U.FRAMEBUFFER,ye)}}},this.readRenderTargetPixelsAsync=async function(x,N,k,G,V,ge,ve,_e=0){if(!(x&&x.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Me=z.get(x).__webglFramebuffer;if(x.isWebGLCubeRenderTarget&&ve!==void 0&&(Me=Me[ve]),Me)if(N>=0&&N<=x.width-G&&k>=0&&k<=x.height-V){f.bindFramebuffer(U.FRAMEBUFFER,Me);const ye=x.textures[_e],Oe=ye.format,Ve=ye.type;if(x.textures.length>1&&U.readBuffer(U.COLOR_ATTACHMENT0+_e),!y.textureFormatReadable(Oe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!y.textureTypeReadable(Ve))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const be=U.createBuffer();U.bindBuffer(U.PIXEL_PACK_BUFFER,be),U.bufferData(U.PIXEL_PACK_BUFFER,ge.byteLength,U.STREAM_READ),U.readPixels(N,k,G,V,ce.convert(Oe),ce.convert(Ve),0);const Qe=ee!==null?z.get(ee).__webglFramebuffer:null;f.bindFramebuffer(U.FRAMEBUFFER,Qe);const mt=U.fenceSync(U.SYNC_GPU_COMMANDS_COMPLETE,0);return U.flush(),await Yc(U,mt,4),U.bindBuffer(U.PIXEL_PACK_BUFFER,be),U.getBufferSubData(U.PIXEL_PACK_BUFFER,0,ge),U.deleteBuffer(be),U.deleteSync(mt),ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(x,N=null,k=0){const G=Math.pow(2,-k),V=Math.floor(x.image.width*G),ge=Math.floor(x.image.height*G),ve=N!==null?N.x:0,_e=N!==null?N.y:0;K.setTexture2D(x,0),U.copyTexSubImage2D(U.TEXTURE_2D,k,0,0,ve,_e,V,ge),f.unbindTexture()},this.copyTextureToTexture=function(x,N,k=null,G=null,V=0,ge=0){let ve,_e,Me,ye,Oe,Ve,be,Qe,mt;const dt=x.isCompressedTexture?x.mipmaps[ge]:x.image;if(k!==null)ve=k.max.x-k.min.x,_e=k.max.y-k.min.y,Me=k.isBox3?k.max.z-k.min.z:1,ye=k.min.x,Oe=k.min.y,Ve=k.isBox3?k.min.z:0;else{const _t=Math.pow(2,-V);ve=Math.floor(dt.width*_t),_e=Math.floor(dt.height*_t),x.isDataArrayTexture?Me=dt.depth:x.isData3DTexture?Me=Math.floor(dt.depth*_t):Me=1,ye=0,Oe=0,Ve=0}G!==null?(be=G.x,Qe=G.y,mt=G.z):(be=0,Qe=0,mt=0);const tt=ce.convert(N.format),Ct=ce.convert(N.type);let xe;N.isData3DTexture?(K.setTexture3D(N,0),xe=U.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(K.setTexture2DArray(N,0),xe=U.TEXTURE_2D_ARRAY):(K.setTexture2D(N,0),xe=U.TEXTURE_2D),f.activeTexture(U.TEXTURE0),f.pixelStorei(U.UNPACK_FLIP_Y_WEBGL,N.flipY),f.pixelStorei(U.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),f.pixelStorei(U.UNPACK_ALIGNMENT,N.unpackAlignment);const Gt=f.getParameter(U.UNPACK_ROW_LENGTH),Ke=f.getParameter(U.UNPACK_IMAGE_HEIGHT),Xt=f.getParameter(U.UNPACK_SKIP_PIXELS),rn=f.getParameter(U.UNPACK_SKIP_ROWS),Cn=f.getParameter(U.UNPACK_SKIP_IMAGES);f.pixelStorei(U.UNPACK_ROW_LENGTH,dt.width),f.pixelStorei(U.UNPACK_IMAGE_HEIGHT,dt.height),f.pixelStorei(U.UNPACK_SKIP_PIXELS,ye),f.pixelStorei(U.UNPACK_SKIP_ROWS,Oe),f.pixelStorei(U.UNPACK_SKIP_IMAGES,Ve);const ai=x.isDataArrayTexture||x.isData3DTexture,nt=N.isDataArrayTexture||N.isData3DTexture;if(x.isDepthTexture){const _t=z.get(x),Pn=z.get(N),it=z.get(_t.__renderTarget),Dn=z.get(Pn.__renderTarget);f.bindFramebuffer(U.READ_FRAMEBUFFER,it.__webglFramebuffer),f.bindFramebuffer(U.DRAW_FRAMEBUFFER,Dn.__webglFramebuffer);for(let oi=0;oiMath.PI&&(n-=Bt),s<-Math.PI?s+=Bt:s>Math.PI&&(s-=Bt),n<=s?this._spherical.theta=Math.max(n,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+s)/2?Math.max(n,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(St.setFromSpherical(this._spherical),St.applyQuaternion(this._quatInverse),t.copy(this.target).add(St),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=St.length();a=this._clampDistance(o*this._scale);const c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){const o=new I(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;const l=new I(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=St.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Ps.origin.copy(this.object.position),Ps.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Ps.direction))Br||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Br||this._lastTargetPosition.distanceToSquared(this.target)>Br?(this.dispatchEvent(gl),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Bt/60*this.autoRotateSpeed*e:Bt/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){St.setFromMatrixColumn(t,0),St.multiplyScalar(-e),this._panOffset.add(St)}_panUp(e,t){this.screenSpacePanning===!0?St.setFromMatrixColumn(t,1):(St.setFromMatrixColumn(t,0),St.crossVectors(this.object.up,St)),St.multiplyScalar(e),this._panOffset.add(St)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;St.copy(s).sub(this.target);let r=St.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),s=e-n.left,r=t-n.top,a=n.width,o=n.height;this._mouse.x=s/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Bt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Bt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Bt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Bt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Bt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Bt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._rotateStart.set(n,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._panStart.set(n,s)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,s=e.pageY-t.y,r=Math.sqrt(n*n+s*s);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),s=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateEnd.set(s,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Bt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Bt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),s=.5*(e.pageY+t.y);this._panEnd.set(n,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,s=e.pageY-t.y,r=Math.sqrt(n*n+s*s);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t"u"?e:getComputedStyle(document.documentElement).getPropertyValue(i).trim()||e}function e_(i,e=26){return i.length<=e?i:`${i.slice(0,e-1)}…`}function nc(i,e,t){const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const s=n.getContext("2d");s&&(s.clearRect(0,0,t.width,t.height),s.fillStyle=e,s.font=t.font,s.textAlign="center",s.textBaseline="middle",s.fillText(i,t.width/2,t.height/2));const r=new Sh(n);r.colorSpace=kt;const a=new mh(new Gl({map:r,transparent:!0,depthTest:!1}));return a.scale.set(t.width*.22,t.height*.22,1),a}function t_(i,e){const t=nc(i,e,{width:512,height:64,font:"600 28px sans-serif"});return t.scale.set(110,14,1),t}function n_(i,e){const t=nc(e_(i),e,{width:384,height:48,font:"600 22px sans-serif"});return t.scale.set(52,6.5,1),t}function i_(i,e,t,n){return i.weight==="critical"?n:i.weight==="expensive"?t:e}function r_({nodes:i,edges:e,selectedId:t,neighborIds:n,onSelect:s,layout:r="layers",nodeRoles:a,testOverlay:o=!1}){const c=Ot.useRef(null),l=Ot.useRef(null),[d,m]=Ot.useState(null),[h,_]=Ot.useState(null),[v,E]=Ot.useState(()=>typeof document>"u"?"obsidian":document.documentElement.dataset.theme||"obsidian"),p=Ot.useRef(s);p.current=s;const u=Ot.useRef({selectedId:t,neighborIds:n});u.current={selectedId:t,neighborIds:n};const A=Ot.useRef({nodeRoles:a,testOverlay:o});A.current={nodeRoles:a,testOverlay:o};const R=Ot.useRef(null),M=Ot.useRef(!1),T=`${r}|${i.map(S=>S.id).join("\0")}|${e.map(S=>S.id).join("\0")}`;return Ot.useEffect(()=>{const S=document.documentElement,w=()=>E(S.dataset.theme||"obsidian"),g=new MutationObserver(w);return g.observe(S,{attributes:!0,attributeFilter:["data-theme"]}),()=>g.disconnect()},[]),Ot.useEffect(()=>{var fe;const S=l.current;if(!S)return;const w=window.matchMedia("(prefers-reduced-motion: reduce)").matches,g=tn("--graph-bg","#0b0f14"),b=tn("--ink","#e8eef7"),L=new Ie(tn("--accent","#4cc9f0")),D=new Ie(tn("--low","#e76f51")),B=new Ie(tn("--high","#2a9d8f")),Z=new ch;Z.background=new Ie(g),Z.fog=new ka(new Ie(g),520,2800);const W=new qt(50,1,1,8e3);let O;try{O=new Om({antialias:!0,alpha:!1,failIfMajorPerformanceCaveat:!1,powerPreference:"low-power"})}catch{_("WebGL is unavailable in this browser, so the 3D view cannot start. Switch back to 2D map.");return}if(!O.getContext()){O.dispose(),_("WebGL is unavailable in this browser, so the 3D view cannot start. Switch back to 2D map.");return}_(null),O.setClearColor(g,1),O.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),O.domElement.dataset.testid="graph-3d-canvas",S.appendChild(O.domElement);const H=new zm(W,O.domElement);H.enableDamping=!w,H.dampingFactor=.08,H.minDistance=80,H.maxDistance=2400,Z.add(new Lh(16777215,1713203,.55)),Z.add(new Fh(16777215,.42));const Y=new Nh(16777215,.8);Y.position.set(200,320,180),Z.add(Y);const ee=oc(i,e,r),te=new Map(i.map(C=>[C.id,C])),he=new Map,me=new Map,de=new Zi;Z.add(de);const Ye=new qa(1,18,14),st=i.length<=Qm,qe=[];for(const C of i){const X=ee.get(C.id)??{x:0,y:0,z:0},J=nr(C.type),Te=new Rh({color:lc(C.type),roughness:.42,metalness:.08,transparent:!0,opacity:1}),Pe=new Kt(Ye,Te);if(Pe.position.set(X.x,X.y,X.z),Pe.scale.setScalar(J),Pe.userData.id=C.id,de.add(Pe),he.set(C.id,Pe),st){const Le=n_(C.name,b);Le.position.set(X.x,X.y+J+8,X.z),de.add(Le),me.set(C.id,Le),qe.push(Le)}}const j=new Ie(tn("--edge-cheap","#4a5568")),ae=new Ie(tn("--edge-expensive","#f4a261")),ne=new Ie(tn("--edge-critical","#e85d04")),Ae=[],Ue=[],Re=[],rt=[],Ge=[];for(const C of e){const X=ee.get(C.src),J=ee.get(C.dst);if(!X||!J)continue;const Te=i_(C,j,ae,ne),Pe=cc(C),Le=Te.clone().multiplyScalar(.55);Pe?(Ae.push({edge:C,a:X,b:J,color:Te,inferred:Pe,solidIndex:-1,dashedIndex:rt.length/3}),rt.push(X.x,X.y,X.z,J.x,J.y,J.z),Ge.push(Le.r,Le.g,Le.b,Te.r,Te.g,Te.b)):(Ae.push({edge:C,a:X,b:J,color:Te,inferred:Pe,solidIndex:Ue.length/3,dashedIndex:-1}),Ue.push(X.x,X.y,X.z,J.x,J.y,J.z),Re.push(Le.r,Le.g,Le.b,Te.r,Te.g,Te.b))}const Ze=new wt;Ze.setAttribute("position",new gt(Ue,3)),Ze.setAttribute("color",new gt(Re,3));const ke=new Fo(Ze,new Ys({vertexColors:!0,transparent:!0,opacity:.58}));de.add(ke);const Be=new wt;Be.setAttribute("position",new gt(rt,3)),Be.setAttribute("color",new gt(Ge,3));const ot=new Dh({vertexColors:!0,transparent:!0,opacity:.5,dashSize:7,gapSize:5}),ut=new Fo(Be,ot);ut.computeLineDistances(),de.add(ut);const ft=new Ya(2.2,7,8),pt=[];if(Ae.length<=jm){const C=new I(0,1,0),X=new I;for(const J of Ae){const Te=new Xs({color:J.color,transparent:!0,opacity:.85}),Pe=new Kt(ft,Te);X.set(J.b.x-J.a.x,J.b.y-J.a.y,J.b.z-J.a.z);const Le=X.length();if(Le<8)Pe.visible=!1;else{X.multiplyScalar(1/Le);const xt=nr(((fe=te.get(J.edge.dst))==null?void 0:fe.type)||""),Ft=Math.min(Le-4,xt+5);Pe.position.set(J.b.x-X.x*Ft,J.b.y-X.y*Ft,J.b.z-X.z*Ft),Pe.quaternion.setFromUnitVectors(C,X)}Pe.userData.src=J.edge.src,Pe.userData.dst=J.edge.dst,de.add(Pe),pt.push(Pe)}}const ct=new Xs({color:new Ie(tn("--node-line","#2a3d52")),transparent:!0,opacity:.16,side:cn,depthWrite:!1}),U=new Ys({color:new Ie(tn("--muted","#8b9bb0")),transparent:!0,opacity:.28}),Rt=tn("--muted","#8b9bb0"),$e=[],y=[],f=new es(1,1);y.push(f);for(const C of hc(i,ee,r))if(C.shape==="slab"){const X=new Kt(f,ct);X.scale.set(C.extentZ*2,C.extentY*2,1),X.rotation.y=Math.PI/2,X.position.set(C.x,C.y,C.z),de.add(X);const J=new wt().setFromPoints([new I(C.x,C.y-C.extentY,C.z-C.extentZ),new I(C.x,C.y+C.extentY,C.z-C.extentZ),new I(C.x,C.y+C.extentY,C.z+C.extentZ),new I(C.x,C.y-C.extentY,C.z+C.extentZ)]);if(y.push(J),de.add(new Oo(J,U)),C.label){const Te=t_(C.label,Rt);Te.position.set(C.x,C.y+C.extentY+12,C.z),de.add(Te),$e.push(Te)}}else if(C.radius>=12){const X=[];for(let Te=0;Te<64;Te+=1){const Pe=Te/64*Math.PI*2;X.push(new I(Math.cos(Pe)*C.radius,Math.sin(Pe)*C.radius,C.z))}const J=new wt().setFromPoints(X);y.push(J),de.add(new Oo(J,U))}const F=R.current;if(F&&F.topology===T)W.position.set(F.position.x,F.position.y,F.position.z),H.target.set(F.target.x,F.target.y,F.target.z),W.lookAt(H.target);else{const C=new Ni().setFromObject(de),X=C.getCenter(new I),J=C.getSize(new I);H.target.copy(X),W.position.set(X.x+J.x*.15,X.y+Math.max(140,J.y*.45),X.z+Math.max(280,J.z*.9+180)),W.lookAt(X)}const z=new zh;z.params.Mesh={...z.params.Mesh,threshold:2};const K=new we,se=[...he.values()];let ie=null,q=null;const Q=(C,X)=>{const J=C.color.clone().multiplyScalar(.55*X),Te=C.color.clone().multiplyScalar(X),Pe=C.inferred?Be.getAttribute("color"):Ze.getAttribute("color"),Le=C.inferred?C.dashedIndex:C.solidIndex;Le<0||(Pe.setXYZ(Le,J.r,J.g,J.b),Pe.setXYZ(Le+1,Te.r,Te.g,Te.b))},oe=(C,X)=>{const J=!!(C&&X.size),Te=A.current.nodeRoles||{},Pe=A.current.testOverlay;for(const[Le,xt]of he){const Ft=te.get(Le),Mt=xt.material,$t=!J||X.has(Le),wn=Le===C,Yn=Te[Le]||[];let Rn=nr((Ft==null?void 0:Ft.type)||"");wn?Rn*=1.28:$t?Yn.includes("seed")&&(Rn*=1.12):Rn*=.7,xt.scale.setScalar(Rn),Mt.opacity=wn?1:$t?.96:.12,wn?(Mt.emissive.copy(L),Mt.emissiveIntensity=.4):Yn.includes("untested")?(Mt.emissive.copy(D),Mt.emissiveIntensity=$t?.32:.05):Pe&&Yn.includes("tested")?(Mt.emissive.copy(B),Mt.emissiveIntensity=$t?.22:.04):Yn.includes("seed")?(Mt.emissive.copy(L),Mt.emissiveIntensity=$t?.2:.04):Yn.includes("contract")?(Mt.emissive.copy(L),Mt.emissiveIntensity=$t?.16:.03):(Mt.emissive.set(0),Mt.emissiveIntensity=0);const Jt=ee.get(Le)??{x:0,y:0,z:0},qn=me.get(Le);qn&&(qn.visible=wn||J&&X.has(Le)||!C&&st,qn.position.set(Jt.x,Jt.y+Rn+8,Jt.z))}ke.material.opacity=J?.9:.55,ot.opacity=J?.78:.48;for(const Le of Ae){const xt=!!(C&&(Le.edge.src===C||Le.edge.dst===C)),Ft=!J||X.has(Le.edge.src)&&X.has(Le.edge.dst);Q(Le,xt?1:Ft?.85:.12)}Ae.length&&(Ze.getAttribute("color").needsUpdate=!0,Be.getAttribute("color").needsUpdate=!0);for(const Le of pt){const xt=Le.userData.src,Ft=Le.userData.dst,Mt=!!(C&&(xt===C||Ft===C)),$t=!J||X.has(xt)&&X.has(Ft);Le.visible=$t&&(Ae.length<=80||Mt),Le.material.opacity=Mt?1:.75}},Se=C=>{if(!C){ie=null,q=null;return}const X=ee.get(C);if(!X)return;const J=new I(X.x,X.y,X.z),Te=W.position.clone().sub(H.target);if(Te.length()<40&&Te.set(90,110,180),w){H.target.copy(J),W.position.copy(J).add(Te),ie=null,q=null;return}ie=J,q=J.clone().add(Te)},ue=C=>{const X=O.domElement.getBoundingClientRect();K.x=(C.clientX-X.left)/X.width*2-1,K.y=-((C.clientY-X.top)/X.height)*2+1},le=()=>{z.setFromCamera(K,W);const C=z.intersectObjects(se,!1)[0],X=C==null?void 0:C.object.userData.id;return X?te.get(X)??null:null},Ee=C=>{ue(C);const X=le();if(!X){m(null),O.domElement.style.cursor="grab";return}O.domElement.style.cursor="pointer";const J=(c.current??S).getBoundingClientRect();m({node:X,x:C.clientX-J.left,y:C.clientY-J.top})},Ce=C=>{ue(C);const X=le();p.current(X?X.id:null)},Ne=()=>{ie=null,q=null},P=()=>{const C=S.clientWidth||1,X=S.clientHeight||1;W.aspect=C/X,W.updateProjectionMatrix(),O.setSize(C,X,!1)};P();const re=new ResizeObserver(P);re.observe(S);let $=0;const ce=()=>{$=requestAnimationFrame(ce);try{ie&&q&&(H.target.lerp(ie,.14),W.position.lerp(q,.14),H.target.distanceTo(ie)<1.5&&(H.target.copy(ie),W.position.copy(q),ie=null,q=null)),H.update(),O.render(Z,W)}catch{cancelAnimationFrame($),_("WebGL is unavailable in this browser, so the 3D view cannot start. Switch back to 2D map.")}};return ce(),O.domElement.addEventListener("pointermove",Ee),O.domElement.addEventListener("click",Ce),H.addEventListener("start",Ne),S.__paint=oe,S.__focus=Se,oe(u.current.selectedId,u.current.neighborIds),()=>{var C;R.current={topology:T,position:{x:W.position.x,y:W.position.y,z:W.position.z},target:{x:H.target.x,y:H.target.y,z:H.target.z}},cancelAnimationFrame($),re.disconnect(),O.domElement.removeEventListener("pointermove",Ee),O.domElement.removeEventListener("click",Ce),H.removeEventListener("start",Ne),delete S.__paint,delete S.__focus,H.dispose(),Ye.dispose(),ft.dispose(),Ze.dispose(),Be.dispose(),ct.dispose(),U.dispose();for(const X of y)X.dispose();ke.material.dispose(),ot.dispose();for(const X of[...$e,...qe]){const J=X.material;(C=J.map)==null||C.dispose(),J.dispose()}for(const X of he.values())X.material.dispose();for(const X of pt)X.material.dispose();O.dispose(),O.domElement.remove(),m(null)}},[T,v]),Ot.useEffect(()=>{var S,w;(w=(S=l.current)==null?void 0:S.__paint)==null||w.call(S,t,n)},[t,n,a,o]),Ot.useEffect(()=>{var S,w;if(!M.current){M.current=!0;return}(w=(S=l.current)==null?void 0:S.__focus)==null||w.call(S,t)},[t]),Zn.jsxs("div",{className:"graph-3d-host",ref:c,children:[Zn.jsx("div",{className:"graph-3d-canvas-host",ref:l}),h?Zn.jsx("p",{className:"muted graph-3d-hint","data-testid":"graph-3d-fallback",children:h}):null,d?Zn.jsxs("div",{className:"graph-3d-tip",style:{left:d.x+12,top:d.y+12},children:[Zn.jsxs("div",{className:"t",children:[uc(d.node.type),d.node.context?` · ${d.node.context}`:""]}),Zn.jsx("div",{className:"n",children:d.node.name}),d.node.file_path?Zn.jsx("div",{className:"f",children:d.node.file_path}):null]}):null]})}export{r_ as LayeredGraph3D}; diff --git a/src/loadpath/static/assets/LayeredGraph3D-HVYd3pFj.js b/src/loadpath/static/assets/LayeredGraph3D-HVYd3pFj.js new file mode 100644 index 0000000..67ab2a1 --- /dev/null +++ b/src/loadpath/static/assets/LayeredGraph3D-HVYd3pFj.js @@ -0,0 +1,4108 @@ +import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./index-DyJR4VJX.js";var l=r(t(),1),u={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},d={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},f=1e3,p=1001,m=1002,h=1003,g=1004,_=1005,v=1006,y=1007,b=1008,x=1009,S=1010,C=1011,w=1012,T=1013,E=1014,D=1015,O=1016,k=1017,A=1018,ee=1020,j=35902,M=35899,te=1021,N=1022,ne=1023,re=1026,ie=1027,ae=1028,oe=1029,se=1030,ce=1031,le=1033,P=33776,F=33777,ue=33778,de=33779,fe=35840,pe=35841,me=35842,he=35843,ge=36196,_e=37492,ve=37496,ye=37488,be=37489,xe=37490,Se=37491,Ce=37808,we=37809,Te=37810,Ee=37811,De=37812,Oe=37813,ke=37814,Ae=37815,je=37816,Me=37817,I=37818,Ne=37819,L=37820,Pe=37821,R=36492,Fe=36494,z=36495,B=36283,Ie=36284,Le=36285,Re=36286,ze=2300,Be=2301,Ve=2302,He=2303,Ue=2400,We=2401,Ge=2402,Ke=3200,qe=`srgb`,Je=`srgb-linear`,Ye=`linear`,Xe=`srgb`,Ze=7680,Qe=35044,$e=2e3;function et(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function tt(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function V(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function nt(){let e=V(`canvas`);return e.style.display=`block`,e}var rt={};function it(...e){let t=`THREE.`+e.shift();console.log(t,...e)}function at(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function H(...e){e=at(e);let t=`THREE.`+e.shift();{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function U(...e){e=at(e);let t=`THREE.`+e.shift();{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function ot(...e){let t=e.join(` `);t in rt||(rt[t]=!0,H(...e))}function st(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var ct={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},lt=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+ut[e>>16&255]+ut[e>>24&255]+`-`+ut[t&255]+ut[t>>8&255]+`-`+ut[t>>16&15|64]+ut[t>>24&255]+`-`+ut[n&63|128]+ut[n>>8&255]+`-`+ut[n>>16&255]+ut[n>>24&255]+ut[r&255]+ut[r>>8&255]+ut[r>>16&255]+ut[r>>24&255]).toLowerCase()}function W(e,t,n){return Math.max(t,Math.min(n,e))}function ht(e,t){return(e%t+t)%t}function gt(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function _t(e,t,n){return e===t?0:(n-e)/(t-e)}function vt(e,t,n){return(1-n)*e+n*t}function yt(e,t,n,r){return vt(e,t,1-Math.exp(-n*r))}function bt(e,t=1){return t-Math.abs(ht(e,t*2)-t)}function xt(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function St(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Ct(e,t){return e+Math.floor(Math.random()*(t-e+1))}function wt(e,t){return e+Math.random()*(t-e)}function Tt(e){return e*(.5-Math.random())}function Et(e){e!==void 0&&(dt=e);let t=dt+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Dt(e){return e*ft}function Ot(e){return e*pt}function kt(e){return!(e&e-1)&&e!==0}function At(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function jt(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function Mt(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:H(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Nt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function G(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}var Pt={DEG2RAD:ft,RAD2DEG:pt,generateUUID:mt,clamp:W,euclideanModulo:ht,mapLinear:gt,inverseLerp:_t,lerp:vt,damp:yt,pingpong:bt,smoothstep:xt,smootherstep:St,randInt:Ct,randFloat:wt,randFloatSpread:Tt,seededRandom:Et,degToRad:Dt,radToDeg:Ot,isPowerOfTwo:kt,ceilPowerOfTwo:At,floorPowerOfTwo:jt,setQuaternionFromProperEuler:Mt,normalize:G,denormalize:Nt},K=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=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 Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`THREE.Vector2: 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){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+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=W(this.x,e.x,t.x),this.y=W(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=W(this.x,e,t),this.y=W(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(W(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(W(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ft=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,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=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:H(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(W(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);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*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},q=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`THREE.Vector3: 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 Error(`THREE.Vector3: 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(Lt.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Lt.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[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=W(this.x,e.x,t.x),this.y=W(this.y,e.y,t.y),this.z=W(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=W(this.x,e,t),this.y=W(this.y,e,t),this.z=W(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(W(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return It.copy(this).projectOnVector(e),this.sub(It)}reflect(e){return this.sub(It.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(W(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+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,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,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(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},It=new q,Lt=new Ft,J=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let 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){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,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){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return ot(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(Rt.makeScale(e,t)),this}rotate(e){return ot(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(Rt.makeRotation(-e)),this}translate(e,t){return ot(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(Rt.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){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Rt=new J,zt=new J().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Bt=new J().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Vt(){let e={enabled:!0,workingColorSpace:Je,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=Ht(e.r),e.g=Ht(e.g),e.b=Ht(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Ut(e.r),e.g=Ut(e.g),e.b=Ut(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?Ye:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return ot(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return ot(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Je]:{primaries:t,whitePoint:r,transfer:Ye,toXYZ:zt,fromXYZ:Bt,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:qe},outputColorSpaceConfig:{drawingBufferColorSpace:qe}},[qe]:{primaries:t,whitePoint:r,transfer:Xe,toXYZ:zt,fromXYZ:Bt,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:qe}}}),e}var Y=Vt();function Ht(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Ut(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var Wt,Gt=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Wt===void 0&&(Wt=V(`canvas`)),Wt.width=e.width,Wt.height=e.height;let t=Wt.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Wt}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=V(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Xt).x}get height(){return this.source.getSize(Xt).y}get depth(){return this.source.getSize(Xt).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){H(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){H(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case f:e.x-=Math.floor(e.x);break;case p:e.x=e.x<0?0:1;break;case m:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case f:e.y-=Math.floor(e.y);break;case p:e.y=e.y<0?0:1;break;case m:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Zt.DEFAULT_IMAGE=null,Zt.DEFAULT_MAPPING=300,Zt.DEFAULT_ANISOTROPY=1;var Qt=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,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,n,r){return this.x=e,this.y=t,this.z=n,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 Error(`THREE.Vector4: 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 Error(`THREE.Vector4: 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?1:e.w,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){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1);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.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.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=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}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.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),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(Nn)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Mn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Fn={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},In={h:0,s:0,l:0},Ln={h:0,s:0,l:0};function Rn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var X=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=qe){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Y.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Y.workingColorSpace){return this.r=e,this.g=t,this.b=n,Y.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Y.workingColorSpace){if(e=ht(e,1),t=W(t,0,1),n=W(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Rn(i,r,e+1/3),this.g=Rn(i,r,e),this.b=Rn(i,r,e-1/3)}return Y.colorSpaceToWorking(this,r),this}setStyle(e,t=qe){function n(t){t!==void 0&&parseFloat(t)<1&&H(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:H(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);H(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=qe){let n=Fn[e.toLowerCase()];return n===void 0?H(`Color: Unknown color `+e):this.setHex(n,t),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=Ht(e.r),this.g=Ht(e.g),this.b=Ht(e.b),this}copyLinearToSRGB(e){return this.r=Ut(e.r),this.g=Ut(e.g),this.b=Ut(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=qe){return Y.workingToColorSpace(zn.copy(this),e),Math.round(W(zn.r*255,0,255))*65536+Math.round(W(zn.g*255,0,255))*256+Math.round(W(zn.b*255,0,255))}getHexString(e=qe){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Y.workingColorSpace){Y.workingToColorSpace(zn.copy(this),t);let n=zn.r,r=zn.g,i=zn.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Hn=new q,Un=new q,Wn=new q,Gn=new q,Kn=new q,qn=new q,Jn=new q,Yn=new q,Xn=new q,Zn=new q,Qn=new Qt,$n=new Qt,er=new Qt,tr=class e{constructor(e=new q,t=new q,n=new q){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Hn.subVectors(e,t),r.cross(Hn);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Hn.subVectors(r,t),Un.subVectors(n,t),Wn.subVectors(e,t);let a=Hn.dot(Hn),o=Hn.dot(Un),s=Hn.dot(Wn),c=Un.dot(Un),l=Un.dot(Wn),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Gn)!==null&&Gn.x>=0&&Gn.y>=0&&Gn.x+Gn.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Gn)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Gn.x),s.addScaledVector(a,Gn.y),s.addScaledVector(o,Gn.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Qn.setScalar(0),$n.setScalar(0),er.setScalar(0),Qn.fromBufferAttribute(e,t),$n.fromBufferAttribute(e,n),er.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Qn,i.x),a.addScaledVector($n,i.y),a.addScaledVector(er,i.z),a}static isFrontFacing(e,t,n,r){return Hn.subVectors(n,t),Un.subVectors(e,t),Hn.cross(Un).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 Hn.subVectors(this.c,this.b),Un.subVectors(this.a,this.b),Hn.cross(Un).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Kn.subVectors(r,n),qn.subVectors(i,n),Yn.subVectors(e,n);let s=Kn.dot(Yn),c=qn.dot(Yn);if(s<=0&&c<=0)return t.copy(n);Xn.subVectors(e,r);let l=Kn.dot(Xn),u=qn.dot(Xn);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Kn,a);Zn.subVectors(e,i);let f=Kn.dot(Zn),p=qn.dot(Zn);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(qn,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Jn.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Jn,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Kn,a).addScaledVector(qn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},nr=class{constructor(e=new q(1/0,1/0,1/0),t=new q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ir),ir.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(fr),pr.subVectors(this.max,fr),or.subVectors(e.a,fr),sr.subVectors(e.b,fr),cr.subVectors(e.c,fr),lr.subVectors(sr,or),ur.subVectors(cr,sr),dr.subVectors(or,cr);let t=[0,-lr.z,lr.y,0,-ur.z,ur.y,0,-dr.z,dr.y,lr.z,0,-lr.x,ur.z,0,-ur.x,dr.z,0,-dr.x,-lr.y,lr.x,0,-ur.y,ur.x,0,-dr.y,dr.x,0];return!gr(t,or,sr,cr,pr)||(t=[1,0,0,0,1,0,0,0,1],!gr(t,or,sr,cr,pr))?!1:(mr.crossVectors(lr,ur),t=[mr.x,mr.y,mr.z],gr(t,or,sr,cr,pr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ir).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ir).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:(rr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rr),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},rr=[new q,new q,new q,new q,new q,new q,new q,new q],ir=new q,ar=new nr,or=new q,sr=new q,cr=new q,lr=new q,ur=new q,dr=new q,fr=new q,pr=new q,mr=new q,hr=new q;function gr(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){hr.fromArray(e,a);let o=i.x*Math.abs(hr.x)+i.y*Math.abs(hr.y)+i.z*Math.abs(hr.z),s=t.dot(hr),c=n.dot(hr),l=r.dot(hr);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var _r=new q,vr=new K,yr=0,br=class extends lt{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:yr++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=Qe,this.updateRanges=[],this.gpuType=D,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rthis.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*=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;Tr.subVectors(e,this.center);let t=Tr.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(Tr,n/e),this.radius+=n}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):(Er.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Tr.copy(e.center).add(Er)),this.expandByPoint(Tr.copy(e.center).sub(Er))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Or=0,kr=new rn,Ar=new jn,jr=new q,Mr=new nr,Nr=new nr,Pr=new q,Fr=class e extends lt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Or++}),this.uuid=mt(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(et(e)?Sr:xr)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new J().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return kr.makeRotationFromQuaternion(e),this.applyMatrix4(kr),this}rotateX(e){return kr.makeRotationX(e),this.applyMatrix4(kr),this}rotateY(e){return kr.makeRotationY(e),this.applyMatrix4(kr),this}rotateZ(e){return kr.makeRotationZ(e),this.applyMatrix4(kr),this}translate(e,t,n){return kr.makeTranslation(e,t,n),this.applyMatrix4(kr),this}scale(e,t,n){return kr.makeScale(e,t,n),this.applyMatrix4(kr),this}lookAt(e){return Ar.lookAt(e),Ar.updateMatrix(),this.applyMatrix4(Ar.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(jr).negate(),this.translate(jr.x,jr.y,jr.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;nt.count&&H(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new nr);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){U(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),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;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){H(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){H(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new X().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(this.vertexColors=typeof e.vertexColors==`number`?e.vertexColors>0:e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),this.normalScale=new K().fromArray(t)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new K().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,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++}},Vr=class extends Br{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new X(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Hr,Ur=new q,Wr=new q,Gr=new q,Kr=new K,qr=new K,Jr=new rn,Yr=new q,Xr=new q,Zr=new q,Qr=new K,$r=new K,ei=new K,ti=class extends jn{constructor(e=new Vr){if(super(),this.isSprite=!0,this.type=`Sprite`,Hr===void 0){Hr=new Fr;let e=new Ir(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Hr.setIndex([0,1,2,0,2,3]),Hr.setAttribute(`position`,new Rr(e,3,0,!1)),Hr.setAttribute(`uv`,new Rr(e,2,3,!1))}this.geometry=Hr,this.material=e,this.center=new K(.5,.5),this.count=1}raycast(e,t){e.camera===null&&U(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),Wr.setFromMatrixScale(this.matrixWorld),Jr.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Gr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Wr.multiplyScalar(-Gr.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;ni(Yr.set(-.5,-.5,0),Gr,a,Wr,r,i),ni(Xr.set(.5,-.5,0),Gr,a,Wr,r,i),ni(Zr.set(.5,.5,0),Gr,a,Wr,r,i),Qr.set(0,0),$r.set(1,0),ei.set(1,1);let o=e.ray.intersectTriangle(Yr,Xr,Zr,!1,Ur);if(o===null&&(ni(Xr.set(-.5,.5,0),Gr,a,Wr,r,i),$r.set(0,1),o=e.ray.intersectTriangle(Yr,Zr,Xr,!1,Ur),o===null))return;let s=e.ray.origin.distanceTo(Ur);se.far||t.push({distance:s,point:Ur.clone(),uv:tr.getInterpolation(Ur,Yr,Xr,Zr,Qr,$r,ei,new K),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 ni(e,t,n,r,i,a){Kr.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?qr.copy(Kr):(qr.x=a*Kr.x-i*Kr.y,qr.y=i*Kr.x+a*Kr.y),e.copy(t),e.x+=qr.x,e.y+=qr.y,e.applyMatrix4(Jr)}var ri=new q,ii=new q,ai=new q,oi=new q,si=new q,ci=new q,li=new q,ui=class{constructor(e=new q,t=new q(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,ri)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ri.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ri.copy(this.origin).addScaledVector(this.direction,t),ri.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ii.copy(e).add(t).multiplyScalar(.5),ai.copy(t).sub(e).normalize(),oi.copy(this.origin).sub(ii);let i=e.distanceTo(t)*.5,a=-this.direction.dot(ai),o=oi.dot(this.direction),s=-oi.dot(ai),c=oi.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0){if(u=a*s-o,d=a*o-s,p=i*l,u>=0){if(d>=-p){if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c)}else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(ii).addScaledVector(ai,d),f}intersectSphere(e,t){ri.subVectors(e.center,this.origin);let n=ri.dot(this.direction),r=ri.dot(ri)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ri)!==null}intersectTriangle(e,t,n,r,i){si.subVectors(t,e),ci.subVectors(n,e),li.crossVectors(si,ci);let a=this.direction.dot(li),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;oi.subVectors(this.origin,e);let s=o*this.direction.dot(ci.crossVectors(oi,ci));if(s<0)return null;let c=o*this.direction.dot(si.cross(oi));if(c<0||s+c>a)return null;let l=-o*oi.dot(li);return l<0?null:this.at(l/a,i)}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)}},di=class extends Br{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},fi=new rn,pi=new ui,mi=new Dr,hi=new q,gi=new q,_i=new q,vi=new q,yi=new q,bi=new q,xi=new q,Si=new q,Ci=class extends jn{constructor(e=new Fr,t=new di){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(fi.copy(i).invert(),pi.copy(e.ray).applyMatrix4(fi),(n.boundingBox===null||pi.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,pi)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null){if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:Si.clone(),object:e}}function Ti(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,gi),e.getVertexPosition(c,_i),e.getVertexPosition(l,vi);let u=wi(e,t,n,r,gi,_i,vi,xi);if(u){let e=new q;tr.getBarycoord(xi,gi,_i,vi,e),i&&(u.uv=tr.getInterpolatedAttribute(i,s,c,l,e,new K)),a&&(u.uv1=tr.getInterpolatedAttribute(a,s,c,l,e,new K)),o&&(u.normal=tr.getInterpolatedAttribute(o,s,c,l,e,new q),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new q,materialIndex:0};tr.getNormal(gi,_i,vi,t.normal),u.face=t,u.barycoord=e}return u}var Ei=class extends Zt{constructor(e=null,t=1,n=1,r,i,a,o,s,c=h,l=h,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Di=new q,Oi=new q,ki=new J,Ai=class{constructor(e=new q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=Di.subVectors(n,t).cross(Oi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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,n=!0){let r=e.delta(Di),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||ki.getNormalMatrix(e),r=this.coplanarPoint(Di).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),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)}},ji=new Dr,Mi=new K(.5,.5),Ni=new q,Pi=class{constructor(e=new Ai,t=new Ai,n=new Ai,r=new Ai,i=new Ai,a=new Ai){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=$e,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),ji.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ji.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ji)}intersectsSprite(e){return ji.center.set(0,0,0),ji.radius=.7071067811865476+Mi.distanceTo(e.center),ji.applyMatrix4(e.matrixWorld),this.intersectsSphere(ji)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Ni.y=r.normal.y>0?e.max.y:e.min.y,Ni.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ni)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Fi=class extends Br{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new X(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Ii=new q,Li=new q,Ri=new rn,zi=new ui,Bi=new Dr,Vi=new q,Hi=new q,Ui=class extends jn{constructor(e=new Fr,t=new Fi){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;Vi.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Vi);if(!(ct.far))return{distance:c,point:Hi.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var Gi=new q,Ki=new q,qi=class extends Ui{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new Cr(u,3)),this.setAttribute(`normal`,new Cr(d,3)),this.setAttribute(`uv`,new Cr(f,2));function _(){let a=new q,_=new q,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new K,m=new q,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case`t`:this.uniforms[n].value=t[r.value]||null;break;case`c`:this.uniforms[n].value=new X().setHex(r.value);break;case`v2`:this.uniforms[n].value=new K().fromArray(r.value);break;case`v3`:this.uniforms[n].value=new q().fromArray(r.value);break;case`v4`:this.uniforms[n].value=new Qt().fromArray(r.value);break;case`m3`:this.uniforms[n].value=new J().fromArray(r.value);break;case`m4`:this.uniforms[n].value=new rn().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let t in e.extensions)this.extensions[t]=e.extensions[t];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},ma=class extends pa{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type=`RawShaderMaterial`}},ha=class extends Br{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new X(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mn,this.envMapIntensity=1,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.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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}},ga=class extends Br{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=Ke,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}},_a=class extends Br{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}},va=class extends Fi{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 ya(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}var ba=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e=i)){let o=t[1];e=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n>>1;et;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(U(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(U(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){U(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){U(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&tt(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){U(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Ve,i=e.length-1,a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Ta.prototype.ValueTypeName=``,Ta.prototype.TimeBufferType=Float32Array,Ta.prototype.ValueBufferType=Float32Array,Ta.prototype.DefaultInterpolation=Be;var Ea=class extends Ta{constructor(e,t,n){super(e,t,n)}};Ea.prototype.ValueTypeName=`bool`,Ea.prototype.ValueBufferType=Array,Ea.prototype.DefaultInterpolation=ze,Ea.prototype.InterpolantFactoryMethodLinear=void 0,Ea.prototype.InterpolantFactoryMethodSmooth=void 0;var Da=class extends Ta{constructor(e,t,n,r){super(e,t,n,r)}};Da.prototype.ValueTypeName=`color`;var Oa=class extends Ta{constructor(e,t,n,r){super(e,t,n,r)}};Oa.prototype.ValueTypeName=`number`;var ka=class extends ba{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Ft.slerpFlat(i,0,a,c-o,a,c,s);return i}},Aa=class extends Ta{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new ka(this.times,this.values,this.getValueSize(),e)}};Aa.prototype.ValueTypeName=`quaternion`,Aa.prototype.InterpolantFactoryMethodSmooth=void 0;var ja=class extends Ta{constructor(e,t,n){super(e,t,n)}};ja.prototype.ValueTypeName=`string`,ja.prototype.ValueBufferType=Array,ja.prototype.DefaultInterpolation=ze,ja.prototype.InterpolantFactoryMethodLinear=void 0,ja.prototype.InterpolantFactoryMethodSmooth=void 0;var Ma=class extends Ta{constructor(e,t,n,r){super(e,t,n,r)}};Ma.prototype.ValueTypeName=`vector`;var Na=class extends jn{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new X(e),this.intensity=t}dispose(){this.dispatchEvent({type:`dispose`})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},Pa=class extends Na{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(jn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new X(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},Fa=new rn,Ia=new q,La=new q,Ra=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.mapType=x,this.map=null,this.mapPass=null,this.matrix=new rn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Pi,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new Qt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;Ia.setFromMatrixPosition(e.matrixWorld),t.position.copy(Ia),La.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(La),t.updateMatrixWorld(),Fa.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Fa,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Fa)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},za=new q,Ba=new Ft,Va=new q,Ha=class extends jn{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new rn,this.projectionMatrix=new rn,this.projectionMatrixInverse=new rn,this.coordinateSystem=$e,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(za,Ba,Va),Va.x===1&&Va.y===1&&Va.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(za,Ba,Va.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(za,Ba,Va),Va.x===1&&Va.y===1&&Va.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(za,Ba,Va.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Ua=new q,Wa=new K,Ga=new K,Ka=class extends Ha{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,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){let t=.5*this.getFilmHeight()/e;this.fov=pt*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(ft*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return pt*2*Math.atan(Math.tan(ft*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Ua.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ua.x,Ua.y).multiplyScalar(-e/Ua.z),Ua.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ua.x,Ua.y).multiplyScalar(-e/Ua.z)}getViewSize(e,t){return this.getViewBounds(e,Wa,Ga),t.subVectors(Ga,Wa)}setViewOffset(e,t,n,r,i,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=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(ft*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},qa=class extends Ha{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,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,n,r,i,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=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},Ja=class extends Ra{constructor(){super(new qa(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},Ya=class extends Na{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(jn.DEFAULT_UP),this.updateMatrix(),this.target=new jn,this.shadow=new Ja}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},Xa=class extends Na{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},Za=-90,Qa=1,$a=class extends jn{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Ka(Za,Qa,e,t);r.layers=this.layers,this.add(r);let i=new Ka(Za,Qa,e,t);i.layers=this.layers,this.add(i);let a=new Ka(Za,Qa,e,t);a.layers=this.layers,this.add(a);let o=new Ka(Za,Qa,e,t);o.layers=this.layers,this.add(o);let s=new Ka(Za,Qa,e,t);s.layers=this.layers,this.add(s);let c=new Ka(Za,Qa,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.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),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.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),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let h=!1;h=e.isWebGLRenderer===!0?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(n,0,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,i),e.setRenderTarget(n,1,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,4,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},eo=class extends Ka{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},to=`\\[\\]\\.:\\/`,no=RegExp(`[\\[\\]\\.:\\/]`,`g`),ro=`[^\\[\\]\\.:\\/]`,io=`[^`+to.replace(`\\.`,``)+`]`,ao=`((?:WC+[\\/:])*)`.replace(`WC`,ro),oo=`(WCOD+)?`.replace(`WCOD`,io),so=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,ro),co=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,ro),lo=RegExp(`^`+ao+oo+so+co+`$`),uo=[`material`,`materials`,`bones`,`map`],fo=class{constructor(e,t,n){let r=n||po.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},po=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(no,``)}static parseTrackName(e){let t=lo.exec(e);if(t===null)throw Error(`THREE.PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);uo.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`THREE.PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;re.start-t.start);let t=0;for(let e=1;e 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,color_fragment:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,color_pars_fragment:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,color_pars_vertex:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,color_vertex:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,common:`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +#define inverseTransformDirection transformDirectionByInverseViewMatrix +vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) { + return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz ); +} +vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) { + return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz ); +} +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`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; +#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,envmap_fragment:`#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 = transformNormalByInverseViewMatrix( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * reflectVec ); + #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 +#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,envmap_pars_fragment:`#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`,envmap_pars_vertex:`#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`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,envmap_vertex:`#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 = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,fog_vertex:`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,fog_pars_vertex:`#ifdef USE_FOG + varying float vFogDepth; +#endif`,fog_fragment:`#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`,fog_pars_fragment:`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,gradientmap_pars_fragment:`#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 +}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,lights_lambert_fragment:`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif +#include `,lights_toon_fragment:`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,lights_physical_pars_fragment:`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); + } + 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.specularColorBlended; + 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 * transpose( 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 rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + 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 + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #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; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#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 ); +}`,lights_fragment_begin:` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif + #ifdef USE_LIGHT_PROBES_GRID + vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz; + vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix ); + irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal ); + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,lights_fragment_maps:`#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( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,lightprobes_pars_fragment:`#ifdef USE_LIGHT_PROBES_GRID +uniform highp sampler3D probesSH; +uniform vec3 probesMin; +uniform vec3 probesMax; +uniform vec3 probesResolution; +vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { + vec3 res = probesResolution; + vec3 gridRange = probesMax - probesMin; + vec3 resMinusOne = res - 1.0; + vec3 probeSpacing = gridRange / resMinusOne; + vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5; + vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 ); + uvw = uvw * resMinusOne / res + 0.5 / res; + float nz = res.z; + float paddedSlices = nz + 2.0; + float atlasDepth = 7.0 * paddedSlices; + float uvZBase = uvw.z * nz + 1.0; + vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) ); + vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) ); + vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) ); + vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) ); + vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) ); + vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) ); + vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) ); + vec3 c0 = s0.xyz; + vec3 c1 = vec3( s0.w, s1.xy ); + vec3 c2 = vec3( s1.zw, s2.x ); + vec3 c3 = s2.yzw; + vec3 c4 = s3.xyz; + vec3 c5 = vec3( s3.w, s4.xy ); + vec3 c6 = vec3( s4.zw, s5.x ); + vec3 c7 = s5.yzw; + vec3 c8 = s6.xyz; + float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z; + vec3 result = c0 * 0.886227; + result += c1 * 2.0 * 0.511664 * y; + result += c2 * 2.0 * 0.511664 * z; + result += c3 * 2.0 * 0.511664 * x; + result += c4 * 2.0 * 0.429043 * x * y; + result += c5 * 2.0 * 0.429043 * y * z; + result += c6 * ( 0.743125 * z * z - 0.247708 ); + result += c7 * 2.0 * 0.429043 * x * z; + result += c8 * 0.429043 * ( x * x - y * y ); + return max( result, vec3( 0.0 ) ); +} +#endif`,logdepthbuf_fragment:`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_vertex:`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,map_fragment:`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,map_pars_fragment:`#ifdef USE_MAP + uniform sampler2D map; +#endif`,map_particle_fragment:`#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`,map_particle_pars_fragment:`#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`,metalnessmap_fragment:`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,normal_fragment_begin:`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 + #ifdef DOUBLE_SIDED + 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 + #ifdef DOUBLE_SIDED + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#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; + #if defined( USE_PACKED_NORMALMAP ) + mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) ); + #endif + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_vertex:`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #ifdef FLIP_SIDED + vBitangent = - vBitangent; + #endif + #endif +#endif`,normalmap_pars_fragment:`#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`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,clearcoat_pars_fragment:`#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`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,opaque_fragment:`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +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 ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,dithering_pars_fragment:`#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`,roughnessmap_fragment:`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,shadowmap_pars_fragment:`#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 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + 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 ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + 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 ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + #ifdef HAS_NORMAL + vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); + #else + vec3 shadowWorldNormal = vec3( 0.0 ); + #endif + 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`,shadowmask_pars_fragment:`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,skinbase_vertex:`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,skinning_vertex:`#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`,skinnormal_vertex:`#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`,specularmap_fragment:`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,tonemapping_pars_fragment:`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#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 = transformNormalByInverseViewMatrix( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,uv_pars_fragment:`#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`,uv_pars_vertex:`#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`,uv_vertex:`#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`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`,background_vert:`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,background_frag:`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,backgroundCube_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,cube_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,cube_frag:`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 +}`,depth_vert:`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,depth_frag:`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,distance_vert:`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,distance_frag:`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,equirect_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,equirect_frag:`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,linedashed_vert:`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,linedashed_frag:`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,meshbasic_vert:`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,meshbasic_frag:`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,meshlambert_vert:`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,meshlambert_frag:`#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 +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,meshmatcap_vert:`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,meshmatcap_frag:`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,meshnormal_vert:`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,meshnormal_frag:`#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 +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,meshphong_vert:`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,meshphong_frag:`#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 +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,meshphysical_vert:`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,meshphysical_frag:`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,meshtoon_vert:`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,meshtoon_frag:`#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 +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,points_vert:`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,points_frag:`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,shadow_vert:`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,shadow_frag:`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,sprite_vert:`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,sprite_frag:`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`},Q={common:{diffuse:{value:new X(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new J},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new J}},envmap:{envMap:{value:null},envMapRotation:{value:new J},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new J}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new J}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new J},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new J},normalScale:{value:new K(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new J},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new J}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new J}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new J}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new X(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new q},probesMax:{value:new q},probesResolution:{value:new q}},points:{diffuse:{value:new X(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0},uvTransform:{value:new J}},sprite:{diffuse:{value:new X(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new J},alphaMap:{value:null},alphaMapTransform:{value:new J},alphaTest:{value:0}}},wo={basic:{uniforms:oa([Q.common,Q.specularmap,Q.envmap,Q.aomap,Q.lightmap,Q.fog]),vertexShader:Z.meshbasic_vert,fragmentShader:Z.meshbasic_frag},lambert:{uniforms:oa([Q.common,Q.specularmap,Q.envmap,Q.aomap,Q.lightmap,Q.emissivemap,Q.bumpmap,Q.normalmap,Q.displacementmap,Q.fog,Q.lights,{emissive:{value:new X(0)},envMapIntensity:{value:1}}]),vertexShader:Z.meshlambert_vert,fragmentShader:Z.meshlambert_frag},phong:{uniforms:oa([Q.common,Q.specularmap,Q.envmap,Q.aomap,Q.lightmap,Q.emissivemap,Q.bumpmap,Q.normalmap,Q.displacementmap,Q.fog,Q.lights,{emissive:{value:new X(0)},specular:{value:new X(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Z.meshphong_vert,fragmentShader:Z.meshphong_frag},standard:{uniforms:oa([Q.common,Q.envmap,Q.aomap,Q.lightmap,Q.emissivemap,Q.bumpmap,Q.normalmap,Q.displacementmap,Q.roughnessmap,Q.metalnessmap,Q.fog,Q.lights,{emissive:{value:new X(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Z.meshphysical_vert,fragmentShader:Z.meshphysical_frag},toon:{uniforms:oa([Q.common,Q.aomap,Q.lightmap,Q.emissivemap,Q.bumpmap,Q.normalmap,Q.displacementmap,Q.gradientmap,Q.fog,Q.lights,{emissive:{value:new X(0)}}]),vertexShader:Z.meshtoon_vert,fragmentShader:Z.meshtoon_frag},matcap:{uniforms:oa([Q.common,Q.bumpmap,Q.normalmap,Q.displacementmap,Q.fog,{matcap:{value:null}}]),vertexShader:Z.meshmatcap_vert,fragmentShader:Z.meshmatcap_frag},points:{uniforms:oa([Q.points,Q.fog]),vertexShader:Z.points_vert,fragmentShader:Z.points_frag},dashed:{uniforms:oa([Q.common,Q.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Z.linedashed_vert,fragmentShader:Z.linedashed_frag},depth:{uniforms:oa([Q.common,Q.displacementmap]),vertexShader:Z.depth_vert,fragmentShader:Z.depth_frag},normal:{uniforms:oa([Q.common,Q.bumpmap,Q.normalmap,Q.displacementmap,{opacity:{value:1}}]),vertexShader:Z.meshnormal_vert,fragmentShader:Z.meshnormal_frag},sprite:{uniforms:oa([Q.sprite,Q.fog]),vertexShader:Z.sprite_vert,fragmentShader:Z.sprite_frag},background:{uniforms:{uvTransform:{value:new J},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Z.background_vert,fragmentShader:Z.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new J}},vertexShader:Z.backgroundCube_vert,fragmentShader:Z.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Z.cube_vert,fragmentShader:Z.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Z.equirect_vert,fragmentShader:Z.equirect_frag},distance:{uniforms:oa([Q.common,Q.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Z.distance_vert,fragmentShader:Z.distance_frag},shadow:{uniforms:oa([Q.lights,Q.fog,{color:{value:new X(0)},opacity:{value:1}}]),vertexShader:Z.shadow_vert,fragmentShader:Z.shadow_frag}};wo.physical={uniforms:oa([wo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new J},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new J},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new J},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new J},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new J},sheen:{value:0},sheenColor:{value:new X(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new J},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new J},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new J},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new J},attenuationDistance:{value:0},attenuationColor:{value:new X(0)},specularColor:{value:new X(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new J},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new J},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new J}}]),vertexShader:Z.meshphysical_vert,fragmentShader:Z.meshphysical_frag};var To={r:0,b:0,g:0},Eo=new rn,Do=new J;Do.set(-1,0,0,0,1,0,0,0,1);function Oo(e,t,n,r,i,a){let o=new X(0),s=i===!0?0:1,c,l,u=null,d=0,f=null;function p(e){let n=e.isScene===!0?e.background:null;if(n&&n.isTexture){let r=e.backgroundBlurriness>0;n=t.get(n,r)}return n}function m(t){let r=!1,i=p(t);i===null?g(o,s):i&&i.isColor&&(g(i,1),r=!0);let c=e.xr.getEnvironmentBlendMode();c===`additive`?n.buffers.color.setClear(0,0,0,1,a):c===`alpha-blend`&&n.buffers.color.setClear(0,0,0,0,a),(e.autoClear||r)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function h(t,n){let i=p(n);i&&(i.isCubeTexture||i.mapping===306)?(l===void 0&&(l=new Ci(new ea(1,1,1),new pa({name:`BackgroundCubeMaterial`,uniforms:aa(wo.backgroundCube.uniforms),vertexShader:wo.backgroundCube.vertexShader,fragmentShader:wo.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),l.geometry.deleteAttribute(`uv`),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=i,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Eo.makeRotationFromEuler(n.backgroundRotation)).transpose(),i.isCubeTexture&&i.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(Do),l.material.toneMapped=Y.getTransfer(i.colorSpace)!==Xe,(u!==i||d!==i.version||f!==e.toneMapping)&&(l.material.needsUpdate=!0,u=i,d=i.version,f=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):i&&i.isTexture&&(c===void 0&&(c=new Ci(new ra(2,2),new pa({name:`BackgroundMaterial`,uniforms:aa(wo.background.uniforms),vertexShader:wo.background.vertexShader,fragmentShader:wo.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!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=i,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.toneMapped=Y.getTransfer(i.colorSpace)!==Xe,i.matrixAutoUpdate===!0&&i.updateMatrix(),c.material.uniforms.uvTransform.value.copy(i.matrix),(u!==i||d!==i.version||f!==e.toneMapping)&&(c.material.needsUpdate=!0,u=i,d=i.version,f=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null))}function g(t,r){t.getRGB(To,la(e)),n.buffers.color.setClear(To.r,To.g,To.b,r,a)}function _(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),s=t,g(o,s)},getClearAlpha:function(){return s},setClearAlpha:function(e){s=e,g(o,s)},render:m,addToRenderList:h,dispose:_}}function ko(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(n,s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n,i){let a=i.wireframe===!0,o=r[t.id];o===void 0&&(o={},r[t.id]=o);let s=e.isInstancedMesh===!0?e.id:0,l=o[s];l===void 0&&(l={},o[s]=l);let u=l[n.id];u===void 0&&(u={},l[n.id]=u);let d=u[a];return d===void 0&&(d=f(c()),u[a]=d),d}function f(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(H(`WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reversedDepthBuffer===!0&&t.has(`EXT_clip_control`);n.reversedDepthBuffer===!0&&f===!1&&H(`WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.`);let p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=e.getParameter(e.MAX_SAMPLES),S=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reversedDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,maxSamples:x,samples:S}}function Mo(e){let t=this,n=null,r=0,i=!1,a=!1,o=new Ai,s=new J,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length0&&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=Zo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Xo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?l:0,l,l),c.setRenderTarget(r),p&&c.render(d,a),c.render(e,a)}c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Zo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Xo());let i=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=i;let o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;qo(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,Lo)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;td-No?n-d+No:0),m=4*(this._cubeSize-f);s.envMap.value=e.texture,s.roughness.value=u,s.mipInt.value=d-t,qo(i,p,m,3*f,2*f),r.setRenderTarget(i),r.render(o,Lo),s.envMap.value=i.texture,s.roughness.value=0,s.mipInt.value=d-n,qo(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,Lo)}_blur(e,t,n,r,i){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)}_halfBlur(e,t,n,r,i,a,o){let s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&U(`blur direction must be either latitudinal or longitudinal!`);let l=this._lodMeshes[r];l.material=c;let u=c.uniforms,d=this._sizeLods[n]-1,f=isFinite(i)?Math.PI/(2*d):2*Math.PI/39,p=i/f,m=isFinite(i)?1+Math.floor(3*p):Fo;m>Fo&&H(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Fo}`);let h=[],g=0;for(let e=0;e_-No?r-_+No:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,Lo)}};function Go(e){let t=[],n=[],r=[],i=e,a=e-No+1+Po.length;for(let o=0;oe-No?s=Po[o-e+No-1]:o===0&&(s=0),n.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new Fr;h.setAttribute(`position`,new br(f,3)),h.setAttribute(`uv`,new br(p,2)),h.setAttribute(`faceIndex`,new br(m,1)),r.push(new Ci(h,null)),i>No&&i--}return{lodMeshes:r,sizeLods:t,sigmas:n}}function Ko(e,t,n){let r=new en(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function qo(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Jo(e,t,n){return new pa({name:`PMREMGGXConvolution`,defines:{GGX_SAMPLES:Io,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Qo(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:0,depthTest:!1,depthWrite:!1})}function Yo(e,t,n){let r=new Float32Array(Fo),i=new q(0,1,0);return new pa({name:`SphericalGaussianBlur`,defines:{n:Fo,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Qo(),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:0,depthTest:!1,depthWrite:!1})}function Xo(){return new pa({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:Qo(),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:0,depthTest:!1,depthWrite:!1})}function Zo(){return new pa({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Qo(),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:0,depthTest:!1,depthWrite:!1})}function Qo(){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 ); + + } + `}var $o=class extends en{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Yi(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}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;let n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new ea(5,5,5),i=new pa({name:`CubemapFromEquirect`,uniforms:aa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new Ci(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=v),new $a(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}};function es(e){let t=new WeakMap,n=new WeakMap,r=null;function i(e,t=!1){return e==null?null:t?o(e):a(e)}function a(n){if(n&&n.isTexture){let r=n.mapping;if(r===303||r===304){if(t.has(n)){let e=t.get(n).texture;return s(e,n.mapping)}{let r=n.image;if(r&&r.height>0){let i=new $o(r.height);return i.fromEquirectangularTexture(e,n),t.set(n,i),n.addEventListener(`dispose`,l),s(i.texture,n.mapping)}return null}}}return n}function o(t){if(t&&t.isTexture){let i=t.mapping,a=i===303||i===304,o=i===301||i===302;if(a||o){let i=n.get(t),s=i===void 0?0:i.texture.pmremVersion;if(t.isRenderTargetTexture&&t.pmremVersion!==s)return r===null&&(r=new Wo(e)),i=a?r.fromEquirectangular(t,i):r.fromCubemap(t,i),i.texture.pmremVersion=t.pmremVersion,n.set(t,i),i.texture;if(i!==void 0)return i.texture;{let s=t.image;return a&&s&&s.height>0||o&&s&&c(s)?(r===null&&(r=new Wo(e)),i=a?r.fromEquirectangular(t):r.fromCubemap(t),i.texture.pmremVersion=t.pmremVersion,n.set(t,i),t.addEventListener(`dispose`,u),i.texture):null}}}return t}function s(e,t){return t===303?e.mapping=301:t===304&&(e.mapping=302),e}function c(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function l(e){let n=e.target;n.removeEventListener(`dispose`,l);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function u(e){let t=e.target;t.removeEventListener(`dispose`,u);let r=n.get(t);r!==void 0&&(n.delete(t),r.dispose())}function d(){t=new WeakMap,n=new WeakMap,r!==null&&(r.dispose(),r=null)}return{get:i,dispose:d}}function ts(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r=e.getExtension(n);return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&ot(`WebGLRenderer: `+e+` extension not supported.`),t}}}function ns(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(i===void 0)return;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;t=65535?Sr:xr)(n,1);s.version=o;let c=a.get(e);c&&t.remove(c),a.set(e,s)}function u(e){let t=a.get(e);if(t){let n=e.index;n!==null&&t.versiont.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new tn(h,p,m,u);g.type=D,g.needsUpdate=!0;let _=f*4;for(let t=0;t + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),u=new Ci(c,l),d=new qa(-1,1,1,-1,0,1),f=null,p=null,m=!1,h,g=null,_=[],v=!1;this.setSize=function(e,t){o.setSize(e,t),s.setSize(e,t);for(let n=0;n<_.length;n++){let r=_[n];r.setSize&&r.setSize(e,t)}},this.setEffects=function(e){_=e,v=_.length>0&&_[0].isRenderPass===!0;let t=o.width,n=o.height;for(let e=0;e<_.length;e++){let r=_[e];r.setSize&&r.setSize(t,n)}},this.begin=function(e,t){if(m||e.toneMapping===0&&_.length===0)return!1;if(g=t,t!==null){let e=t.width,n=t.height;(o.width!==e||o.height!==n)&&this.setSize(e,n)}return v===!1&&e.setRenderTarget(o),h=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return v},this.end=function(e,t){e.toneMapping=h,m=!0;let n=o,r=s;for(let i=0;i<_.length;i++){let a=_[i];if(a.enabled!==!1&&(a.render(e,r,n,t),a.needsSwap!==!1)){let e=n;n=r,r=e}}if(f!==e.outputColorSpace||p!==e.toneMapping){f=e.outputColorSpace,p=e.toneMapping,l.defines={},Y.getTransfer(f)===`srgb`&&(l.defines.SRGB_TRANSFER=``);let t=ss[p];t&&(l.defines[t]=``),l.needsUpdate=!0}l.uniforms.tDiffuse.value=n.texture,e.setRenderTarget(g),e.render(u,d),g=null,m=!1},this.isCompositing=function(){return m},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),s.dispose(),c.dispose(),l.dispose()}}var ls=new Zt,us=new Zi(1,1),ds=new tn,fs=new nn,ps=new Yi,ms=[],hs=[],gs=new Float32Array(16),_s=new Float32Array(9),vs=new Float32Array(4);function ys(e,t,n){let r=e[0];if(r<=0||r>0)return e;let i=t*n,a=ms[i];if(a===void 0&&(a=new Float32Array(i),ms[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function bs(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n0&&(this.seq=r.concat(i))}setValue(e,t,n,r){let i=this.map[t];i!==void 0&&i.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let i=0,a=t.length;i!==a;++i){let a=t[i],o=n[a.id];o.needsUpdate!==!1&&a.setValue(e,o.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,i=e.length;r!==i;++r){let i=e[r];i.id in t&&n.push(i)}return n}};function gc(e,t,n){let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var _c=37297,vc=0;function yc(e,t){let n=e.split(` +`),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=i;e`:` `} ${i}: ${n[e]}`)}return r.join(` +`)}var bc=new J;function xc(e){Y._getMatrix(bc,Y.workingColorSpace,e);let t=`mat3( ${bc.elements.map(e=>e.toFixed(4))} )`;switch(Y.getTransfer(e)){case Ye:return[t,`LinearTransferOETF`];case Xe:return[t,`sRGBTransferOETF`];default:return H(`WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function Sc(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||``).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` + +`+i+` + +`+yc(e.getShaderSource(t),r)}return i}function Cc(e,t){let n=xc(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` +`)}var wc={1:`Linear`,2:`Reinhard`,3:`Cineon`,4:`ACESFilmic`,6:`AgX`,7:`Neutral`,5:`Custom`};function Tc(e,t){let n=wc[t];return n===void 0?(H(`WebGLProgram: Unsupported toneMapping:`,t),`vec3 `+e+`( vec3 color ) { return LinearToneMapping( color ); }`):`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var Ec=new q;function Dc(){return Y.getLuminanceCoefficients(Ec),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${Ec.x.toFixed(4)}, ${Ec.y.toFixed(4)}, ${Ec.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` +`)}function Oc(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(jc).join(` +`)}function kc(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` +`)}function Ac(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function Fc(e){return e.replace(Pc,Lc)}var Ic=new Map;function Lc(e,t){let n=Z[t];if(n===void 0){let e=Ic.get(t);if(e!==void 0)n=Z[e],H(`WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`THREE.WebGLProgram: Can not resolve #include <`+t+`>`)}return Fc(n)}var Rc=/#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 zc(e){return e.replace(Rc,Bc)}function Bc(e,t,n,r){let i=``;for(let e=parseInt(t);e0&&(g+=` +`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(jc).join(` +`),_.length>0&&(_+=` +`)):(g=[Vc(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexNormals?`#define HAS_NORMAL`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGARITHMIC_DEPTH_BUFFER`:``,n.reversedDepthBuffer?`#define USE_REVERSED_DEPTH_BUFFER`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` +`].filter(jc).join(` +`),_=[Vc(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.packedNormalMap?`#define USE_PACKED_NORMALMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor?`#define USE_COLOR`:``,n.vertexAlphas||n.batchingColor?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.numLightProbeGrids>0?`#define USE_LIGHT_PROBES_GRID`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGARITHMIC_DEPTH_BUFFER`:``,n.reversedDepthBuffer?`#define USE_REVERSED_DEPTH_BUFFER`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:Z.tonemapping_pars_fragment,n.toneMapping===0?``:Tc(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,Z.colorspace_pars_fragment,Cc(`linearToOutputTexel`,n.outputColorSpace),Dc(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` +`].filter(jc).join(` +`)),o=Fc(o),o=Mc(o,n),o=Nc(o,n),s=Fc(s),s=Mc(s,n),s=Nc(s,n),o=zc(o),s=zc(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es +`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` +`)+` +`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#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(` +`)+` +`+_);let y=v+g+o,b=v+_+s,x=gc(i,i.VERTEX_SHADER,y),S=gc(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.hasPositionAttribute===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h)||``,r=i.getShaderInfoLog(x)||``,a=i.getShaderInfoLog(S)||``,o=n.trim(),s=r.trim(),c=a.trim(),l=!0,u=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1){if(l=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=Sc(i,x,`vertex`),n=Sc(i,S,`fragment`);U(`WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` + +Material Name: `+t.name+` +Material Type: `+t.type+` + +Program Info Log: `+o+` +`+e+` +`+n)}}else o===``?(s===``||c===``)&&(u=!1):H(`WebGLProgram: Program Info Log:`,o);u&&(t.diagnostics={runnable:l,programLog:o,vertexShader:{log:s,prefix:g},fragmentShader:{log:c,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new hc(i,h),T=Ac(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,_c)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=vc++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var Qc=0,$c=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new el(e),t.set(e,n)),n}},el=class{constructor(e){this.id=Qc++,this.code=e,this.usedTimes=0}};function tl(e){return e===1030||e===37490||e===36285}function nl(e,t,n,r,i,a){let o=new hn,s=new $c,c=new Set,l=[],u=new Map,d=r.logarithmicDepthBuffer,f=r.precision,p={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distance`,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 m(e){return c.add(e),e===0?`uv`:`uv${e}`}function h(i,o,l,u,h,g){let _=u.fog,v=h.geometry,y=i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial?u.environment:null,b=i.isMeshStandardMaterial||i.isMeshLambertMaterial&&!i.envMap||i.isMeshPhongMaterial&&!i.envMap,x=t.get(i.envMap||y,b),S=x&&x.mapping===306?x.image.height:null,C=p[i.type];i.precision!==null&&(f=r.getMaxPrecision(i.precision),f!==i.precision&&H(`WebGLProgram.getParameters:`,i.precision,`not supported, using`,f,`instead.`));let w=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,T=w===void 0?0:w.length,E=0;v.morphAttributes.position!==void 0&&(E=1),v.morphAttributes.normal!==void 0&&(E=2),v.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=wo[C];D=e.vertexShader,O=e.fragmentShader}else{D=i.vertexShader,O=i.fragmentShader;let e=s.getVertexShaderStage(i),t=s.getFragmentShaderStage(i);s.update(i,e,t),k=e.id,A=t.id}let ee=e.getRenderTarget(),j=e.state.buffers.depth.getReversed(),M=h.isInstancedMesh===!0,te=h.isBatchedMesh===!0,N=!!i.map,ne=!!i.matcap,re=!!x,ie=!!i.aoMap,ae=!!i.lightMap,oe=!!i.bumpMap&&i.wireframe===!1,se=!!i.normalMap,ce=!!i.displacementMap,le=!!i.emissiveMap,P=!!i.metalnessMap,F=!!i.roughnessMap,ue=i.anisotropy>0,de=i.clearcoat>0,fe=i.dispersion>0,pe=i.iridescence>0,me=i.sheen>0,he=i.transmission>0,ge=ue&&!!i.anisotropyMap,_e=de&&!!i.clearcoatMap,ve=de&&!!i.clearcoatNormalMap,ye=de&&!!i.clearcoatRoughnessMap,be=pe&&!!i.iridescenceMap,xe=pe&&!!i.iridescenceThicknessMap,Se=me&&!!i.sheenColorMap,Ce=me&&!!i.sheenRoughnessMap,we=!!i.specularMap,Te=!!i.specularColorMap,Ee=!!i.specularIntensityMap,De=he&&!!i.transmissionMap,Oe=he&&!!i.thicknessMap,ke=!!i.gradientMap,Ae=!!i.alphaMap,je=i.alphaTest>0,Me=!!i.alphaHash,I=!!i.extensions,Ne=0;i.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(Ne=e.toneMapping);let L={shaderID:C,shaderType:i.type,shaderName:i.name,vertexShader:D,fragmentShader:O,defines:i.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:i.isRawShaderMaterial===!0,glslVersion:i.glslVersion,precision:f,batching:te,batchingColor:te&&h._colorsTexture!==null,instancing:M,instancingColor:M&&h.instanceColor!==null,instancingMorph:M&&h.morphTexture!==null,outputColorSpace:ee===null?e.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:Y.workingColorSpace,alphaToCoverage:!!i.alphaToCoverage,map:N,matcap:ne,envMap:re,envMapMode:re&&x.mapping,envMapCubeUVHeight:S,aoMap:ie,lightMap:ae,bumpMap:oe,normalMap:se,displacementMap:ce,emissiveMap:le,normalMapObjectSpace:se&&i.normalMapType===1,normalMapTangentSpace:se&&i.normalMapType===0,packedNormalMap:se&&i.normalMapType===0&&tl(i.normalMap.format),metalnessMap:P,roughnessMap:F,anisotropy:ue,anisotropyMap:ge,clearcoat:de,clearcoatMap:_e,clearcoatNormalMap:ve,clearcoatRoughnessMap:ye,dispersion:fe,iridescence:pe,iridescenceMap:be,iridescenceThicknessMap:xe,sheen:me,sheenColorMap:Se,sheenRoughnessMap:Ce,specularMap:we,specularColorMap:Te,specularIntensityMap:Ee,transmission:he,transmissionMap:De,thicknessMap:Oe,gradientMap:ke,opaque:i.transparent===!1&&i.blending===1&&i.alphaToCoverage===!1,alphaMap:Ae,alphaTest:je,alphaHash:Me,combine:i.combine,mapUv:N&&m(i.map.channel),aoMapUv:ie&&m(i.aoMap.channel),lightMapUv:ae&&m(i.lightMap.channel),bumpMapUv:oe&&m(i.bumpMap.channel),normalMapUv:se&&m(i.normalMap.channel),displacementMapUv:ce&&m(i.displacementMap.channel),emissiveMapUv:le&&m(i.emissiveMap.channel),metalnessMapUv:P&&m(i.metalnessMap.channel),roughnessMapUv:F&&m(i.roughnessMap.channel),anisotropyMapUv:ge&&m(i.anisotropyMap.channel),clearcoatMapUv:_e&&m(i.clearcoatMap.channel),clearcoatNormalMapUv:ve&&m(i.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ye&&m(i.clearcoatRoughnessMap.channel),iridescenceMapUv:be&&m(i.iridescenceMap.channel),iridescenceThicknessMapUv:xe&&m(i.iridescenceThicknessMap.channel),sheenColorMapUv:Se&&m(i.sheenColorMap.channel),sheenRoughnessMapUv:Ce&&m(i.sheenRoughnessMap.channel),specularMapUv:we&&m(i.specularMap.channel),specularColorMapUv:Te&&m(i.specularColorMap.channel),specularIntensityMapUv:Ee&&m(i.specularIntensityMap.channel),transmissionMapUv:De&&m(i.transmissionMap.channel),thicknessMapUv:Oe&&m(i.thicknessMap.channel),alphaMapUv:Ae&&m(i.alphaMap.channel),vertexTangents:!!v.attributes.tangent&&(se||ue),vertexNormals:!!v.attributes.normal,vertexColors:i.vertexColors,vertexAlphas:i.vertexColors===!0&&!!v.attributes.color&&v.attributes.color.itemSize===4,pointsUvs:h.isPoints===!0&&!!v.attributes.uv&&(N||Ae),fog:!!_,useFog:i.fog===!0,fogExp2:!!_&&_.isFogExp2,flatShading:i.wireframe===!1&&(i.flatShading===!0||v.attributes.normal===void 0&&se===!1&&(i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshPhysicalMaterial)),sizeAttenuation:i.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:j,skinning:h.isSkinnedMesh===!0,hasPositionAttribute:v.attributes.position!==void 0,morphTargets:v.morphAttributes.position!==void 0,morphNormals:v.morphAttributes.normal!==void 0,morphColors:v.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numLightProbeGrids:g.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.length>0,shadowMapType:e.shadowMap.type,toneMapping:Ne,decodeVideoTexture:N&&i.map.isVideoTexture===!0&&Y.getTransfer(i.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:le&&i.emissiveMap.isVideoTexture===!0&&Y.getTransfer(i.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:i.premultipliedAlpha,doubleSided:i.side===2,flipSided:i.side===1,useDepthPacking:i.depthPacking>=0,depthPacking:i.depthPacking||0,index0AttributeName:i.index0AttributeName,extensionClipCullDistance:I&&i.extensions.clipCullDistance===!0&&n.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(I&&i.extensions.multiDraw===!0||te)&&n.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:n.has(`KHR_parallel_shader_compile`),customProgramCacheKey:i.customProgramCacheKey()};return L.vertexUv1s=c.has(1),L.vertexUv2s=c.has(2),L.vertexUv3s=c.has(3),c.clear(),L}function g(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(_(n,t),v(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function _(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function v(e,t){o.disableAll(),t.instancing&&o.enable(0),t.instancingColor&&o.enable(1),t.instancingMorph&&o.enable(2),t.matcap&&o.enable(3),t.envMap&&o.enable(4),t.normalMapObjectSpace&&o.enable(5),t.normalMapTangentSpace&&o.enable(6),t.clearcoat&&o.enable(7),t.iridescence&&o.enable(8),t.alphaTest&&o.enable(9),t.vertexColors&&o.enable(10),t.vertexAlphas&&o.enable(11),t.vertexUv1s&&o.enable(12),t.vertexUv2s&&o.enable(13),t.vertexUv3s&&o.enable(14),t.vertexTangents&&o.enable(15),t.anisotropy&&o.enable(16),t.alphaHash&&o.enable(17),t.batching&&o.enable(18),t.dispersion&&o.enable(19),t.batchingColor&&o.enable(20),t.gradientMap&&o.enable(21),t.packedNormalMap&&o.enable(22),t.vertexNormals&&o.enable(23),e.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.reversedDepthBuffer&&o.enable(4),t.skinning&&o.enable(5),t.morphTargets&&o.enable(6),t.morphNormals&&o.enable(7),t.morphColors&&o.enable(8),t.premultipliedAlpha&&o.enable(9),t.shadowMapEnabled&&o.enable(10),t.doubleSided&&o.enable(11),t.flipSided&&o.enable(12),t.useDepthPacking&&o.enable(13),t.dithering&&o.enable(14),t.transmission&&o.enable(15),t.sheen&&o.enable(16),t.opaque&&o.enable(17),t.pointsUvs&&o.enable(18),t.decodeVideoTexture&&o.enable(19),t.decodeVideoTextureEmissive&&o.enable(20),t.alphaToCoverage&&o.enable(21),t.numLightProbeGrids>0&&o.enable(22),t.hasPositionAttribute&&o.enable(23),e.push(o.mask)}function y(e){let t=p[e.type],n;if(t){let e=wo[t];n=ua.clone(e.uniforms)}else n=e.uniforms;return n}function b(t,n){let r=u.get(n);return r===void 0?(r=new Zc(e,n,t,i),l.push(r),u.set(n,r)):++r.usedTimes,r}function x(e){if(--e.usedTimes===0){let t=l.indexOf(e);l[t]=l[l.length-1],l.pop(),u.delete(e.cacheKey),e.destroy()}}function S(e){s.remove(e)}function C(){s.dispose()}return{getParameters:h,getProgramCacheKey:g,getUniforms:y,acquireProgram:b,releaseProgram:x,releaseShaderCache:S,programs:l,dispose:C}}function rl(){let e=new WeakMap;function t(t){return e.has(t)}function n(t){let n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function r(t){e.delete(t)}function i(t,n,r){e.get(t)[n]=r}function a(){e=new WeakMap}return{has:t,get:n,remove:r,update:i,dispose:a}}function il(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.material.id===t.material.id?e.materialVariant===t.materialVariant?e.z===t.z?e.id-t.id:e.z-t.z:e.materialVariant-t.materialVariant:e.material.id-t.material.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function al(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function ol(){let e=[],t=0,n=[],r=[],i=[];function a(){t=0,n.length=0,r.length=0,i.length=0}function o(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function s(n,r,i,a,s,c){let l=e[t];return l===void 0?(l={id:n.id,object:n,geometry:r,material:i,materialVariant:o(n),groupOrder:a,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.materialVariant=o(n),l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}function c(e,t,a,o,c,l){let u=s(e,t,a,o,c,l);a.transmission>0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function l(e,t,a,o,c,l){let u=s(e,t,a,o,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function u(e,t,a){n.length>1&&n.sort(e||il),r.length>1&&r.sort(t||al),i.length>1&&i.sort(t||al),a&&(n.reverse(),r.reverse(),i.reverse())}function d(){for(let n=t,r=e.length;n=r.length?(i=new ol,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function cl(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new q,color:new X};break;case`SpotLight`:n={position:new q,direction:new q,color:new X,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new q,color:new X,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new q,skyColor:new X,groundColor:new X};break;case`RectAreaLight`:n={color:new X,position:new q,halfWidth:new q,halfHeight:new q}}return e[t.id]=n,n}}}function ll(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}var ul=0;function dl(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function fl(e){let t=new cl,n=ll(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new q);let i=new q,a=new rn,o=new rn;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(dl);for(let e=0,y=i.length;e0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=Q.LTC_FLOAT_1,r.rectAreaLTC2=Q.LTC_FLOAT_2):(r.rectAreaLTC1=Q.LTC_HALF_1,r.rectAreaLTC2=Q.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=ul++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new pl(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var hl=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,gl=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,_l=[new q(1,0,0),new q(-1,0,0),new q(0,1,0),new q(0,-1,0),new q(0,0,1),new q(0,0,-1)],vl=[new q(0,-1,0),new q(0,-1,0),new q(0,0,1),new q(0,0,-1),new q(0,-1,0),new q(0,-1,0)],yl=new rn,bl=new q,xl=new q;function Sl(e,t,n){let r=new Pi,i=new K,a=new K,o=new Qt,s=new ga,c=new _a,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new pa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:hl,fragmentShader:gl}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new Fr;m.setAttribute(`position`,new br(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new Ci(m,f),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let y=this.type;this.render=function(t,n,s){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||t.length===0)return;this.type===2&&(H(`WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead.`),this.type=1);let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.depth.getReversed()===!0?f.buffers.color.setClear(0,0,0,0):f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=y!==this.type;p&&n.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let c=0,l=t.length;cu||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/m.x),i.x=a.x*m.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/m.y),i.y=a.y*m.y,d.mapSize.y=a.y));let g=e.state.buffers.depth.getReversed();if(d.camera._reversedDepth=g,d.map===null||p===!0){if(d.map!==null&&(d.map.depthTexture!==null&&(d.map.depthTexture.dispose(),d.map.depthTexture=null),d.map.dispose()),this.type===3){if(l.isPointLight){H(`WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.`);continue}d.map=new en(i.x,i.y,{format:se,type:O,minFilter:v,magFilter:v,generateMipmaps:!1}),d.map.texture.name=l.name+`.shadowMap`,d.map.depthTexture=new Zi(i.x,i.y,D),d.map.depthTexture.name=l.name+`.shadowMapDepth`,d.map.depthTexture.format=re,d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=h,d.map.depthTexture.magFilter=h}else l.isPointLight?(d.map=new $o(i.x),d.map.depthTexture=new Qi(i.x,E)):(d.map=new en(i.x,i.y),d.map.depthTexture=new Zi(i.x,i.y,E)),d.map.depthTexture.name=l.name+`.shadowMap`,d.map.depthTexture.format=re,this.type===1?(d.map.depthTexture.compareFunction=g?518:515,d.map.depthTexture.minFilter=v,d.map.depthTexture.magFilter=v):(d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=h,d.map.depthTexture.magFilter=h);d.camera.updateProjectionMatrix()}let _=d.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t<_;t++){if(d.map.isWebGLCubeRenderTarget)e.setRenderTarget(d.map,t),e.clear();else{t===0&&(e.setRenderTarget(d.map),e.clear());let n=d.getViewport(t);o.set(a.x*n.x,a.y*n.y,a.x*n.z,a.y*n.w),f.viewport(o)}if(l.isPointLight){let e=d.camera,n=d.matrix,r=l.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),bl.setFromMatrixPosition(l.matrixWorld),e.position.copy(bl),xl.copy(e.position),xl.add(_l[t]),e.up.copy(vl[t]),e.lookAt(xl),e.updateMatrixWorld(),n.makeTranslation(-bl.x,-bl.y,-bl.z),yl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),d._frustum.setFromProjectionMatrix(yl,e.coordinateSystem,e.reversedDepth)}else d.updateMatrices(l);r=d.getFrustum(),S(n,s,d.camera,l,this.type)}d.isPointLightShadow!==!0&&this.type===3&&b(d,s),d.needsUpdate=!1}y=this.type,_.needsUpdate=!1,e.setRenderTarget(c,l,d)};function b(n,r){let a=t.update(g);f.defines.VSM_SAMPLES!==n.blurSamples&&(f.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),n.mapPass===null&&(n.mapPass=new en(i.x,i.y,{format:se,type:O})),f.uniforms.shadow_pass.value=n.map.depthTexture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,f,g,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,p,g,null)}function x(t,n,r,i){let a=null,o=r.isPointLight===!0?t.customDistanceMaterial:t.customDepthMaterial;if(o!==void 0)a=o;else if(a=r.isPointLight===!0?c:s,e.localClippingEnabled&&n.clipShadows===!0&&Array.isArray(n.clippingPlanes)&&n.clippingPlanes.length!==0||n.displacementMap&&n.displacementScale!==0||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,C)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function S(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l=2):(te=parseFloat(/^WebGL (\d)/.exec(N)[1]),M=te>=1);let ne=null,re={},ie=e.getParameter(e.SCISSOR_BOX),ae=e.getParameter(e.VIEWPORT),oe=new Qt().fromArray(ie),se=new Qt().fromArray(ae);function ce(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new K,u=new WeakMap,d=new Set,x,S=new WeakMap,C=!1;try{C=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function w(e,t){return C?new OffscreenCanvas(e,t):V(`canvas`)}function T(e,t,n){let r=1,i=L(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);x===void 0&&(x=w(n,a));let o=t?w(n,a):x;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),H(`WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}return`data`in e&&H(`WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e}return e}function E(e){return e.generateMipmaps}function D(t){e.generateMipmap(t)}function O(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function k(n,r,i,a,o,s=!1){if(n!==null){if(e[n]!==void 0)return e[n];H(`WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let c;a&&(c=t.get(`EXT_texture_norm16`),c||H(`WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension`));let l=r;if(r===e.RED&&(i===e.FLOAT&&(l=e.R32F),i===e.HALF_FLOAT&&(l=e.R16F),i===e.UNSIGNED_BYTE&&(l=e.R8),i===e.UNSIGNED_SHORT&&c&&(l=c.R16_EXT),i===e.SHORT&&c&&(l=c.R16_SNORM_EXT)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.R8UI),i===e.UNSIGNED_SHORT&&(l=e.R16UI),i===e.UNSIGNED_INT&&(l=e.R32UI),i===e.BYTE&&(l=e.R8I),i===e.SHORT&&(l=e.R16I),i===e.INT&&(l=e.R32I)),r===e.RG&&(i===e.FLOAT&&(l=e.RG32F),i===e.HALF_FLOAT&&(l=e.RG16F),i===e.UNSIGNED_BYTE&&(l=e.RG8),i===e.UNSIGNED_SHORT&&c&&(l=c.RG16_EXT),i===e.SHORT&&c&&(l=c.RG16_SNORM_EXT)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RG8UI),i===e.UNSIGNED_SHORT&&(l=e.RG16UI),i===e.UNSIGNED_INT&&(l=e.RG32UI),i===e.BYTE&&(l=e.RG8I),i===e.SHORT&&(l=e.RG16I),i===e.INT&&(l=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RGB8UI),i===e.UNSIGNED_SHORT&&(l=e.RGB16UI),i===e.UNSIGNED_INT&&(l=e.RGB32UI),i===e.BYTE&&(l=e.RGB8I),i===e.SHORT&&(l=e.RGB16I),i===e.INT&&(l=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(l=e.RGBA16UI),i===e.UNSIGNED_INT&&(l=e.RGBA32UI),i===e.BYTE&&(l=e.RGBA8I),i===e.SHORT&&(l=e.RGBA16I),i===e.INT&&(l=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_SHORT&&c&&(l=c.RGB16_EXT),i===e.SHORT&&c&&(l=c.RGB16_SNORM_EXT),i===e.UNSIGNED_INT_5_9_9_9_REV&&(l=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(l=e.R11F_G11F_B10F)),r===e.RGBA){let t=s?Ye:Y.getTransfer(o);i===e.FLOAT&&(l=e.RGBA32F),i===e.HALF_FLOAT&&(l=e.RGBA16F),i===e.UNSIGNED_BYTE&&(l=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT&&c&&(l=c.RGBA16_EXT),i===e.SHORT&&c&&(l=c.RGBA16_SNORM_EXT),i===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)}return(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),l}function A(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,H(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function ee(e,t){return E(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function j(e){let t=e.target;t.removeEventListener(`dispose`,j),te(t),t.isVideoTexture&&u.delete(t),t.isHTMLTexture&&d.delete(t)}function M(e){let t=e.target;t.removeEventListener(`dispose`,M),ne(t)}function te(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=S.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&N(e),Object.keys(i).length===0&&S.delete(n)}r.remove(e)}function N(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=S.get(i);delete a[n.__cacheKey],o.memory.textures--}function ne(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r=i.maxTextures&&H(`WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),re+=1,e}function le(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function P(t,i){let a=r.get(t);if(t.isVideoTexture&&I(t),t.isRenderTargetTexture===!1&&t.isExternalTexture!==!0&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)H(`WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)H(`WebGLRenderer: Texture marked for update but image is incomplete`);else{ye(a,t,i);return}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function F(t,i){let a=r.get(t);if(t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){ye(a,t,i);return}t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function ue(t,i){let a=r.get(t);if(t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){ye(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function de(t,i){let a=r.get(t);if(t.isCubeDepthTexture!==!0&&t.version>0&&a.__version!==t.version){be(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let fe={[f]:e.REPEAT,[p]:e.CLAMP_TO_EDGE,[m]:e.MIRRORED_REPEAT},pe={[h]:e.NEAREST,[g]:e.NEAREST_MIPMAP_NEAREST,[_]:e.NEAREST_MIPMAP_LINEAR,[v]:e.LINEAR,[y]:e.LINEAR_MIPMAP_NEAREST,[b]:e.LINEAR_MIPMAP_LINEAR},me={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function he(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&H(`WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,fe[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,fe[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,fe[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,pe[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,pe[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,me[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function ge(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,j));let i=n.source,a=S.get(i);a===void 0&&(a={},S.set(i,a));let s=le(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&N(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function _e(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ve(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e0){_&&v&&n.texStorage2D(e.TEXTURE_2D,b,m,g[0].width,g[0].height);for(let t=0,i=g.length;t0){let t=bo(h.width,h.height,o.format,o.type);for(let a of o.layerUpdates){let o=h.data.subarray(a*t/h.data.BYTES_PER_ELEMENT,(a+1)*t/h.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,a,h.width,h.height,1,r,o)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,h.width,h.height,t.depth,r,h.data)}}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,i,m,h.width,h.height,t.depth,0,h.data,0,0)}else H(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`)}else _?y&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,h.width,h.height,t.depth,r,p,h.data):n.texImage3D(e.TEXTURE_2D_ARRAY,i,m,h.width,h.height,t.depth,0,r,p,h.data)}else{_&&v&&n.texStorage2D(e.TEXTURE_2D,b,m,g[0].width,g[0].height);for(let t=0,i=g.length;t0){let i=bo(t.width,t.height,o.format,o.type);for(let a of o.layerUpdates){let o=t.data.subarray(a*i/t.data.BYTES_PER_ELEMENT,(a+1)*i/t.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,a,t.width,t.height,1,r,p,o)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)}}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,m,t.width,t.height,t.depth,0,r,p,t.data)}else if(o.isData3DTexture)_?(v&&n.texStorage3D(e.TEXTURE_3D,b,m,t.width,t.height,t.depth),y&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)):n.texImage3D(e.TEXTURE_3D,0,m,t.width,t.height,t.depth,0,r,p,t.data);else if(o.isFramebufferTexture){if(v){if(_)n.texStorage2D(e.TEXTURE_2D,b,m,t.width,t.height);else{let i=t.width,a=t.height;for(let t=0;t>=1,a>>=1}}}else if(o.isHTMLTexture){if(`texElementImage2D`in e){let n=e.canvas;if(n.hasAttribute(`layoutsubtree`)||n.setAttribute(`layoutsubtree`,`true`),t.parentNode!==n){n.appendChild(t),d.add(o),n.onpaint=e=>{let t=e.changedElements;for(let e of d)t.includes(e.image)&&(e.needsUpdate=!0)},n.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,t);else{let n=e.RGBA,r=e.RGBA,i=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,0,n,r,i,t)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(g.length>0){if(_&&v){let t=L(g[0]);n.texStorage2D(e.TEXTURE_2D,b,m,t.width,t.height)}for(let t=0,i=g.length;t0&&S++;let t=L(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,S,v,t.width,t.height)}for(let t=0;t<6;t++)if(p){y?x&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,g,_,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,v,m[t].width,m[t].height,0,g,_,m[t].data);for(let r=0;r>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),Me(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,je(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function Se(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=A(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;Me(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,je(n),o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,je(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)for(let e=0;e<6;e++)Ce(i.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?Ce(i.__webglFramebuffer[0],t,0):Ce(i.__webglFramebuffer,t,0)}}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),Se(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),Se(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function Te(t,n,i){let a=r.get(t);n!==void 0&&xe(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&we(t)}function Ee(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,M);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n0){s.__webglFramebuffer=[];for(let t=0;t0&&Me(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(Me(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function I(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function Ne(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(Y.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&H(`WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):U(`WebGLTextures: Unsupported texture color space:`,n)),t}function L(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=ce,this.resetTextureUnits=ae,this.getTextureUnits=oe,this.setTextureUnits=se,this.setTexture2D=P,this.setTexture2DArray=F,this.setTexture3D=ue,this.setTextureCube=de,this.rebindTextures=Te,this.setupRenderTarget=Ee,this.updateRenderTargetMipmap=De,this.updateMultisampleRenderTarget=Ae,this.setupDepthRenderbuffer=we,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=Me,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function Tl(e,t){function n(n,r=``){let i,a=Y.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===35899)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779){if(a===`srgb`){if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null}else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null}if(n===35840||n===35841||n===35842||n===35843){if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null}if(n===36196||n===37492||n===37496||n===37488||n===37489||n===37490||n===37491){if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC;if(n===37488)return i.COMPRESSED_R11_EAC;if(n===37489)return i.COMPRESSED_SIGNED_R11_EAC;if(n===37490)return i.COMPRESSED_RG11_EAC;if(n===37491)return i.COMPRESSED_SIGNED_RG11_EAC}else return null}if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821){if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null}if(n===36492||n===36494||n===36495){if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null}if(n===36283||n===36284||n===36285||n===36286){if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36283)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null}return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var El=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,Dl=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`,Ol=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new $i(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new pa({vertexShader:El,fragmentShader:Dl,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ci(new ra(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},kl=class extends lt{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new Ol,g={},_=t.getContextAttributes(),v=null,y=null,b=[],S=[],C=new K,w=null,T=new Ka;T.viewport=new Qt;let D=new Ka;D.viewport=new Qt;let O=[T,D],k=new eo,A=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new Pn,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new Pn,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new Pn,b[e]=t),t.getHandSpace()};function M(e){let t=S.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function te(){r.removeEventListener(`select`,M),r.removeEventListener(`selectstart`,M),r.removeEventListener(`selectend`,M),r.removeEventListener(`squeeze`,M),r.removeEventListener(`squeezestart`,M),r.removeEventListener(`squeezeend`,M),r.removeEventListener(`end`,te),r.removeEventListener(`inputsourceschange`,N);for(let e=0;e=0&&(S[r]=null,b[r].disconnect(n))}for(let t=0;t=S.length){S.push(n),r=e;break}else if(S[e]===null){S[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let ae=new q,oe=new q;function se(e,t,n){ae.setFromMatrixPosition(t.matrixWorld),oe.setFromMatrixPosition(n.matrixWorld);let r=ae.distanceTo(oe),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function ce(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),k.near=D.near=T.near=t,k.far=D.far=T.far=n,(A!==k.near||j!==k.far)&&(r.updateRenderState({depthNear:k.near,depthFar:k.far}),A=k.near,j=k.far),k.layers.mask=e.layers.mask|6,T.layers.mask=k.layers.mask&-5,D.layers.mask=k.layers.mask&-3;let i=e.parent,a=k.cameras;ce(k,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(Al.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&a.isRenderTargetTexture===!1&&e.envMapRotation.value.premultiply(jl),e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function Nl(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(g(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,v));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function _(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?H(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):H(`WebGLRenderer: Unsupported uniform value type.`,e),t}function v(t){let n=t.target;n.removeEventListener(`dispose`,v);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function y(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:y}}var Pl=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Fl=null;function Il(){return Fl===null&&(Fl=new Ei(Pl,16,16,se,O),Fl.name=`DFG_LUT`,Fl.minFilter=v,Fl.magFilter=v,Fl.wrapS=p,Fl.wrapT=p,Fl.generateMipmaps=!1,Fl.needsUpdate=!0),Fl}var Ll=class{constructor(e={}){let{canvas:t=nt(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=x}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);p=n.getContextAttributes().alpha}else p=a;let m=f,h=new Set([le,ce,oe]),g=new Set([x,E,w,ee,k,A]),_=new Uint32Array(4),v=new Int32Array(4),y=new q,S=null,C=null,T=[],D=[],j=null;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.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let M=this,te=!1,N=null,ne=null,re=null,ie=null;this._outputColorSpace=qe;let ae=0,se=0,P=null,F=-1,ue=null,de=new Qt,fe=new Qt,pe=null,me=new X(0),he=0,ge=t.width,_e=t.height,ve=1,ye=null,be=null,xe=new Qt(0,0,ge,_e),Se=new Qt(0,0,ge,_e),Ce=!1,we=new Pi,Te=!1,Ee=!1,De=new rn,Oe=new q,ke=new Qt,Ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},je=!1;function Me(){return P===null?ve:1}let I=n;function Ne(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r185`),t.addEventListener(`webglcontextlost`,rt,!1),t.addEventListener(`webglcontextrestored`,at,!1),t.addEventListener(`webglcontextcreationerror`,ot,!1),I===null){let t=`webgl2`;if(I=Ne(t,e),I===null)throw Ne(t)?Error(`THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.`):Error(`THREE.WebGLRenderer: Error creating WebGL context.`)}}catch(e){throw U(`WebGLRenderer: `+e.message),e}let L,Pe,R,Fe,z,B,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,Je,Ye,Xe,Ze,Qe,et;function tt(){L=new ts(I),L.init(),Ze=new Tl(I,L),Pe=new jo(I,L,e,Ze),R=new Cl(I,L),Pe.reversedDepthBuffer&&d&&R.buffers.depth.setReversed(!0),ne=I.createFramebuffer(),re=I.createFramebuffer(),ie=I.createFramebuffer(),Fe=new is(I),z=new rl,B=new wl(I,L,R,z,Pe,Ze,Fe),Ie=new es(M),Le=new Co(I),Qe=new ko(I,Le),Re=new ns(I,Le,Fe,Qe),ze=new os(I,Re,Le,Qe,Fe),Je=new as(I,Pe,B),We=new Mo(z),Be=new nl(M,Ie,L,Pe,Qe,We),Ve=new Ml(M,z),He=new sl,Ue=new ml(L),Ke=new Oo(M,Ie,R,ze,p,s),Ge=new Sl(M,ze,Pe),et=new Nl(I,Fe,Pe,R),Ye=new Ao(I,L,Fe),Xe=new rs(I,L,Fe),Fe.programs=Be.programs,M.capabilities=Pe,M.extensions=L,M.properties=z,M.renderLists=He,M.shadowMap=Ge,M.state=R,M.info=Fe}tt(),m!==1009&&(j=new cs(m,t.width,t.height,o,r,i));let V=new kl(M,I);this.xr=V,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let e=L.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=L.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return ve},this.setPixelRatio=function(e){e!==void 0&&(ve=e,this.setSize(ge,_e,!1))},this.getSize=function(e){return e.set(ge,_e)},this.setSize=function(e,n,r=!0){if(V.isPresenting){H(`WebGLRenderer: Can't change size while VR device is presenting.`);return}ge=e,_e=n,t.width=Math.floor(e*ve),t.height=Math.floor(n*ve),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),j!==null&&j.setSize(t.width,t.height),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(ge*ve,_e*ve).floor()},this.setDrawingBufferSize=function(e,n,r){ge=e,_e=n,ve=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(m===1009){U(`WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(e){for(let t=0;t{function n(){if(r.forEach(function(e){z.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}L.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let ft=null;function pt(e){ft&&ft(e)}function mt(){ht.stop()}function W(){ht.start()}let ht=new So;ht.setAnimationLoop(pt),typeof self<`u`&&ht.setContext(self),this.setAnimationLoop=function(e){ft=e,V.setAnimationLoop(e),e===null?ht.stop():ht.start()},V.addEventListener(`sessionstart`,mt),V.addEventListener(`sessionend`,W),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){U(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(te===!0)return;N!==null&&N.renderStart(e,t);let n=V.enabled===!0&&V.isPresenting===!0,r=j!==null&&(P===null||n)&&j.begin(M,P);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),V.enabled===!0&&V.isPresenting===!0&&(j===null||j.isCompositing()===!1)&&(V.cameraAutoUpdate===!0&&V.updateCamera(t),t=V.getCamera()),e.isScene===!0&&e.onBeforeRender(M,e,t,P),C=Ue.get(e,D.length),C.init(t),C.state.textureUnits=B.getTextureUnits(),D.push(C),De.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),we.setFromProjectionMatrix(De,$e,t.reversedDepth),Ee=this.localClippingEnabled,Te=We.init(this.clippingPlanes,Ee),S=He.get(e,T.length),S.init(),T.push(S),V.enabled===!0&&V.isPresenting===!0){let e=M.xr.getDepthSensingMesh();e!==null&>(e,t,-1/0,M.sortObjects)}gt(e,t,0,M.sortObjects),S.finish(),M.sortObjects===!0&&S.sort(ye,be,t.reversedDepth),je=V.enabled===!1||V.isPresenting===!1||V.hasDepthSensing()===!1,je&&Ke.addToRenderList(S,e),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Te===!0&&We.beginShadows();let i=C.state.shadowsArray;if(Ge.render(i,e,t),Te===!0&&We.endShadows(),(r&&j.hasRenderPass())===!1){let n=S.opaque,r=S.transmissive;if(C.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t0&&vt(n,r,e,t),je&&Ke.render(e),_t(S,e,t)}P!==null&&se===0&&(B.updateMultisampleRenderTarget(P),B.updateRenderTargetMipmap(P)),r&&j.end(M),e.isScene===!0&&e.onAfterRender(M,e,t),Qe.resetDefaultState(),F=-1,ue=null,D.pop(),D.length>0?(C=D[D.length-1],B.setTextureUnits(C.state.textureUnits),Te===!0&&We.setGlobalState(M.clippingPlanes,C.state.camera)):C=null,T.pop(),S=T.length>0?T[T.length-1]:null,N!==null&&N.renderEnd()};function gt(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLightProbeGrid)C.pushLightProbeGrid(e);else if(e.isLight)C.pushLight(e),e.castShadow&&C.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||we.intersectsSprite(e)){r&&ke.setFromMatrixPosition(e.matrixWorld).applyMatrix4(De);let t=ze.update(e),i=e.material;i.visible&&S.push(e,t,i,n,ke.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||we.intersectsObject(e))){let t=ze.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),ke.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),ke.copy(e.boundingSphere.center)),ke.applyMatrix4(e.matrixWorld).applyMatrix4(De)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&yt(i,t,n),a.length>0&&yt(a,t,n),o.length>0&&yt(o,t,n),R.buffers.depth.setTest(!0),R.buffers.depth.setMask(!0),R.buffers.color.setMask(!0),R.setPolygonOffset(!1)}function vt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(C.state.transmissionRenderTarget[r.id]===void 0){let e=L.has(`EXT_color_buffer_half_float`)||L.has(`EXT_color_buffer_float`);C.state.transmissionRenderTarget[r.id]=new en(1,1,{generateMipmaps:!0,type:e?O:x,minFilter:b,samples:Math.max(4,Pe.samples),stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Y.workingColorSpace})}let a=C.state.transmissionRenderTarget[r.id],o=r.viewport||de;a.setSize(o.z*M.transmissionResolutionScale,o.w*M.transmissionResolutionScale);let s=M.getRenderTarget(),c=M.getActiveCubeFace(),l=M.getActiveMipmapLevel();M.setRenderTarget(a),M.getClearColor(me),he=M.getClearAlpha(),he<1&&M.setClearColor(16777215,.5),M.clear(),je&&Ke.render(n);let u=M.toneMapping;M.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),C.setupLightsView(r),Te===!0&&We.setGlobalState(M.clippingPlanes,r),yt(e,n,r),B.updateMultisampleRenderTarget(a),B.updateRenderTargetMipmap(a),L.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0,r.currentProgram=d,r.uniformsList=null,d}function St(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=hc.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function Ct(e,t){let n=z.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function wt(e,t){if(e.length===0)return null;if(e.length===1)return e[0].texture===null?null:e[0];y.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=0;r.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(h=M.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=z.get(r),y=C.state.lights;if(Te===!0&&(Ee===!0||e!==ue)){let t=e===ue&&r.id===F;We.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?b=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?b=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==We.numPlanes||v.numIntersection!==We.numIntersection)?b=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h&&v.morphTargetsCount===_?!!v.lightProbeGrid!=C.state.lightProbeGridArray.length>0&&(b=!0):b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let x=v.currentProgram;b===!0&&(x=xt(r,t,i),N&&r.isNodeMaterial&&N.onUpdateProgram(r,x,v));let S=!1,w=!1,T=!1,E=x.getUniforms(),D=v.uniforms;if(R.useProgram(x.program)&&(S=!0,w=!0,T=!0),r.id!==F&&(F=r.id,w=!0),v.needsLights){let e=wt(C.state.lightProbeGridArray,i);v.lightProbeGrid!==e&&(v.lightProbeGrid=e,w=!0)}if(S||ue!==e){R.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),E.setValue(I,`projectionMatrix`,e.projectionMatrix),E.setValue(I,`viewMatrix`,e.matrixWorldInverse);let t=E.map.cameraPosition;t!==void 0&&t.setValue(I,Oe.setFromMatrixPosition(e.matrixWorld)),Pe.logarithmicDepthBuffer&&E.setValue(I,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&E.setValue(I,`isOrthographic`,e.isOrthographicCamera===!0),ue!==e&&(ue=e,w=!0,T=!0)}if(v.needsLights&&(y.state.directionalShadowMap.length>0&&E.setValue(I,`directionalShadowMap`,y.state.directionalShadowMap,B),y.state.spotShadowMap.length>0&&E.setValue(I,`spotShadowMap`,y.state.spotShadowMap,B),y.state.pointShadowMap.length>0&&E.setValue(I,`pointShadowMap`,y.state.pointShadowMap,B)),i.isSkinnedMesh){E.setOptional(I,i,`bindMatrix`),E.setOptional(I,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),E.setValue(I,`boneTexture`,e.boneTexture,B))}i.isBatchedMesh&&(E.setOptional(I,i,`batchingTexture`),E.setValue(I,`batchingTexture`,i._matricesTexture,B),E.setOptional(I,i,`batchingIdTexture`),E.setValue(I,`batchingIdTexture`,i._indirectTexture,B),E.setOptional(I,i,`batchingColorTexture`),i._colorsTexture!==null&&E.setValue(I,`batchingColorTexture`,i._colorsTexture,B));let O=n.morphAttributes;if((O.position!==void 0||O.normal!==void 0||O.color!==void 0)&&Je.update(i,n,x),(w||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,E.setValue(I,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(D.envMapIntensity.value=t.environmentIntensity),D.dfgLUT!==void 0&&(D.dfgLUT.value=Il()),w){if(E.setValue(I,`toneMappingExposure`,M.toneMappingExposure),v.needsLights&&Et(D,T),a&&r.fog===!0&&Ve.refreshFogUniforms(D,a),Ve.refreshMaterialUniforms(D,r,ve,_e,C.state.transmissionRenderTarget[e.id]),v.needsLights&&v.lightProbeGrid){let e=v.lightProbeGrid;D.probesSH.value=e.texture,D.probesMin.value.copy(e.boundingBox.min),D.probesMax.value.copy(e.boundingBox.max),D.probesResolution.value.copy(e.resolution)}hc.upload(I,St(v),D,B)}if(r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(hc.upload(I,St(v),D,B),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&E.setValue(I,`center`,i.center),E.setValue(I,`modelViewMatrix`,i.modelViewMatrix),E.setValue(I,`normalMatrix`,i.normalMatrix),E.setValue(I,`modelMatrix`,i.matrixWorld),r.uniformsGroups!==void 0){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&B.useMultisampledRTT(e)===!1?z.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,de.copy(e.viewport),fe.copy(e.scissor),pe=e.scissorTest}else de.copy(xe).multiplyScalar(ve).floor(),fe.copy(Se).multiplyScalar(ve).floor(),pe=Ce;if(n!==0&&(r=ne),R.bindFramebuffer(I.FRAMEBUFFER,r)&&R.drawBuffers(e,r),R.viewport(de),R.scissor(fe),R.setScissorTest(pe),i){let r=z.get(e.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),!Pe.textureFormatReadable(c)){U(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!Pe.textureTypeReadable(l)){U(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&I.readPixels(t,n,r,i,Ze.convert(c),Ze.convert(l),a)}finally{let e=P===null?null:z.get(P).__webglFramebuffer;R.bindFramebuffer(I.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){R.bindFramebuffer(I.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(e.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),!Pe.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!Pe.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.bufferData(I.PIXEL_PACK_BUFFER,a.byteLength,I.STREAM_READ),I.readPixels(t,n,r,i,Ze.convert(l),Ze.convert(u),0);let f=P===null?null:z.get(P).__webglFramebuffer;R.bindFramebuffer(I.FRAMEBUFFER,f);let p=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await st(I,p,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,a),I.deleteBuffer(d),I.deleteSync(p),a}throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)}},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;B.setTexture2D(e,0),I.copyTexSubImage2D(I.TEXTURE_2D,n,0,0,o,s,i,a),R.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ze.convert(t.format),_=Ze.convert(t.type),v;t.isData3DTexture?(B.setTexture3D(t,0),v=I.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(B.setTexture2DArray(t,0),v=I.TEXTURE_2D_ARRAY):(B.setTexture2D(t,0),v=I.TEXTURE_2D),R.activeTexture(I.TEXTURE0),R.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,t.flipY),R.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),R.pixelStorei(I.UNPACK_ALIGNMENT,t.unpackAlignment);let y=R.getParameter(I.UNPACK_ROW_LENGTH),b=R.getParameter(I.UNPACK_IMAGE_HEIGHT),x=R.getParameter(I.UNPACK_SKIP_PIXELS),S=R.getParameter(I.UNPACK_SKIP_ROWS),C=R.getParameter(I.UNPACK_SKIP_IMAGES);R.pixelStorei(I.UNPACK_ROW_LENGTH,h.width),R.pixelStorei(I.UNPACK_IMAGE_HEIGHT,h.height),R.pixelStorei(I.UNPACK_SKIP_PIXELS,l),R.pixelStorei(I.UNPACK_SKIP_ROWS,u),R.pixelStorei(I.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=z.get(e),r=z.get(t),h=z.get(n.__renderTarget),g=z.get(r.__renderTarget);R.bindFramebuffer(I.READ_FRAMEBUFFER,h.__webglFramebuffer),R.bindFramebuffer(I.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=Gl),r<-Math.PI?r+=Gl:r>Math.PI&&(r-=Gl),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(Wl.setFromSpherical(this._spherical),Wl.applyQuaternion(this._quatInverse),t.copy(this.target).add(Wl),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=Wl.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new q(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new q(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=Wl.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(Vl.origin.copy(this.object.position),Vl.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Vl.direction))Kl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Kl||this._lastTargetPosition.distanceToSquared(this.target)>Kl?(this.dispatchEvent(Rl),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?Gl/60/60*this.autoRotateSpeed:Gl/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Wl.setFromMatrixColumn(t,0),Wl.multiplyScalar(-e),this._panOffset.add(Wl)}_panUp(e,t){this.screenSpacePanning===!0?Wl.setFromMatrixColumn(t,1):(Wl.setFromMatrixColumn(t,0),Wl.crossVectors(this.object.up,Wl)),Wl.multiplyScalar(e),this._panOffset.add(Wl)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;Wl.copy(r).sub(this.target);let i=Wl.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Gl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Gl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Gl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Gl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Gl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Gl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Gl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Gl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t`u`?t:getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}function uu(e,t=26){return e.length<=t?e:`${e.slice(0,t-1)}…`}function du(e,t,n){let r=document.createElement(`canvas`);r.width=n.width,r.height=n.height;let i=r.getContext(`2d`);i&&(i.clearRect(0,0,n.width,n.height),i.fillStyle=t,i.font=n.font,i.textAlign=`center`,i.textBaseline=`middle`,i.fillText(e,n.width/2,n.height/2));let a=new Xi(r);a.colorSpace=qe;let o=new ti(new Vr({map:a,transparent:!0,depthTest:!1}));return o.scale.set(n.width*.22,n.height*.22,1),o}function fu(e,t){let n=du(e,t,{width:512,height:64,font:`600 28px sans-serif`});return n.scale.set(110,14,1),n}function pu(e,t){let n=du(uu(e),t,{width:384,height:48,font:`600 22px sans-serif`});return n.scale.set(52,6.5,1),n}function mu(e,t,n,r){return e.weight===`critical`?r:e.weight===`expensive`?n:t}function hu({nodes:t,edges:r,selectedId:s,neighborIds:u,onSelect:d,layout:f=`layers`,nodeRoles:p,testOverlay:m=!1}){let h=(0,l.useRef)(null),g=(0,l.useRef)(null),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(()=>typeof document>`u`?`obsidian`:document.documentElement.dataset.theme||`obsidian`),C=(0,l.useRef)(d);C.current=d;let w=(0,l.useRef)({selectedId:s,neighborIds:u});w.current={selectedId:s,neighborIds:u};let T=(0,l.useRef)({nodeRoles:p,testOverlay:m});T.current={nodeRoles:p,testOverlay:m};let E=(0,l.useRef)(null),D=(0,l.useRef)(!1),O=`${f}|${t.map(e=>e.id).join(`\0`)}|${r.map(e=>e.id).join(`\0`)}`;return(0,l.useEffect)(()=>{let e=document.documentElement,t=new MutationObserver(()=>S(e.dataset.theme||`obsidian`));return t.observe(e,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()},[]),(0,l.useEffect)(()=>{let a=g.current;if(!a)return;let s=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,l=lu(`--graph-bg`,`#0b0f14`),u=lu(`--ink`,`#e8eef7`),d=new X(lu(`--accent`,`#4cc9f0`)),p=new X(lu(`--low`,`#e76f51`)),m=new X(lu(`--high`,`#2a9d8f`)),_=new Vn;_.background=new X(l),_.fog=new Bn(new X(l),520,2800);let y=new Ka(50,1,1,8e3),x;try{x=new Ll({antialias:!0,alpha:!1,failIfMajorPerformanceCaveat:!1,powerPreference:`low-power`})}catch{b(`WebGL is unavailable in this browser, so the 3D view cannot start. Switch back to 2D map.`);return}if(!x.getContext()){x.dispose(),b(`WebGL is unavailable in this browser, so the 3D view cannot start. Switch back to 2D map.`);return}b(null),x.setClearColor(l,1),x.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),x.domElement.dataset.testid=`graph-3d-canvas`,a.appendChild(x.domElement);let S=new ql(y,x.domElement);S.enableDamping=!s,S.dampingFactor=.08,S.minDistance=80,S.maxDistance=2400,_.add(new Pa(16777215,1713203,.55)),_.add(new Xa(16777215,.42));let D=new Ya(16777215,.8);D.position.set(200,320,180),_.add(D);let k=n(t,r,f),A=new Map(t.map(e=>[e.id,e])),ee=new Map,j=new Map,M=new Mn;_.add(M);let te=new ia(1,18,14),N=t.length<=su,ne=[];for(let n of t){let t=k.get(n.id)??{x:0,y:0,z:0},r=e(n.type),i=new Ci(te,new ha({color:c(n.type),roughness:.42,metalness:.08,transparent:!0,opacity:1}));if(i.position.set(t.x,t.y,t.z),i.scale.setScalar(r),i.userData.id=n.id,M.add(i),ee.set(n.id,i),N){let e=pu(n.name,u);e.position.set(t.x,t.y+r+8,t.z),M.add(e),j.set(n.id,e),ne.push(e)}}let re=new X(lu(`--edge-cheap`,`#4a5568`)),ie=new X(lu(`--edge-expensive`,`#f4a261`)),ae=new X(lu(`--edge-critical`,`#e85d04`)),oe=[],se=[],ce=[],le=[],P=[];for(let e of r){let t=k.get(e.src),n=k.get(e.dst);if(!t||!n)continue;let r=mu(e,re,ie,ae),a=i(e),o=r.clone().multiplyScalar(.55);a?(oe.push({edge:e,a:t,b:n,color:r,inferred:a,solidIndex:-1,dashedIndex:le.length/3}),le.push(t.x,t.y,t.z,n.x,n.y,n.z),P.push(o.r,o.g,o.b,r.r,r.g,r.b)):(oe.push({edge:e,a:t,b:n,color:r,inferred:a,solidIndex:se.length/3,dashedIndex:-1}),se.push(t.x,t.y,t.z,n.x,n.y,n.z),ce.push(o.r,o.g,o.b,r.r,r.g,r.b))}let F=new Fr;F.setAttribute(`position`,new Cr(se,3)),F.setAttribute(`color`,new Cr(ce,3));let ue=new qi(F,new Fi({vertexColors:!0,transparent:!0,opacity:.58}));M.add(ue);let de=new Fr;de.setAttribute(`position`,new Cr(le,3)),de.setAttribute(`color`,new Cr(P,3));let fe=new va({vertexColors:!0,transparent:!0,opacity:.5,dashSize:7,gapSize:5}),pe=new qi(de,fe);pe.computeLineDistances(),M.add(pe);let me=new na(2.2,7,8),he=[];if(oe.length<=cu){let t=new q(0,1,0),n=new q;for(let r of oe){let i=new Ci(me,new di({color:r.color,transparent:!0,opacity:.85}));n.set(r.b.x-r.a.x,r.b.y-r.a.y,r.b.z-r.a.z);let a=n.length();if(a<8)i.visible=!1;else{n.multiplyScalar(1/a);let o=e(A.get(r.edge.dst)?.type||``),s=Math.min(a-4,o+5);i.position.set(r.b.x-n.x*s,r.b.y-n.y*s,r.b.z-n.z*s),i.quaternion.setFromUnitVectors(t,n)}i.userData.src=r.edge.src,i.userData.dst=r.edge.dst,M.add(i),he.push(i)}}let ge=new di({color:new X(lu(`--node-line`,`#2a3d52`)),transparent:!0,opacity:.16,side:2,depthWrite:!1}),_e=new Fi({color:new X(lu(`--muted`,`#8b9bb0`)),transparent:!0,opacity:.28}),ve=lu(`--muted`,`#8b9bb0`),ye=[],be=[],xe=new ra(1,1);be.push(xe);for(let e of o(t,k,f))if(e.shape===`slab`){let t=new Ci(xe,ge);t.scale.set(e.extentZ*2,e.extentY*2,1),t.rotation.y=Math.PI/2,t.position.set(e.x,e.y,e.z),M.add(t);let n=new Fr().setFromPoints([new q(e.x,e.y-e.extentY,e.z-e.extentZ),new q(e.x,e.y+e.extentY,e.z-e.extentZ),new q(e.x,e.y+e.extentY,e.z+e.extentZ),new q(e.x,e.y-e.extentY,e.z+e.extentZ)]);if(be.push(n),M.add(new Ji(n,_e)),e.label){let t=fu(e.label,ve);t.position.set(e.x,e.y+e.extentY+12,e.z),M.add(t),ye.push(t)}}else if(e.radius>=12){let t=[];for(let n=0;n<64;n+=1){let r=n/64*Math.PI*2;t.push(new q(Math.cos(r)*e.radius,Math.sin(r)*e.radius,e.z))}let n=new Fr().setFromPoints(t);be.push(n),M.add(new Ji(n,_e))}let Se=E.current;if(Se&&Se.topology===O)y.position.set(Se.position.x,Se.position.y,Se.position.z),S.target.set(Se.target.x,Se.target.y,Se.target.z),y.lookAt(S.target);else{let e=new nr().setFromObject(M),t=e.getCenter(new q),n=e.getSize(new q);S.target.copy(t),y.position.set(t.x+n.x*.15,t.y+Math.max(140,n.y*.45),t.z+Math.max(280,n.z*.9+180)),y.lookAt(t)}let Ce=new ho;Ce.params.Mesh={...Ce.params.Mesh,threshold:2};let we=new K,Te=[...ee.values()],Ee=null,De=null,Oe=(e,t)=>{let n=e.color.clone().multiplyScalar(.55*t),r=e.color.clone().multiplyScalar(t),i=e.inferred?de.getAttribute(`color`):F.getAttribute(`color`),a=e.inferred?e.dashedIndex:e.solidIndex;a<0||(i.setXYZ(a,n.r,n.g,n.b),i.setXYZ(a+1,r.r,r.g,r.b))},ke=(t,n)=>{let r=!!(t&&n.size),i=T.current.nodeRoles||{},a=T.current.testOverlay;for(let[o,s]of ee){let c=A.get(o),l=s.material,u=!r||n.has(o),f=o===t,h=i[o]||[],g=e(c?.type||``);f?g*=1.28:u?h.includes(`seed`)&&(g*=1.12):g*=.7,s.scale.setScalar(g),l.opacity=f?1:u?.96:.12,f?(l.emissive.copy(d),l.emissiveIntensity=.4):h.includes(`untested`)?(l.emissive.copy(p),l.emissiveIntensity=u?.32:.05):a&&h.includes(`tested`)?(l.emissive.copy(m),l.emissiveIntensity=u?.22:.04):h.includes(`seed`)?(l.emissive.copy(d),l.emissiveIntensity=u?.2:.04):h.includes(`contract`)?(l.emissive.copy(d),l.emissiveIntensity=u?.16:.03):(l.emissive.set(0),l.emissiveIntensity=0);let _=k.get(o)??{x:0,y:0,z:0},v=j.get(o);v&&(v.visible=f||r&&n.has(o)||!t&&N,v.position.set(_.x,_.y+g+8,_.z))}ue.material.opacity=r?.9:.55,fe.opacity=r?.78:.48;for(let e of oe){let i=!!(t&&(e.edge.src===t||e.edge.dst===t)),a=!r||n.has(e.edge.src)&&n.has(e.edge.dst);Oe(e,i?1:a?.85:.12)}oe.length&&(F.getAttribute(`color`).needsUpdate=!0,de.getAttribute(`color`).needsUpdate=!0);for(let e of he){let i=e.userData.src,a=e.userData.dst,o=!!(t&&(i===t||a===t));e.visible=(!r||n.has(i)&&n.has(a))&&(oe.length<=80||o),e.material.opacity=o?1:.75}},Ae=e=>{if(!e){Ee=null,De=null;return}let t=k.get(e);if(!t)return;let n=new q(t.x,t.y,t.z),r=y.position.clone().sub(S.target);if(r.length()<40&&r.set(90,110,180),s){S.target.copy(n),y.position.copy(n).add(r),Ee=null,De=null;return}Ee=n,De=n.clone().add(r)},je=e=>{let t=x.domElement.getBoundingClientRect();we.x=(e.clientX-t.left)/t.width*2-1,we.y=-((e.clientY-t.top)/t.height)*2+1},Me=()=>{Ce.setFromCamera(we,y);let e=Ce.intersectObjects(Te,!1)[0]?.object.userData.id;return e?A.get(e)??null:null},I=e=>{je(e);let t=Me();if(!t){v(null),x.domElement.style.cursor=`grab`;return}x.domElement.style.cursor=`pointer`;let n=(h.current??a).getBoundingClientRect();v({node:t,x:e.clientX-n.left,y:e.clientY-n.top})},Ne=e=>{je(e);let t=Me();C.current(t?t.id:null)},L=()=>{Ee=null,De=null},Pe=()=>{let e=a.clientWidth||1,t=a.clientHeight||1;y.aspect=e/t,y.updateProjectionMatrix(),x.setSize(e,t,!1)};Pe();let R=new ResizeObserver(Pe);R.observe(a);let Fe=0,z=()=>{Fe=requestAnimationFrame(z);try{Ee&&De&&(S.target.lerp(Ee,.14),y.position.lerp(De,.14),S.target.distanceTo(Ee)<1.5&&(S.target.copy(Ee),y.position.copy(De),Ee=null,De=null)),S.update(),x.render(_,y)}catch{cancelAnimationFrame(Fe),b(`WebGL is unavailable in this browser, so the 3D view cannot start. Switch back to 2D map.`)}};return z(),x.domElement.addEventListener(`pointermove`,I),x.domElement.addEventListener(`click`,Ne),S.addEventListener(`start`,L),a.__paint=ke,a.__focus=Ae,ke(w.current.selectedId,w.current.neighborIds),()=>{E.current={topology:O,position:{x:y.position.x,y:y.position.y,z:y.position.z},target:{x:S.target.x,y:S.target.y,z:S.target.z}},cancelAnimationFrame(Fe),R.disconnect(),x.domElement.removeEventListener(`pointermove`,I),x.domElement.removeEventListener(`click`,Ne),S.removeEventListener(`start`,L),delete a.__paint,delete a.__focus,S.dispose(),te.dispose(),me.dispose(),F.dispose(),de.dispose(),ge.dispose(),_e.dispose();for(let e of be)e.dispose();ue.material.dispose(),fe.dispose();for(let e of[...ye,...ne]){let t=e.material;t.map?.dispose(),t.dispose()}for(let e of ee.values())e.material.dispose();for(let e of he)e.material.dispose();x.dispose(),x.domElement.remove(),v(null)}},[O,x]),(0,l.useEffect)(()=>{g.current?.__paint?.(s,u)},[s,u,p,m]),(0,l.useEffect)(()=>{if(!D.current){D.current=!0;return}g.current?.__focus?.(s)},[s]),(0,ou.jsxs)(`div`,{className:`graph-3d-host`,ref:h,children:[(0,ou.jsx)(`div`,{className:`graph-3d-canvas-host`,ref:g}),y?(0,ou.jsx)(`p`,{className:`muted graph-3d-hint`,"data-testid":`graph-3d-fallback`,children:y}):null,_?(0,ou.jsxs)(`div`,{className:`graph-3d-tip`,style:{left:_.x+12,top:_.y+12},children:[(0,ou.jsxs)(`div`,{className:`t`,children:[a(_.node.type),_.node.context?` · ${_.node.context}`:``]}),(0,ou.jsx)(`div`,{className:`n`,children:_.node.name}),_.node.file_path?(0,ou.jsx)(`div`,{className:`f`,children:_.node.file_path}):null]}):null]})}export{hu as LayeredGraph3D}; \ No newline at end of file diff --git a/src/loadpath/static/assets/index-BkFhH9qc.css b/src/loadpath/static/assets/index-BkFhH9qc.css new file mode 100644 index 0000000..0d370e4 --- /dev/null +++ b/src/loadpath/static/assets/index-BkFhH9qc.css @@ -0,0 +1 @@ +.react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#ffffff80;--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:#f0f0f099;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;background-color:var(--xy-background-color,var(--xy-background-color-default));--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #00000014;--xy-node-boxshadow-selected-default:0 0 0 .5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:#0059dc14;--xy-selection-border-default:1px dotted #0059dccc;--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#96969640;--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:#3c3c3c99;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#555;--xy-background-pattern-lines-color-default:#333;--xy-background-pattern-cross-color-default:#333;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #ffffff14;--xy-node-boxshadow-selected-default:0 0 0 .5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:#c8c8dc14;--xy-selection-border-default:1px dotted #c8c8dccc;--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{pointer-events:none;position:absolute;overflow:visible}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}svg.react-flow__connectionline{z-index:1001;position:absolute;overflow:visible}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:0;left:50%;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px)translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px)translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__viewport-portal{-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__minimap{background:var(--xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default)))}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(--xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default)));stroke:var(--xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default)));stroke-width:var(--xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default)))}.react-flow__minimap-node{fill:var(--xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default)));stroke:var(--xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default)));stroke-width:var(--xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default)))}.react-flow__background-pattern.dots{fill:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default)))}.react-flow__background-pattern.lines{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default)))}.react-flow__background-pattern.cross{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default)))}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));flex-direction:column;display:flex}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)));width:26px;height:26px;color:var(--xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default)));cursor:pointer;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;padding:4px;display:flex}.react-flow__controls-button svg{fill:currentColor;width:100%;max-width:12px;max-height:12px}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));width:150px;color:var(--xy-node-color,var(--xy-node-color-default));text-align:center;border:var(--xy-node-border,var(--xy-node-border-default));background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));padding:10px;font-size:12px}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(--xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default)));color:var(--xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default)))}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)))}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;width:5px;height:5px;translate:-50% -50%}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}:root,[data-theme=obsidian]{--bg:#070b10;--bg-2:#0d141c;--surface:#121a24;--line:#1e2c3c;--ink:#e7eef6;--muted:#8b9bb0;--high:#2a9d8f;--medium:#e9c46a;--low:#e76f51;--critical:#e85d04;--accent:#4cc9f0;--rail-from:#0b1219;--rail-to:#070b10;--rail-active:#15202c;--btn:#173044;--btn-line:#24506c;--btn-primary:#134e4a;--btn-primary-line:#2a9d8f;--node-bg:#101822;--node-line:#2a3d52;--graph-bg:#070b10;--graph-grid:#2a507817;--edge-cheap:#4a5568;--edge-expensive:#f4a261;--edge-critical:#e85d04;--shadow:#4cc9f014}[data-theme=nord]{--bg:#2e3440;--bg-2:#3b4252;--surface:#434c5e;--line:#4c566a;--ink:#eceff4;--muted:#d8dee9;--high:#a3be8c;--medium:#ebcb8b;--low:#bf616a;--critical:#d08770;--accent:#88c0d0;--rail-from:#3b4252;--rail-to:#2e3440;--rail-active:#4c566a;--btn:#434c5e;--btn-line:#81a1c1;--btn-primary:#5e81ac;--btn-primary-line:#88c0d0;--node-bg:#3b4252;--node-line:#81a1c1;--graph-bg:#2e3440;--graph-grid:#88c0d01f;--edge-cheap:#4c566a;--edge-expensive:#d08770;--edge-critical:#bf616a;--shadow:#88c0d01f}[data-theme=solarized-dark]{--bg:#002b36;--bg-2:#073642;--surface:#0a3944;--line:#16444f;--ink:#eee8d5;--muted:#93a1a1;--high:#859900;--medium:#b58900;--low:#dc322f;--critical:#cb4b16;--accent:#2aa198;--rail-from:#073642;--rail-to:#002b36;--rail-active:#16444f;--btn:#073642;--btn-line:#268bd2;--btn-primary:#0a4a42;--btn-primary-line:#2aa198;--node-bg:#073642;--node-line:#268bd2;--graph-bg:#002b36;--graph-grid:#2aa1981f;--edge-cheap:#586e75;--edge-expensive:#cb4b16;--edge-critical:#dc322f;--shadow:#2aa1981f}[data-theme=forest]{--bg:#0e1510;--bg-2:#152019;--surface:#1b2a20;--line:#2c4334;--ink:#e4f0e6;--muted:#8eaa96;--high:#6ab04c;--medium:#c8a951;--low:#e17055;--critical:#d35400;--accent:#7bed9f;--rail-from:#152019;--rail-to:#0e1510;--rail-active:#1f3326;--btn:#1f3326;--btn-line:#3d6b4f;--btn-primary:#1e4d32;--btn-primary-line:#6ab04c;--node-bg:#16241b;--node-line:#3d6b4f;--graph-bg:#0e1510;--graph-grid:#7bed9f1a;--edge-cheap:#3d6b4f;--edge-expensive:#c8a951;--edge-critical:#d35400;--shadow:#7bed9f1a}[data-theme=rose]{--bg:#191724;--bg-2:#1f1d2e;--surface:#26233a;--line:#403d52;--ink:#e0def4;--muted:#908caa;--high:#9ccfd8;--medium:#f6c177;--low:#eb6f92;--critical:#eb6f92;--accent:#c4a7e7;--rail-from:#1f1d2e;--rail-to:#191724;--rail-active:#26233a;--btn:#26233a;--btn-line:#c4a7e7;--btn-primary:#3a2f4d;--btn-primary-line:#c4a7e7;--node-bg:#1f1d2e;--node-line:#524f67;--graph-bg:#191724;--graph-grid:#c4a7e71f;--edge-cheap:#524f67;--edge-expensive:#f6c177;--edge-critical:#eb6f92;--shadow:#c4a7e71f}[data-theme=amber]{--bg:#120e0a;--bg-2:#1c1610;--surface:#261e16;--line:#3d2f22;--ink:#f4e6d0;--muted:#b59a78;--high:#c4d6a0;--medium:#e9b44c;--low:#d8572a;--critical:#c0392b;--accent:#f0a05a;--rail-from:#1c1610;--rail-to:#120e0a;--rail-active:#2b2218;--btn:#2b2218;--btn-line:#8a5a2b;--btn-primary:#4a3418;--btn-primary-line:#f0a05a;--node-bg:#1c1610;--node-line:#8a5a2b;--graph-bg:#120e0a;--graph-grid:#f0a05a1f;--edge-cheap:#5c4a38;--edge-expensive:#e9b44c;--edge-critical:#d8572a;--shadow:#f0a05a1f}[data-theme=volcano]{--bg:#14090a;--bg-2:#1e0e10;--surface:#2a1416;--line:#4a2226;--ink:#fde8e4;--muted:#c48b86;--high:#7bed9f;--medium:#f6c90e;--low:#ff6b6b;--critical:#ff3b3b;--accent:#ff7b54;--rail-from:#1e0e10;--rail-to:#14090a;--rail-active:#32181b;--btn:#32181b;--btn-line:#ff7b54;--btn-primary:#5a1f18;--btn-primary-line:#ff7b54;--node-bg:#1e0e10;--node-line:#7a3330;--graph-bg:#14090a;--graph-grid:#ff7b541f;--edge-cheap:#5a3330;--edge-expensive:#ff7b54;--edge-critical:#ff3b3b;--shadow:#ff7b5424}[data-theme=lavender]{--bg:#12101c;--bg-2:#1a1730;--surface:#221e3c;--line:#3b3560;--ink:#efeaff;--muted:#b3a7d6;--high:#80ffdb;--medium:#ffd166;--low:#ff6b9d;--critical:#ff4d6d;--accent:#c77dff;--rail-from:#1a1730;--rail-to:#12101c;--rail-active:#2a2550;--btn:#2a2550;--btn-line:#c77dff;--btn-primary:#3d2a66;--btn-primary-line:#c77dff;--node-bg:#1a1730;--node-line:#5a4d8a;--graph-bg:#12101c;--graph-grid:#c77dff1f;--edge-cheap:#5a4d8a;--edge-expensive:#ffd166;--edge-critical:#ff4d6d;--shadow:#c77dff24}[data-theme=neon-noir]{--bg:#05060a;--bg-2:#0a0c14;--surface:#10131c;--line:#1e2436;--ink:#f0f4ff;--muted:#8b93b0;--high:#39ff88;--medium:#ffe66d;--low:#ff2d95;--critical:#ff3d5a;--accent:#00f0ff;--rail-from:#0a0c14;--rail-to:#05060a;--rail-active:#151a2a;--btn:#151a2a;--btn-line:#00f0ff;--btn-primary:#063a40;--btn-primary-line:#00f0ff;--node-bg:#0a0c14;--node-line:#2a3550;--graph-bg:#05060a;--graph-grid:#00f0ff1f;--edge-cheap:#3a4560;--edge-expensive:#ff2d95;--edge-critical:#ff3d5a;--shadow:#00f0ff38}[data-theme=synthwave]{--bg:#1a0a2e;--bg-2:#240b3d;--surface:#2d1250;--line:#4a1d7a;--ink:#ffe6fb;--muted:#c49ad8;--high:#00f5d4;--medium:#ffd60a;--low:#ff6b9d;--critical:#ff006e;--accent:#ff2bd6;--rail-from:#240b3d;--rail-to:#1a0a2e;--rail-active:#3a1570;--btn:#3a1570;--btn-line:#ff2bd6;--btn-primary:#5a0a4a;--btn-primary-line:#ff2bd6;--node-bg:#240b3d;--node-line:#7b2cbf;--graph-bg:#1a0a2e;--graph-grid:#ff2bd629;--edge-cheap:#5a3a80;--edge-expensive:#ff9e00;--edge-critical:#ff006e;--shadow:#ff2bd63d}[data-theme=phosphor]{--bg:#020804;--bg-2:#061208;--surface:#0a1a0e;--line:#163c1e;--ink:#c8ffc8;--muted:#5aaa5a;--high:#39ff14;--medium:#c8f542;--low:#ffb000;--critical:#ff5e00;--accent:#0f6;--rail-from:#061208;--rail-to:#020804;--rail-active:#0e2414;--btn:#0e2414;--btn-line:#0f6;--btn-primary:#0a3a18;--btn-primary-line:#0f6;--node-bg:#061208;--node-line:#1e6a32;--graph-bg:#020804;--graph-grid:#00ff661f;--edge-cheap:#1e5a2a;--edge-expensive:#c8f542;--edge-critical:#ff5e00;--shadow:#0f63}[data-theme=aurora]{--bg:#071018;--bg-2:#0c1c28;--surface:#122636;--line:#1e3d52;--ink:#e8fff6;--muted:#7eb8a8;--high:#5fffcf;--medium:#ffe566;--low:#ff7eb6;--critical:#ff4d6d;--accent:#7cffb2;--rail-from:#0c1c28;--rail-to:#071018;--rail-active:#163044;--btn:#163044;--btn-line:#7cffb2;--btn-primary:#0e3d3a;--btn-primary-line:#7cffb2;--node-bg:#0c1c28;--node-line:#2a6a78;--graph-bg:#071018;--graph-grid:#7cffb21f;--edge-cheap:#2a5a68;--edge-expensive:#c9a0ff;--edge-critical:#ff4d6d;--shadow:#7cffb22e}[data-theme=biolume]{--bg:#02141c;--bg-2:#042430;--surface:#073040;--line:#0a4a5c;--ink:#e6fffb;--muted:#6eb8b0;--high:#5dffb0;--medium:#ffe066;--low:#ff79c6;--critical:#ff4d6d;--accent:#18e7d4;--rail-from:#042430;--rail-to:#02141c;--rail-active:#0a3848;--btn:#0a3848;--btn-line:#18e7d4;--btn-primary:#0a4a48;--btn-primary-line:#18e7d4;--node-bg:#042430;--node-line:#1a7080;--graph-bg:#02141c;--graph-grid:#18e7d41f;--edge-cheap:#1a5a68;--edge-expensive:#ff79c6;--edge-critical:#ff4d6d;--shadow:#18e7d433}[data-theme=carbon]{--bg:#0d0d0f;--bg-2:#16161a;--surface:#1e1e24;--line:#33333c;--ink:#f2f2f4;--muted:#9a9aa8;--high:#3dd68c;--medium:#f0c040;--low:#ff5a5a;--critical:#ff2a2a;--accent:#ff2a2a;--rail-from:#16161a;--rail-to:#0d0d0f;--rail-active:#24242c;--btn:#24242c;--btn-line:#ff2a2a;--btn-primary:#4a1212;--btn-primary-line:#ff2a2a;--node-bg:#16161a;--node-line:#4a4a55;--graph-bg:#0d0d0f;--graph-grid:#ff2a2a1a;--edge-cheap:#4a4a55;--edge-expensive:#ff8a3d;--edge-critical:#ff2a2a;--shadow:#ff2a2a2e}[data-theme=paper]{--bg:#f6f1e8;--bg-2:#efe6d6;--surface:#fffaf2;--line:#d9cbb6;--ink:#2b241c;--muted:#6f6456;--high:#2a7a4b;--medium:#b5811a;--low:#c0392b;--critical:#a93226;--accent:#1d6a7a;--rail-from:#efe6d6;--rail-to:#e7dcc8;--rail-active:#e2d3bb;--btn:#fffaf2;--btn-line:#c9b79a;--btn-primary:#d7eee0;--btn-primary-line:#2a7a4b;--node-bg:#fffaf2;--node-line:#c9b79a;--graph-bg:#f6f1e8;--graph-grid:#1d6a7a1a;--edge-cheap:#b7a48c;--edge-expensive:#c0392b;--edge-critical:#a93226;--shadow:#2b241c14}[data-theme=solarized-light]{--bg:#fdf6e3;--bg-2:#eee8d5;--surface:#f5efdc;--line:#d6cba9;--ink:#657b83;--muted:#93a1a1;--high:#859900;--medium:#b58900;--low:#dc322f;--critical:#cb4b16;--accent:#268bd2;--rail-from:#eee8d5;--rail-to:#e6dfc8;--rail-active:#e0d9c0;--btn:#fdf6e3;--btn-line:#93a1a1;--btn-primary:#e8efc8;--btn-primary-line:#859900;--node-bg:#fdf6e3;--node-line:#93a1a1;--graph-bg:#fdf6e3;--graph-grid:#268bd21f;--edge-cheap:#93a1a1;--edge-expensive:#cb4b16;--edge-critical:#dc322f;--shadow:#657b831a}[data-theme=seafoam]{--bg:#eef7f4;--bg-2:#dff0ea;--surface:#fff;--line:#b7d5cc;--ink:#17332c;--muted:#4d7268;--high:#1b8a5a;--medium:#c48a14;--low:#c44536;--critical:#9b2d22;--accent:#1d9a8a;--rail-from:#dff0ea;--rail-to:#cfe6de;--rail-active:#c4ddd4;--btn:#fff;--btn-line:#8fbfb2;--btn-primary:#d4f0e4;--btn-primary-line:#1b8a5a;--node-bg:#fff;--node-line:#8fbfb2;--graph-bg:#eef7f4;--graph-grid:#1d9a8a1f;--edge-cheap:#8fbfb2;--edge-expensive:#c48a14;--edge-critical:#c44536;--shadow:#17332c14}[data-theme=high-contrast]{--bg:#fff;--bg-2:#f2f2f2;--surface:#fff;--line:#111;--ink:#000;--muted:#222;--high:#007a33;--medium:#8a5a00;--low:#b00000;--critical:#9b0000;--accent:#03c;--rail-from:#f2f2f2;--rail-to:#e6e6e6;--rail-active:#d9d9d9;--btn:#fff;--btn-line:#000;--btn-primary:#d9f2e3;--btn-primary-line:#007a33;--node-bg:#fff;--node-line:#000;--graph-bg:#fff;--graph-grid:#0000001f;--edge-cheap:#444;--edge-expensive:#8a5a00;--edge-critical:#b00000;--shadow:#0000001f}[data-theme=sakura]{--bg:#fff0f5;--bg-2:#ffe4ee;--surface:#fff7fa;--line:#f5b8cc;--ink:#4a1830;--muted:#a05a78;--high:#1a8a5c;--medium:#c48a14;--low:#d63d6e;--critical:#b01040;--accent:#e84a8a;--rail-from:#ffe4ee;--rail-to:#f8d4e0;--rail-active:#f5c8d8;--btn:#fff7fa;--btn-line:#e89ab0;--btn-primary:#ffd6e6;--btn-primary-line:#e84a8a;--node-bg:#fff7fa;--node-line:#e89ab0;--graph-bg:#fff0f5;--graph-grid:#e84a8a1f;--edge-cheap:#d4a0b0;--edge-expensive:#d63d6e;--edge-critical:#b01040;--shadow:#4a18301a}[data-theme=citrus]{--bg:#fffce8;--bg-2:#fff3b0;--surface:#fffef5;--line:#e8d44a;--ink:#2a2a08;--muted:#6a6a20;--high:#2a8a20;--medium:#d4a000;--low:#e85d04;--critical:#c0392b;--accent:#5aad14;--rail-from:#fff3b0;--rail-to:#ffe98a;--rail-active:#ffe066;--btn:#fffef5;--btn-line:#d4c030;--btn-primary:#e8f5b8;--btn-primary-line:#5aad14;--node-bg:#fffef5;--node-line:#d4c030;--graph-bg:#fffce8;--graph-grid:#5aad1424;--edge-cheap:#c4b040;--edge-expensive:#e85d04;--edge-critical:#c0392b;--shadow:#2a2a081a}[data-theme=peach]{--bg:#fff3eb;--bg-2:#ffe0cc;--surface:#fffaf6;--line:#f0c4a8;--ink:#3a2218;--muted:#8a5a48;--high:#2a8a5c;--medium:#d48a14;--low:#e85d3a;--critical:#c0392b;--accent:#ff6b35;--rail-from:#ffe0cc;--rail-to:#ffd4b8;--rail-active:#ffc8a8;--btn:#fffaf6;--btn-line:#e8a888;--btn-primary:#ffe0cc;--btn-primary-line:#ff6b35;--node-bg:#fffaf6;--node-line:#e8a888;--graph-bg:#fff3eb;--graph-grid:#ff6b351f;--edge-cheap:#d4a088;--edge-expensive:#e85d3a;--edge-critical:#c0392b;--shadow:#3a22181a}[data-theme=candy]{--bg:#f4f0ff;--bg-2:#e8dcff;--surface:#fbf8ff;--line:#d4c0f0;--ink:#2a1848;--muted:#6a5890;--high:#1a8a6a;--medium:#c48a14;--low:#e84a8a;--critical:#c01060;--accent:#ff5eb1;--rail-from:#e8dcff;--rail-to:#ddd0ff;--rail-active:#d4c4ff;--btn:#fbf8ff;--btn-line:#c4a8e8;--btn-primary:#ffd6ec;--btn-primary-line:#ff5eb1;--node-bg:#fbf8ff;--node-line:#c4a8e8;--graph-bg:#f4f0ff;--graph-grid:#ff5eb124;--edge-cheap:#b0a0d0;--edge-expensive:#e84a8a;--edge-critical:#c01060;--shadow:#2a18481a}[data-theme=sky]{--bg:#e8f4ff;--bg-2:#cfe8ff;--surface:#f5faff;--line:#90c8f0;--ink:#0a2848;--muted:#3a6080;--high:#0a8a4a;--medium:#c48a14;--low:#e85d3a;--critical:#c0392b;--accent:#07f;--rail-from:#cfe8ff;--rail-to:#b8dcff;--rail-active:#a8d4ff;--btn:#f5faff;--btn-line:#70b0e0;--btn-primary:#cfe8ff;--btn-primary-line:#07f;--node-bg:#f5faff;--node-line:#70b0e0;--graph-bg:#e8f4ff;--graph-grid:#0077ff1f;--edge-cheap:#80b0d0;--edge-expensive:#e85d3a;--edge-critical:#c0392b;--shadow:#0a28481a}[data-theme=coral]{--bg:#fff1ee;--bg-2:#ffddd6;--surface:#fff8f6;--line:#f0b0a4;--ink:#3a1814;--muted:#8a5048;--high:#0d9488;--medium:#d48a14;--low:#e85d4a;--critical:#c0392b;--accent:#0d9488;--rail-from:#ffddd6;--rail-to:#ffd0c6;--rail-active:#ffc4b8;--btn:#fff8f6;--btn-line:#e89888;--btn-primary:#d4f4ee;--btn-primary-line:#0d9488;--node-bg:#fff8f6;--node-line:#e89888;--graph-bg:#fff1ee;--graph-grid:#0d948824;--edge-cheap:#d4a098;--edge-expensive:#e85d4a;--edge-critical:#c0392b;--shadow:#3a18141a}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}:root{--radius:6px;--radius-lg:10px;--control-h:32px;--font:"IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--mono:"IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;--focus-ring:0 0 0 2px var(--bg), 0 0 0 4px var(--accent);--space:8px}body{background:var(--bg);color:var(--ink);font-family:var(--font);-webkit-font-smoothing:antialiased;font-size:13px;line-height:1.45}button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible,summary:focus-visible{box-shadow:var(--focus-ring);outline:none}.sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.skip{z-index:50;background:var(--surface);color:var(--ink);border:1px solid var(--accent);border-radius:var(--radius);padding:8px 12px;position:absolute;top:-40px;left:12px}.skip:focus{top:12px}.app{grid-template-columns:232px 1fr;height:100%;display:grid}.rail{border-right:1px solid var(--line);background:linear-gradient(180deg, var(--rail-from), var(--rail-to));flex-direction:column;gap:2px;min-width:0;padding:16px 12px;display:flex}.brand{flex-direction:column;gap:2px;padding:4px 8px 16px;display:flex}.brand-mark{font-family:var(--mono);letter-spacing:.16em;text-transform:uppercase;color:var(--accent);font-size:11px;font-weight:600}.brand-sub{color:var(--muted);font-size:11px}.nav-item{text-align:left;border-radius:var(--radius);color:var(--muted);cursor:pointer;background:0 0;border:0;align-items:center;gap:10px;width:100%;padding:8px 10px;display:flex}.nav-item:hover{background:color-mix(in srgb, var(--rail-active) 70%, transparent);color:var(--ink)}.nav-item.active{background:var(--rail-active);color:var(--ink);font-weight:500}.nav-item svg{flex-shrink:0}.theme-pick{gap:4px;margin-top:14px;padding:0 2px;display:grid}.theme-pick label{letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-size:11px;font-weight:500}.theme-pick select,.field select,.field input,.topbar input,.topbar select,.settings input,.settings select,.explorer-path input{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);height:var(--control-h);width:100%;padding:0 10px}.rail-foot{border-top:1px solid var(--line);gap:6px;margin-top:auto;padding:12px 8px 4px;display:grid}.kbd-hint{color:var(--muted);font-size:11px}kbd{font-family:var(--mono);border:1px solid var(--line);background:var(--surface);border-radius:4px;padding:0 4px;font-size:10px}.main{background:var(--bg);flex-direction:column;min-width:0;min-height:0;display:flex;position:relative}.progress{z-index:30;background:color-mix(in srgb, var(--accent) 20%, transparent);height:2px;position:absolute;top:0;left:0;right:0;overflow:hidden}.progress i{background:var(--accent);width:32%;height:100%;animation:1.1s ease-in-out infinite indeterminate;display:block}.progress.determinate i{width:0;transition:width .2s ease-out;animation:none;transform:none}@keyframes indeterminate{0%{transform:translate(-120%)}to{transform:translate(400%)}}.topbar{border-bottom:1px solid var(--line);background:var(--bg-2);flex-wrap:wrap;align-items:flex-end;gap:10px;padding:10px 16px;display:flex}.field{gap:4px;min-width:0;display:grid}.field>span{color:var(--muted);font-size:11px;font-weight:500}.field.path{flex:1;min-width:180px}.field.ref{flex:0 0 188px;width:188px}.field.workspace{flex:0 0 180px;width:180px}.path-row,.combo-row{min-width:0;display:flex}.path-row input,.combo-row input{flex:1;min-width:0}.combo{min-width:0;position:relative}.combo-row input{border-top-right-radius:0;border-bottom-right-radius:0}.topbar .icon-btn{width:var(--control-h);flex:0 0 var(--control-h);padding:0}.combo-toggle{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.combo-menu{z-index:40;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);min-width:340px;max-width:min(480px,70vw);max-height:360px;box-shadow:0 12px 32px var(--shadow);padding:6px 0;position:absolute;top:calc(100% + 4px);left:auto;right:0;overflow:auto}.combo-heading{letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:8px 12px 4px;font-size:10px;font-weight:600}.combo-menu .combo-option{text-align:left;width:100%;height:auto;color:var(--ink);cursor:pointer;background:0 0;border:0;border-radius:0;flex-direction:column;align-items:flex-start;gap:2px;padding:6px 12px;display:flex}.combo-menu .combo-option:hover,.combo-menu .combo-option.active{background:var(--rail-active)}.combo-label{font-family:var(--mono);font-size:12px}.combo-detail{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;max-width:100%;font-size:12px;line-height:1.35;overflow:hidden}.combo-empty{padding:10px 12px}.modal-backdrop{z-index:50;background:color-mix(in srgb, var(--bg) 72%, transparent);place-items:center;padding:24px;display:grid;position:fixed;inset:0}.modal{background:var(--bg-2);border:1px solid var(--line);border-radius:var(--radius-lg);width:min(720px,100%);max-height:min(640px,90vh);box-shadow:0 16px 48px var(--shadow);flex-direction:column;display:flex;overflow:hidden}.modal-head{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-start;gap:12px;padding:14px 16px 10px;display:flex}.modal-head h2{font-size:15px}.modal-head .muted{margin:4px 0 0}.explorer-path{border-bottom:1px solid var(--line);gap:8px;padding:12px 16px;display:flex}.explorer-path input{flex:1;min-width:0}.explorer-list{flex:1;min-height:220px;padding:8px;overflow:auto}.explorer-row{text-align:left;border-radius:var(--radius);width:100%;color:var(--ink);cursor:pointer;background:0 0;border:0;align-items:center;gap:8px;height:auto;padding:8px 10px;display:flex}.explorer-row:hover,.explorer-row.active{background:var(--rail-active)}.explorer-name{text-overflow:ellipsis;min-width:0;overflow:hidden}.git-badge{margin-bottom:0;margin-left:auto}.explorer-empty{padding:18px 10px}.modal-foot{border-top:1px solid var(--line);align-items:center;gap:12px;padding:12px 16px;display:flex}.explorer-current{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-family:var(--mono);flex:1;font-size:12px;overflow:hidden}.topbar input,.topbar select{min-width:0}.topbar-actions{align-items:center;gap:8px;margin-left:auto;padding-bottom:0;display:flex}.btn,.topbar button{background:var(--btn);border:1px solid var(--btn-line);border-radius:var(--radius);height:var(--control-h);cursor:pointer;white-space:nowrap;justify-content:center;align-items:center;gap:6px;padding:0 12px;font-weight:500;display:inline-flex}.btn:hover,.topbar button:hover{filter:brightness(1.08)}.btn:disabled,.topbar button:disabled{opacity:.55;cursor:not-allowed;filter:none}.btn.primary{background:var(--btn-primary);border-color:var(--btn-primary-line)}.btn.ghost{background:0 0}.alerts{gap:8px;padding:10px 16px 0;display:grid}.alerts:empty{padding:0;display:none}.stage{flex-direction:column;flex:1;min-height:0;display:flex}.content{flex:1;grid-template-columns:minmax(340px,420px) 1fr;min-height:0;display:grid}.brief{border-right:1px solid var(--line);background:radial-gradient(circle at 0 0, color-mix(in srgb, var(--accent) 8%, transparent), transparent 42%), var(--bg);padding:16px 18px 24px;overflow:auto}.graph-wrap{flex-direction:column;min-height:0;display:flex;position:relative}.impact-graph{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.graph-toolbar{border-bottom:1px solid var(--line);background:var(--bg-2);flex-wrap:wrap;align-items:center;gap:8px;padding:8px 14px;display:flex}.graph-count{margin-left:auto;font-size:11px}.graph-layout{color:var(--muted);letter-spacing:.04em;align-items:center;gap:6px;font-size:11px;display:inline-flex}.graph-layout select{background:var(--surface);border:1px solid var(--line);min-width:11.5rem;height:26px;color:var(--ink);font:inherit;letter-spacing:0;cursor:pointer;border-radius:999px;padding:0 10px;font-size:12px}.chip-btn{background:var(--surface);border:1px solid var(--line);color:var(--muted);cursor:pointer;border-radius:999px;height:26px;padding:4px 12px}.chip-btn:hover{color:var(--ink)}.chip-btn.active{background:var(--rail-active);color:var(--ink)}.chip-btn:disabled{opacity:.45;cursor:not-allowed}.graph-stage{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.graph-stage .react-flow,.graph-3d,.graph-3d-host,.graph-3d-canvas-host{flex:1;width:100%;height:100%;min-height:280px}.graph-3d{background:var(--graph-bg);flex-direction:column;display:flex;position:relative}.graph-3d-host{flex-direction:column;min-height:0;display:flex;position:relative}.graph-3d-canvas-host{background:var(--graph-bg);min-height:0;position:relative}.graph-3d canvas{width:100%;height:100%;display:block}.graph-3d-tip{pointer-events:none;z-index:2;border-radius:var(--radius);background:var(--surface);border:1px solid var(--line);max-width:320px;color:var(--ink);box-shadow:0 8px 24px var(--shadow);padding:6px 8px;font-size:11px;line-height:1.35;position:absolute}.graph-3d-tip .t{color:var(--muted);text-transform:uppercase;letter-spacing:.08em;font-size:10px}.graph-3d-tip .n{font-weight:600}.graph-3d-tip .f{color:var(--muted);overflow-wrap:anywhere;margin-top:2px;font-size:10px}.graph-3d-hint{z-index:2;color:var(--muted);pointer-events:none;max-width:min(420px,100% - 24px);margin:0;font-size:11px;position:absolute;bottom:10px;left:10px}.graph-wrap .react-flow{background-color:var(--graph-bg);background-image:linear-gradient(var(--graph-grid) 1px, transparent 1px), linear-gradient(90deg, var(--graph-grid) 1px, transparent 1px);background-size:24px 24px}.react-flow__minimap{border-radius:var(--radius);box-shadow:0 8px 24px var(--shadow);overflow:hidden;background:var(--graph-bg)!important;border:1px solid var(--line)!important}.react-flow__minimap-node{fill:var(--muted);stroke:none}.react-flow__minimap-node.selected{fill:var(--accent)}.react-flow__minimap-mask{fill:#00000073!important;stroke:var(--accent)!important}.react-flow__controls{box-shadow:none!important}.react-flow__controls-button{background:var(--surface)!important;border-bottom:1px solid var(--line)!important;fill:var(--ink)!important}h1{margin:0 0 6px;font-size:18px;font-weight:600}h2{margin:0;font-size:13px;font-weight:600}.merge-box{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-lg);margin-bottom:12px;padding:12px 14px}.merge-box.high{border-color:color-mix(in srgb, var(--high) 55%, var(--line))}.merge-box.medium{border-color:color-mix(in srgb, var(--medium) 55%, var(--line))}.merge-box.low{border-color:color-mix(in srgb, var(--low) 55%, var(--line))}.level{font-family:var(--mono);font-size:14px;font-weight:600}.level.high{color:var(--high)}.level.medium{color:var(--medium)}.level.low{color:var(--low)}.merge-title{color:var(--ink);margin-top:4px;font-size:13px}.reasons{color:var(--muted);margin:10px 0 0;padding:0 0 0 18px}.reasons li{margin:0 0 4px}.metrics{grid-template-columns:repeat(3,1fr);gap:8px;margin:0 0 14px;display:grid}.metric{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);padding:8px 10px}.metric .n{font-family:var(--mono);font-variant-numeric:tabular-nums;font-size:16px;font-weight:600}.metric .l{color:var(--muted);margin-top:2px;font-size:11px}.section{border-top:1px solid var(--line);padding:8px 0 4px}.section>summary{cursor:pointer;color:var(--muted);text-transform:uppercase;letter-spacing:.07em;justify-content:space-between;align-items:center;padding:6px 0;font-size:11px;font-weight:600;list-style:none;display:flex}.section>summary::-webkit-details-marker{display:none}.section>summary .count{font-family:var(--mono);letter-spacing:0;text-transform:none;border:1px solid var(--line);border-radius:999px;align-items:center;height:18px;padding:0 7px;font-size:11px;display:inline-flex}.kicker{color:var(--muted);text-transform:uppercase;letter-spacing:.08em;margin:16px 0 6px;font-size:11px;font-weight:600}.chip{border:1px solid var(--line);color:var(--muted);background:var(--surface);border-radius:999px;align-items:center;margin:0 6px 6px 0;padding:2px 8px;font-size:11px;display:inline-flex}.chip.blocker{color:var(--low);border-color:var(--low)}.chip.warning{color:var(--medium);border-color:var(--medium)}.chip.strong{color:var(--low);border-color:var(--low)}.chip.worth_exploring{color:var(--medium);border-color:var(--medium)}.chip.speculative{color:var(--muted);border-color:var(--line)}.chip.open{color:var(--high);border-color:color-mix(in srgb, var(--high) 50%, var(--line))}.file{font-family:var(--mono);color:var(--accent);font-size:12px}.read-item,.finding,.residual{border-bottom:1px solid color-mix(in srgb, var(--line) 70%, transparent);padding:8px 0}.read-item:last-child,.finding:last-child{border-bottom:0}.read-item.tour-current{background:color-mix(in srgb, var(--accent) 12%, var(--surface));border-color:var(--accent)}.tour-row{align-items:center;margin-top:8px}.field.dirty .chip-btn{height:32px}.muted{color:var(--muted);font-size:13px;line-height:1.45}.error{color:var(--low);border:1px solid var(--low);background:color-mix(in srgb, var(--low) 10%, var(--surface));border-radius:var(--radius);justify-content:space-between;align-items:flex-start;gap:12px;padding:8px 12px;display:flex}.banner{border-radius:var(--radius);border:1px solid var(--line);background:var(--surface);justify-content:space-between;align-items:flex-start;gap:12px;padding:8px 12px;font-size:13px;line-height:1.45;display:flex}.banner.warn{border-color:var(--medium);color:var(--medium)}.banner.stale{border-color:var(--low);color:var(--low)}.banner.whatif{border-color:var(--accent);align-items:center}.banner.whatif .btn{white-space:nowrap;flex:none}.chip.whatif{color:var(--accent);border-color:color-mix(in srgb, var(--accent) 55%, var(--line))}.whatif-hint{color:var(--muted);margin:10px 0 0;font-size:12px;line-height:1.4}.banner .dismiss{color:inherit;cursor:pointer;opacity:.7;background:0 0;border:0;height:auto;padding:0 2px}.empty{color:var(--muted);padding:24px 8px;font-size:13px;line-height:1.55}.workspace-loading{text-align:center;flex-direction:column;flex:1;justify-content:center;align-items:center;min-height:220px;padding:48px 16px;display:flex}.graph-walk-empty{flex-direction:column;flex:1;justify-content:center;max-width:36rem;margin:0 auto;display:flex}.empty ol{margin:12px 0 0 18px;padding:0}.empty code,code{font-family:var(--mono);color:var(--accent);font-size:12px}.btn-row{flex-wrap:wrap;gap:8px;margin-top:12px;display:flex}.pr-list{padding:16px;overflow:auto}.pr-toolbar{align-items:flex-end;gap:8px;margin-bottom:14px;display:flex}.pr-toolbar .field{flex:1}.pr-toolbar .field.provider{flex:0 0 140px}.scm-count{margin:0 0 12px;font-size:12px}.scm-login{border-top:1px solid var(--line);justify-content:space-between;align-items:center;gap:12px;padding:10px 0;display:flex}.scm-login:first-of-type{border-top:0;padding-top:0}.scm-login .btn-row{margin-top:0}.scm-login p{margin:2px 0 0}.oauth-code{margin:0;font-size:13px}.oauth-code code{letter-spacing:.08em;font-size:14px}.pr{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-lg);margin-bottom:10px;padding:12px 14px}.pr h3{margin:0 0 4px;font-size:14px;font-weight:600}.pr-meta{flex-wrap:wrap;align-items:center;gap:8px 12px;margin:6px 0 10px;display:flex}.pr-actions{align-items:center;gap:8px;display:flex}.settings{gap:16px;max-width:760px;padding:24px;display:grid;overflow:auto}.settings-card{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-lg);gap:8px;padding:16px;display:grid}.settings-card h2{margin-bottom:2px;font-size:14px}.settings label{color:var(--muted);font-size:12px;font-weight:500}.theme-grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px;display:grid}.theme-swatch{border:1px solid var(--line);background:var(--bg);color:var(--ink);border-radius:var(--radius);text-align:left;cursor:pointer;height:auto;box-shadow:0 1px 8px var(--shadow);padding:10px}.theme-swatch.active{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent), 0 1px 8px var(--shadow)}.theme-swatch .swatch-bar{background:linear-gradient(90deg, var(--accent), var(--high), var(--medium), var(--low));border-radius:3px;height:6px;margin-bottom:8px}.theme-swatch .name{font-size:13px;font-weight:600}.theme-swatch .group{color:var(--muted);font-size:11px}.headline{white-space:pre-wrap;font-family:var(--mono);color:var(--muted);margin:8px 0 0;font-size:12px}.graph-modes{border-bottom:1px solid var(--line);background:var(--bg-2);align-items:center;gap:8px;padding:8px 14px;display:flex}.seg{border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:2px;display:inline-flex}.seg button,.graph-modes button{color:var(--muted);cursor:pointer;background:0 0;border:0;border-radius:999px;height:26px;padding:4px 12px}.seg button.active,.graph-modes button.active{background:var(--rail-active);color:var(--ink)}.legend{color:var(--muted);gap:12px;margin-left:auto;font-size:11px;display:flex}.legend i{vertical-align:middle;background:var(--edge-cheap);width:14px;height:2px;margin-right:6px;display:inline-block}.legend i.exp{background:var(--edge-expensive)}.legend i.crit{background:var(--edge-critical);height:3px}.legend i.dash{border-top:2px dashed var(--muted);background:0 0;height:0}.legend i.seed{background:color-mix(in srgb, var(--medium) 70%, var(--node-bg));border-radius:2px;width:10px;height:10px}.legend i.down{border:1px solid color-mix(in srgb, var(--accent) 45%, var(--node-line));background:var(--node-bg);border-radius:2px;width:10px;height:10px}.inspector{z-index:5;overflow-wrap:break-word;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);width:300px;max-width:calc(100% - 24px);max-height:calc(100% - 24px);box-shadow:0 8px 24px var(--shadow);padding:10px 12px;font-size:12px;position:absolute;top:12px;right:12px;overflow:hidden auto}.inspector .t{color:var(--muted);text-transform:uppercase;letter-spacing:.06em;font-size:11px}.inspector .n,.inspector .file,.inspector .muted{overflow-wrap:break-word}.inspector .n{margin:4px 0;font-weight:600}.inspector-head{align-items:flex-start;gap:8px;display:flex}.inspector-roles{flex-wrap:wrap;flex:1;justify-content:flex-end;gap:4px;display:flex}.inspector-chip{text-transform:uppercase;letter-spacing:.04em;border:1px solid var(--line);color:var(--muted);white-space:nowrap;border-radius:999px;padding:1px 6px;font-size:10px}.inspector-close{border:1px solid var(--line);border-radius:var(--radius);width:24px;height:24px;color:var(--muted);cursor:pointer;background:0 0;flex:none;padding:0;font-size:16px;line-height:1}.inspector-close:hover{color:var(--ink)}.inspector-purpose{color:var(--ink);margin:6px 0 8px;font-size:12px;line-height:1.4}.inspector-layer{margin-top:4px;font-size:11px}.inspector-degree{font-size:11px}.inspector-path{color:var(--muted);margin:6px 0 0;font-size:12px;line-height:1.4}.inspector-facts{border-top:1px solid var(--line);margin:10px 0 0;padding-top:8px}.inspector-fact{grid-template-columns:minmax(64px,92px) minmax(0,1fr);align-items:start;gap:8px;padding:3px 0;display:grid}.inspector-fact dt{color:var(--muted);margin:0;font-size:11px}.inspector-fact dd{overflow-wrap:break-word;margin:0}.inspector-section{border-top:1px solid var(--line);margin-top:10px;padding-top:8px}.inspector-section h3{color:var(--muted);text-transform:uppercase;letter-spacing:.07em;justify-content:space-between;align-items:center;margin:0 0 6px;font-size:11px;font-weight:600;display:flex}.inspector-section .count{font-family:var(--mono);letter-spacing:0;text-transform:none;border:1px solid var(--line);border-radius:999px;align-items:center;height:18px;padding:0 7px;font-size:11px;display:inline-flex}.inspector-section ul{margin:0;padding:0;list-style:none}.inspector-section li{border-bottom:1px solid color-mix(in srgb, var(--line) 70%, transparent);padding:4px 0}.inspector-section li:last-child{border-bottom:0}.inspector-link-name{overflow-wrap:break-word;font-weight:600;display:block}.inspector-link-meta{color:var(--muted);font-size:11px;display:block}.lp-node{border-radius:var(--radius);border:1px solid var(--node-line);background:var(--node-bg);box-sizing:border-box;width:208px;max-width:100%;height:64px;box-shadow:0 0 0 1px var(--shadow);padding:8px 10px;position:relative;overflow:visible}.lp-node .t{color:var(--muted);text-transform:uppercase;letter-spacing:.08em;font-size:10px}.lp-node .n{-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:13px;font-weight:600;line-height:1.2;display:-webkit-box;overflow:hidden}.lp-node.selected{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}.lp-node.role-seed{border-color:var(--medium);background:color-mix(in srgb, var(--medium) 14%, var(--node-bg))}.lp-node.role-downstream{border-color:color-mix(in srgb, var(--accent) 45%, var(--node-line))}.lp-node.role-untested{box-shadow:inset 3px 0 0 var(--low)}.lp-node.role-tested{box-shadow:inset 3px 0 0 var(--high)}.lp-node.role-contract{outline:1px dashed color-mix(in srgb, var(--accent) 50%, transparent)}.lp-node.dim{opacity:.38}.merge-box.compact{min-width:92px;margin:0;padding:6px 10px}.merge-box.compact .level{font-size:12px}.palette-scrim{background:color-mix(in srgb, var(--bg) 55%, transparent);z-index:40;place-items:start center;padding-top:12vh;display:grid;position:fixed;inset:0}.palette{background:var(--surface);border:1px solid var(--line);width:min(640px,100vw - 32px);box-shadow:0 18px 60px var(--shadow);border-radius:12px;overflow:hidden}.palette input{border:0;border-bottom:1px solid var(--line);width:100%;color:var(--ink);font:inherit;background:0 0;padding:14px 16px}.palette ul{max-height:360px;margin:0;padding:6px;list-style:none;overflow:auto}.palette li button{text-align:left;width:100%;color:var(--ink);cursor:pointer;background:0 0;border:0;border-radius:8px;justify-content:space-between;gap:12px;padding:8px 10px;display:flex}.palette li button.active,.palette li button:hover{background:var(--rail-active)}.palette-foot{padding:8px 12px 10px}.graph-search{min-width:140px;position:relative}.graph-search input{background:var(--bg-2);border:1px solid var(--line);width:100%;color:var(--ink);font:inherit;border-radius:8px;padding:6px 8px}.graph-search-hits{z-index:5;background:var(--surface);border:1px solid var(--line);border-radius:8px;max-height:240px;margin:0;padding:4px;list-style:none;position:absolute;top:calc(100% + 4px);left:0;right:0;overflow:auto}.graph-search-hits button{width:100%;color:var(--ink);text-align:left;cursor:pointer;background:0 0;border:0;justify-content:space-between;gap:8px;padding:6px 8px;display:flex}.graph-search-hits button:hover{background:var(--rail-active)}.inspector-link{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;flex-direction:column;padding:0;display:flex}.file-row{flex-direction:column;gap:6px;display:flex}.linkish{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.history-item,.check-item{width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;flex-wrap:wrap;align-items:baseline;gap:8px;padding:6px 0;display:flex}.history-item.current{color:var(--accent)}.check-row{align-items:center;gap:8px;margin:4px 0;display:flex}.sparkline{align-items:flex-end;gap:3px;height:36px;margin:8px 0;display:flex}.sparkline i{background:var(--muted);border-radius:2px 2px 0 0;flex:1;min-width:4px}.sparkline i.high{background:var(--high)}.sparkline i.medium{background:var(--medium)}.sparkline i.low{background:var(--low)}.config-editor .field{flex-direction:column;gap:4px;margin:8px 0;display:flex}.config-editor input,.config-editor select{background:var(--bg-2);border:1px solid var(--line);color:var(--ink);border-radius:8px;padding:6px 8px}.react-flow__node-load .react-flow__handle{opacity:0;background:0 0;border:none;width:8px;height:8px}.type-table{border-collapse:collapse;width:100%;font-size:12px}.type-table td{padding:3px 0}.type-table td:last-child{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--muted)}@media (prefers-reduced-motion:reduce){.progress i{width:100%;animation:none}.progress.determinate i{width:var(--progress,100%)}*{scroll-behavior:auto!important}}@media (width<=960px){.app{grid-template-columns:56px 1fr}.brand-sub,.nav-item span,.theme-pick,.kbd-hint,.rail-foot .muted{display:none}.nav-item{justify-content:center;padding:10px}.content{grid-template-columns:1fr}.brief{border-right:0;border-bottom:1px solid var(--line);max-height:42vh}} diff --git a/src/loadpath/static/assets/index-CcW4ogPp.js b/src/loadpath/static/assets/index-CcW4ogPp.js deleted file mode 100644 index 899dc41..0000000 --- a/src/loadpath/static/assets/index-CcW4ogPp.js +++ /dev/null @@ -1,62 +0,0 @@ -var N0=Object.defineProperty;var b0=(e,r,o)=>r in e?N0(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o;var ih=(e,r,o)=>b0(e,typeof r!="symbol"?r+"":r,o);(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const u of a)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function o(a){const u={};return a.integrity&&(u.integrity=a.integrity),a.referrerPolicy&&(u.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?u.credentials="include":a.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(a){if(a.ep)return;a.ep=!0;const u=o(a);fetch(a.href,u)}})();function Op(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hu={exports:{}},Ki={},Bu={exports:{}},Ae={};/** - * @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 sh;function j0(){if(sh)return Ae;sh=1;var e=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function g(R){return R===null||typeof R!="object"?null:(R=v&&R[v]||R["@@iterator"],typeof R=="function"?R:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,k={};function b(R,z,re){this.props=R,this.context=z,this.refs=k,this.updater=re||x}b.prototype.isReactComponent={},b.prototype.setState=function(R,z){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,z,"setState")},b.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function E(){}E.prototype=b.prototype;function I(R,z,re){this.props=R,this.context=z,this.refs=k,this.updater=re||x}var _=I.prototype=new E;_.constructor=I,S(_,b.prototype),_.isPureReactComponent=!0;var j=Array.isArray,L=Object.prototype.hasOwnProperty,$={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function U(R,z,re){var oe,fe={},le=null,he=null;if(z!=null)for(oe in z.ref!==void 0&&(he=z.ref),z.key!==void 0&&(le=""+z.key),z)L.call(z,oe)&&!F.hasOwnProperty(oe)&&(fe[oe]=z[oe]);var Z=arguments.length-2;if(Z===1)fe.children=re;else if(1>>1,z=M[R];if(0>>1;Ra(fe,H))lea(he,fe)?(M[R]=he,M[le]=H,R=le):(M[R]=fe,M[oe]=H,R=oe);else if(lea(he,H))M[R]=he,M[le]=H,R=le;else break e}}return D}function a(M,D){var H=M.sortIndex-D.sortIndex;return H!==0?H:M.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,h=c.now();e.unstable_now=function(){return c.now()-h}}var p=[],y=[],w=1,v=null,g=3,x=!1,S=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(M){for(var D=o(y);D!==null;){if(D.callback===null)s(y);else if(D.startTime<=M)s(y),D.sortIndex=D.expirationTime,r(p,D);else break;D=o(y)}}function j(M){if(k=!1,_(M),!S)if(o(p)!==null)S=!0,W(L);else{var D=o(y);D!==null&&Y(j,D.startTime-M)}}function L(M,D){S=!1,k&&(k=!1,E(U),U=-1),x=!0;var H=g;try{for(_(D),v=o(p);v!==null&&(!(v.expirationTime>D)||M&&!J());){var R=v.callback;if(typeof R=="function"){v.callback=null,g=v.priorityLevel;var z=R(v.expirationTime<=D);D=e.unstable_now(),typeof z=="function"?v.callback=z:v===o(p)&&s(p),_(D)}else s(p);v=o(p)}if(v!==null)var re=!0;else{var oe=o(y);oe!==null&&Y(j,oe.startTime-D),re=!1}return re}finally{v=null,g=H,x=!1}}var $=!1,F=null,U=-1,q=5,te=-1;function J(){return!(e.unstable_now()-teM||125R?(M.sortIndex=H,r(y,M),o(p)===null&&M===o(y)&&(k?(E(U),U=-1):k=!0,Y(j,H-R))):(M.sortIndex=z,r(p,M),S||x||(S=!0,W(L))),M},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(M){var D=g;return function(){var H=g;g=D;try{return M.apply(this,arguments)}finally{g=H}}}})(Uu)),Uu}var dh;function I0(){return dh||(dh=1,Wu.exports=P0()),Wu.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 fh;function R0(){if(fh)return Ot;fh=1;var e=ps(),r=I0();function o(t){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,y=/^[: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]*$/,w={},v={};function g(t){return p.call(v,t)?!0:p.call(w,t)?!1:y.test(t)?v[t]=!0:(w[t]=!0,!1)}function x(t,n,i,l){if(i!==null&&i.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return l?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function S(t,n,i,l){if(n===null||typeof n>"u"||x(t,n,i,l))return!0;if(l)return!1;if(i!==null)switch(i.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 k(t,n,i,l,f,m,N){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=l,this.attributeNamespace=f,this.mustUseProperty=i,this.propertyName=t,this.type=n,this.sanitizeURL=m,this.removeEmptyString=N}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){b[t]=new k(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var n=t[0];b[n]=new k(n,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){b[t]=new k(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){b[t]=new k(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){b[t]=new k(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){b[t]=new k(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){b[t]=new k(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){b[t]=new k(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){b[t]=new k(t,5,!1,t.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function I(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var n=t.replace(E,I);b[n]=new k(n,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var n=t.replace(E,I);b[n]=new k(n,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var n=t.replace(E,I);b[n]=new k(n,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){b[t]=new k(t,1,!1,t.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){b[t]=new k(t,1,!1,t.toLowerCase(),null,!0,!0)});function _(t,n,i,l){var f=b.hasOwnProperty(n)?b[n]:null;(f!==null?f.type!==0:l||!(2T||f[N]!==m[T]){var O=` -`+f[N].replace(" at new "," at ");return t.displayName&&O.includes("")&&(O=O.replace("",t.displayName)),O}while(1<=N&&0<=T);break}}}finally{re=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?z(t):""}function fe(t){switch(t.tag){case 5:return z(t.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return t=oe(t.type,!1),t;case 11:return t=oe(t.type.render,!1),t;case 1:return t=oe(t.type,!0),t;default:return""}}function le(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case F:return"Fragment";case $:return"Portal";case q:return"Profiler";case U:return"StrictMode";case Q:return"Suspense";case C:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case J:return(t.displayName||"Context")+".Consumer";case te:return(t._context.displayName||"Context")+".Provider";case ne:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V:return n=t.displayName||null,n!==null?n:le(t.type)||"Memo";case W:n=t._payload,t=t._init;try{return le(t(n))}catch{}}return null}function he(t){var n=t.type;switch(t.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 t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return le(n);case 8:return n===U?"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 Z(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function se(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function me(t){var n=se(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,n),l=""+t[n];if(!t.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var f=i.get,m=i.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(N){l=""+N,m.call(this,N)}}),Object.defineProperty(t,n,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(N){l=""+N},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Ne(t){t._valueTracker||(t._valueTracker=me(t))}function we(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var i=n.getValue(),l="";return t&&(l=se(t)?t.checked?"true":"false":t.value),t=l,t!==i?(n.setValue(t),!0):!1}function ye(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Me(t,n){var i=n.checked;return H({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function Te(t,n){var i=n.defaultValue==null?"":n.defaultValue,l=n.checked!=null?n.checked:n.defaultChecked;i=Z(n.value!=null?n.value:i),t._wrapperState={initialChecked:l,initialValue:i,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Le(t,n){n=n.checked,n!=null&&_(t,"checked",n,!1)}function De(t,n){Le(t,n);var i=Z(n.value),l=n.type;if(i!=null)l==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(l==="submit"||l==="reset"){t.removeAttribute("value");return}n.hasOwnProperty("value")?$e(t,n.type,i):n.hasOwnProperty("defaultValue")&&$e(t,n.type,Z(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(t.defaultChecked=!!n.defaultChecked)}function pe(t,n,i){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var l=n.type;if(!(l!=="submit"&&l!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+t._wrapperState.initialValue,i||n===t.value||(t.value=n),t.defaultValue=n}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function $e(t,n,i){(n!=="number"||ye(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var Ve=Array.isArray;function Ue(t,n,i,l){if(t=t.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=rt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;n.firstChild;)t.appendChild(n.firstChild)}});function Pt(t,n){if(n){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=n;return}}t.textContent=n}var bn={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},di=["Webkit","ms","Moz","O"];Object.keys(bn).forEach(function(t){di.forEach(function(n){n=n+t.charAt(0).toUpperCase()+t.substring(1),bn[n]=bn[t]})});function Vn(t,n,i){return n==null||typeof n=="boolean"||n===""?"":i||typeof n!="number"||n===0||bn.hasOwnProperty(t)&&bn[t]?(""+n).trim():n+"px"}function So(t,n){t=t.style;for(var i in n)if(n.hasOwnProperty(i)){var l=i.indexOf("--")===0,f=Vn(i,n[i],l);i==="float"&&(i="cssFloat"),l?t.setProperty(i,f):t[i]=f}}var dr=H({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 Br(t,n){if(n){if(dr[t]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(o(137,t));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(o(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(o(61))}if(n.style!=null&&typeof n.style!="object")throw Error(o(62))}}function Wn(t,n){if(t.indexOf("-")===-1)return typeof n.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Vr=null;function fr(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var hr=null,Ht=null,dt=null;function Un(t){if(t=Ai(t)){if(typeof hr!="function")throw Error(o(280));var n=t.stateNode;n&&(n=zs(n),hr(t.stateNode,t.type,n))}}function Gn(t){Ht?dt?dt.push(t):dt=[t]:Ht=t}function jn(){if(Ht){var t=Ht,n=dt;if(dt=Ht=null,Un(t),n)for(t=0;t>>=0,t===0?32:31-(gi(t)/mi|0)|0}var In=64,Zn=4194304;function Rn(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Kt(t,n){var i=t.pendingLanes;if(i===0)return 0;var l=0,f=t.suspendedLanes,m=t.pingedLanes,N=i&268435455;if(N!==0){var T=N&~f;T!==0?l=Rn(T):(m&=N,m!==0&&(l=Rn(m)))}else N=i&~f,N!==0?l=Rn(N):m!==0&&(l=Rn(m));if(l===0)return 0;if(n!==0&&n!==l&&(n&f)===0&&(f=l&-l,m=n&-n,f>=m||f===16&&(m&4194240)!==0))return n;if((l&4)!==0&&(l|=i&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=l;0i;i++)n.push(t);return n}function Jn(t,n,i){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-yt(n),t[n]=i}function Co(t,n){var i=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var l=t.eventTimes;for(t=t.expirationTimes;0=ji),Qc=" ",Zc=!1;function Jc(t,n){switch(t){case"keyup":return xy.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ed(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var To=!1;function _y(t,n){switch(t){case"compositionend":return ed(n);case"keypress":return n.which!==32?null:(Zc=!0,Qc);case"textInput":return t=n.data,t===Qc&&Zc?null:t;default:return null}}function Sy(t,n){if(To)return t==="compositionend"||!_l&&Jc(t,n)?(t=Uc(),js=gl=wr=null,To=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:i,offset:n-t};t=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=ad(i)}}function ud(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?ud(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function cd(){for(var t=window,n=ye();n instanceof t.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)t=n.contentWindow;else break;n=ye(t.document)}return n}function Nl(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}function Iy(t){var n=cd(),i=t.focusedElem,l=t.selectionRange;if(n!==i&&i&&i.ownerDocument&&ud(i.ownerDocument.documentElement,i)){if(l!==null&&Nl(i)){if(n=l.start,t=l.end,t===void 0&&(t=n),"selectionStart"in i)i.selectionStart=n,i.selectionEnd=Math.min(t,i.value.length);else if(t=(n=i.ownerDocument||document)&&n.defaultView||window,t.getSelection){t=t.getSelection();var f=i.textContent.length,m=Math.min(l.start,f);l=l.end===void 0?m:Math.min(l.end,f),!t.extend&&m>l&&(f=l,l=m,m=f),f=ld(i,m);var N=ld(i,l);f&&N&&(t.rangeCount!==1||t.anchorNode!==f.node||t.anchorOffset!==f.offset||t.focusNode!==N.node||t.focusOffset!==N.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),t.removeAllRanges(),m>l?(t.addRange(n),t.extend(N.node,N.offset)):(n.setEnd(N.node,N.offset),t.addRange(n)))}}for(n=[],t=i;t=t.parentNode;)t.nodeType===1&&n.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i=document.documentMode,Lo=null,bl=null,Pi=null,jl=!1;function dd(t,n,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;jl||Lo==null||Lo!==ye(l)||(l=Lo,"selectionStart"in l&&Nl(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Pi&&Mi(Pi,l)||(Pi=l,l=Ls(bl,"onSelect"),0Oo||(t.current=Dl[Oo],Dl[Oo]=null,Oo--)}function Ge(t,n){Oo++,Dl[Oo]=t.current,t.current=n}var Nr={},St=kr(Nr),Lt=kr(!1),Jr=Nr;function Fo(t,n){var i=t.type.contextTypes;if(!i)return Nr;var l=t.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===n)return l.__reactInternalMemoizedMaskedChildContext;var f={},m;for(m in i)f[m]=n[m];return l&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=f),f}function At(t){return t=t.childContextTypes,t!=null}function Ds(){qe(Lt),qe(St)}function jd(t,n,i){if(St.current!==Nr)throw Error(o(168));Ge(St,n),Ge(Lt,i)}function Ed(t,n,i){var l=t.stateNode;if(n=n.childContextTypes,typeof l.getChildContext!="function")return i;l=l.getChildContext();for(var f in l)if(!(f in n))throw Error(o(108,he(t)||"Unknown",f));return H({},i,l)}function Os(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Nr,Jr=St.current,Ge(St,t),Ge(Lt,Lt.current),!0}function Cd(t,n,i){var l=t.stateNode;if(!l)throw Error(o(169));i?(t=Ed(t,n,Jr),l.__reactInternalMemoizedMergedChildContext=t,qe(Lt),qe(St),Ge(St,t)):qe(Lt),Ge(Lt,i)}var tr=null,Fs=!1,Ol=!1;function Md(t){tr===null?tr=[t]:tr.push(t)}function Vy(t){Fs=!0,Md(t)}function br(){if(!Ol&&tr!==null){Ol=!0;var t=0,n=Be;try{var i=tr;for(Be=1;t>=N,f-=N,nr=1<<32-yt(n)+f|i<Ce?(pt=je,je=null):pt=je.sibling;var He=ie(X,je,K[Ce],de);if(He===null){je===null&&(je=pt);break}t&&je&&He.alternate===null&&n(X,je),B=m(He,B,Ce),be===null?Se=He:be.sibling=He,be=He,je=pt}if(Ce===K.length)return i(X,je),Qe&&to(X,Ce),Se;if(je===null){for(;CeCe?(pt=je,je=null):pt=je.sibling;var Lr=ie(X,je,He.value,de);if(Lr===null){je===null&&(je=pt);break}t&&je&&Lr.alternate===null&&n(X,je),B=m(Lr,B,Ce),be===null?Se=Lr:be.sibling=Lr,be=Lr,je=pt}if(He.done)return i(X,je),Qe&&to(X,Ce),Se;if(je===null){for(;!He.done;Ce++,He=K.next())He=ue(X,He.value,de),He!==null&&(B=m(He,B,Ce),be===null?Se=He:be.sibling=He,be=He);return Qe&&to(X,Ce),Se}for(je=l(X,je);!He.done;Ce++,He=K.next())He=ge(je,X,Ce,He.value,de),He!==null&&(t&&He.alternate!==null&&je.delete(He.key===null?Ce:He.key),B=m(He,B,Ce),be===null?Se=He:be.sibling=He,be=He);return t&&je.forEach(function(k0){return n(X,k0)}),Qe&&to(X,Ce),Se}function ot(X,B,K,de){if(typeof K=="object"&&K!==null&&K.type===F&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case L:e:{for(var Se=K.key,be=B;be!==null;){if(be.key===Se){if(Se=K.type,Se===F){if(be.tag===7){i(X,be.sibling),B=f(be,K.props.children),B.return=X,X=B;break e}}else if(be.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===W&&Ad(Se)===be.type){i(X,be.sibling),B=f(be,K.props),B.ref=$i(X,be,K),B.return=X,X=B;break e}i(X,be);break}else n(X,be);be=be.sibling}K.type===F?(B=uo(K.props.children,X.mode,de,K.key),B.return=X,X=B):(de=pa(K.type,K.key,K.props,null,X.mode,de),de.ref=$i(X,B,K),de.return=X,X=de)}return N(X);case $:e:{for(be=K.key;B!==null;){if(B.key===be)if(B.tag===4&&B.stateNode.containerInfo===K.containerInfo&&B.stateNode.implementation===K.implementation){i(X,B.sibling),B=f(B,K.children||[]),B.return=X,X=B;break e}else{i(X,B);break}else n(X,B);B=B.sibling}B=$u(K,X.mode,de),B.return=X,X=B}return N(X);case W:return be=K._init,ot(X,B,be(K._payload),de)}if(Ve(K))return xe(X,B,K,de);if(D(K))return _e(X,B,K,de);Ws(X,K)}return typeof K=="string"&&K!==""||typeof K=="number"?(K=""+K,B!==null&&B.tag===6?(i(X,B.sibling),B=f(B,K),B.return=X,X=B):(i(X,B),B=Au(K,X.mode,de),B.return=X,X=B),N(X)):i(X,B)}return ot}var Wo=$d(!0),zd=$d(!1),Us=kr(null),Gs=null,Uo=null,Ul=null;function Gl(){Ul=Uo=Gs=null}function Yl(t){var n=Us.current;qe(Us),t._currentValue=n}function Xl(t,n,i){for(;t!==null;){var l=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),t===i)break;t=t.return}}function Go(t,n){Gs=t,Ul=Uo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&n)!==0&&($t=!0),t.firstContext=null)}function Jt(t){var n=t._currentValue;if(Ul!==t)if(t={context:t,memoizedValue:n,next:null},Uo===null){if(Gs===null)throw Error(o(308));Uo=t,Gs.dependencies={lanes:0,firstContext:t}}else Uo=Uo.next=t;return n}var no=null;function ql(t){no===null?no=[t]:no.push(t)}function Dd(t,n,i,l){var f=n.interleaved;return f===null?(i.next=i,ql(n)):(i.next=f.next,f.next=i),n.interleaved=i,or(t,l)}function or(t,n){t.lanes|=n;var i=t.alternate;for(i!==null&&(i.lanes|=n),i=t,t=t.return;t!==null;)t.childLanes|=n,i=t.alternate,i!==null&&(i.childLanes|=n),i=t,t=t.return;return i.tag===3?i.stateNode:null}var jr=!1;function Kl(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Od(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ir(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function Er(t,n,i){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(Oe&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,or(t,i)}return f=l.interleaved,f===null?(n.next=n,ql(l)):(n.next=f.next,f.next=n),l.interleaved=n,or(t,i)}function Ys(t,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194240)!==0)){var l=n.lanes;l&=t.pendingLanes,i|=l,n.lanes=i,vr(t,i)}}function Fd(t,n){var i=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var f=null,m=null;if(i=i.firstBaseUpdate,i!==null){do{var N={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};m===null?f=m=N:m=m.next=N,i=i.next}while(i!==null);m===null?f=m=n:m=m.next=n}else f=m=n;i={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:l.shared,effects:l.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=n:t.next=n,i.lastBaseUpdate=n}function Xs(t,n,i,l){var f=t.updateQueue;jr=!1;var m=f.firstBaseUpdate,N=f.lastBaseUpdate,T=f.shared.pending;if(T!==null){f.shared.pending=null;var O=T,ee=O.next;O.next=null,N===null?m=ee:N.next=ee,N=O;var ae=t.alternate;ae!==null&&(ae=ae.updateQueue,T=ae.lastBaseUpdate,T!==N&&(T===null?ae.firstBaseUpdate=ee:T.next=ee,ae.lastBaseUpdate=O))}if(m!==null){var ue=f.baseState;N=0,ae=ee=O=null,T=m;do{var ie=T.lane,ge=T.eventTime;if((l&ie)===ie){ae!==null&&(ae=ae.next={eventTime:ge,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var xe=t,_e=T;switch(ie=n,ge=i,_e.tag){case 1:if(xe=_e.payload,typeof xe=="function"){ue=xe.call(ge,ue,ie);break e}ue=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=_e.payload,ie=typeof xe=="function"?xe.call(ge,ue,ie):xe,ie==null)break e;ue=H({},ue,ie);break e;case 2:jr=!0}}T.callback!==null&&T.lane!==0&&(t.flags|=64,ie=f.effects,ie===null?f.effects=[T]:ie.push(T))}else ge={eventTime:ge,lane:ie,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ae===null?(ee=ae=ge,O=ue):ae=ae.next=ge,N|=ie;if(T=T.next,T===null){if(T=f.shared.pending,T===null)break;ie=T,T=ie.next,ie.next=null,f.lastBaseUpdate=ie,f.shared.pending=null}}while(!0);if(ae===null&&(O=ue),f.baseState=O,f.firstBaseUpdate=ee,f.lastBaseUpdate=ae,n=f.shared.interleaved,n!==null){f=n;do N|=f.lane,f=f.next;while(f!==n)}else m===null&&(f.shared.lanes=0);io|=N,t.lanes=N,t.memoizedState=ue}}function Hd(t,n,i){if(t=n.effects,n.effects=null,t!==null)for(n=0;ni?i:4,t(!0);var l=tu.transition;tu.transition={};try{t(!1),n()}finally{Be=i,tu.transition=l}}function af(){return en().memoizedState}function Yy(t,n,i){var l=Ir(t);if(i={lane:l,action:i,hasEagerState:!1,eagerState:null,next:null},lf(t))uf(n,i);else if(i=Dd(t,n,i,l),i!==null){var f=Ct();yn(i,t,l,f),cf(i,n,l)}}function Xy(t,n,i){var l=Ir(t),f={lane:l,action:i,hasEagerState:!1,eagerState:null,next:null};if(lf(t))uf(n,f);else{var m=t.alternate;if(t.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var N=n.lastRenderedState,T=m(N,i);if(f.hasEagerState=!0,f.eagerState=T,fn(T,N)){var O=n.interleaved;O===null?(f.next=f,ql(n)):(f.next=O.next,O.next=f),n.interleaved=f;return}}catch{}finally{}i=Dd(t,n,f,l),i!==null&&(f=Ct(),yn(i,t,l,f),cf(i,n,l))}}function lf(t){var n=t.alternate;return t===Je||n!==null&&n===Je}function uf(t,n){Fi=Qs=!0;var i=t.pending;i===null?n.next=n:(n.next=i.next,i.next=n),t.pending=n}function cf(t,n,i){if((i&4194240)!==0){var l=n.lanes;l&=t.pendingLanes,i|=l,n.lanes=i,vr(t,i)}}var ea={readContext:Jt,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useInsertionEffect:kt,useLayoutEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useMutableSource:kt,useSyncExternalStore:kt,useId:kt,unstable_isNewReconciler:!1},qy={readContext:Jt,useCallback:function(t,n){return An().memoizedState=[t,n===void 0?null:n],t},useContext:Jt,useEffect:Zd,useImperativeHandle:function(t,n,i){return i=i!=null?i.concat([t]):null,Zs(4194308,4,tf.bind(null,n,t),i)},useLayoutEffect:function(t,n){return Zs(4194308,4,t,n)},useInsertionEffect:function(t,n){return Zs(4,2,t,n)},useMemo:function(t,n){var i=An();return n=n===void 0?null:n,t=t(),i.memoizedState=[t,n],t},useReducer:function(t,n,i){var l=An();return n=i!==void 0?i(n):n,l.memoizedState=l.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},l.queue=t,t=t.dispatch=Yy.bind(null,Je,t),[l.memoizedState,t]},useRef:function(t){var n=An();return t={current:t},n.memoizedState=t},useState:Kd,useDebugValue:lu,useDeferredValue:function(t){return An().memoizedState=t},useTransition:function(){var t=Kd(!1),n=t[0];return t=Gy.bind(null,t[1]),An().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,i){var l=Je,f=An();if(Qe){if(i===void 0)throw Error(o(407));i=i()}else{if(i=n(),ht===null)throw Error(o(349));(oo&30)!==0||Ud(l,n,i)}f.memoizedState=i;var m={value:i,getSnapshot:n};return f.queue=m,Zd(Yd.bind(null,l,m,t),[t]),l.flags|=2048,Vi(9,Gd.bind(null,l,m,i,n),void 0,null),i},useId:function(){var t=An(),n=ht.identifierPrefix;if(Qe){var i=rr,l=nr;i=(l&~(1<<32-yt(l)-1)).toString(32)+i,n=":"+n+"R"+i,i=Hi++,0<\/script>",t=t.removeChild(t.firstChild)):typeof l.is=="string"?t=N.createElement(i,{is:l.is}):(t=N.createElement(i),i==="select"&&(N=t,l.multiple?N.multiple=!0:l.size&&(N.size=l.size))):t=N.createElementNS(t,i),t[Tn]=n,t[Li]=l,Pf(t,n,!1,!1),n.stateNode=t;e:{switch(N=Wn(i,l),i){case"dialog":Xe("cancel",t),Xe("close",t),f=l;break;case"iframe":case"object":case"embed":Xe("load",t),f=l;break;case"video":case"audio":for(f=0;fQo&&(n.flags|=128,l=!0,Wi(m,!1),n.lanes=4194304)}else{if(!l)if(t=qs(N),t!==null){if(n.flags|=128,l=!0,i=t.updateQueue,i!==null&&(n.updateQueue=i,n.flags|=4),Wi(m,!0),m.tail===null&&m.tailMode==="hidden"&&!N.alternate&&!Qe)return Nt(n),null}else 2*Ye()-m.renderingStartTime>Qo&&i!==1073741824&&(n.flags|=128,l=!0,Wi(m,!1),n.lanes=4194304);m.isBackwards?(N.sibling=n.child,n.child=N):(i=m.last,i!==null?i.sibling=N:n.child=N,m.last=N)}return m.tail!==null?(n=m.tail,m.rendering=n,m.tail=n.sibling,m.renderingStartTime=Ye(),n.sibling=null,i=Ze.current,Ge(Ze,l?i&1|2:i&1),n):(Nt(n),null);case 22:case 23:return Ru(),l=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==l&&(n.flags|=8192),l&&(n.mode&1)!==0?(Ut&1073741824)!==0&&(Nt(n),n.subtreeFlags&6&&(n.flags|=8192)):Nt(n),null;case 24:return null;case 25:return null}throw Error(o(156,n.tag))}function r0(t,n){switch(Hl(n),n.tag){case 1:return At(n.type)&&Ds(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Yo(),qe(Lt),qe(St),eu(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 5:return Zl(n),null;case 13:if(qe(Ze),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(o(340));Vo()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return qe(Ze),null;case 4:return Yo(),null;case 10:return Yl(n.type._context),null;case 22:case 23:return Ru(),null;case 24:return null;default:return null}}var oa=!1,bt=!1,o0=typeof WeakSet=="function"?WeakSet:Set,ve=null;function qo(t,n){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(l){nt(t,n,l)}else i.current=null}function wu(t,n,i){try{i()}catch(l){nt(t,n,l)}}var Tf=!1;function i0(t,n){if(Rl=Ns,t=cd(),Nl(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var f=l.anchorOffset,m=l.focusNode;l=l.focusOffset;try{i.nodeType,m.nodeType}catch{i=null;break e}var N=0,T=-1,O=-1,ee=0,ae=0,ue=t,ie=null;t:for(;;){for(var ge;ue!==i||f!==0&&ue.nodeType!==3||(T=N+f),ue!==m||l!==0&&ue.nodeType!==3||(O=N+l),ue.nodeType===3&&(N+=ue.nodeValue.length),(ge=ue.firstChild)!==null;)ie=ue,ue=ge;for(;;){if(ue===t)break t;if(ie===i&&++ee===f&&(T=N),ie===m&&++ae===l&&(O=N),(ge=ue.nextSibling)!==null)break;ue=ie,ie=ue.parentNode}ue=ge}i=T===-1||O===-1?null:{start:T,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Tl={focusedElem:t,selectionRange:i},Ns=!1,ve=n;ve!==null;)if(n=ve,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,ve=t;else for(;ve!==null;){n=ve;try{var xe=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var _e=xe.memoizedProps,ot=xe.memoizedState,X=n.stateNode,B=X.getSnapshotBeforeUpdate(n.elementType===n.type?_e:pn(n.type,_e),ot);X.__reactInternalSnapshotBeforeUpdate=B}break;case 3:var K=n.stateNode.containerInfo;K.nodeType===1?K.textContent="":K.nodeType===9&&K.documentElement&&K.removeChild(K.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(de){nt(n,n.return,de)}if(t=n.sibling,t!==null){t.return=n.return,ve=t;break}ve=n.return}return xe=Tf,Tf=!1,xe}function Ui(t,n,i){var l=n.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var f=l=l.next;do{if((f.tag&t)===t){var m=f.destroy;f.destroy=void 0,m!==void 0&&wu(n,i,m)}f=f.next}while(f!==l)}}function ia(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var l=i.create;i.destroy=l()}i=i.next}while(i!==n)}}function _u(t){var n=t.ref;if(n!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof n=="function"?n(t):n.current=t}}function Lf(t){var n=t.alternate;n!==null&&(t.alternate=null,Lf(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&(delete n[Tn],delete n[Li],delete n[zl],delete n[Hy],delete n[By])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Af(t){return t.tag===5||t.tag===3||t.tag===4}function $f(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Af(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Su(t,n,i){var l=t.tag;if(l===5||l===6)t=t.stateNode,n?i.nodeType===8?i.parentNode.insertBefore(t,n):i.insertBefore(t,n):(i.nodeType===8?(n=i.parentNode,n.insertBefore(t,i)):(n=i,n.appendChild(t)),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=$s));else if(l!==4&&(t=t.child,t!==null))for(Su(t,n,i),t=t.sibling;t!==null;)Su(t,n,i),t=t.sibling}function ku(t,n,i){var l=t.tag;if(l===5||l===6)t=t.stateNode,n?i.insertBefore(t,n):i.appendChild(t);else if(l!==4&&(t=t.child,t!==null))for(ku(t,n,i),t=t.sibling;t!==null;)ku(t,n,i),t=t.sibling}var vt=null,gn=!1;function Cr(t,n,i){for(i=i.child;i!==null;)zf(t,n,i),i=i.sibling}function zf(t,n,i){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(Pn,i)}catch{}switch(i.tag){case 5:bt||qo(i,n);case 6:var l=vt,f=gn;vt=null,Cr(t,n,i),vt=l,gn=f,vt!==null&&(gn?(t=vt,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):vt.removeChild(i.stateNode));break;case 18:vt!==null&&(gn?(t=vt,i=i.stateNode,t.nodeType===8?$l(t.parentNode,i):t.nodeType===1&&$l(t,i),ki(t)):$l(vt,i.stateNode));break;case 4:l=vt,f=gn,vt=i.stateNode.containerInfo,gn=!0,Cr(t,n,i),vt=l,gn=f;break;case 0:case 11:case 14:case 15:if(!bt&&(l=i.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){f=l=l.next;do{var m=f,N=m.destroy;m=m.tag,N!==void 0&&((m&2)!==0||(m&4)!==0)&&wu(i,n,N),f=f.next}while(f!==l)}Cr(t,n,i);break;case 1:if(!bt&&(qo(i,n),l=i.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=i.memoizedProps,l.state=i.memoizedState,l.componentWillUnmount()}catch(T){nt(i,n,T)}Cr(t,n,i);break;case 21:Cr(t,n,i);break;case 22:i.mode&1?(bt=(l=bt)||i.memoizedState!==null,Cr(t,n,i),bt=l):Cr(t,n,i);break;default:Cr(t,n,i)}}function Df(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new o0),n.forEach(function(l){var f=p0.bind(null,t,l);i.has(l)||(i.add(l),l.then(f,f))})}}function mn(t,n){var i=n.deletions;if(i!==null)for(var l=0;lf&&(f=N),l&=~m}if(l=f,l=Ye()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*a0(l/1960))-l,10t?16:t,Pr===null)var l=!1;else{if(t=Pr,Pr=null,ca=0,(Oe&6)!==0)throw Error(o(331));var f=Oe;for(Oe|=4,ve=t.current;ve!==null;){var m=ve,N=m.child;if((ve.flags&16)!==0){var T=m.deletions;if(T!==null){for(var O=0;OYe()-ju?ao(t,0):bu|=i),Dt(t,n)}function Qf(t,n){n===0&&((t.mode&1)===0?n=1:(n=Zn,Zn<<=1,(Zn&130023424)===0&&(Zn=4194304)));var i=Ct();t=or(t,n),t!==null&&(Jn(t,n,i),Dt(t,i))}function h0(t){var n=t.memoizedState,i=0;n!==null&&(i=n.retryLane),Qf(t,i)}function p0(t,n){var i=0;switch(t.tag){case 13:var l=t.stateNode,f=t.memoizedState;f!==null&&(i=f.retryLane);break;case 19:l=t.stateNode;break;default:throw Error(o(314))}l!==null&&l.delete(n),Qf(t,i)}var Zf;Zf=function(t,n,i){if(t!==null)if(t.memoizedProps!==n.pendingProps||Lt.current)$t=!0;else{if((t.lanes&i)===0&&(n.flags&128)===0)return $t=!1,t0(t,n,i);$t=(t.flags&131072)!==0}else $t=!1,Qe&&(n.flags&1048576)!==0&&Pd(n,Bs,n.index);switch(n.lanes=0,n.tag){case 2:var l=n.type;ra(t,n),t=n.pendingProps;var f=Fo(n,St.current);Go(n,i),f=ru(null,n,l,t,f,i);var m=ou();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,At(l)?(m=!0,Os(n)):m=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Kl(n),f.updater=ta,n.stateNode=f,f._reactInternals=n,cu(n,l,t,i),n=pu(null,n,l,!0,m,i)):(n.tag=0,Qe&&m&&Fl(n),Et(null,n,f,i),n=n.child),n;case 16:l=n.elementType;e:{switch(ra(t,n),t=n.pendingProps,f=l._init,l=f(l._payload),n.type=l,f=n.tag=m0(l),t=pn(l,t),f){case 0:n=hu(null,n,l,t,i);break e;case 1:n=Nf(null,n,l,t,i);break e;case 11:n=xf(null,n,l,t,i);break e;case 14:n=wf(null,n,l,pn(l.type,t),i);break e}throw Error(o(306,l,""))}return n;case 0:return l=n.type,f=n.pendingProps,f=n.elementType===l?f:pn(l,f),hu(t,n,l,f,i);case 1:return l=n.type,f=n.pendingProps,f=n.elementType===l?f:pn(l,f),Nf(t,n,l,f,i);case 3:e:{if(bf(n),t===null)throw Error(o(387));l=n.pendingProps,m=n.memoizedState,f=m.element,Od(t,n),Xs(n,l,null,i);var N=n.memoizedState;if(l=N.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:N.cache,pendingSuspenseBoundaries:N.pendingSuspenseBoundaries,transitions:N.transitions},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){f=Xo(Error(o(423)),n),n=jf(t,n,l,i,f);break e}else if(l!==f){f=Xo(Error(o(424)),n),n=jf(t,n,l,i,f);break e}else for(Wt=Sr(n.stateNode.containerInfo.firstChild),Vt=n,Qe=!0,hn=null,i=zd(n,null,l,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Vo(),l===f){n=sr(t,n,i);break e}Et(t,n,l,i)}n=n.child}return n;case 5:return Bd(n),t===null&&Vl(n),l=n.type,f=n.pendingProps,m=t!==null?t.memoizedProps:null,N=f.children,Ll(l,f)?N=null:m!==null&&Ll(l,m)&&(n.flags|=32),kf(t,n),Et(t,n,N,i),n.child;case 6:return t===null&&Vl(n),null;case 13:return Ef(t,n,i);case 4:return Ql(n,n.stateNode.containerInfo),l=n.pendingProps,t===null?n.child=Wo(n,null,l,i):Et(t,n,l,i),n.child;case 11:return l=n.type,f=n.pendingProps,f=n.elementType===l?f:pn(l,f),xf(t,n,l,f,i);case 7:return Et(t,n,n.pendingProps,i),n.child;case 8:return Et(t,n,n.pendingProps.children,i),n.child;case 12:return Et(t,n,n.pendingProps.children,i),n.child;case 10:e:{if(l=n.type._context,f=n.pendingProps,m=n.memoizedProps,N=f.value,Ge(Us,l._currentValue),l._currentValue=N,m!==null)if(fn(m.value,N)){if(m.children===f.children&&!Lt.current){n=sr(t,n,i);break e}}else for(m=n.child,m!==null&&(m.return=n);m!==null;){var T=m.dependencies;if(T!==null){N=m.child;for(var O=T.firstContext;O!==null;){if(O.context===l){if(m.tag===1){O=ir(-1,i&-i),O.tag=2;var ee=m.updateQueue;if(ee!==null){ee=ee.shared;var ae=ee.pending;ae===null?O.next=O:(O.next=ae.next,ae.next=O),ee.pending=O}}m.lanes|=i,O=m.alternate,O!==null&&(O.lanes|=i),Xl(m.return,i,n),T.lanes|=i;break}O=O.next}}else if(m.tag===10)N=m.type===n.type?null:m.child;else if(m.tag===18){if(N=m.return,N===null)throw Error(o(341));N.lanes|=i,T=N.alternate,T!==null&&(T.lanes|=i),Xl(N,i,n),N=m.sibling}else N=m.child;if(N!==null)N.return=m;else for(N=m;N!==null;){if(N===n){N=null;break}if(m=N.sibling,m!==null){m.return=N.return,N=m;break}N=N.return}m=N}Et(t,n,f.children,i),n=n.child}return n;case 9:return f=n.type,l=n.pendingProps.children,Go(n,i),f=Jt(f),l=l(f),n.flags|=1,Et(t,n,l,i),n.child;case 14:return l=n.type,f=pn(l,n.pendingProps),f=pn(l.type,f),wf(t,n,l,f,i);case 15:return _f(t,n,n.type,n.pendingProps,i);case 17:return l=n.type,f=n.pendingProps,f=n.elementType===l?f:pn(l,f),ra(t,n),n.tag=1,At(l)?(t=!0,Os(n)):t=!1,Go(n,i),ff(n,l,f),cu(n,l,f,i),pu(null,n,l,!0,t,i);case 19:return Mf(t,n,i);case 22:return Sf(t,n,i)}throw Error(o(156,n.tag))};function Jf(t,n){return Kn(t,n)}function g0(t,n,i,l){this.tag=t,this.key=i,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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nn(t,n,i,l){return new g0(t,n,i,l)}function Lu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function m0(t){if(typeof t=="function")return Lu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ne)return 11;if(t===V)return 14}return 2}function Tr(t,n){var i=t.alternate;return i===null?(i=nn(t.tag,n,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=n,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,n=t.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function pa(t,n,i,l,f,m){var N=2;if(l=t,typeof t=="function")Lu(t)&&(N=1);else if(typeof t=="string")N=5;else e:switch(t){case F:return uo(i.children,f,m,n);case U:N=8,f|=8;break;case q:return t=nn(12,i,n,f|2),t.elementType=q,t.lanes=m,t;case Q:return t=nn(13,i,n,f),t.elementType=Q,t.lanes=m,t;case C:return t=nn(19,i,n,f),t.elementType=C,t.lanes=m,t;case Y:return ga(i,f,m,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case te:N=10;break e;case J:N=9;break e;case ne:N=11;break e;case V:N=14;break e;case W:N=16,l=null;break e}throw Error(o(130,t==null?t:typeof t,""))}return n=nn(N,i,n,f),n.elementType=t,n.type=l,n.lanes=m,n}function uo(t,n,i,l){return t=nn(7,t,l,n),t.lanes=i,t}function ga(t,n,i,l){return t=nn(22,t,l,n),t.elementType=Y,t.lanes=i,t.stateNode={isHidden:!1},t}function Au(t,n,i){return t=nn(6,t,null,n),t.lanes=i,t}function $u(t,n,i){return n=nn(4,t.children!==null?t.children:[],t.key,n),n.lanes=i,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function y0(t,n,i,l,f){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ln(0),this.expirationTimes=ln(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ln(0),this.identifierPrefix=l,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function zu(t,n,i,l,f,m,N,T,O){return t=new y0(t,n,i,T,O),n===1?(n=1,m===!0&&(n|=8)):n=0,m=nn(3,null,null,n),t.current=m,m.stateNode=t,m.memoizedState={element:l,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kl(m),t}function v0(t,n,i){var l=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),Vu.exports=R0(),Vu.exports}var ph;function T0(){if(ph)return Sa;ph=1;var e=Fp();return Sa.createRoot=e.createRoot,Sa.hydrateRoot=e.hydrateRoot,Sa}var L0=T0();function Hp(e,r="Request failed"){const o=(e||"").trim();if(!o)return r;try{const a=JSON.parse(o).detail;if(typeof a=="string"&&a.trim())return a;if(Array.isArray(a)){const u=a.map(c=>typeof c=="string"?c:c&&typeof c=="object"&&"msg"in c?String(c.msg):"").filter(Boolean);if(u.length)return u.join("; ")}}catch{}return o}async function ze(e,r){const o=await fetch(e,{...r,headers:{"Content-Type":"application/json",...(r==null?void 0:r.headers)||{}}});if(!o.ok){const s=await o.text();throw new Error(Hp(s,o.statusText||"Request failed"))}return o.json()}const A0=["github_token","gitlab_token","gitlab_oauth_client_secret","bitbucket_token","bitbucket_oauth_client_secret","ai_api_key","ai_model","ai_base_url"],Re={health:()=>ze("/api/health"),settings:()=>ze("/api/settings"),saveSettings:e=>{const r={...e};for(const o of A0)r[o]===""&&delete r[o];return ze("/api/settings",{method:"PUT",body:JSON.stringify(r)})},repos:()=>ze("/api/repos"),browse:e=>ze(`/api/fs${e?`?path=${encodeURIComponent(e)}`:""}`),gitRefs:(e,r=50)=>ze(`/api/git/refs?repo_path=${encodeURIComponent(e)}&limit=${r}`),index:(e,r=!0)=>ze("/api/index",{method:"POST",body:JSON.stringify({repo_path:e,incremental:r})}),indexStatus:e=>ze(`/api/index?repo_path=${encodeURIComponent(e)}`),indexProgress:e=>ze(`/api/index/progress?repo_path=${encodeURIComponent(e)}`),architecture:(e,r=!0)=>ze(`/api/architecture?repo_path=${encodeURIComponent(e)}&graph=${r?"1":"0"}`),architectureGraph:e=>ze(`/api/architecture/graph?repo_path=${encodeURIComponent(e)}`),review:(e,r,o,s=!0,a=!1)=>ze("/api/review",{method:"POST",body:JSON.stringify({repo_path:e,base:r,head:o||null,reindex:s,incremental:!0,three_dot:!0,dirty:a})}),whatIf:(e,r)=>ze("/api/whatif",{method:"POST",body:JSON.stringify({repo_path:e,node_id:r})}),reviewPr:(e,r,o,s)=>ze("/api/prs/review",{method:"POST",body:JSON.stringify({provider:e,repo:r,number:o,repo_path:s||null})}),init:(e,r=!1)=>ze("/api/init",{method:"POST",body:JSON.stringify({repo_path:e,overwrite:r})}),postComment:(e,r,o,s)=>ze("/api/prs/comment",{method:"POST",body:JSON.stringify({provider:e,repo:r,number:o,markdown:s})}),graph:(e,r="full")=>ze(`/api/graph?repo_path=${encodeURIComponent(e)}&scope=${r}`),prs:(e,r,o="open",s)=>ze("/api/prs",{method:"POST",body:JSON.stringify({provider:e,repo:r,state:o,repo_path:s||null})}),scmRepos:e=>ze(`/api/scm/repos?provider=${encodeURIComponent(e)}`),oauthStatus:()=>ze("/api/oauth/status"),githubOAuthStart:()=>ze("/api/oauth/github/start",{method:"POST",body:"{}"}),githubOAuthPoll:e=>ze("/api/oauth/github/poll",{method:"POST",body:JSON.stringify({flow_id:e})}),bitbucketOAuthStart:()=>ze("/api/oauth/bitbucket/start"),gitlabOAuthStart:()=>ze("/api/oauth/gitlab/start"),oauthDisconnect:e=>ze("/api/oauth/disconnect",{method:"POST",body:JSON.stringify({provider:e})}),residual:e=>ze("/api/ai/residual",{method:"POST",body:JSON.stringify({review:e})}),reviews:e=>ze(`/api/reviews?repo_path=${encodeURIComponent(e)}`),getReview:(e,r)=>ze(`/api/reviews/${encodeURIComponent(r)}?repo_path=${encodeURIComponent(e)}`),reviewDiff:(e,r,o)=>ze(`/api/reviews/${encodeURIComponent(r)}/diff?repo_path=${encodeURIComponent(e)}&other=${encodeURIComponent(o)}`),config:e=>ze(`/api/config?repo_path=${encodeURIComponent(e)}`),saveConfig:(e,r)=>ze("/api/config",{method:"PUT",body:JSON.stringify({repo_path:e,...r})}),addWaiver:(e,r,o,s)=>ze("/api/config/waiver",{method:"POST",body:JSON.stringify({repo_path:e,rule:r,node:o||null,reason:s||""})}),marks:(e,r)=>ze(`/api/marks?repo_path=${encodeURIComponent(e)}${r?`&review_id=${encodeURIComponent(r)}`:""}`),architectureHealth:e=>ze(`/api/architecture/health?repo_path=${encodeURIComponent(e)}`),workspaceStatus:e=>ze(`/api/workspace/status?repo_path=${encodeURIComponent(e)}`),openEditor:(e,r,o,s)=>ze("/api/open",{method:"POST",body:JSON.stringify({repo_path:e,path:r,line:o||null,editor:s||null})}),exportHtml:e=>fetch("/api/export/html",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({review:e})}).then(async r=>{if(!r.ok){const o=await r.text();throw new Error(Hp(o,r.statusText||"Request failed"))}return r.blob()}),isolate:(e,r,o,s)=>ze("/api/graph/isolate",{method:"POST",body:JSON.stringify({nodes:e,edges:r,source_id:o,target_id:s||null})})};function $0(e,r){const o=r.trim().toLowerCase();return o?e.filter(s=>s.label.toLowerCase().includes(o)||(s.hint||"").toLowerCase().includes(o)||(s.group||"").toLowerCase().includes(o)):e}function z0({open:e,actions:r,onClose:o}){const[s,a]=A.useState(""),[u,c]=A.useState(0),h=A.useRef(null),p=A.useMemo(()=>$0(r,s),[r,s]);if(A.useEffect(()=>{if(!e)return;a(""),c(0);const g=window.setTimeout(()=>{var x;return(x=h.current)==null?void 0:x.focus()},0);return()=>window.clearTimeout(g)},[e]),A.useEffect(()=>{c(0)},[s]),!e)return null;const y=p.slice(0,40),w=y[Math.min(u,Math.max(y.length-1,0))],v=g=>{g&&(o(),g.run())};return d.jsx("div",{className:"palette-scrim","data-testid":"command-palette",onClick:g=>{g.target===g.currentTarget&&o()},children:d.jsxs("div",{className:"palette",role:"dialog","aria-label":"Command palette",children:[d.jsx("input",{ref:h,"data-testid":"command-palette-input",placeholder:"Jump to a node, run a review, toggle overlays…",value:s,onChange:g=>a(g.target.value),onKeyDown:g=>{g.key==="Escape"?(g.preventDefault(),o()):g.key==="ArrowDown"?(g.preventDefault(),c(x=>Math.min(Math.max(y.length-1,0),x+1))):g.key==="ArrowUp"?(g.preventDefault(),c(x=>Math.max(0,x-1))):g.key==="Enter"&&(g.preventDefault(),v(w))}}),d.jsxs("ul",{children:[y.length===0?d.jsx("li",{className:"muted",children:"No matches"}):null,y.map((g,x)=>d.jsx("li",{children:d.jsxs("button",{type:"button",className:x===u?"active":"",onMouseEnter:()=>c(x),onClick:()=>v(g),children:[d.jsx("span",{children:g.label}),g.hint?d.jsx("span",{className:"muted",children:g.hint}):null]})},g.id))]}),d.jsxs("div",{className:"palette-foot muted",children:[d.jsx("kbd",{children:"↑"}),d.jsx("kbd",{children:"↓"})," move · ",d.jsx("kbd",{children:"Enter"})," run · ",d.jsx("kbd",{children:"Esc"})," close"]})]})})}function D0({config:e,busy:r,onSave:o,onWaiver:s}){const[a,u]=A.useState(e),[c,h]=A.useState(e.available_rules[0]||""),[p,y]=A.useState(""),[w,v]=A.useState("");A.useEffect(()=>{u(e)},[e]);const g=Object.entries(a.contexts||{}),x=(I,_,j)=>{const L=a.contexts[I];if(!L)return;const $=F=>F.split(",").map(U=>U.trim()).filter(Boolean);u({...a,contexts:{...a.contexts,[I]:{...L,[_]:_==="name"?j:$(j)}}})},S=(I,_)=>{const j=_.trim();if(!j||j===I)return;const{[I]:L,...$}=a.contexts;L&&u({...a,contexts:{...$,[j]:{...L,name:j}}})},k=()=>{let I=1;for(;a.contexts[`context-${I}`];)I+=1;const _=`context-${I}`;u({...a,contexts:{...a.contexts,[_]:{name:_,django_apps:[],react:[],public_api:[],owners:[]}}})},b=I=>{const{[I]:_,...j}=a.contexts;u({...a,contexts:j})},E=I=>{const _=a.rules.includes(I);u({...a,rules:_?a.rules.filter(j=>j!==I):[...a.rules,I]})};return d.jsxs("div",{className:"config-editor","data-testid":"config-editor",children:[d.jsx("p",{className:"muted",children:a.exists?a.path:"No loadpath.yml yet — saving writes one at the repo root."}),g.map(([I,_])=>d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Context ",d.jsx("span",{className:"count",children:I})]}),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"Name"}),d.jsx("input",{defaultValue:I,"data-testid":`config-context-name-${I}`,onBlur:j=>S(I,j.target.value)})]}),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"Django apps"}),d.jsx("input",{value:(_.django_apps||[]).join(", "),onChange:j=>x(I,"django_apps",j.target.value)})]}),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"React folders"}),d.jsx("input",{value:(_.react||[]).join(", "),onChange:j=>x(I,"react",j.target.value)})]}),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"Public API"}),d.jsx("input",{value:(_.public_api||[]).join(", "),onChange:j=>x(I,"public_api",j.target.value)})]}),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"Owners"}),d.jsx("input",{value:(_.owners||[]).join(", "),onChange:j=>x(I,"owners",j.target.value)})]}),d.jsx("button",{type:"button",className:"btn",onClick:()=>b(I),children:"Remove context"})]},I)),d.jsx("div",{className:"btn-row",children:d.jsx("button",{type:"button",className:"btn","data-testid":"config-add-context",onClick:k,children:"Add context"})}),d.jsxs("details",{className:"section",children:[d.jsxs("summary",{children:["Rules ",d.jsx("span",{className:"count",children:a.rules.length})]}),(a.available_rules.length?a.available_rules:a.rules).map(I=>d.jsxs("label",{className:"check-row",children:[d.jsx("input",{type:"checkbox",checked:a.rules.includes(I),onChange:()=>E(I)}),I]},I))]}),d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Waivers ",d.jsx("span",{className:"count",children:(a.waivers||[]).length})]}),(a.waivers||[]).map((I,_)=>d.jsxs("div",{className:"muted",children:[d.jsx("strong",{children:I.rule}),I.node?` · ${I.node}`:"",I.reason?` — ${I.reason}`:""]},`${I.rule}:${I.node}:${_}`)),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"Rule"}),d.jsx("select",{value:c,onChange:I=>h(I.target.value),children:(a.available_rules.length?a.available_rules:a.rules).map(I=>d.jsx("option",{value:I,children:I},I))})]}),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"Node id (optional)"}),d.jsx("input",{value:p,onChange:I=>y(I.target.value),placeholder:"django.view:…"})]}),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"Reason"}),d.jsx("input",{value:w,onChange:I=>v(I.target.value)})]}),d.jsx("button",{type:"button",className:"btn","data-testid":"config-add-waiver",disabled:r||!c,onClick:()=>s==null?void 0:s(c,p,w),children:"Add waiver"})]}),d.jsx("div",{className:"btn-row",children:d.jsx("button",{type:"button",className:"btn primary","data-testid":"config-save",disabled:r,onClick:()=>o(a),children:"Save loadpath.yml"})})]})}function rs(e){return e.replaceAll("_"," ")}function O0(e){return e.replaceAll("_"," ")}function ci(e){return e.split(".").pop()||e}function lc(e){if(!e)return"";const r=new Date(e);return Number.isNaN(r.getTime())?e:r.toLocaleString()}function F0(e){return e.split(/[\\/]/).filter(Boolean).pop()||e}function Dr(e){return e.replace(/([/\\._:@-])/g,"$1​")}function _o({className:e,children:r}){return d.jsx("svg",{className:e,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r})}function H0({className:e}){return d.jsxs(_o,{className:e,children:[d.jsx("path",{d:"M3 3.5h6.5L13 7v5.5H3z"}),d.jsx("path",{d:"M9.5 3.5V7H13"}),d.jsx("path",{d:"M5.5 9.5h5M5.5 11.5h3.5"})]})}function B0({className:e}){return d.jsxs(_o,{className:e,children:[d.jsx("rect",{x:"2.5",y:"2.5",width:"4.5",height:"4.5",rx:"0.8"}),d.jsx("rect",{x:"9",y:"2.5",width:"4.5",height:"4.5",rx:"0.8"}),d.jsx("rect",{x:"2.5",y:"9",width:"4.5",height:"4.5",rx:"0.8"}),d.jsx("rect",{x:"9",y:"9",width:"4.5",height:"4.5",rx:"0.8"})]})}function V0({className:e}){return d.jsxs(_o,{className:e,children:[d.jsx("circle",{cx:"4",cy:"8",r:"1.6"}),d.jsx("circle",{cx:"12",cy:"4",r:"1.6"}),d.jsx("circle",{cx:"12",cy:"12",r:"1.6"}),d.jsx("path",{d:"M5.5 7.2 10.4 4.8M5.5 8.8 10.4 11.2"})]})}function W0({className:e}){return d.jsxs(_o,{className:e,children:[d.jsx("circle",{cx:"4.5",cy:"4",r:"1.4"}),d.jsx("circle",{cx:"4.5",cy:"12",r:"1.4"}),d.jsx("circle",{cx:"11.5",cy:"12",r:"1.4"}),d.jsx("path",{d:"M4.5 5.5v5M4.5 8h4.2a3 3 0 0 1 3 3"})]})}function U0({className:e}){return d.jsxs(_o,{className:e,children:[d.jsx("circle",{cx:"8",cy:"8",r:"2.1"}),d.jsx("path",{d:"M8 2.5v1.6M8 11.9v1.6M2.5 8h1.6M11.9 8h1.6M4.1 4.1l1.1 1.1M10.8 10.8l1.1 1.1M11.9 4.1l-1.1 1.1M5.2 10.8l-1.1 1.1"})]})}function Bp({className:e}){return d.jsx(_o,{className:e,children:d.jsx("path",{d:"M2.5 4.5h4L8 6h5.5v6.5h-11z"})})}function G0({className:e}){return d.jsx(_o,{className:e,children:d.jsx("path",{d:"M4 6.5 8 10.5 12 6.5"})})}const Y0="modulepreload",X0=function(e,r){return new URL(e,r).href},gh={},q0=function(r,o,s){let a=Promise.resolve();if(o&&o.length>0){let c=function(w){return Promise.all(w.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};const h=document.getElementsByTagName("link"),p=document.querySelector("meta[property=csp-nonce]"),y=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));a=c(o.map(w=>{if(w=X0(w,s),w in gh)return;gh[w]=!0;const v=w.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(!!s)for(let k=h.length-1;k>=0;k--){const b=h[k];if(b.href===w&&(!v||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${w}"]${g}`))return;const S=document.createElement("link");if(S.rel=v?"stylesheet":Y0,v||(S.as="script"),S.crossOrigin="",S.href=w,y&&S.setAttribute("nonce",y),document.head.appendChild(S),v)return new Promise((k,b)=>{S.addEventListener("load",k),S.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${w}`)))})}))}function u(c){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=c,window.dispatchEvent(h),!h.defaultPrevented)throw c}return a.then(c=>{for(const h of c||[])h.status==="rejected"&&u(h.reason);return r().catch(u)})};function st(e){if(typeof e=="string"||typeof e=="number")return""+e;let r="";if(Array.isArray(e))for(let o=0,s;o{}};function el(){for(var e=0,r=arguments.length,o={},s;e=0&&(s=o.slice(a+1),o=o.slice(0,a)),o&&!r.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:s}})}La.prototype=el.prototype={constructor:La,on:function(e,r){var o=this._,s=Q0(e+"",o),a,u=-1,c=s.length;if(arguments.length<2){for(;++u0)for(var o=new Array(a),s=0,a,u;s=0&&(r=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),yh.hasOwnProperty(r)?{space:yh[r],local:e}:e}function J0(e){return function(){var r=this.ownerDocument,o=this.namespaceURI;return o===uc&&r.documentElement.namespaceURI===uc?r.createElement(e):r.createElementNS(o,e)}}function ev(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Vp(e){var r=tl(e);return(r.local?ev:J0)(r)}function tv(){}function kc(e){return e==null?tv:function(){return this.querySelector(e)}}function nv(e){typeof e!="function"&&(e=kc(e));for(var r=this._groups,o=r.length,s=new Array(o),a=0;a=_&&(_=I+1);!(L=b[_])&&++_=0;)(c=s[a])&&(u&&c.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(c,u),u=c);return this}function Ev(e){e||(e=Cv);function r(v,g){return v&&g?e(v.__data__,g.__data__):!v-!g}for(var o=this._groups,s=o.length,a=new Array(s),u=0;ur?1:e>=r?0:NaN}function Mv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Pv(){return Array.from(this)}function Iv(){for(var e=this._groups,r=0,o=e.length;r1?this.each((r==null?Bv:typeof r=="function"?Wv:Vv)(e,r,o??"")):ri(this.node(),e)}function ri(e,r){return e.style.getPropertyValue(r)||Xp(e).getComputedStyle(e,null).getPropertyValue(r)}function Gv(e){return function(){delete this[e]}}function Yv(e,r){return function(){this[e]=r}}function Xv(e,r){return function(){var o=r.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function qv(e,r){return arguments.length>1?this.each((r==null?Gv:typeof r=="function"?Xv:Yv)(e,r)):this.node()[e]}function qp(e){return e.trim().split(/^|\s+/)}function Nc(e){return e.classList||new Kp(e)}function Kp(e){this._node=e,this._names=qp(e.getAttribute("class")||"")}Kp.prototype={add:function(e){var r=this._names.indexOf(e);r<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var r=this._names.indexOf(e);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Qp(e,r){for(var o=Nc(e),s=-1,a=r.length;++s=0&&(o=r.slice(s+1),r=r.slice(0,s)),{type:r,name:o}})}function kx(e){return function(){var r=this.__on;if(r){for(var o=0,s=-1,a=r.length,u;o()=>e;function cc(e,{sourceEvent:r,subject:o,target:s,identifier:a,active:u,x:c,y:h,dx:p,dy:y,dispatch:w}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:h,enumerable:!0,configurable:!0},dx:{value:p,enumerable:!0,configurable:!0},dy:{value:y,enumerable:!0,configurable:!0},_:{value:w}})}cc.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Tx(e){return!e.ctrlKey&&!e.button}function Lx(){return this.parentNode}function Ax(e,r){return r??{x:e.x,y:e.y}}function $x(){return navigator.maxTouchPoints||"ontouchstart"in this}function rg(){var e=Tx,r=Lx,o=Ax,s=$x,a={},u=el("start","drag","end"),c=0,h,p,y,w,v=0;function g(j){j.on("mousedown.drag",x).filter(s).on("touchstart.drag",b).on("touchmove.drag",E,Rx).on("touchend.drag touchcancel.drag",I).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(j,L){if(!(w||!e.call(this,j,L))){var $=_(this,r.call(this,j,L),j,L,"mouse");$&&(Gt(j.view).on("mousemove.drag",S,os).on("mouseup.drag",k,os),tg(j.view),Gu(j),y=!1,h=j.clientX,p=j.clientY,$("start",j))}}function S(j){if(ti(j),!y){var L=j.clientX-h,$=j.clientY-p;y=L*L+$*$>v}a.mouse("drag",j)}function k(j){Gt(j.view).on("mousemove.drag mouseup.drag",null),ng(j.view,y),ti(j),a.mouse("end",j)}function b(j,L){if(e.call(this,j,L)){var $=j.changedTouches,F=r.call(this,j,L),U=$.length,q,te;for(q=0;q>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):o===8?Na(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):o===4?Na(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=Dx.exec(e))?new Ft(r[1],r[2],r[3],1):(r=Ox.exec(e))?new Ft(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=Fx.exec(e))?Na(r[1],r[2],r[3],r[4]):(r=Hx.exec(e))?Na(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=Bx.exec(e))?Nh(r[1],r[2]/100,r[3]/100,1):(r=Vx.exec(e))?Nh(r[1],r[2]/100,r[3]/100,r[4]):vh.hasOwnProperty(e)?_h(vh[e]):e==="transparent"?new Ft(NaN,NaN,NaN,0):null}function _h(e){return new Ft(e>>16&255,e>>8&255,e&255,1)}function Na(e,r,o,s){return s<=0&&(e=r=o=NaN),new Ft(e,r,o,s)}function Gx(e){return e instanceof ms||(e=mo(e)),e?(e=e.rgb(),new Ft(e.r,e.g,e.b,e.opacity)):new Ft}function dc(e,r,o,s){return arguments.length===1?Gx(e):new Ft(e,r,o,s??1)}function Ft(e,r,o,s){this.r=+e,this.g=+r,this.b=+o,this.opacity=+s}bc(Ft,dc,og(ms,{brighter(e){return e=e==null?Fa:Math.pow(Fa,e),new Ft(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?is:Math.pow(is,e),new Ft(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ft(ho(this.r),ho(this.g),ho(this.b),Ha(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:Sh,formatHex:Sh,formatHex8:Yx,formatRgb:kh,toString:kh}));function Sh(){return`#${fo(this.r)}${fo(this.g)}${fo(this.b)}`}function Yx(){return`#${fo(this.r)}${fo(this.g)}${fo(this.b)}${fo((isNaN(this.opacity)?1:this.opacity)*255)}`}function kh(){const e=Ha(this.opacity);return`${e===1?"rgb(":"rgba("}${ho(this.r)}, ${ho(this.g)}, ${ho(this.b)}${e===1?")":`, ${e})`}`}function Ha(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ho(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function fo(e){return e=ho(e),(e<16?"0":"")+e.toString(16)}function Nh(e,r,o,s){return s<=0?e=r=o=NaN:o<=0||o>=1?e=r=NaN:r<=0&&(e=NaN),new xn(e,r,o,s)}function ig(e){if(e instanceof xn)return new xn(e.h,e.s,e.l,e.opacity);if(e instanceof ms||(e=mo(e)),!e)return new xn;if(e instanceof xn)return e;e=e.rgb();var r=e.r/255,o=e.g/255,s=e.b/255,a=Math.min(r,o,s),u=Math.max(r,o,s),c=NaN,h=u-a,p=(u+a)/2;return h?(r===u?c=(o-s)/h+(o0&&p<1?0:c,new xn(c,h,p,e.opacity)}function Xx(e,r,o,s){return arguments.length===1?ig(e):new xn(e,r,o,s??1)}function xn(e,r,o,s){this.h=+e,this.s=+r,this.l=+o,this.opacity=+s}bc(xn,Xx,og(ms,{brighter(e){return e=e==null?Fa:Math.pow(Fa,e),new xn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?is:Math.pow(is,e),new xn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,r=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,s=o+(o<.5?o:1-o)*r,a=2*o-s;return new Ft(Yu(e>=240?e-240:e+120,a,s),Yu(e,a,s),Yu(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new xn(bh(this.h),ba(this.s),ba(this.l),Ha(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ha(this.opacity);return`${e===1?"hsl(":"hsla("}${bh(this.h)}, ${ba(this.s)*100}%, ${ba(this.l)*100}%${e===1?")":`, ${e})`}`}}));function bh(e){return e=(e||0)%360,e<0?e+360:e}function ba(e){return Math.max(0,Math.min(1,e||0))}function Yu(e,r,o){return(e<60?r+(o-r)*e/60:e<180?o:e<240?r+(o-r)*(240-e)/60:r)*255}const jc=e=>()=>e;function qx(e,r){return function(o){return e+o*r}}function Kx(e,r,o){return e=Math.pow(e,o),r=Math.pow(r,o)-e,o=1/o,function(s){return Math.pow(e+s*r,o)}}function Qx(e){return(e=+e)==1?sg:function(r,o){return o-r?Kx(r,o,e):jc(isNaN(r)?o:r)}}function sg(e,r){var o=r-e;return o?qx(e,o):jc(isNaN(e)?r:e)}const Ba=(function e(r){var o=Qx(r);function s(a,u){var c=o((a=dc(a)).r,(u=dc(u)).r),h=o(a.g,u.g),p=o(a.b,u.b),y=sg(a.opacity,u.opacity);return function(w){return a.r=c(w),a.g=h(w),a.b=p(w),a.opacity=y(w),a+""}}return s.gamma=e,s})(1);function Zx(e,r){r||(r=[]);var o=e?Math.min(r.length,e.length):0,s=r.slice(),a;return function(u){for(a=0;ao&&(u=r.slice(o,u),h[c]?h[c]+=u:h[++c]=u),(s=s[0])===(a=a[0])?h[c]?h[c]+=a:h[++c]=a:(h[++c]=null,p.push({i:c,x:zn(s,a)})),o=Xu.lastIndex;return o180?w+=360:w-y>180&&(y+=360),g.push({i:v.push(a(v)+"rotate(",null,s)-2,x:zn(y,w)})):w&&v.push(a(v)+"rotate("+w+s)}function h(y,w,v,g){y!==w?g.push({i:v.push(a(v)+"skewX(",null,s)-2,x:zn(y,w)}):w&&v.push(a(v)+"skewX("+w+s)}function p(y,w,v,g,x,S){if(y!==v||w!==g){var k=x.push(a(x)+"scale(",null,",",null,")");S.push({i:k-4,x:zn(y,v)},{i:k-2,x:zn(w,g)})}else(v!==1||g!==1)&&x.push(a(x)+"scale("+v+","+g+")")}return function(y,w){var v=[],g=[];return y=e(y),w=e(w),u(y.translateX,y.translateY,w.translateX,w.translateY,v,g),c(y.rotate,w.rotate,v,g),h(y.skewX,w.skewX,v,g),p(y.scaleX,y.scaleY,w.scaleX,w.scaleY,v,g),y=w=null,function(x){for(var S=-1,k=g.length,b;++S=0&&e._call.call(void 0,r),e=e._next;--oi}function Ch(){yo=(Wa=as.now())+nl,oi=Ji=0;try{hw()}finally{oi=0,gw(),yo=0}}function pw(){var e=as.now(),r=e-Wa;r>cg&&(nl-=r,Wa=e)}function gw(){for(var e,r=Va,o,s=1/0;r;)r._call?(s>r._time&&(s=r._time),e=r,r=r._next):(o=r._next,r._next=null,r=e?e._next=o:Va=o);es=e,pc(s)}function pc(e){if(!oi){Ji&&(Ji=clearTimeout(Ji));var r=e-yo;r>24?(e<1/0&&(Ji=setTimeout(Ch,e-as.now()-nl)),Qi&&(Qi=clearInterval(Qi))):(Qi||(Wa=as.now(),Qi=setInterval(pw,cg)),oi=1,dg(Ch))}}function Mh(e,r,o){var s=new Ua;return r=r==null?0:+r,s.restart(a=>{s.stop(),e(a+r)},r,o),s}var mw=el("start","end","cancel","interrupt"),yw=[],hg=0,Ph=1,gc=2,$a=3,Ih=4,mc=5,za=6;function rl(e,r,o,s,a,u){var c=e.__transition;if(!c)e.__transition={};else if(o in c)return;vw(e,o,{name:r,index:s,group:a,on:mw,tween:yw,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:hg})}function Cc(e,r){var o=kn(e,r);if(o.state>hg)throw new Error("too late; already scheduled");return o}function Hn(e,r){var o=kn(e,r);if(o.state>$a)throw new Error("too late; already running");return o}function kn(e,r){var o=e.__transition;if(!o||!(o=o[r]))throw new Error("transition not found");return o}function vw(e,r,o){var s=e.__transition,a;s[r]=o,o.timer=fg(u,0,o.time);function u(y){o.state=Ph,o.timer.restart(c,o.delay,o.time),o.delay<=y&&c(y-o.delay)}function c(y){var w,v,g,x;if(o.state!==Ph)return p();for(w in s)if(x=s[w],x.name===o.name){if(x.state===$a)return Mh(c);x.state===Ih?(x.state=za,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete s[w]):+wgc&&s.state=0&&(r=r.slice(0,o)),!r||r==="start"})}function Xw(e,r,o){var s,a,u=Yw(r)?Cc:Hn;return function(){var c=u(this,e),h=c.on;h!==s&&(a=(s=h).copy()).on(r,o),c.on=a}}function qw(e,r){var o=this._id;return arguments.length<2?kn(this.node(),o).on.on(e):this.each(Xw(o,e,r))}function Kw(e){return function(){var r=this.parentNode;for(var o in this.__transition)if(+o!==e)return;r&&r.removeChild(this)}}function Qw(){return this.on("end.remove",Kw(this._id))}function Zw(e){var r=this._name,o=this._id;typeof e!="function"&&(e=kc(e));for(var s=this._groups,a=s.length,u=new Array(a),c=0;c()=>e;function k1(e,{sourceEvent:r,target:o,transform:s,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:a}})}function ur(e,r,o){this.k=e,this.x=r,this.y=o}ur.prototype={constructor:ur,scale:function(e){return e===1?this:new ur(this.k*e,this.x,this.y)},translate:function(e,r){return e===0&r===0?this:new ur(this.k,this.x+this.k*e,this.y+this.k*r)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ol=new ur(1,0,0);yg.prototype=ur.prototype;function yg(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ol;return e.__zoom}function qu(e){e.stopImmediatePropagation()}function Zi(e){e.preventDefault(),e.stopImmediatePropagation()}function N1(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function b1(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Rh(){return this.__zoom||ol}function j1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function E1(){return navigator.maxTouchPoints||"ontouchstart"in this}function C1(e,r,o){var s=e.invertX(r[0][0])-o[0][0],a=e.invertX(r[1][0])-o[1][0],u=e.invertY(r[0][1])-o[0][1],c=e.invertY(r[1][1])-o[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),c>u?(u+c)/2:Math.min(0,u)||Math.max(0,c))}function vg(){var e=N1,r=b1,o=C1,s=j1,a=E1,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],h=250,p=Aa,y=el("start","zoom","end"),w,v,g,x=500,S=150,k=0,b=10;function E(C){C.property("__zoom",Rh).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",te).filter(a).on("touchstart.zoom",J).on("touchmove.zoom",ne).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(C,V,W,Y){var M=C.selection?C.selection():C;M.property("__zoom",Rh),C!==M?L(C,V,W,Y):M.interrupt().each(function(){$(this,arguments).event(Y).start().zoom(null,typeof V=="function"?V.apply(this,arguments):V).end()})},E.scaleBy=function(C,V,W,Y){E.scaleTo(C,function(){var M=this.__zoom.k,D=typeof V=="function"?V.apply(this,arguments):V;return M*D},W,Y)},E.scaleTo=function(C,V,W,Y){E.transform(C,function(){var M=r.apply(this,arguments),D=this.__zoom,H=W==null?j(M):typeof W=="function"?W.apply(this,arguments):W,R=D.invert(H),z=typeof V=="function"?V.apply(this,arguments):V;return o(_(I(D,z),H,R),M,c)},W,Y)},E.translateBy=function(C,V,W,Y){E.transform(C,function(){return o(this.__zoom.translate(typeof V=="function"?V.apply(this,arguments):V,typeof W=="function"?W.apply(this,arguments):W),r.apply(this,arguments),c)},null,Y)},E.translateTo=function(C,V,W,Y,M){E.transform(C,function(){var D=r.apply(this,arguments),H=this.__zoom,R=Y==null?j(D):typeof Y=="function"?Y.apply(this,arguments):Y;return o(ol.translate(R[0],R[1]).scale(H.k).translate(typeof V=="function"?-V.apply(this,arguments):-V,typeof W=="function"?-W.apply(this,arguments):-W),D,c)},Y,M)};function I(C,V){return V=Math.max(u[0],Math.min(u[1],V)),V===C.k?C:new ur(V,C.x,C.y)}function _(C,V,W){var Y=V[0]-W[0]*C.k,M=V[1]-W[1]*C.k;return Y===C.x&&M===C.y?C:new ur(C.k,Y,M)}function j(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function L(C,V,W,Y){C.on("start.zoom",function(){$(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(Y).end()}).tween("zoom",function(){var M=this,D=arguments,H=$(M,D).event(Y),R=r.apply(M,D),z=W==null?j(R):typeof W=="function"?W.apply(M,D):W,re=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),oe=M.__zoom,fe=typeof V=="function"?V.apply(M,D):V,le=p(oe.invert(z).concat(re/oe.k),fe.invert(z).concat(re/fe.k));return function(he){if(he===1)he=fe;else{var Z=le(he),se=re/Z[2];he=new ur(se,z[0]-Z[0]*se,z[1]-Z[1]*se)}H.zoom(null,he)}})}function $(C,V,W){return!W&&C.__zooming||new F(C,V)}function F(C,V){this.that=C,this.args=V,this.active=0,this.sourceEvent=null,this.extent=r.apply(C,V),this.taps=0}F.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,V){return this.mouse&&C!=="mouse"&&(this.mouse[1]=V.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=V.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=V.invert(this.touch1[0])),this.that.__zoom=V,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var V=Gt(this.that).datum();y.call(C,this.that,new k1(C,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:y}),V)}};function U(C,...V){if(!e.apply(this,arguments))return;var W=$(this,V).event(C),Y=this.__zoom,M=Math.max(u[0],Math.min(u[1],Y.k*Math.pow(2,s.apply(this,arguments)))),D=vn(C);if(W.wheel)(W.mouse[0][0]!==D[0]||W.mouse[0][1]!==D[1])&&(W.mouse[1]=Y.invert(W.mouse[0]=D)),clearTimeout(W.wheel);else{if(Y.k===M)return;W.mouse=[D,Y.invert(D)],Da(this),W.start()}Zi(C),W.wheel=setTimeout(H,S),W.zoom("mouse",o(_(I(Y,M),W.mouse[0],W.mouse[1]),W.extent,c));function H(){W.wheel=null,W.end()}}function q(C,...V){if(g||!e.apply(this,arguments))return;var W=C.currentTarget,Y=$(this,V,!0).event(C),M=Gt(C.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",re,!0),D=vn(C,W),H=C.clientX,R=C.clientY;tg(C.view),qu(C),Y.mouse=[D,this.__zoom.invert(D)],Da(this),Y.start();function z(oe){if(Zi(oe),!Y.moved){var fe=oe.clientX-H,le=oe.clientY-R;Y.moved=fe*fe+le*le>k}Y.event(oe).zoom("mouse",o(_(Y.that.__zoom,Y.mouse[0]=vn(oe,W),Y.mouse[1]),Y.extent,c))}function re(oe){M.on("mousemove.zoom mouseup.zoom",null),ng(oe.view,Y.moved),Zi(oe),Y.event(oe).end()}}function te(C,...V){if(e.apply(this,arguments)){var W=this.__zoom,Y=vn(C.changedTouches?C.changedTouches[0]:C,this),M=W.invert(Y),D=W.k*(C.shiftKey?.5:2),H=o(_(I(W,D),Y,M),r.apply(this,V),c);Zi(C),h>0?Gt(this).transition().duration(h).call(L,H,Y,C):Gt(this).call(E.transform,H,Y,C)}}function J(C,...V){if(e.apply(this,arguments)){var W=C.touches,Y=W.length,M=$(this,V,C.changedTouches.length===Y).event(C),D,H,R,z;for(qu(C),H=0;H`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:r,sourceHandle:o,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?o:s}", edge id: ${r}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},ls=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xg=["Enter"," ","Escape"],wg={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:r,y:o})=>`Moved selected node ${e}. New position, x: ${r}, y: ${o}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ii;(function(e){e.Strict="strict",e.Loose="loose"})(ii||(ii={}));var po;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(po||(po={}));var us;(function(e){e.Partial="partial",e.Full="full"})(us||(us={}));const _g={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Or;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Or||(Or={}));var cs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(cs||(cs={}));var ke;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ke||(ke={}));const Th={[ke.Left]:ke.Right,[ke.Right]:ke.Left,[ke.Top]:ke.Bottom,[ke.Bottom]:ke.Top};function Sg(e){return e===null?null:e?"valid":"invalid"}const kg=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,M1=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pc=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ys=(e,r=[0,0])=>{const{width:o,height:s}=Nn(e),a=e.origin??r,u=o*a[0],c=s*a[1];return{x:e.position.x-u,y:e.position.y-c}},P1=(e,r={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let o=!1;const s=e.reduce((a,u)=>{const c=typeof u=="string";let h=!r.nodeLookup&&!c?u:void 0;return r.nodeLookup&&(h=c?r.nodeLookup.get(u):Pc(u)?u:r.nodeLookup.get(u.id)),h?(o=!0,il(a,Ga(h,r.nodeOrigin))):a},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return o?sl(s):{x:0,y:0,width:0,height:0}},vs=(e,r={})=>{let o={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(a=>{(r.filter===void 0||r.filter(a))&&(o=il(o,Ga(a)),s=!0)}),s?sl(o):{x:0,y:0,width:0,height:0}},Ic=(e,r,[o,s,a]=[0,0,1],u=!1,c=!1)=>{const h=(r.x-o)/a,p=(r.y-s)/a,y=r.width/a,w=r.height/a,v=[];for(const g of e.values()){const{measured:x,selectable:S=!0,hidden:k=!1}=g;if(c&&!S||k)continue;const b=x.width??g.width??g.initialWidth??0,E=x.height??g.height??g.initialHeight??0,{x:I,y:_}=g.internals.positionAbsolute,j=Eg(h,p,y,w,I,_,b,E),L=b*E,$=u&&j>0;(!g.internals.handleBounds||$||j>=L||g.dragging)&&v.push(g)}return v},I1=(e,r)=>{const o=new Set;return e.forEach(s=>{o.add(s.id)}),r.filter(s=>o.has(s.source)||o.has(s.target))};function R1(e,r){const o=new Map,s=r!=null&&r.nodes?new Set(r.nodes.map(a=>a.id)):null;return e.forEach(a=>{let u;if(r!=null&&r.includeHiddenNodes){const{width:c,height:h}=Nn(a);u=c>0&&h>0}else u=!!(a.measured.width&&a.measured.height&&!a.hidden);u&&(!s||s.has(a.id))&&o.set(a.id,a)}),o}async function T1({nodes:e,width:r,height:o,panZoom:s,minZoom:a,maxZoom:u},c){if(e.size===0)return!0;const h=R1(e,c),p=vs(h),y=Tc(p,r,o,(c==null?void 0:c.minZoom)??a,(c==null?void 0:c.maxZoom)??u,(c==null?void 0:c.padding)??.1);return await s.setViewport(y,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),!0}function Ng({nodeId:e,nextPosition:r,nodeLookup:o,nodeOrigin:s=[0,0],nodeExtent:a,onError:u}){const c=o.get(e),h=c.parentId?o.get(c.parentId):void 0,{x:p,y}=h?h.internals.positionAbsolute:{x:0,y:0},w=c.origin??s;let v=c.extent||a;if(c.extent==="parent"&&!c.expandParent)if(!h)u==null||u("005",Sn.error005());else{const{width:x,height:S}=Nn(h);x&&S&&(v=[[p,y],[p+x,y+S]])}else h&&xo(c.extent)&&(v=[[c.extent[0][0]+p,c.extent[0][1]+y],[c.extent[1][0]+p,c.extent[1][1]+y]]);const g=xo(v)?vo(r,v,c.measured):r;return(c.measured.width===void 0||c.measured.height===void 0)&&(u==null||u("015",Sn.error015())),{position:{x:g.x-p+(c.measured.width??0)*w[0],y:g.y-y+(c.measured.height??0)*w[1]},positionAbsolute:g}}async function L1({nodesToRemove:e=[],edgesToRemove:r=[],nodes:o,edges:s,onBeforeDelete:a}){const u=new Set(e.map(g=>g.id)),c=[];for(const g of o){if(g.deletable===!1)continue;const x=u.has(g.id),S=!x&&g.parentId&&c.find(k=>k.id===g.parentId);(x||S)&&c.push(g)}const h=new Set(r.map(g=>g.id)),p=s.filter(g=>g.deletable!==!1),w=I1(c,p);for(const g of p)h.has(g.id)&&!w.find(S=>S.id===g.id)&&w.push(g);if(!a)return{edges:w,nodes:c};const v=await a({nodes:c,edges:w});return typeof v=="boolean"?v?{edges:w,nodes:c}:{edges:[],nodes:[]}:v}const si=(e,r=0,o=1)=>Math.min(Math.max(e,r),o),vo=(e={x:0,y:0},r,o)=>({x:si(e.x,r[0][0],r[1][0]-((o==null?void 0:o.width)??0)),y:si(e.y,r[0][1],r[1][1]-((o==null?void 0:o.height)??0))});function bg(e,r,o){const{width:s,height:a}=Nn(o),{x:u,y:c}=o.internals.positionAbsolute;return vo(e,[[u,c],[u+s,c+a]],r)}const Lh=(e,r,o)=>eo?-si(Math.abs(e-o),1,r)/r:0,Rc=(e,r,o=15,s=40)=>{const a=Lh(e.x,s,r.width-s)*o,u=Lh(e.y,s,r.height-s)*o;return[a,u]},il=(e,r)=>({x:Math.min(e.x,r.x),y:Math.min(e.y,r.y),x2:Math.max(e.x2,r.x2),y2:Math.max(e.y2,r.y2)}),yc=({x:e,y:r,width:o,height:s})=>({x:e,y:r,x2:e+o,y2:r+s}),sl=({x:e,y:r,x2:o,y2:s})=>({x:e,y:r,width:o-e,height:s-r}),ds=(e,r=[0,0])=>{var a,u;const{x:o,y:s}=Pc(e)?e.internals.positionAbsolute:ys(e,r);return{x:o,y:s,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((u=e.measured)==null?void 0:u.height)??e.height??e.initialHeight??0}},Ga=(e,r=[0,0])=>{var a,u;const{x:o,y:s}=Pc(e)?e.internals.positionAbsolute:ys(e,r);return{x:o,y:s,x2:o+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:s+(((u=e.measured)==null?void 0:u.height)??e.height??e.initialHeight??0)}},jg=(e,r)=>sl(il(yc(e),yc(r))),Eg=(e,r,o,s,a,u,c,h)=>{const p=Math.max(0,Math.min(e+o,a+c)-Math.max(e,a)),y=Math.max(0,Math.min(r+s,u+h)-Math.max(r,u));return Math.ceil(p*y)},Ya=(e,r)=>Eg(e.x,e.y,e.width,e.height,r.x,r.y,r.width,r.height),Ah=e=>wn(e.width)&&wn(e.height)&&wn(e.x)&&wn(e.y),wn=e=>!isNaN(e)&&isFinite(e),Cg=(e,r)=>(o,s)=>{},xs=(e,r=[1,1])=>({x:r[0]*Math.round(e.x/r[0]),y:r[1]*Math.round(e.y/r[1])}),ws=({x:e,y:r},[o,s,a],u=!1,c=[1,1])=>{const h={x:(e-o)/a,y:(r-s)/a};return u?xs(h,c):h},ai=({x:e,y:r},[o,s,a])=>({x:e*a+o,y:r*a+s});function Jo(e,r){if(typeof e=="number")return Math.floor((r-r/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=parseFloat(e);if(!Number.isNaN(o))return Math.floor(r*o*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function A1(e,r,o){if(typeof e=="string"||typeof e=="number"){const s=Jo(e,o),a=Jo(e,r);return{top:s,right:a,bottom:s,left:a,x:a*2,y:s*2}}if(typeof e=="object"){const s=Jo(e.top??e.y??0,o),a=Jo(e.bottom??e.y??0,o),u=Jo(e.left??e.x??0,r),c=Jo(e.right??e.x??0,r);return{top:s,right:c,bottom:a,left:u,x:u+c,y:s+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function $1(e,r,o,s,a,u){const{x:c,y:h}=ai(e,[r,o,s]),{x:p,y}=ai({x:e.x+e.width,y:e.y+e.height},[r,o,s]),w=a-p,v=u-y;return{left:Math.floor(c),top:Math.floor(h),right:Math.floor(w),bottom:Math.floor(v)}}const Tc=(e,r,o,s,a,u)=>{const c=A1(u,r,o),h=(r-c.x)/e.width,p=(o-c.y)/e.height,y=Math.min(h,p),w=si(y,s,a),v=e.x+e.width/2,g=e.y+e.height/2,x=r/2-v*w,S=o/2-g*w,k=$1(e,x,S,w,r,o),b={left:Math.min(k.left-c.left,0),top:Math.min(k.top-c.top,0),right:Math.min(k.right-c.right,0),bottom:Math.min(k.bottom-c.bottom,0)};return{x:x-b.left+b.right,y:S-b.top+b.bottom,zoom:w}},fs=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function xo(e){return e!=null&&e!=="parent"}function Nn(e){var r,o;return{width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}}function Mg(e){var r,o;return(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth)!==void 0&&(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight)!==void 0}function Pg(e,r={width:0,height:0},o,s,a){const u={...e},c=s.get(o);if(c){const h=c.origin||a;u.x+=c.internals.positionAbsolute.x-(r.width??0)*h[0],u.y+=c.internals.positionAbsolute.y-(r.height??0)*h[1]}return u}function $h(e,r){if(e.size!==r.size)return!1;for(const o of e)if(!r.has(o))return!1;return!0}function z1(){let e,r;return{promise:new Promise((s,a)=>{e=s,r=a}),resolve:e,reject:r}}function D1(e){return{...wg,...e||{}}}function ns(e,{snapGrid:r=[0,0],snapToGrid:o=!1,transform:s,containerBounds:a}){const{x:u,y:c}=_n(e),h=ws({x:u-((a==null?void 0:a.left)??0),y:c-((a==null?void 0:a.top)??0)},s),{x:p,y}=o?xs(h,r):h;return{xSnapped:p,ySnapped:y,...h}}const Lc=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ig=e=>{var r;return((r=e==null?void 0:e.getRootNode)==null?void 0:r.call(e))||(window==null?void 0:window.document)},O1=["INPUT","SELECT","TEXTAREA"];function Rg(e){var s,a;const r=((a=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:a[0])||e.target;return(r==null?void 0:r.nodeType)!==1?!1:O1.includes(r.nodeName)||r.hasAttribute("contenteditable")||!!r.closest(".nokey")}const Tg=e=>"clientX"in e,_n=(e,r)=>{var u,c;const o=Tg(e),s=o?e.clientX:(u=e.touches)==null?void 0:u[0].clientX,a=o?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:s-((r==null?void 0:r.left)??0),y:a-((r==null?void 0:r.top)??0)}},zh=(e,r,o,s,a)=>{const u=r.querySelectorAll(`.${e}`);return!u||!u.length?null:Array.from(u).map(c=>{const h=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:a,position:c.getAttribute("data-handlepos"),x:(h.left-o.left)/s,y:(h.top-o.top)/s,...Lc(c)}})};function Lg({sourceX:e,sourceY:r,targetX:o,targetY:s,sourceControlX:a,sourceControlY:u,targetControlX:c,targetControlY:h}){const p=e*.125+a*.375+c*.375+o*.125,y=r*.125+u*.375+h*.375+s*.125,w=Math.abs(p-e),v=Math.abs(y-r);return[p,y,w,v]}function Ca(e,r){return e>=0?.5*e:r*25*Math.sqrt(-e)}function Dh({pos:e,x1:r,y1:o,x2:s,y2:a,c:u}){switch(e){case ke.Left:return[r-Ca(r-s,u),o];case ke.Right:return[r+Ca(s-r,u),o];case ke.Top:return[r,o-Ca(o-a,u)];case ke.Bottom:return[r,o+Ca(a-o,u)]}}function Ag({sourceX:e,sourceY:r,sourcePosition:o=ke.Bottom,targetX:s,targetY:a,targetPosition:u=ke.Top,curvature:c=.25}){const[h,p]=Dh({pos:o,x1:e,y1:r,x2:s,y2:a,c}),[y,w]=Dh({pos:u,x1:s,y1:a,x2:e,y2:r,c}),[v,g,x,S]=Lg({sourceX:e,sourceY:r,targetX:s,targetY:a,sourceControlX:h,sourceControlY:p,targetControlX:y,targetControlY:w});return[`M${e},${r} C${h},${p} ${y},${w} ${s},${a}`,v,g,x,S]}function $g({sourceX:e,sourceY:r,targetX:o,targetY:s}){const a=Math.abs(o-e)/2,u=o0}const B1=({source:e,sourceHandle:r,target:o,targetHandle:s})=>`xy-edge__${e}${r||""}-${o}${s||""}`,V1=(e,r)=>r.some(o=>o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle)),W1=(e,r,o={})=>{var u;if(!e.source||!e.target)return(u=o.onError)==null||u.call(o,"006",Sn.error006()),r;const s=o.getEdgeId||B1;let a;return kg(e)?a={...e}:a={...e,id:s(e)},V1(a,r)?r:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,r.concat(a))};function zg({sourceX:e,sourceY:r,targetX:o,targetY:s}){const[a,u,c,h]=$g({sourceX:e,sourceY:r,targetX:o,targetY:s});return[`M ${e},${r}L ${o},${s}`,a,u,c,h]}const Oh={[ke.Left]:{x:-1,y:0},[ke.Right]:{x:1,y:0},[ke.Top]:{x:0,y:-1},[ke.Bottom]:{x:0,y:1}},U1=({source:e,sourcePosition:r=ke.Bottom,target:o})=>r===ke.Left||r===ke.Right?e.xMath.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2));function G1({source:e,sourcePosition:r=ke.Bottom,target:o,targetPosition:s=ke.Top,center:a,offset:u,stepPosition:c}){const h=Oh[r],p=Oh[s],y={x:e.x+h.x*u,y:e.y+h.y*u},w={x:o.x+p.x*u,y:o.y+p.y*u},v=U1({source:y,sourcePosition:r,target:w}),g=v.x!==0?"x":"y",x=v[g];let S=[],k,b;const E={x:0,y:0},I={x:0,y:0},[,,_,j]=$g({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(h[g]*p[g]===-1){g==="x"?(k=a.x??y.x+(w.x-y.x)*c,b=a.y??(y.y+w.y)/2):(k=a.x??(y.x+w.x)/2,b=a.y??y.y+(w.y-y.y)*c);const U=[{x:k,y:y.y},{x:k,y:w.y}],q=[{x:y.x,y:b},{x:w.x,y:b}];h[g]===x?S=g==="x"?U:q:S=g==="x"?q:U}else{const U=[{x:y.x,y:w.y}],q=[{x:w.x,y:y.y}];if(g==="x"?S=h.x===x?q:U:S=h.y===x?U:q,r===s){const C=Math.abs(e[g]-o[g]);if(C<=u){const V=Math.min(u-1,u-C);h[g]===x?E[g]=(y[g]>e[g]?-1:1)*V:I[g]=(w[g]>o[g]?-1:1)*V}}if(r!==s){const C=g==="x"?"y":"x",V=h[g]===p[C],W=y[C]>w[C],Y=y[C]=Q?(k=(te.x+J.x)/2,b=S[0].y):(k=S[0].x,b=(te.y+J.y)/2)}const L={x:y.x+E.x,y:y.y+E.y},$={x:w.x+I.x,y:w.y+I.y};return[[e,...L.x!==S[0].x||L.y!==S[0].y?[L]:[],...S,...$.x!==S[S.length-1].x||$.y!==S[S.length-1].y?[$]:[],o],k,b,_,j]}function Y1(e,r,o,s){const a=Math.min(Fh(e,r)/2,Fh(r,o)/2,s),{x:u,y:c}=r;if(e.x===u&&u===o.x||e.y===c&&c===o.y)return`L${u} ${c}`;if(e.y===c){const y=e.xo.id===r):e[0])||null}function vc(e,r){return e?typeof e=="string"?e:`${r?`${r}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function q1(e,{id:r,defaultColor:o,defaultMarkerStart:s,defaultMarkerEnd:a}){const u=new Set;return e.reduce((c,h)=>([h.markerStart||s,h.markerEnd||a].forEach(p=>{if(p&&typeof p=="object"){const y=vc(p,r);u.has(y)||(c.push({id:y,color:p.color||o,...p}),u.add(y))}}),c),[]).sort((c,h)=>c.id.localeCompare(h.id))}const Dg=1e3,K1=10,Ac={nodeOrigin:[0,0],nodeExtent:ls,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Q1={...Ac,checkEquality:!0};function $c(e,r){const o={...e};for(const s in r)r[s]!==void 0&&(o[s]=r[s]);return o}function Z1(e,r,o){const s=$c(Ac,o);for(const a of e.values())if(a.parentId)Dc(a,e,r,s);else{const u=ys(a,s.nodeOrigin),c=xo(a.extent)?a.extent:s.nodeExtent,h=vo(u,c,Nn(a));a.internals.positionAbsolute=h}}function J1(e,r){if(!e.handles)return e.measured?r==null?void 0:r.internals.handleBounds:void 0;const o=[],s=[];for(const a of e.handles){const u={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?o.push(u):a.type==="target"&&s.push(u)}return{source:o,target:s}}function zc(e){return e==="manual"}function xc(e,r,o,s={}){var w,v;const a=$c(Q1,s),u={i:0},c=new Map(r),h=a!=null&&a.elevateNodesOnSelect&&!zc(a.zIndexMode)?Dg:0;let p=e.length>0,y=!1;r.clear(),o.clear();for(const g of e){let x=c.get(g.id);if(a.checkEquality&&g===(x==null?void 0:x.internals.userNode))r.set(g.id,x);else{const S=ys(g,a.nodeOrigin),k=xo(g.extent)?g.extent:a.nodeExtent,b=vo(S,k,Nn(g));x={...a.defaults,...g,measured:{width:(w=g.measured)==null?void 0:w.width,height:(v=g.measured)==null?void 0:v.height},internals:{positionAbsolute:b,handleBounds:J1(g,x),z:Og(g,h,a.zIndexMode),userNode:g}},r.set(g.id,x)}(x.measured===void 0||x.measured.width===void 0||x.measured.height===void 0)&&!x.hidden&&(p=!1),g.parentId&&Dc(x,r,o,s,u),y||(y=g.selected??!1)}return{nodesInitialized:p,hasSelectedNodes:y}}function e_(e,r){if(!e.parentId)return;const o=r.get(e.parentId);o?o.set(e.id,e):r.set(e.parentId,new Map([[e.id,e]]))}function Dc(e,r,o,s,a){const{elevateNodesOnSelect:u,nodeOrigin:c,nodeExtent:h,zIndexMode:p}=$c(Ac,s),y=e.parentId,w=r.get(y);if(!w){console.warn(`Parent node ${y} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}e_(e,o),a&&!w.parentId&&w.internals.rootParentIndex===void 0&&p==="auto"&&(w.internals.rootParentIndex=++a.i,w.internals.z=w.internals.z+a.i*K1),a&&w.internals.rootParentIndex!==void 0&&(a.i=w.internals.rootParentIndex);const v=u&&!zc(p)?Dg:0,{x:g,y:x,z:S}=t_(e,w,c,h,v,p),{positionAbsolute:k}=e.internals,b=g!==k.x||x!==k.y;(b||S!==e.internals.z)&&r.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:g,y:x}:k,z:S}})}function Og(e,r,o){const s=wn(e.zIndex)?e.zIndex:0;return zc(o)?s:s+(e.selected?r:0)}function t_(e,r,o,s,a,u){const{x:c,y:h}=r.internals.positionAbsolute,p=Nn(e),y=ys(e,o),w=xo(e.extent)?vo(y,e.extent,p):y;let v=vo({x:c+w.x,y:h+w.y},s,p);e.extent==="parent"&&(v=bg(v,p,r));const g=Og(e,a,u),x=r.internals.z??0;return{x:v.x,y:v.y,z:x>=g?x+1:g}}function Oc(e,r,o,s=[0,0]){var c;const a=[],u=new Map;for(const h of e){const p=r.get(h.parentId);if(!p)continue;const y=((c=u.get(h.parentId))==null?void 0:c.expandedRect)??ds(p),w=jg(y,h.rect);u.set(h.parentId,{expandedRect:w,parent:p})}return u.size>0&&u.forEach(({expandedRect:h,parent:p},y)=>{var _;const w=p.internals.positionAbsolute,v=Nn(p),g=p.origin??s,x=h.x0||S>0||E||I)&&(a.push({id:y,type:"position",position:{x:p.position.x-x+E,y:p.position.y-S+I}}),(_=o.get(y))==null||_.forEach(j=>{e.some(L=>L.id===j.id)||a.push({id:j.id,type:"position",position:{x:j.position.x+x,y:j.position.y+S}})})),(v.width0){const x=Oc(g,r,o,a);y.push(...x)}return{changes:y,updatedInternals:p}}async function r_({delta:e,panZoom:r,transform:o,translateExtent:s,width:a,height:u}){if(!r||!e.x&&!e.y)return!1;const c=await r.setViewportConstrained({x:o[0]+e.x,y:o[1]+e.y,zoom:o[2]},[[0,0],[a,u]],s);return!!c&&(c.x!==o[0]||c.y!==o[1]||c.k!==o[2])}function Wh(e,r,o,s,a,u){let c=a;const h=s.get(c)||new Map;s.set(c,h.set(o,r)),c=`${a}-${e}`;const p=s.get(c)||new Map;if(s.set(c,p.set(o,r)),u){c=`${a}-${e}-${u}`;const y=s.get(c)||new Map;s.set(c,y.set(o,r))}}function Fg(e,r,o){e.clear(),r.clear();for(const s of o){const{source:a,target:u,sourceHandle:c=null,targetHandle:h=null}=s,p={edgeId:s.id,source:a,target:u,sourceHandle:c,targetHandle:h},y=`${a}-${c}--${u}-${h}`,w=`${u}-${h}--${a}-${c}`;Wh("source",p,w,e,a,c),Wh("target",p,y,e,u,h),r.set(s.id,s)}}function Hg(e,r){if(!e.parentId)return!1;const o=r.get(e.parentId);return o?o.selected?!0:Hg(o,r):!1}function Uh(e,r,o){var a;let s=e;do{if((a=s==null?void 0:s.matches)!=null&&a.call(s,r))return!0;if(s===o)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function o_(e,r,o,s){const a=new Map;for(const[u,c]of e)if((c.selected||c.id===s)&&(!c.parentId||!Hg(c,e))&&(c.draggable||r&&typeof c.draggable>"u")){const h=e.get(u);h&&a.set(u,{id:u,position:h.position||{x:0,y:0},distance:{x:o.x-h.internals.positionAbsolute.x,y:o.y-h.internals.positionAbsolute.y},extent:h.extent,parentId:h.parentId,origin:h.origin,expandParent:h.expandParent,internals:{positionAbsolute:h.internals.positionAbsolute||{x:0,y:0}},measured:{width:h.measured.width??0,height:h.measured.height??0}})}return a}function Ku({nodeId:e,dragItems:r,nodeLookup:o,dragging:s=!0}){var c,h,p;const a=[];for(const[y,w]of r){const v=(c=o.get(y))==null?void 0:c.internals.userNode;v&&a.push({...v,position:w.position,dragging:s})}if(!e)return[a[0],a];const u=(h=o.get(e))==null?void 0:h.internals.userNode;return[u?{...u,position:((p=r.get(e))==null?void 0:p.position)||u.position,dragging:s}:a[0],a]}function i_({dragItems:e,snapGrid:r,x:o,y:s}){const a=e.values().next().value;if(!a)return null;const u={x:o-a.distance.x,y:s-a.distance.y},c=xs(u,r);return{x:c.x-u.x,y:c.y-u.y}}function s_({onNodeMouseDown:e,getStoreItems:r,onDragStart:o,onDrag:s,onDragStop:a}){let u={x:null,y:null},c=0,h=new Map,p=!1,y={x:0,y:0},w=null,v=!1,g=null,x=!1,S=!1,k=null;function b({noDragClassName:I,handleSelector:_,domNode:j,isSelectable:L,nodeId:$,nodeClickDistance:F=0}){g=Gt(j);function U({x:ne,y:Q}){const{nodeLookup:C,nodeExtent:V,snapGrid:W,snapToGrid:Y,nodeOrigin:M,onNodeDrag:D,onSelectionDrag:H,onError:R,updateNodePositions:z}=r();u={x:ne,y:Q};let re=!1;const oe=h.size>1,fe=oe&&V?yc(vs(h)):null,le=oe&&Y?i_({dragItems:h,snapGrid:W,x:ne,y:Q}):null;for(const[he,Z]of h){if(!C.has(he))continue;let se={x:ne-Z.distance.x,y:Q-Z.distance.y};Y&&(se=le?{x:Math.round(se.x+le.x),y:Math.round(se.y+le.y)}:xs(se,W));let me=null;if(oe&&V&&!Z.extent&&fe){const{positionAbsolute:ye}=Z.internals,Me=ye.x-fe.x+V[0][0],Te=ye.x+Z.measured.width-fe.x2+V[1][0],Le=ye.y-fe.y+V[0][1],De=ye.y+Z.measured.height-fe.y2+V[1][1];me=[[Me,Le],[Te,De]]}const{position:Ne,positionAbsolute:we}=Ng({nodeId:he,nextPosition:se,nodeLookup:C,nodeExtent:me||V,nodeOrigin:M,onError:R});re=re||Z.position.x!==Ne.x||Z.position.y!==Ne.y,Z.position=Ne,Z.internals.positionAbsolute=we}if(S=S||re,!!re&&(z(h,!0),k&&(s||D||!$&&H))){const[he,Z]=Ku({nodeId:$,dragItems:h,nodeLookup:C});s==null||s(k,h,he,Z),D==null||D(k,he,Z),$||H==null||H(k,Z)}}async function q(){if(!w)return;const{transform:ne,panBy:Q,autoPanSpeed:C,autoPanOnNodeDrag:V}=r();if(!V){p=!1,cancelAnimationFrame(c);return}const[W,Y]=Rc(y,w,C);(W!==0||Y!==0)&&(u.x=(u.x??0)-W/ne[2],u.y=(u.y??0)-Y/ne[2],await Q({x:W,y:Y})&&U(u)),c=requestAnimationFrame(q)}function te(ne){var oe;const{nodeLookup:Q,multiSelectionActive:C,nodesDraggable:V,transform:W,snapGrid:Y,snapToGrid:M,selectNodesOnDrag:D,onNodeDragStart:H,onSelectionDragStart:R,unselectNodesAndEdges:z}=r();v=!0,(!D||!L)&&!C&&$&&((oe=Q.get($))!=null&&oe.selected||z()),L&&D&&$&&(e==null||e($));const re=ns(ne.sourceEvent,{transform:W,snapGrid:Y,snapToGrid:M,containerBounds:w});if(u=re,h=o_(Q,V,re,$),h.size>0&&(o||H||!$&&R)){const[fe,le]=Ku({nodeId:$,dragItems:h,nodeLookup:Q});o==null||o(ne.sourceEvent,h,fe,le),H==null||H(ne.sourceEvent,fe,le),$||R==null||R(ne.sourceEvent,le)}}const J=rg().clickDistance(F).on("start",ne=>{const{domNode:Q,nodeDragThreshold:C,transform:V,snapGrid:W,snapToGrid:Y}=r();w=(Q==null?void 0:Q.getBoundingClientRect())||null,x=!1,S=!1,k=ne.sourceEvent,C===0&&te(ne),u=ns(ne.sourceEvent,{transform:V,snapGrid:W,snapToGrid:Y,containerBounds:w}),y=_n(ne.sourceEvent,w)}).on("drag",ne=>{const{autoPanOnNodeDrag:Q,transform:C,snapGrid:V,snapToGrid:W,nodeDragThreshold:Y,nodeLookup:M}=r(),D=ns(ne.sourceEvent,{transform:C,snapGrid:V,snapToGrid:W,containerBounds:w});if(k=ne.sourceEvent,(ne.sourceEvent.type==="touchmove"&&ne.sourceEvent.touches.length>1||$&&!M.has($))&&(x=!0),!x){if(!p&&Q&&v&&(p=!0,q()),!v){const H=_n(ne.sourceEvent,w),R=H.x-y.x,z=H.y-y.y;Math.sqrt(R*R+z*z)>Y&&te(ne)}(u.x!==D.xSnapped||u.y!==D.ySnapped)&&h&&v&&(y=_n(ne.sourceEvent,w),U(D))}}).on("end",ne=>{if(!v||x){x&&h.size>0&&r().updateNodePositions(h,!1);return}if(p=!1,v=!1,cancelAnimationFrame(c),h.size>0){const{nodeLookup:Q,updateNodePositions:C,onNodeDragStop:V,onSelectionDragStop:W}=r();if(S&&(C(h,!1),S=!1),a||V||!$&&W){const[Y,M]=Ku({nodeId:$,dragItems:h,nodeLookup:Q,dragging:!1});a==null||a(ne.sourceEvent,h,Y,M),V==null||V(ne.sourceEvent,Y,M),$||W==null||W(ne.sourceEvent,M)}}}).filter(ne=>{const Q=ne.target;return!ne.button&&(!I||!Uh(Q,`.${I}`,j))&&(!_||Uh(Q,_,j))});g.call(J)}function E(){g==null||g.on(".drag",null)}return{update:b,destroy:E}}function a_(e,r,o){const s=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const u of r.values())Ya(a,ds(u))>0&&s.push(u);return s}const l_=250;function u_(e,r,o,s){var h,p;let a=[],u=1/0;const c=a_(e,o,r+l_);for(const y of c){const w=[...((h=y.internals.handleBounds)==null?void 0:h.source)??[],...((p=y.internals.handleBounds)==null?void 0:p.target)??[]];for(const v of w){if(s.nodeId===v.nodeId&&s.type===v.type&&s.id===v.id)continue;const{x:g,y:x}=wo(y,v,v.position,!0),S=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(x-e.y,2));S>r||(S1){const y=s.type==="source"?"target":"source";return a.find(w=>w.type===y)??a[0]}return a[0]}function Bg(e,r,o,s,a,u=!1){var y,w,v;const c=s.get(e);if(!c)return null;const h=a==="strict"?(y=c.internals.handleBounds)==null?void 0:y[r]:[...((w=c.internals.handleBounds)==null?void 0:w.source)??[],...((v=c.internals.handleBounds)==null?void 0:v.target)??[]],p=(o?h==null?void 0:h.find(g=>g.id===o):h==null?void 0:h[0])??null;return p&&u?{...p,...wo(c,p,p.position,!0)}:p}function Vg(e,r){return e||(r!=null&&r.classList.contains("target")?"target":r!=null&&r.classList.contains("source")?"source":null)}function c_(e,r){let o=null;return r?o=!0:e&&!r&&(o=!1),o}const Wg=()=>!0;function d_(e,{connectionMode:r,connectionRadius:o,handleId:s,nodeId:a,edgeUpdaterType:u,isTarget:c,domNode:h,nodeLookup:p,lib:y,autoPanOnConnect:w,flowId:v,panBy:g,cancelConnection:x,onConnectStart:S,onConnect:k,onConnectEnd:b,isValidConnection:E=Wg,onReconnectEnd:I,updateConnection:_,getTransform:j,getFromHandle:L,autoPanSpeed:$,dragThreshold:F=1,handleDomNode:U}){const q=Ig(e.target);let te=0,J;const{x:ne,y:Q}=_n(e),C=Vg(u,U),V=h==null?void 0:h.getBoundingClientRect();let W=!1;if(!V||!C)return;const Y=Bg(a,C,s,p,r);if(!Y)return;let M=_n(e,V),D=!1,H=null,R=!1,z=null;function re(){if(!w||!V)return;const[Ne,we]=Rc(M,V,$);g({x:Ne,y:we}),te=requestAnimationFrame(re)}const oe={...Y,nodeId:a,type:C,position:Y.position},fe=p.get(a);let he={inProgress:!0,isValid:null,from:wo(fe,oe,ke.Left,!0),fromHandle:oe,fromPosition:oe.position,fromNode:fe,to:M,toHandle:null,toPosition:Th[oe.position],toNode:null,pointer:M};function Z(){W=!0,_(he),S==null||S(e,{nodeId:a,handleId:s,handleType:C})}F===0&&Z();function se(Ne){if(!W){const{x:De,y:pe}=_n(Ne),$e=De-ne,Ve=pe-Q;if(!($e*$e+Ve*Ve>F*F))return;Z()}if(!L()||!oe){me(Ne);return}const we=j();M=_n(Ne,V),J=u_(ws(M,we,!1,[1,1]),o,p,oe),D||(re(),D=!0);const ye=Ug(Ne,{handle:J,connectionMode:r,fromNodeId:a,fromHandleId:s,fromType:c?"target":"source",isValidConnection:E,doc:q,lib:y,flowId:v,nodeLookup:p});z=ye.handleDomNode,H=ye.connection,R=c_(!!J,ye.isValid);const Me=p.get(a),Te=Me?wo(Me,oe,ke.Left,!0):he.from,Le={...he,from:Te,isValid:R,to:ye.toHandle&&R?ai({x:ye.toHandle.x,y:ye.toHandle.y},we):M,toHandle:ye.toHandle,toPosition:R&&ye.toHandle?ye.toHandle.position:Th[oe.position],toNode:ye.toHandle?p.get(ye.toHandle.nodeId):null,pointer:M};_(Le),he=Le}function me(Ne){if(!("touches"in Ne&&Ne.touches.length>0)){if(W){(J||z)&&H&&R&&(k==null||k(H));const{inProgress:we,...ye}=he,Me={...ye,toPosition:he.toHandle?he.toPosition:null};b==null||b(Ne,Me),u&&(I==null||I(Ne,Me))}x(),cancelAnimationFrame(te),D=!1,R=!1,H=null,z=null,q.removeEventListener("mousemove",se),q.removeEventListener("mouseup",me),q.removeEventListener("touchmove",se),q.removeEventListener("touchend",me)}}q.addEventListener("mousemove",se),q.addEventListener("mouseup",me),q.addEventListener("touchmove",se),q.addEventListener("touchend",me)}function Ug(e,{handle:r,connectionMode:o,fromNodeId:s,fromHandleId:a,fromType:u,doc:c,lib:h,flowId:p,isValidConnection:y=Wg,nodeLookup:w}){const v=u==="target",g=r?c.querySelector(`.${h}-flow__handle[data-id="${p}-${r==null?void 0:r.nodeId}-${r==null?void 0:r.id}-${r==null?void 0:r.type}"]`):null,{x,y:S}=_n(e),k=c.elementFromPoint(x,S),b=k!=null&&k.classList.contains(`${h}-flow__handle`)?k:g,E={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const I=Vg(void 0,b),_=b.getAttribute("data-nodeid"),j=b.getAttribute("data-handleid"),L=b.classList.contains("connectable"),$=b.classList.contains("connectableend");if(!_||!I)return E;const F={source:v?_:s,sourceHandle:v?j:a,target:v?s:_,targetHandle:v?a:j};E.connection=F;const q=L&&$&&(o===ii.Strict?v&&I==="source"||!v&&I==="target":_!==s||j!==a);E.isValid=q&&y(F),E.toHandle=Bg(_,I,j,w,o,!0)}return E}const wc={onPointerDown:d_,isValid:Ug};function f_({domNode:e,panZoom:r,getTransform:o,getViewScale:s}){const a=Gt(e);function u({translateExtent:h,width:p,height:y,zoomStep:w=1,pannable:v=!0,zoomable:g=!0,inversePan:x=!1}){const S=_=>{if(_.sourceEvent.type!=="wheel"||!r)return;const j=o(),L=_.sourceEvent.ctrlKey&&fs()?10:1,$=-_.sourceEvent.deltaY*(_.sourceEvent.deltaMode===1?.05:_.sourceEvent.deltaMode?1:.002)*w,F=j[2]*Math.pow(2,$*L);r.scaleTo(F)};let k=[0,0];const b=_=>{(_.sourceEvent.type==="mousedown"||_.sourceEvent.type==="touchstart")&&(k=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY])},E=_=>{const j=o();if(_.sourceEvent.type!=="mousemove"&&_.sourceEvent.type!=="touchmove"||!r)return;const L=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY],$=[L[0]-k[0],L[1]-k[1]];k=L;const F=s()*Math.max(j[2],Math.log(j[2]))*(x?-1:1),U={x:j[0]-$[0]*F,y:j[1]-$[1]*F},q=[[0,0],[p,y]];r.setViewportConstrained({x:U.x,y:U.y,zoom:j[2]},q,h)},I=vg().on("start",b).on("zoom",v?E:null).on("zoom.wheel",g?S:null);a.call(I,{})}function c(){a.on("zoom",null)}return{update:u,destroy:c,pointer:vn}}const al=e=>({x:e.x,y:e.y,zoom:e.k}),Qu=({x:e,y:r,zoom:o})=>ol.translate(e,r).scale(o),zr=(e,r)=>e.target.closest(`.${r}`),Gg=(e,r)=>r===2&&Array.isArray(e)&&e.includes(2),h_=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Zu=(e,r=0,o=h_,s=()=>{})=>{const a=typeof r=="number"&&r>0;return a||s(),a?e.transition().duration(r).ease(o).on("end",s):e},Yg=e=>{const r=e.ctrlKey&&fs()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*r};function p_({zoomPanValues:e,noWheelClassName:r,d3Selection:o,d3Zoom:s,panOnScrollMode:a,panOnScrollSpeed:u,zoomOnPinch:c,onPanZoomStart:h,onPanZoom:p,onPanZoomEnd:y}){return w=>{if(zr(w,r))return w.ctrlKey&&w.preventDefault(),!1;w.preventDefault(),w.stopImmediatePropagation();const v=o.property("__zoom").k||1;if(w.ctrlKey&&c){const b=vn(w),E=Yg(w),I=v*Math.pow(2,E);s.scaleTo(o,I,b,w);return}const g=w.deltaMode===1?20:1;let x=a===po.Vertical?0:w.deltaX*g,S=a===po.Horizontal?0:w.deltaY*g;!fs()&&w.shiftKey&&a!==po.Vertical&&(x=w.deltaY*g,S=0),s.translateBy(o,-(x/v)*u,-(S/v)*u,{internal:!0});const k=al(o.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?p==null||p(w,k):(e.isPanScrolling=!0,h==null||h(w,k)),e.panScrollTimeout=setTimeout(()=>{y==null||y(w,k),e.isPanScrolling=!1},150)}}function g_({noWheelClassName:e,preventScrolling:r,d3ZoomHandler:o}){return function(s,a){const u=s.type==="wheel",c=!r&&u&&!s.ctrlKey,h=zr(s,e);if(s.ctrlKey&&u&&h&&s.preventDefault(),c||h)return null;s.preventDefault(),o.call(this,s,a)}}function m_({zoomPanValues:e,onDraggingChange:r,onPanZoomStart:o}){return s=>{var u,c,h;if((u=s.sourceEvent)!=null&&u.internal)return;const a=al(s.transform);e.mouseButton=((c=s.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((h=s.sourceEvent)==null?void 0:h.type)==="mousedown"&&r(!0),o&&(o==null||o(s.sourceEvent,a))}}function y_({zoomPanValues:e,panOnDrag:r,onPaneContextMenu:o,onTransformChange:s,onPanZoom:a}){return u=>{var c,h;e.usedRightMouseButton=!!(o&&Gg(r,e.mouseButton??0)),(c=u.sourceEvent)!=null&&c.sync||s([u.transform.x,u.transform.y,u.transform.k]),a&&!((h=u.sourceEvent)!=null&&h.internal)&&(a==null||a(u.sourceEvent,al(u.transform)))}}function v_({zoomPanValues:e,panOnDrag:r,panOnScroll:o,onDraggingChange:s,onPanZoomEnd:a,onPaneContextMenu:u}){return c=>{var h;if(!((h=c.sourceEvent)!=null&&h.internal)&&(e.isZoomingOrPanning=!1,u&&Gg(r,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&u(c.sourceEvent),e.usedRightMouseButton=!1,s(!1),a)){const p=al(c.transform);e.prevViewport=p,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(c.sourceEvent,p)},o?150:0)}}}function x_({panActivationKeyPressed:e,zoomActivationKeyPressed:r,zoomOnScroll:o,zoomOnPinch:s,panOnDrag:a,panOnScroll:u,zoomOnDoubleClick:c,userSelectionActive:h,noWheelClassName:p,noPanClassName:y,lib:w,connectionInProgress:v}){return g=>{var E;const x=r||o,S=s&&g.ctrlKey,k=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(zr(g,`${w}-flow__node`)||zr(g,`${w}-flow__edge`)||zr(g,`${w}-flow__selection`)||zr(g,`${w}-flow__nodesselection`)))return!0;if(!a&&!x&&!u&&!c&&!s||h||v&&!k||zr(g,p)&&k||zr(g,y)&&(!k||u&&k&&!r)||!s&&g.ctrlKey&&k)return!1;if(!s&&g.type==="touchstart"&&((E=g.touches)==null?void 0:E.length)>1)return g.preventDefault(),!1;if(!x&&!u&&!S&&k||!a&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(a)&&!a.includes(g.button)&&g.type==="mousedown")return!1;const b=Array.isArray(a)&&a.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||k||e)&&b}}function w_({domNode:e,minZoom:r,maxZoom:o,translateExtent:s,viewport:a,onPanZoom:u,onPanZoomStart:c,onPanZoomEnd:h,onDraggingChange:p}){const y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},w=e.getBoundingClientRect();let v=[[0,0],[w.width,w.height]];const g=typeof ResizeObserver<"u"?new ResizeObserver(Q=>{const C=Q[0];C&&(v=[[0,0],[C.contentRect.width,C.contentRect.height]])}):null;g==null||g.observe(e);const x=vg().extent(()=>v).scaleExtent([r,o]).translateExtent(s),S=Gt(e).call(x);j({x:a.x,y:a.y,zoom:si(a.zoom,r,o)},[[0,0],[w.width,w.height]],s);const k=S.on("wheel.zoom"),b=S.on("dblclick.zoom");x.wheelDelta(Yg);async function E(Q,C){return S?new Promise(V=>{x==null||x.interpolate((C==null?void 0:C.interpolate)==="linear"?ts:Aa).transform(Zu(S,C==null?void 0:C.duration,C==null?void 0:C.ease,()=>V(!0)),Q)}):!1}function I({noWheelClassName:Q,noPanClassName:C,onPaneContextMenu:V,userSelectionActive:W,panOnScroll:Y,panOnDrag:M,panOnScrollMode:D,panOnScrollSpeed:H,preventScrolling:R,zoomOnPinch:z,zoomOnScroll:re,zoomOnDoubleClick:oe,panActivationKeyPressed:fe=!1,zoomActivationKeyPressed:le,lib:he,onTransformChange:Z,connectionInProgress:se,paneClickDistance:me,selectionOnDrag:Ne}){W&&!y.isZoomingOrPanning&&_();const we=Y&&!le&&!W;x.clickDistance(Ne?1/0:!wn(me)||me<0?0:me);const ye=we?p_({zoomPanValues:y,noWheelClassName:Q,d3Selection:S,d3Zoom:x,panOnScrollMode:D,panOnScrollSpeed:H,zoomOnPinch:z,onPanZoomStart:c,onPanZoom:u,onPanZoomEnd:h}):g_({noWheelClassName:Q,preventScrolling:R,d3ZoomHandler:k});S.on("wheel.zoom",ye,{passive:!1});const Me=m_({zoomPanValues:y,onDraggingChange:p,onPanZoomStart:c});x.on("start",Me);const Te=y_({zoomPanValues:y,panOnDrag:M,onPaneContextMenu:!!V,onPanZoom:u,onTransformChange:Z});x.on("zoom",Te);const Le=v_({zoomPanValues:y,panOnDrag:M,panOnScroll:Y,onPaneContextMenu:V,onPanZoomEnd:h,onDraggingChange:p});x.on("end",Le);const De=x_({panActivationKeyPressed:fe,zoomActivationKeyPressed:le,panOnDrag:M,zoomOnScroll:re,panOnScroll:Y,zoomOnDoubleClick:oe,zoomOnPinch:z,userSelectionActive:W,noPanClassName:C,noWheelClassName:Q,lib:he,connectionInProgress:se});x.filter(De),oe?S.on("dblclick.zoom",b):S.on("dblclick.zoom",null)}function _(){x.on("zoom",null)}async function j(Q,C,V){const W=Qu(Q),Y=x==null?void 0:x.constrain()(W,C,V);return Y&&await E(Y),Y}async function L(Q,C){const V=Qu(Q);return await E(V,C),V}function $(Q){if(S){const C=Qu(Q),V=S.property("__zoom");(V.k!==Q.zoom||V.x!==Q.x||V.y!==Q.y)&&(x==null||x.transform(S,C,null,{sync:!0}))}}function F(){const Q=S?yg(S.node()):{x:0,y:0,k:1};return{x:Q.x,y:Q.y,zoom:Q.k}}async function U(Q,C){return S?new Promise(V=>{x==null||x.interpolate((C==null?void 0:C.interpolate)==="linear"?ts:Aa).scaleTo(Zu(S,C==null?void 0:C.duration,C==null?void 0:C.ease,()=>V(!0)),Q)}):!1}async function q(Q,C){return S?new Promise(V=>{x==null||x.interpolate((C==null?void 0:C.interpolate)==="linear"?ts:Aa).scaleBy(Zu(S,C==null?void 0:C.duration,C==null?void 0:C.ease,()=>V(!0)),Q)}):!1}function te(Q){x==null||x.scaleExtent(Q)}function J(Q){x==null||x.translateExtent(Q)}function ne(Q){const C=!wn(Q)||Q<0?0:Q;x==null||x.clickDistance(C)}return{update:I,destroy:_,setViewport:L,setViewportConstrained:j,getViewport:F,scaleTo:U,scaleBy:q,setScaleExtent:te,setTranslateExtent:J,syncViewport:$,setClickDistance:ne}}var li;(function(e){e.Line="line",e.Handle="handle"})(li||(li={}));function __({width:e,prevWidth:r,height:o,prevHeight:s,affectsX:a,affectsY:u}){const c=e-r,h=o-s,p=[c>0?1:c<0?-1:0,h>0?1:h<0?-1:0];return c&&a&&(p[0]=p[0]*-1),h&&u&&(p[1]=p[1]*-1),p}function Gh(e){const r=e.includes("right")||e.includes("left"),o=e.includes("bottom")||e.includes("top"),s=e.includes("left"),a=e.includes("top");return{isHorizontal:r,isVertical:o,affectsX:s,affectsY:a}}function Ar(e,r){return Math.max(0,r-e)}function $r(e,r){return Math.max(0,e-r)}function Ma(e,r,o){return Math.max(0,r-e,e-o)}function Yh(e,r){return e?!r:r}function S_(e,r,o,s,a,u,c,h){let{affectsX:p,affectsY:y}=r;const{isHorizontal:w,isVertical:v}=r,g=w&&v,{xSnapped:x,ySnapped:S}=o,{minWidth:k,maxWidth:b,minHeight:E,maxHeight:I}=s,{x:_,y:j,width:L,height:$,aspectRatio:F}=e;let U=Math.floor(w?x-e.pointerX:0),q=Math.floor(v?S-e.pointerY:0);const te=L+(p?-U:U),J=$+(y?-q:q),ne=-u[0]*L,Q=-u[1]*$;let C=Ma(te,k,b),V=Ma(J,E,I);if(c){let M=0,D=0;p&&U<0?M=Ar(_+U+ne,c[0][0]):!p&&U>0&&(M=$r(_+te+ne,c[1][0])),y&&q<0?D=Ar(j+q+Q,c[0][1]):!y&&q>0&&(D=$r(j+J+Q,c[1][1])),C=Math.max(C,M),V=Math.max(V,D)}if(h){let M=0,D=0;p&&U>0?M=$r(_+U,h[0][0]):!p&&U<0&&(M=Ar(_+te,h[1][0])),y&&q>0?D=$r(j+q,h[0][1]):!y&&q<0&&(D=Ar(j+J,h[1][1])),C=Math.max(C,M),V=Math.max(V,D)}if(a){if(w){const M=Ma(te/F,E,I)*F;if(C=Math.max(C,M),c){let D=0;!p&&!y||p&&!y&&g?D=$r(j+Q+te/F,c[1][1])*F:D=Ar(j+Q+(p?U:-U)/F,c[0][1])*F,C=Math.max(C,D)}if(h){let D=0;!p&&!y||p&&!y&&g?D=Ar(j+te/F,h[1][1])*F:D=$r(j+(p?U:-U)/F,h[0][1])*F,C=Math.max(C,D)}}if(v){const M=Ma(J*F,k,b)/F;if(V=Math.max(V,M),c){let D=0;!p&&!y||y&&!p&&g?D=$r(_+J*F+ne,c[1][0])/F:D=Ar(_+(y?q:-q)*F+ne,c[0][0])/F,V=Math.max(V,D)}if(h){let D=0;!p&&!y||y&&!p&&g?D=Ar(_+J*F,h[1][0])/F:D=$r(_+(y?q:-q)*F,h[0][0])/F,V=Math.max(V,D)}}}q=q+(q<0?V:-V),U=U+(U<0?C:-C),a&&(g?te>J*F?q=(Yh(p,y)?-U:U)/F:U=(Yh(p,y)?-q:q)*F:w?(q=U/F,y=p):(U=q*F,p=y));const W=p?_+U:_,Y=y?j+q:j;return{width:L+(p?-U:U),height:$+(y?-q:q),x:u[0]*U*(p?-1:1)+W,y:u[1]*q*(y?-1:1)+Y}}const Xg={width:0,height:0,x:0,y:0},k_={...Xg,pointerX:0,pointerY:0,aspectRatio:1};function N_(e,r,o){const s=r.position.x+e.position.x,a=r.position.y+e.position.y,u=e.measured.width??0,c=e.measured.height??0,h=o[0]*u,p=o[1]*c;return[[s-h,a-p],[s+u-h,a+c-p]]}function b_({domNode:e,nodeId:r,getStoreItems:o,onChange:s,onEnd:a}){const u=Gt(e);let c={controlDirection:Gh("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function h({controlPosition:y,boundaries:w,keepAspectRatio:v,resizeDirection:g,onResizeStart:x,onResize:S,onResizeEnd:k,shouldResize:b}){let E={...Xg},I={...k_};c={boundaries:w,resizeDirection:g,keepAspectRatio:v,controlDirection:Gh(y)};let _,j=null,L=[],$,F,U,q=!1;const te=rg().on("start",J=>{const{nodeLookup:ne,transform:Q,snapGrid:C,snapToGrid:V,nodeOrigin:W,paneDomNode:Y}=o();if(_=ne.get(r),!_)return;j=(Y==null?void 0:Y.getBoundingClientRect())??null;const{xSnapped:M,ySnapped:D}=ns(J.sourceEvent,{transform:Q,snapGrid:C,snapToGrid:V,containerBounds:j});E={width:_.measured.width??0,height:_.measured.height??0,x:_.position.x??0,y:_.position.y??0},I={...E,pointerX:M,pointerY:D,aspectRatio:E.width/E.height},$=void 0,F=xo(_.extent)?_.extent:void 0,_.parentId&&(_.extent==="parent"||_.expandParent)&&($=ne.get(_.parentId)),$&&_.extent==="parent"&&(F=[[0,0],[$.measured.width,$.measured.height]]),L=[],U=void 0;for(const[H,R]of ne)if(R.parentId===r&&(L.push({id:H,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const z=N_(R,_,R.origin??W);U?U=[[Math.min(z[0][0],U[0][0]),Math.min(z[0][1],U[0][1])],[Math.max(z[1][0],U[1][0]),Math.max(z[1][1],U[1][1])]]:U=z}x==null||x(J,{...E})}).on("drag",J=>{const{transform:ne,snapGrid:Q,snapToGrid:C,nodeOrigin:V}=o(),W=ns(J.sourceEvent,{transform:ne,snapGrid:Q,snapToGrid:C,containerBounds:j}),Y=[];if(!_)return;const{x:M,y:D,width:H,height:R}=E,z={},re=_.origin??V,{width:oe,height:fe,x:le,y:he}=S_(I,c.controlDirection,W,c.boundaries,c.keepAspectRatio,re,F,U),Z=oe!==H,se=fe!==R,me=le!==M&&Z,Ne=he!==D&&se;if(!me&&!Ne&&!Z&&!se)return;if((me||Ne||re[0]===1||re[1]===1)&&(z.x=me?le:E.x,z.y=Ne?he:E.y,E.x=z.x,E.y=z.y,L.length>0)){const Te=le-M,Le=he-D;for(const De of L)De.position={x:De.position.x-Te+re[0]*(oe-H),y:De.position.y-Le+re[1]*(fe-R)},Y.push(De)}if((Z||se)&&(z.width=Z&&(!c.resizeDirection||c.resizeDirection==="horizontal")?oe:E.width,z.height=se&&(!c.resizeDirection||c.resizeDirection==="vertical")?fe:E.height,E.width=z.width,E.height=z.height),$&&_.expandParent){const Te=re[0]*(z.width??0);z.x&&z.x{q&&(k==null||k(J,{...E}),a==null||a({...E}),q=!1)});u.call(te)}function p(){u.on(".drag",null)}return{update:h,destroy:p}}var Ju={exports:{}},ec={},tc={exports:{}},nc={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Xh;function j_(){if(Xh)return nc;Xh=1;var e=ps();function r(v,g){return v===g&&(v!==0||1/v===1/g)||v!==v&&g!==g}var o=typeof Object.is=="function"?Object.is:r,s=e.useState,a=e.useEffect,u=e.useLayoutEffect,c=e.useDebugValue;function h(v,g){var x=g(),S=s({inst:{value:x,getSnapshot:g}}),k=S[0].inst,b=S[1];return u(function(){k.value=x,k.getSnapshot=g,p(k)&&b({inst:k})},[v,x,g]),a(function(){return p(k)&&b({inst:k}),v(function(){p(k)&&b({inst:k})})},[v]),c(x),x}function p(v){var g=v.getSnapshot;v=v.value;try{var x=g();return!o(v,x)}catch{return!0}}function y(v,g){return g()}var w=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?y:h;return nc.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:w,nc}var qh;function E_(){return qh||(qh=1,tc.exports=j_()),tc.exports}/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Kh;function C_(){if(Kh)return ec;Kh=1;var e=ps(),r=E_();function o(y,w){return y===w&&(y!==0||1/y===1/w)||y!==y&&w!==w}var s=typeof Object.is=="function"?Object.is:o,a=r.useSyncExternalStore,u=e.useRef,c=e.useEffect,h=e.useMemo,p=e.useDebugValue;return ec.useSyncExternalStoreWithSelector=function(y,w,v,g,x){var S=u(null);if(S.current===null){var k={hasValue:!1,value:null};S.current=k}else k=S.current;S=h(function(){function E($){if(!I){if(I=!0,_=$,$=g($),x!==void 0&&k.hasValue){var F=k.value;if(x(F,$))return j=F}return j=$}if(F=j,s(_,$))return F;var U=g($);return x!==void 0&&x(F,U)?(_=$,F):(_=$,j=U)}var I=!1,_,j,L=v===void 0?null:v;return[function(){return E(w())},L===null?void 0:function(){return E(L())}]},[w,v,g,x]);var b=a(y,S[0],S[1]);return c(function(){k.hasValue=!0,k.value=b},[b]),p(b),b},ec}var Qh;function M_(){return Qh||(Qh=1,Ju.exports=C_()),Ju.exports}var P_=M_();const I_=Op(P_),R_={},Zh=e=>{let r;const o=new Set,s=(w,v)=>{const g=typeof w=="function"?w(r):w;if(!Object.is(g,r)){const x=r;r=v??(typeof g!="object"||g===null)?g:Object.assign({},r,g),o.forEach(S=>S(r,x))}},a=()=>r,p={setState:s,getState:a,getInitialState:()=>y,subscribe:w=>(o.add(w),()=>o.delete(w)),destroy:()=>{(R_?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),o.clear()}},y=r=e(s,a,p);return p},T_=e=>e?Zh(e):Zh,{useDebugValue:L_}=M0,{useSyncExternalStoreWithSelector:A_}=I_,$_=e=>e;function qg(e,r=$_,o){const s=A_(e.subscribe,e.getState,e.getServerState||e.getInitialState,r,o);return L_(s),s}const Jh=(e,r)=>{const o=T_(e),s=(a,u=r)=>qg(o,a,u);return Object.assign(s,o),s},z_=(e,r)=>e?Jh(e,r):Jh;function et(e,r){if(Object.is(e,r))return!0;if(typeof e!="object"||e===null||typeof r!="object"||r===null)return!1;if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(const[s,a]of e)if(!Object.is(a,r.get(s)))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(const s of e)if(!r.has(s))return!1;return!0}const o=Object.keys(e);if(o.length!==Object.keys(r).length)return!1;for(const s of o)if(!Object.prototype.hasOwnProperty.call(r,s)||!Object.is(e[s],r[s]))return!1;return!0}Fp();const ll=A.createContext(null),D_=ll.Provider,Kg=Sn.error001("react");function Fe(e,r){const o=A.useContext(ll);if(o===null)throw new Error(Kg);return qg(o,e,r)}function Ke(){const e=A.useContext(ll);if(e===null)throw new Error(Kg);return A.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ep={display:"none"},O_={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Qg="react-flow__node-desc",Zg="react-flow__edge-desc",F_="react-flow__aria-live",H_=e=>e.ariaLiveMessage,B_=e=>e.ariaLabelConfig;function V_({rfId:e}){const r=Fe(H_);return d.jsx("div",{id:`${F_}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:O_,children:r})}function W_({rfId:e,disableKeyboardA11y:r}){const o=Fe(B_);return d.jsxs(d.Fragment,{children:[d.jsx("div",{id:`${Qg}-${e}`,style:ep,children:r?o["node.a11yDescription.default"]:o["node.a11yDescription.keyboardDisabled"]}),d.jsx("div",{id:`${Zg}-${e}`,style:ep,children:o["edge.a11yDescription.default"]}),!r&&d.jsx(V_,{rfId:e})]})}const ul=A.forwardRef(({position:e="top-left",children:r,className:o,style:s,...a},u)=>{const c=`${e}`.split("-");return d.jsx("div",{className:st(["react-flow__panel",o,...c]),style:s,ref:u,...a,children:r})});ul.displayName="Panel";const tp="https://reactflow.dev?utm_source=attribution";function U_({proOptions:e,position:r="bottom-right"}){return e!=null&&e.hideAttribution?null:d.jsx(ul,{position:r,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${tp}`,children:d.jsx("a",{href:tp,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const G_=e=>{const r=[],o=[];for(const[,s]of e.nodeLookup)s.selected&&r.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&o.push(s);return{selectedNodes:r,selectedEdges:o}},Pa=e=>e.id;function Y_(e,r){return et(e.selectedNodes.map(Pa),r.selectedNodes.map(Pa))&&et(e.selectedEdges.map(Pa),r.selectedEdges.map(Pa))}function X_({onSelectionChange:e}){const r=Ke(),{selectedNodes:o,selectedEdges:s}=Fe(G_,Y_);return A.useEffect(()=>{const a={nodes:o,edges:s};e==null||e(a),r.getState().onSelectionChangeHandlers.forEach(u=>u(a))},[o,s,e]),null}const q_=e=>!!e.onSelectionChangeHandlers;function K_({onSelectionChange:e}){const r=Fe(q_);return e||r?d.jsx(X_,{onSelectionChange:e}):null}const Jg=[0,0],Q_={x:0,y:0,zoom:1},Z_=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],np=[...Z_,"rfId"],J_=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),rp={translateExtent:ls,nodeOrigin:Jg,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function eS(e){const{setNodes:r,setEdges:o,setMinZoom:s,setMaxZoom:a,setTranslateExtent:u,setNodeExtent:c,reset:h,setDefaultNodesAndEdges:p}=Fe(J_,et),y=Ke();A.useEffect(()=>(p(e.defaultNodes,e.defaultEdges),()=>{w.current=rp,h()}),[]);const w=A.useRef(rp);return A.useEffect(()=>{for(const v of np){const g=e[v],x=w.current[v];g!==x&&(typeof e[v]>"u"||(v==="nodes"?r(g):v==="edges"?o(g):v==="minZoom"?s(g):v==="maxZoom"?a(g):v==="translateExtent"?u(g):v==="nodeExtent"?c(g):v==="ariaLabelConfig"?y.setState({ariaLabelConfig:D1(g)}):v==="fitView"?y.setState({fitViewQueued:g}):v==="fitViewOptions"?y.setState({fitViewOptions:g}):y.setState({[v]:g})))}w.current=e},np.map(v=>e[v])),null}function op(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function tS(e){var s;const[r,o]=A.useState(e==="system"?null:e);return A.useEffect(()=>{if(e!=="system"){o(e);return}const a=op(),u=()=>o(a!=null&&a.matches?"dark":"light");return u(),a==null||a.addEventListener("change",u),()=>{a==null||a.removeEventListener("change",u)}},[e]),r!==null?r:(s=op())!=null&&s.matches?"dark":"light"}const ip=typeof document<"u"?document:null;function hs(e=null,r={target:ip,actInsideInputWithModifier:!0}){const[o,s]=A.useState(!1),a=A.useRef(!1),u=A.useRef(new Set([])),[c,h]=A.useMemo(()=>{if(e!==null){const y=(Array.isArray(e)?e:[e]).filter(v=>typeof v=="string").map(v=>v.replace(/\+/g,` -`).replace(` - -`,` -+`).split(` -`)),w=y.reduce((v,g)=>v.concat(...g),[]);return[y,w]}return[[],[]]},[e]);return A.useEffect(()=>{const p=(r==null?void 0:r.target)??ip,y=(r==null?void 0:r.actInsideInputWithModifier)??!0;if(e!==null){const w=x=>{var b,E;if(a.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!a.current||a.current&&!y)&&Rg(x))return!1;const k=ap(x.code,h);if(u.current.add(x[k]),sp(c,u.current,!1)){const I=((E=(b=x.composedPath)==null?void 0:b.call(x))==null?void 0:E[0])||x.target,_=(I==null?void 0:I.nodeName)==="BUTTON"||(I==null?void 0:I.nodeName)==="A";r.preventDefault!==!1&&(a.current||!_)&&x.preventDefault(),s(!0)}},v=x=>{const S=ap(x.code,h);sp(c,u.current,!0)?(s(!1),u.current.clear()):u.current.delete(x[S]),x.key==="Meta"&&u.current.clear(),a.current=!1},g=()=>{u.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",w),p==null||p.addEventListener("keyup",v),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{p==null||p.removeEventListener("keydown",w),p==null||p.removeEventListener("keyup",v),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,s]),o}function sp(e,r,o){return e.filter(s=>o||s.length===r.size).some(s=>s.every(a=>r.has(a)))}function ap(e,r){return r.includes(e)?"code":"key"}const nS=()=>{const e=Ke();return A.useMemo(()=>({zoomIn:async r=>{const{panZoom:o}=e.getState();return o?o.scaleBy(1.2,r):!1},zoomOut:async r=>{const{panZoom:o}=e.getState();return o?o.scaleBy(1/1.2,r):!1},zoomTo:async(r,o)=>{const{panZoom:s}=e.getState();return s?s.scaleTo(r,o):!1},getZoom:()=>e.getState().transform[2],setViewport:async(r,o)=>{const{transform:[s,a,u],panZoom:c}=e.getState();return c?(await c.setViewport({x:r.x??s,y:r.y??a,zoom:r.zoom??u},o),!0):!1},getViewport:()=>{const[r,o,s]=e.getState().transform;return{x:r,y:o,zoom:s}},setCenter:async(r,o,s)=>e.getState().setCenter(r,o,s),fitBounds:async(r,o)=>{const{width:s,height:a,minZoom:u,maxZoom:c,panZoom:h}=e.getState(),p=Tc(r,s,a,u,c,(o==null?void 0:o.padding)??.1);return h?(await h.setViewport(p,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),!0):!1},screenToFlowPosition:(r,o={})=>{const{transform:s,snapGrid:a,snapToGrid:u,domNode:c}=e.getState();if(!c)return r;const{x:h,y:p}=c.getBoundingClientRect(),y={x:r.x-h,y:r.y-p},w=o.snapGrid??a,v=o.snapToGrid??u;return ws(y,s,v,w)},flowToScreenPosition:r=>{const{transform:o,domNode:s}=e.getState();if(!s)return r;const{x:a,y:u}=s.getBoundingClientRect(),c=ai(r,o);return{x:c.x+a,y:c.y+u}}}),[])};function em(e,r){const o=[],s=new Map,a=[];for(const u of e)if(u.type==="add"){a.push(u);continue}else if(u.type==="remove"||u.type==="replace")s.set(u.id,[u]);else{const c=s.get(u.id);c?c.push(u):s.set(u.id,[u])}for(const u of r){const c=s.get(u.id);if(!c){o.push(u);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){o.push({...c[0].item});continue}const h={...u};for(const p of c)rS(p,h);o.push(h)}return a.length&&a.forEach(u=>{u.index!==void 0?o.splice(u.index,0,{...u.item}):o.push({...u.item})}),o}function rS(e,r){switch(e.type){case"select":{r.selected=e.selected;break}case"position":{typeof e.position<"u"&&(r.position=e.position),typeof e.dragging<"u"&&(r.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(r.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(r.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(r.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(r.resizing=e.resizing);break}}}function oS(e,r){return em(e,r)}function iS(e,r){return em(e,r)}function co(e,r){return{id:e,type:"select",selected:r}}function ei(e,r=new Set,o=!1){const s=[];for(const[a,u]of e){const c=r.has(a);!(u.selected===void 0&&!c)&&u.selected!==c&&(o&&(u.selected=c),s.push(co(u.id,c)))}return s}function lp({items:e=[],lookup:r}){var a;const o=[],s=new Map(e.map(u=>[u.id,u]));for(const[u,c]of e.entries()){const h=r.get(c.id),p=((a=h==null?void 0:h.internals)==null?void 0:a.userNode)??h;p!==void 0&&p!==c&&o.push({id:c.id,item:c,type:"replace"}),p===void 0&&o.push({item:c,type:"add",index:u})}for(const[u]of r)s.get(u)===void 0&&o.push({id:u,type:"remove"});return o}function up(e){return{id:e.id,type:"remove"}}const sS=Cg();function aS(e,r,o={}){return W1(e,r,{...o,onError:o.onError??sS})}const cp=e=>M1(e),lS=e=>kg(e);function tm(e){return A.forwardRef(e)}const nm=typeof window<"u"?A.useLayoutEffect:A.useEffect;function dp(e){const[r,o]=A.useState(BigInt(0)),[s]=A.useState(()=>uS(()=>o(a=>a+BigInt(1))));return nm(()=>{const a=s.get();a.length&&(e(a),s.reset())},[r]),s}function uS(e){let r=[];return{get:()=>r,reset:()=>{r=[]},push:o=>{r.push(o),e()}}}const rm=A.createContext(null);function cS({children:e}){const r=Ke(),o=A.useCallback(h=>{const{nodes:p=[],setNodes:y,hasDefaultNodes:w,onNodesChange:v,nodeLookup:g,fitViewQueued:x,onNodesChangeMiddlewareMap:S}=r.getState();let k=p;for(const E of h)k=typeof E=="function"?E(k):E;let b=lp({items:k,lookup:g});for(const E of S.values())b=E(b);w&&y(k),b.length>0?v==null||v(b):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:I,setNodes:_}=r.getState();E&&_(I)})},[]),s=dp(o),a=A.useCallback(h=>{const{edges:p=[],setEdges:y,hasDefaultEdges:w,onEdgesChange:v,edgeLookup:g}=r.getState();let x=p;for(const S of h)x=typeof S=="function"?S(x):S;w?y(x):v&&v(lp({items:x,lookup:g}))},[]),u=dp(a),c=A.useMemo(()=>({nodeQueue:s,edgeQueue:u}),[]);return d.jsx(rm.Provider,{value:c,children:e})}function dS(){const e=A.useContext(rm);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const fS=e=>!!e.panZoom;function cl(){const e=nS(),r=Ke(),o=dS(),s=Fe(fS),a=A.useMemo(()=>{const u=v=>r.getState().nodeLookup.get(v),c=v=>{o.nodeQueue.push(v)},h=v=>{o.edgeQueue.push(v)},p=v=>{var E,I;const{nodeLookup:g,nodeOrigin:x}=r.getState(),S=cp(v)?v:g.get(v.id),k=S.parentId?Pg(S.position,S.measured,S.parentId,g,x):S.position,b={...S,position:k,width:((E=S.measured)==null?void 0:E.width)??S.width,height:((I=S.measured)==null?void 0:I.height)??S.height};return ds(b)},y=(v,g,x={replace:!1})=>{c(S=>S.map(k=>{if(k.id===v){const b=typeof g=="function"?g(k):g;return x.replace&&cp(b)?b:{...k,...b}}return k}))},w=(v,g,x={replace:!1})=>{h(S=>S.map(k=>{if(k.id===v){const b=typeof g=="function"?g(k):g;return x.replace&&lS(b)?b:{...k,...b}}return k}))};return{getNodes:()=>r.getState().nodes.map(v=>({...v})),getNode:v=>{var g;return(g=u(v))==null?void 0:g.internals.userNode},getInternalNode:u,getEdges:()=>{const{edges:v=[]}=r.getState();return v.map(g=>({...g}))},getEdge:v=>r.getState().edgeLookup.get(v),setNodes:c,setEdges:h,addNodes:v=>{const g=Array.isArray(v)?v:[v];o.nodeQueue.push(x=>[...x,...g])},addEdges:v=>{const g=Array.isArray(v)?v:[v];o.edgeQueue.push(x=>[...x,...g])},toObject:()=>{const{nodes:v=[],edges:g=[],transform:x}=r.getState(),[S,k,b]=x;return{nodes:v.map(E=>({...E})),edges:g.map(E=>({...E})),viewport:{x:S,y:k,zoom:b}}},deleteElements:async({nodes:v=[],edges:g=[]})=>{const{nodes:x,edges:S,onNodesDelete:k,onEdgesDelete:b,triggerNodeChanges:E,triggerEdgeChanges:I,onDelete:_,onBeforeDelete:j}=r.getState(),{nodes:L,edges:$}=await L1({nodesToRemove:v,edgesToRemove:g,nodes:x,edges:S,onBeforeDelete:j}),F=$.length>0,U=L.length>0;if(F){const q=$.map(up);b==null||b($),I(q)}if(U){const q=L.map(up);k==null||k(L),E(q)}return(U||F)&&(_==null||_({nodes:L,edges:$})),{deletedNodes:L,deletedEdges:$}},getIntersectingNodes:(v,g=!0,x)=>{const S=Ah(v),k=S?v:p(v),b=x!==void 0;return k?(x||r.getState().nodes).filter(E=>{const I=r.getState().nodeLookup.get(E.id);if(I&&!S&&(E.id===v.id||!I.internals.positionAbsolute))return!1;const _=ds(b?E:I),j=Ya(_,k);return g&&j>0||j>=_.width*_.height||j>=k.width*k.height}):[]},isNodeIntersecting:(v,g,x=!0)=>{const k=Ah(v)?v:p(v);if(!k)return!1;const b=Ya(k,g);return x&&b>0||b>=g.width*g.height||b>=k.width*k.height},updateNode:y,updateNodeData:(v,g,x={replace:!1})=>{y(v,S=>{const k=typeof g=="function"?g(S):g;return x.replace?{...S,data:k}:{...S,data:{...S.data,...k}}},x)},updateEdge:w,updateEdgeData:(v,g,x={replace:!1})=>{w(v,S=>{const k=typeof g=="function"?g(S):g;return x.replace?{...S,data:k}:{...S,data:{...S.data,...k}}},x)},getNodesBounds:v=>{const{nodeLookup:g,nodeOrigin:x}=r.getState();return P1(v,{nodeLookup:g,nodeOrigin:x})},getHandleConnections:({type:v,id:g,nodeId:x})=>{var S;return Array.from(((S=r.getState().connectionLookup.get(`${x}-${v}${g?`-${g}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:v,handleId:g,nodeId:x})=>{var S;return Array.from(((S=r.getState().connectionLookup.get(`${x}${v?g?`-${v}-${g}`:`-${v}`:""}`))==null?void 0:S.values())??[])},fitView:async v=>{const g=r.getState().fitViewResolver??z1();return r.setState({fitViewQueued:!0,fitViewOptions:v,fitViewResolver:g}),o.nodeQueue.push(x=>[...x]),g.promise}}},[]);return A.useMemo(()=>({...a,...e,viewportInitialized:s}),[s])}const fp=e=>e.selected,hS=typeof window<"u"?window:void 0;function pS({deleteKeyCode:e,multiSelectionKeyCode:r}){const o=Ke(),{deleteElements:s}=cl(),a=hs(e,{actInsideInputWithModifier:!1}),u=hs(r,{target:hS});A.useEffect(()=>{if(a){const{edges:c,nodes:h}=o.getState();s({nodes:h.filter(fp),edges:c.filter(fp)}),o.setState({nodesSelectionActive:!1})}},[a]),A.useEffect(()=>{o.setState({multiSelectionActive:u})},[u])}function gS(e){const r=Ke();A.useEffect(()=>{const o=()=>{var a,u,c,h;if(!e.current||!(((u=(a=e.current).checkVisibility)==null?void 0:u.call(a))??!0))return!1;const s=Lc(e.current);(s.height===0||s.width===0)&&((h=(c=r.getState()).onError)==null||h.call(c,"004",Sn.error004())),r.setState({width:s.width||500,height:s.height||500})};if(e.current){o(),window.addEventListener("resize",o);const s=new ResizeObserver(()=>o());return s.observe(e.current),()=>{window.removeEventListener("resize",o),s&&e.current&&s.unobserve(e.current)}}},[])}const dl={position:"absolute",width:"100%",height:"100%",top:0,left:0},mS=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function yS({onPaneContextMenu:e,zoomOnScroll:r=!0,zoomOnPinch:o=!0,panOnScroll:s=!1,panActivationKeyPressed:a,panOnScrollSpeed:u=.5,panOnScrollMode:c=po.Free,zoomOnDoubleClick:h=!0,panOnDrag:p=!0,defaultViewport:y,translateExtent:w,minZoom:v,maxZoom:g,zoomActivationKeyCode:x,preventScrolling:S=!0,children:k,noWheelClassName:b,noPanClassName:E,onViewportChange:I,isControlledViewport:_,paneClickDistance:j,selectionOnDrag:L}){const $=Ke(),F=A.useRef(null),{userSelectionActive:U,lib:q,connectionInProgress:te}=Fe(mS,et),J=hs(x),ne=A.useRef();gS(F);const Q=A.useCallback(C=>{I==null||I({x:C[0],y:C[1],zoom:C[2]}),_||$.setState({transform:C})},[I,_]);return A.useEffect(()=>{if(F.current){ne.current=w_({domNode:F.current,minZoom:v,maxZoom:g,translateExtent:w,viewport:y,onDraggingChange:Y=>$.setState(M=>M.paneDragging===Y?M:{paneDragging:Y}),onPanZoomStart:(Y,M)=>{const{onViewportChangeStart:D,onMoveStart:H}=$.getState();H==null||H(Y,M),D==null||D(M)},onPanZoom:(Y,M)=>{const{onViewportChange:D,onMove:H}=$.getState();H==null||H(Y,M),D==null||D(M)},onPanZoomEnd:(Y,M)=>{const{onViewportChangeEnd:D,onMoveEnd:H}=$.getState();H==null||H(Y,M),D==null||D(M)}});const{x:C,y:V,zoom:W}=ne.current.getViewport();return $.setState({panZoom:ne.current,transform:[C,V,W],domNode:F.current.closest(".react-flow")}),()=>{var Y;(Y=ne.current)==null||Y.destroy()}}},[]),A.useEffect(()=>{var C;(C=ne.current)==null||C.update({onPaneContextMenu:e,zoomOnScroll:r,zoomOnPinch:o,panOnScroll:s,panActivationKeyPressed:a,panOnScrollSpeed:u,panOnScrollMode:c,zoomOnDoubleClick:h,panOnDrag:p,zoomActivationKeyPressed:J,preventScrolling:S,noPanClassName:E,userSelectionActive:U,noWheelClassName:b,lib:q,onTransformChange:Q,connectionInProgress:te,selectionOnDrag:L,paneClickDistance:j})},[e,r,o,s,a,u,c,h,p,J,S,E,U,b,q,Q,te,L,j]),d.jsx("div",{className:"react-flow__renderer",ref:F,style:dl,children:k})}const vS=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function xS(){const{userSelectionActive:e,userSelectionRect:r}=Fe(vS,et);return e&&r?d.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:r.width,height:r.height,transform:`translate(${r.x}px, ${r.y}px)`}}):null}const rc=(e,r)=>o=>{o.target===r.current&&(e==null||e(o))},wS=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function _S({isSelecting:e,selectionKeyPressed:r,selectionMode:o=us.Full,panOnDrag:s,autoPanOnSelection:a,paneClickDistance:u,selectionOnDrag:c,onSelectionStart:h,onSelectionEnd:p,onPaneClick:y,onPaneContextMenu:w,onPaneScroll:v,onPaneMouseEnter:g,onPaneMouseMove:x,onPaneMouseLeave:S,children:k}){const b=A.useRef(0),E=Ke(),{userSelectionActive:I,elementsSelectable:_,dragging:j,panBy:L,autoPanSpeed:$}=Fe(wS,et),F=_&&(e||I),U=A.useRef(null),q=A.useRef(),te=A.useRef(new Set),J=A.useRef(new Set),ne=A.useRef(!1),Q=A.useRef(!1),C=A.useRef({x:0,y:0}),V=A.useRef(!1),W=Z=>{if(Q.current||ne.current||E.getState().connection.inProgress){Q.current=!1,ne.current=!1;return}y==null||y(Z),E.getState().resetSelectedElements(),E.setState({nodesSelectionActive:!1})},Y=Z=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){Z.preventDefault();return}w==null||w(Z)},M=v?Z=>v(Z):void 0,D=Z=>{Q.current&&(Z.stopPropagation(),Q.current=!1)},H=Z=>{var De,pe;if(Z.pointerType==="touch"&&s!==!1&&!r)return;const{domNode:se,transform:me}=E.getState();if(q.current=se==null?void 0:se.getBoundingClientRect(),!q.current)return;const Ne=Z.target===U.current;if(!Ne&&!!Z.target.closest(".nokey")||!e||!(c&&Ne||r)||Z.button!==0||!Z.isPrimary)return;(pe=(De=Z.target)==null?void 0:De.setPointerCapture)==null||pe.call(De,Z.pointerId),Q.current=!1;const{x:Me,y:Te}=_n(Z.nativeEvent,q.current),Le=ws({x:Me,y:Te},me);E.setState({userSelectionRect:{width:0,height:0,startX:Le.x,startY:Le.y,x:Me,y:Te}}),Ne||(Z.stopPropagation(),Z.preventDefault())};function R(Z,se){const{userSelectionRect:me}=E.getState();if(!me)return;const{transform:Ne,nodeLookup:we,edgeLookup:ye,connectionLookup:Me,triggerNodeChanges:Te,triggerEdgeChanges:Le,defaultEdgeOptions:De}=E.getState(),pe={x:me.startX,y:me.startY},{x:$e,y:Ve}=ai(pe,Ne),Ue={startX:pe.x,startY:pe.y,x:Z<$e?Z:$e,y:semt.id)),J.current=new Set;const gt=(De==null?void 0:De.selectable)??!0;for(const mt of te.current){const Mt=Me.get(mt);if(Mt)for(const{edgeId:ct}of Mt.values()){const rt=ye.get(ct);rt&&(rt.selectable??gt)&&J.current.add(ct)}}if(!$h(wt,te.current)){const mt=ei(we,te.current,!0);Te(mt)}if(!$h(Xt,J.current)){const mt=ei(ye,J.current);Le(mt)}E.setState({userSelectionRect:Ue,userSelectionActive:!0,nodesSelectionActive:!1})}function z(){if(!a||!q.current)return;const[Z,se]=Rc(C.current,q.current,$);L({x:Z,y:se}).then(me=>{if(!Q.current||!me){b.current=requestAnimationFrame(z);return}const{x:Ne,y:we}=C.current;R(Ne,we),b.current=requestAnimationFrame(z)})}const re=()=>{cancelAnimationFrame(b.current),b.current=0,V.current=!1};A.useEffect(()=>()=>re(),[]);const oe=Z=>{const{userSelectionRect:se,transform:me,resetSelectedElements:Ne}=E.getState();if(!q.current||!se)return;const{x:we,y:ye}=_n(Z.nativeEvent,q.current);C.current={x:we,y:ye};const Me=ai({x:se.startX,y:se.startY},me);if(!Q.current){const Te=r?0:u;if(Math.hypot(we-Me.x,ye-Me.y)<=Te)return;Ne(),h==null||h(Z)}Q.current=!0,V.current||(z(),V.current=!0),R(we,ye)},fe=Z=>{var se,me;if(!F){Z.target===U.current&&E.getState().connection.inProgress&&(ne.current=!0);return}Z.button===0&&((me=(se=Z.target)==null?void 0:se.releasePointerCapture)==null||me.call(se,Z.pointerId),!I&&Z.target===U.current&&E.getState().userSelectionRect&&(W==null||W(Z)),E.setState({userSelectionActive:!1,userSelectionRect:null}),Q.current&&(p==null||p(Z),E.setState({nodesSelectionActive:te.current.size>0})),re())},le=Z=>{var se,me;(me=(se=Z.target)==null?void 0:se.releasePointerCapture)==null||me.call(se,Z.pointerId),re()},he=s===!0||Array.isArray(s)&&s.includes(0);return d.jsxs("div",{className:st(["react-flow__pane",{draggable:he,dragging:j,selection:e}]),onClick:F?void 0:rc(W,U),onContextMenu:rc(Y,U),onWheel:rc(M,U),onPointerEnter:F?void 0:g,onPointerMove:F?oe:x,onPointerUp:fe,onPointerCancel:F?le:void 0,onPointerDownCapture:F?H:void 0,onClickCapture:F?D:void 0,onPointerLeave:S,ref:U,style:dl,children:[k,d.jsx(xS,{})]})}function _c({id:e,store:r,unselect:o=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:u,multiSelectionActive:c,nodeLookup:h,onError:p}=r.getState(),y=h.get(e);if(!y){p==null||p("012",Sn.error012(e));return}r.setState({nodesSelectionActive:!1}),y.selected?(o||y.selected&&c)&&(u({nodes:[y],edges:[]}),requestAnimationFrame(()=>{var w;return(w=s==null?void 0:s.current)==null?void 0:w.blur()})):a([e])}function om({nodeRef:e,disabled:r=!1,noDragClassName:o,handleSelector:s,nodeId:a,isSelectable:u,nodeClickDistance:c}){const h=Ke(),[p,y]=A.useState(!1),w=A.useRef();return A.useEffect(()=>{if(!r)return w.current=s_({getStoreItems:()=>h.getState(),onNodeMouseDown:v=>{_c({id:v,store:h,nodeRef:e})},onDragStart:()=>{y(!0)},onDragStop:()=>{y(!1)}}),()=>{var v;(v=w.current)==null||v.destroy(),w.current=void 0}},[r,h,e]),A.useEffect(()=>{r||!e.current||!w.current||w.current.update({noDragClassName:o,handleSelector:s,domNode:e.current,isSelectable:u,nodeId:a,nodeClickDistance:c})},[o,s,r,u,e,a,c]),p}const SS=e=>r=>r.selected&&(r.draggable||e&&typeof r.draggable>"u");function im(){const e=Ke();return A.useCallback(o=>{const{nodeExtent:s,snapToGrid:a,snapGrid:u,nodesDraggable:c,onError:h,updateNodePositions:p,nodeLookup:y,nodeOrigin:w}=e.getState(),v=new Map,g=SS(c),x=a?u[0]:5,S=a?u[1]:5,k=o.direction.x*x*o.factor,b=o.direction.y*S*o.factor;for(const[,E]of y){if(!g(E))continue;let I={x:E.internals.positionAbsolute.x+k,y:E.internals.positionAbsolute.y+b};a&&(I=xs(I,u));const{position:_,positionAbsolute:j}=Ng({nodeId:E.id,nextPosition:I,nodeLookup:y,nodeExtent:s,nodeOrigin:w,onError:h});E.position=_,E.internals.positionAbsolute=j,v.set(E.id,E)}p(v)},[])}const Fc=A.createContext(null),kS=Fc.Provider;Fc.Consumer;const sm=()=>A.useContext(Fc),NS=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),am=A.createContext(null);function bS({children:e}){const r=Fe(NS,et);return d.jsx(am.Provider,{value:r,children:e})}function jS(){const e=A.useContext(am);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const ES={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},CS=(e,r,o)=>s=>{const{connectionClickStartHandle:a,connectionMode:u,connection:c}=s,{fromHandle:h,toHandle:p,isValid:y}=c;if(!h&&!a)return ES;const w=(p==null?void 0:p.nodeId)===e&&(p==null?void 0:p.id)===r&&(p==null?void 0:p.type)===o;return{connectingFrom:(h==null?void 0:h.nodeId)===e&&(h==null?void 0:h.id)===r&&(h==null?void 0:h.type)===o,connectingTo:w,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===r&&(a==null?void 0:a.type)===o,isPossibleEndHandle:u===ii.Strict?(h==null?void 0:h.type)!==o:e!==(h==null?void 0:h.nodeId)||r!==(h==null?void 0:h.id),connectionInProcess:!!h,clickConnectionInProcess:!!a,valid:w&&y}};function MS({type:e="source",position:r=ke.Top,isValidConnection:o,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:u=!0,id:c,onConnect:h,children:p,className:y,onMouseDown:w,onTouchStart:v,...g},x){var V,W;const S=c||null,k=e==="target",b=Ke(),E=sm(),{connectOnClick:I,noPanClassName:_,rfId:j}=jS(),{connectingFrom:L,connectingTo:$,clickConnecting:F,isPossibleEndHandle:U,connectionInProcess:q,clickConnectionInProcess:te,valid:J}=Fe(CS(E,S,e),et);E||(W=(V=b.getState()).onError)==null||W.call(V,"010",Sn.error010());const ne=Y=>{const{defaultEdgeOptions:M,onConnect:D,hasDefaultEdges:H}=b.getState(),R={...M,...Y};if(H){const{edges:z,setEdges:re,onError:oe}=b.getState();re(aS(R,z,{onError:oe}))}D==null||D(R),h==null||h(R)},Q=Y=>{if(!E)return;const M=Tg(Y.nativeEvent);if(a&&(M&&Y.button===0||!M)){const D=b.getState();wc.onPointerDown(Y.nativeEvent,{handleDomNode:Y.currentTarget,autoPanOnConnect:D.autoPanOnConnect,connectionMode:D.connectionMode,connectionRadius:D.connectionRadius,domNode:D.domNode,nodeLookup:D.nodeLookup,lib:D.lib,isTarget:k,handleId:S,nodeId:E,flowId:D.rfId,panBy:D.panBy,cancelConnection:D.cancelConnection,onConnectStart:D.onConnectStart,onConnectEnd:(...H)=>{var R,z;return(z=(R=b.getState()).onConnectEnd)==null?void 0:z.call(R,...H)},updateConnection:D.updateConnection,onConnect:ne,isValidConnection:o||((...H)=>{var R,z;return((z=(R=b.getState()).isValidConnection)==null?void 0:z.call(R,...H))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:D.autoPanSpeed,dragThreshold:D.connectionDragThreshold})}M?w==null||w(Y):v==null||v(Y)},C=Y=>{const{onClickConnectStart:M,onClickConnectEnd:D,connectionClickStartHandle:H,connectionMode:R,isValidConnection:z,lib:re,rfId:oe,nodeLookup:fe,connection:le}=b.getState();if(!E||!H&&!a)return;if(!H){M==null||M(Y.nativeEvent,{nodeId:E,handleId:S,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:E,type:e,id:S}});return}const he=Ig(Y.target),Z=o||z,{connection:se,isValid:me}=wc.isValid(Y.nativeEvent,{handle:{nodeId:E,id:S,type:e},connectionMode:R,fromNodeId:H.nodeId,fromHandleId:H.id||null,fromType:H.type,isValidConnection:Z,flowId:oe,doc:he,lib:re,nodeLookup:fe});me&&se&&ne(se);const Ne=structuredClone(le);delete Ne.inProgress,Ne.toPosition=Ne.toHandle?Ne.toHandle.position:null,D==null||D(Y,Ne),b.setState({connectionClickStartHandle:null})};return d.jsx("div",{"data-handleid":S,"data-nodeid":E,"data-handlepos":r,"data-id":`${j}-${E}-${S}-${e}`,className:st(["react-flow__handle",`react-flow__handle-${r}`,"nodrag",_,y,{source:!k,target:k,connectable:s,connectablestart:a,connectableend:u,clickconnecting:F,connectingfrom:L,connectingto:$,valid:J,connectionindicator:s&&(!q||U)&&(q||te?u:a)}]),onMouseDown:Q,onTouchStart:Q,onClick:I?C:void 0,ref:x,...g,children:p})}const ui=A.memo(tm(MS));function PS({data:e,isConnectable:r,sourcePosition:o=ke.Bottom}){return d.jsxs(d.Fragment,{children:[e==null?void 0:e.label,d.jsx(ui,{type:"source",position:o,isConnectable:r})]})}function IS({data:e,isConnectable:r,targetPosition:o=ke.Top,sourcePosition:s=ke.Bottom}){return d.jsxs(d.Fragment,{children:[d.jsx(ui,{type:"target",position:o,isConnectable:r}),e==null?void 0:e.label,d.jsx(ui,{type:"source",position:s,isConnectable:r})]})}function RS(){return null}function TS({data:e,isConnectable:r,targetPosition:o=ke.Top}){return d.jsxs(d.Fragment,{children:[d.jsx(ui,{type:"target",position:o,isConnectable:r}),e==null?void 0:e.label]})}const qa={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},hp={input:PS,default:IS,output:TS,group:RS};function LS(e){var r,o,s,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((r=e.style)==null?void 0:r.width),height:e.height??e.initialHeight??((o=e.style)==null?void 0:o.height)}:{width:e.width??((s=e.style)==null?void 0:s.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const AS=e=>{const{width:r,height:o,x:s,y:a}=vs(e.nodeLookup,{filter:u=>!!u.selected});return{width:wn(r)?r:null,height:wn(o)?o:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${s}px,${a}px)`}};function $S({onSelectionContextMenu:e,noPanClassName:r,disableKeyboardA11y:o}){const s=Ke(),{width:a,height:u,transformString:c,userSelectionActive:h}=Fe(AS,et),p=im(),y=A.useRef(null);A.useEffect(()=>{var x;o||(x=y.current)==null||x.focus({preventScroll:!0})},[o]);const w=!h&&a!==null&&u!==null;if(om({nodeRef:y,disabled:!w}),!w)return null;const v=e?x=>{const S=s.getState().nodes.filter(k=>k.selected);e(x,S)}:void 0,g=x=>{Object.prototype.hasOwnProperty.call(qa,x.key)&&(x.preventDefault(),p({direction:qa[x.key],factor:x.shiftKey?4:1}))};return d.jsx("div",{className:st(["react-flow__nodesselection","react-flow__container",r]),style:{transform:c},children:d.jsx("div",{ref:y,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:o?void 0:-1,onKeyDown:o?void 0:g,style:{width:a,height:u}})})}const pp=typeof window<"u"?window:void 0,zS=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function lm({children:e,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:c,paneClickDistance:h,deleteKeyCode:p,selectionKeyCode:y,selectionOnDrag:w,selectionMode:v,onSelectionStart:g,onSelectionEnd:x,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:b,elementsSelectable:E,zoomOnScroll:I,zoomOnPinch:_,panOnScroll:j,panOnScrollSpeed:L,panOnScrollMode:$,zoomOnDoubleClick:F,panOnDrag:U,autoPanOnSelection:q,defaultViewport:te,translateExtent:J,minZoom:ne,maxZoom:Q,preventScrolling:C,onSelectionContextMenu:V,noWheelClassName:W,noPanClassName:Y,disableKeyboardA11y:M,onViewportChange:D,isControlledViewport:H}){const{nodesSelectionActive:R,userSelectionActive:z}=Fe(zS,et),re=hs(y,{target:pp}),oe=hs(k,{target:pp}),fe=oe||U,le=oe||j,he=w&&fe!==!0,Z=re||z||he;return pS({deleteKeyCode:p,multiSelectionKeyCode:S}),d.jsx(yS,{onPaneContextMenu:u,elementsSelectable:E,zoomOnScroll:I,zoomOnPinch:_,panOnScroll:le,panActivationKeyPressed:oe,panOnScrollSpeed:L,panOnScrollMode:$,zoomOnDoubleClick:F,panOnDrag:!re&&fe,defaultViewport:te,translateExtent:J,minZoom:ne,maxZoom:Q,zoomActivationKeyCode:b,preventScrolling:C,noWheelClassName:W,noPanClassName:Y,onViewportChange:D,isControlledViewport:H,paneClickDistance:h,selectionOnDrag:he,children:d.jsxs(_S,{onSelectionStart:g,onSelectionEnd:x,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:c,panOnDrag:fe,autoPanOnSelection:q,isSelecting:!!Z,selectionMode:v,selectionKeyPressed:re,paneClickDistance:h,selectionOnDrag:he,children:[e,R&&d.jsx($S,{onSelectionContextMenu:V,noPanClassName:Y,disableKeyboardA11y:M})]})})}lm.displayName="FlowRenderer";const DS=A.memo(lm),OS=e=>r=>e?Ic(r.nodeLookup,{x:0,y:0,width:r.width,height:r.height},r.transform,!0).map(o=>o.id):Array.from(r.nodeLookup.keys());function FS(e){return Fe(A.useCallback(OS(e),[e]),et)}const HS=e=>e.updateNodeInternals;function BS(){const e=Fe(HS),[r]=A.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(o=>{const s=new Map;o.forEach(a=>{const u=a.target.getAttribute("data-id");s.set(u,{id:u,nodeElement:a.target,force:!0})}),e(s)}));return A.useEffect(()=>()=>{r==null||r.disconnect()},[r]),r}function VS({node:e,nodeType:r,hasDimensions:o,resizeObserver:s}){const a=Ke(),u=A.useRef(null),c=A.useRef(null),h=A.useRef(e.sourcePosition),p=A.useRef(e.targetPosition),y=A.useRef(r),w=o&&!!e.internals.handleBounds;return A.useEffect(()=>{u.current&&!e.hidden&&(!w||c.current!==u.current)&&(c.current&&(s==null||s.unobserve(c.current)),s==null||s.observe(u.current),c.current=u.current)},[w,e.hidden]),A.useEffect(()=>()=>{c.current&&(s==null||s.unobserve(c.current),c.current=null)},[]),A.useEffect(()=>{if(u.current){const v=y.current!==r,g=h.current!==e.sourcePosition,x=p.current!==e.targetPosition;(v||g||x)&&(y.current=r,h.current=e.sourcePosition,p.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:u.current,force:!0}]])))}},[e.id,r,e.sourcePosition,e.targetPosition]),u}function WS({id:e,onClick:r,onMouseEnter:o,onMouseMove:s,onMouseLeave:a,onContextMenu:u,onDoubleClick:c,nodesDraggable:h,elementsSelectable:p,nodesConnectable:y,nodesFocusable:w,resizeObserver:v,noDragClassName:g,noPanClassName:x,disableKeyboardA11y:S,rfId:k,nodeTypes:b,nodeClickDistance:E,onError:I}){const{node:_,internals:j,isParent:L}=Fe(Z=>{const se=Z.nodeLookup.get(e),me=Z.parentLookup.has(e);return{node:se,internals:se.internals,isParent:me}},et);let $=_.type||"default",F=(b==null?void 0:b[$])||hp[$];F===void 0&&(I==null||I("003",Sn.error003($)),$="default",F=(b==null?void 0:b.default)||hp.default);const U=!!(_.draggable||h&&typeof _.draggable>"u"),q=!!(_.selectable||p&&typeof _.selectable>"u"),te=!!(_.connectable||y&&typeof _.connectable>"u"),J=!!(_.focusable||w&&typeof _.focusable>"u"),ne=Ke(),Q=Mg(_),C=VS({node:_,nodeType:$,hasDimensions:Q,resizeObserver:v}),V=om({nodeRef:C,disabled:_.hidden||!U,noDragClassName:g,handleSelector:_.dragHandle,nodeId:e,isSelectable:q,nodeClickDistance:E}),W=im();if(_.hidden)return null;const Y=Nn(_),M=LS(_),D=q||U||r||o||s||a,H=o?Z=>o(Z,{...j.userNode}):void 0,R=s?Z=>s(Z,{...j.userNode}):void 0,z=a?Z=>a(Z,{...j.userNode}):void 0,re=u?Z=>u(Z,{...j.userNode}):void 0,oe=c?Z=>c(Z,{...j.userNode}):void 0,fe=Z=>{const{selectNodesOnDrag:se,nodeDragThreshold:me}=ne.getState();q&&(!se||!U||me>0)&&_c({id:e,store:ne,nodeRef:C}),r&&r(Z,{...j.userNode})},le=Z=>{if(!(Rg(Z.nativeEvent)||S)){if(xg.includes(Z.key)&&q){const se=Z.key==="Escape";_c({id:e,store:ne,unselect:se,nodeRef:C})}else if(U&&_.selected&&Object.prototype.hasOwnProperty.call(qa,Z.key)){Z.preventDefault();const{ariaLabelConfig:se}=ne.getState();ne.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:Z.key.replace("Arrow","").toLowerCase(),x:~~j.positionAbsolute.x,y:~~j.positionAbsolute.y})}),W({direction:qa[Z.key],factor:Z.shiftKey?4:1})}}},he=()=>{var Me;if(S||!((Me=C.current)!=null&&Me.matches(":focus-visible")))return;const{transform:Z,width:se,height:me,autoPanOnNodeFocus:Ne,setCenter:we}=ne.getState();if(!Ne)return;Ic(new Map([[e,_]]),{x:0,y:0,width:se,height:me},Z,!0).length>0||we(_.position.x+Y.width/2,_.position.y+Y.height/2,{zoom:Z[2]})};return d.jsx("div",{className:st(["react-flow__node",`react-flow__node-${$}`,{[x]:U},_.className,{selected:_.selected,selectable:q,parent:L,draggable:U,dragging:V}]),ref:C,style:{zIndex:j.z,transform:`translate(${j.positionAbsolute.x}px,${j.positionAbsolute.y}px)`,pointerEvents:D?"all":"none",visibility:Q?"visible":"hidden",..._.style,...M},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:H,onMouseMove:R,onMouseLeave:z,onContextMenu:re,onClick:fe,onDoubleClick:oe,onKeyDown:J?le:void 0,tabIndex:J?0:void 0,onFocus:J?he:void 0,role:_.ariaRole??(J?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${Qg}-${k}`,"aria-label":_.ariaLabel,..._.domAttributes,children:d.jsx(kS,{value:e,children:d.jsx(F,{id:e,data:_.data,type:$,positionAbsoluteX:j.positionAbsolute.x,positionAbsoluteY:j.positionAbsolute.y,selected:_.selected??!1,selectable:q,draggable:U,deletable:_.deletable??!0,isConnectable:te,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:V,dragHandle:_.dragHandle,zIndex:j.z,parentId:_.parentId,...Y})})})}var US=A.memo(WS);const GS=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function um(e){const{nodesConnectable:r,nodesFocusable:o,elementsSelectable:s,onError:a}=Fe(GS,et),u=FS(e.onlyRenderVisibleElements),c=BS();return d.jsx("div",{className:"react-flow__nodes",style:dl,children:u.map(h=>d.jsx(US,{id:h,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:c,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:r,nodesFocusable:o,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:a},h))})}um.displayName="NodeRenderer";const YS=A.memo(um);function XS(e){return Fe(A.useCallback(o=>{if(!e)return o.edges.map(a=>a.id);const s=[];if(o.width&&o.height)for(const a of o.edges){const u=o.nodeLookup.get(a.source),c=o.nodeLookup.get(a.target);u&&c&&H1({sourceNode:u,targetNode:c,width:o.width,height:o.height,transform:o.transform})&&s.push(a.id)}return s},[e]),et)}const qS=({color:e="none",strokeWidth:r=1})=>{const o={strokeWidth:r,...e&&{stroke:e}};return d.jsx("polyline",{className:"arrow",style:o,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},KS=({color:e="none",strokeWidth:r=1})=>{const o={strokeWidth:r,...e&&{stroke:e,fill:e}};return d.jsx("polyline",{className:"arrowclosed",style:o,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},gp={[cs.Arrow]:qS,[cs.ArrowClosed]:KS};function QS(e){const r=Ke();return A.useMemo(()=>{var a,u;return Object.prototype.hasOwnProperty.call(gp,e)?gp[e]:((u=(a=r.getState()).onError)==null||u.call(a,"009",Sn.error009(e)),null)},[e])}const ZS=({id:e,type:r,color:o,width:s=12.5,height:a=12.5,markerUnits:u="strokeWidth",strokeWidth:c,orient:h="auto-start-reverse"})=>{const p=QS(r);return p?d.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:h,refX:"0",refY:"0",children:d.jsx(p,{color:o,strokeWidth:c})}):null},cm=({defaultColor:e,rfId:r})=>{const o=Fe(u=>u.edges),s=Fe(u=>u.defaultEdgeOptions),a=A.useMemo(()=>q1(o,{id:r,defaultColor:e,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[o,s,r,e]);return a.length?d.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:d.jsx("defs",{children:a.map(u=>d.jsx(ZS,{id:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,strokeWidth:u.strokeWidth,orient:u.orient},u.id))})}):null};cm.displayName="MarkerDefinitions";var JS=A.memo(cm);function dm({x:e,y:r,label:o,labelStyle:s,labelShowBg:a=!0,labelBgStyle:u,labelBgPadding:c=[2,4],labelBgBorderRadius:h=2,children:p,className:y,...w}){const[v,g]=A.useState({x:1,y:0,width:0,height:0}),x=st(["react-flow__edge-textwrapper",y]),S=A.useRef(null);return A.useEffect(()=>{if(S.current){const k=S.current.getBBox();g({x:k.x,y:k.y,width:k.width,height:k.height})}},[o]),o?d.jsxs("g",{transform:`translate(${e-v.width/2} ${r-v.height/2})`,className:x,visibility:v.width?"visible":"hidden",...w,children:[a&&d.jsx("rect",{width:v.width+2*c[0],x:-c[0],y:-c[1],height:v.height+2*c[1],className:"react-flow__edge-textbg",style:u,rx:h,ry:h}),d.jsx("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:S,style:s,children:o}),p]}):null}dm.displayName="EdgeText";const ek=A.memo(dm);function _s({path:e,labelX:r,labelY:o,label:s,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,interactionWidth:y=20,...w}){return d.jsxs(d.Fragment,{children:[d.jsx("path",{...w,d:e,fill:"none",className:st(["react-flow__edge-path",w.className])}),y?d.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:y,className:"react-flow__edge-interaction"}):null,s&&wn(r)&&wn(o)?d.jsx(ek,{x:r,y:o,label:s,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p}):null]})}function mp({pos:e,x1:r,y1:o,x2:s,y2:a}){return e===ke.Left||e===ke.Right?[.5*(r+s),o]:[r,.5*(o+a)]}function fm({sourceX:e,sourceY:r,sourcePosition:o=ke.Bottom,targetX:s,targetY:a,targetPosition:u=ke.Top}){const[c,h]=mp({pos:o,x1:e,y1:r,x2:s,y2:a}),[p,y]=mp({pos:u,x1:s,y1:a,x2:e,y2:r}),[w,v,g,x]=Lg({sourceX:e,sourceY:r,targetX:s,targetY:a,sourceControlX:c,sourceControlY:h,targetControlX:p,targetControlY:y});return[`M${e},${r} C${c},${h} ${p},${y} ${s},${a}`,w,v,g,x]}function hm(e){return A.memo(({id:r,sourceX:o,sourceY:s,targetX:a,targetY:u,sourcePosition:c,targetPosition:h,label:p,labelStyle:y,labelShowBg:w,labelBgStyle:v,labelBgPadding:g,labelBgBorderRadius:x,style:S,markerEnd:k,markerStart:b,interactionWidth:E})=>{const[I,_,j]=fm({sourceX:o,sourceY:s,sourcePosition:c,targetX:a,targetY:u,targetPosition:h}),L=e.isInternal?void 0:r;return d.jsx(_s,{id:L,path:I,labelX:_,labelY:j,label:p,labelStyle:y,labelShowBg:w,labelBgStyle:v,labelBgPadding:g,labelBgBorderRadius:x,style:S,markerEnd:k,markerStart:b,interactionWidth:E})})}const tk=hm({isInternal:!1}),pm=hm({isInternal:!0});tk.displayName="SimpleBezierEdge";pm.displayName="SimpleBezierEdgeInternal";function gm(e){return A.memo(({id:r,sourceX:o,sourceY:s,targetX:a,targetY:u,label:c,labelStyle:h,labelShowBg:p,labelBgStyle:y,labelBgPadding:w,labelBgBorderRadius:v,style:g,sourcePosition:x=ke.Bottom,targetPosition:S=ke.Top,markerEnd:k,markerStart:b,pathOptions:E,interactionWidth:I})=>{const[_,j,L]=Xa({sourceX:o,sourceY:s,sourcePosition:x,targetX:a,targetY:u,targetPosition:S,borderRadius:E==null?void 0:E.borderRadius,offset:E==null?void 0:E.offset,stepPosition:E==null?void 0:E.stepPosition}),$=e.isInternal?void 0:r;return d.jsx(_s,{id:$,path:_,labelX:j,labelY:L,label:c,labelStyle:h,labelShowBg:p,labelBgStyle:y,labelBgPadding:w,labelBgBorderRadius:v,style:g,markerEnd:k,markerStart:b,interactionWidth:I})})}const mm=gm({isInternal:!1}),ym=gm({isInternal:!0});mm.displayName="SmoothStepEdge";ym.displayName="SmoothStepEdgeInternal";function vm(e){return A.memo(({id:r,...o})=>{var a;const s=e.isInternal?void 0:r;return d.jsx(mm,{...o,id:s,pathOptions:A.useMemo(()=>{var u;return{borderRadius:0,offset:(u=o.pathOptions)==null?void 0:u.offset}},[(a=o.pathOptions)==null?void 0:a.offset])})})}const nk=vm({isInternal:!1}),xm=vm({isInternal:!0});nk.displayName="StepEdge";xm.displayName="StepEdgeInternal";function wm(e){return A.memo(({id:r,sourceX:o,sourceY:s,targetX:a,targetY:u,label:c,labelStyle:h,labelShowBg:p,labelBgStyle:y,labelBgPadding:w,labelBgBorderRadius:v,style:g,markerEnd:x,markerStart:S,interactionWidth:k})=>{const[b,E,I]=zg({sourceX:o,sourceY:s,targetX:a,targetY:u}),_=e.isInternal?void 0:r;return d.jsx(_s,{id:_,path:b,labelX:E,labelY:I,label:c,labelStyle:h,labelShowBg:p,labelBgStyle:y,labelBgPadding:w,labelBgBorderRadius:v,style:g,markerEnd:x,markerStart:S,interactionWidth:k})})}const rk=wm({isInternal:!1}),_m=wm({isInternal:!0});rk.displayName="StraightEdge";_m.displayName="StraightEdgeInternal";function Sm(e){return A.memo(({id:r,sourceX:o,sourceY:s,targetX:a,targetY:u,sourcePosition:c=ke.Bottom,targetPosition:h=ke.Top,label:p,labelStyle:y,labelShowBg:w,labelBgStyle:v,labelBgPadding:g,labelBgBorderRadius:x,style:S,markerEnd:k,markerStart:b,pathOptions:E,interactionWidth:I})=>{const[_,j,L]=Ag({sourceX:o,sourceY:s,sourcePosition:c,targetX:a,targetY:u,targetPosition:h,curvature:E==null?void 0:E.curvature}),$=e.isInternal?void 0:r;return d.jsx(_s,{id:$,path:_,labelX:j,labelY:L,label:p,labelStyle:y,labelShowBg:w,labelBgStyle:v,labelBgPadding:g,labelBgBorderRadius:x,style:S,markerEnd:k,markerStart:b,interactionWidth:I})})}const ok=Sm({isInternal:!1}),km=Sm({isInternal:!0});ok.displayName="BezierEdge";km.displayName="BezierEdgeInternal";const yp={default:km,straight:_m,step:xm,smoothstep:ym,simplebezier:pm},vp={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},ik=(e,r,o)=>o===ke.Left?e-r:o===ke.Right?e+r:e,sk=(e,r,o)=>o===ke.Top?e-r:o===ke.Bottom?e+r:e,xp="react-flow__edgeupdater";function wp({position:e,centerX:r,centerY:o,radius:s=10,onMouseDown:a,onMouseEnter:u,onMouseOut:c,type:h}){return d.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:st([xp,`${xp}-${h}`]),cx:ik(r,s,e),cy:sk(o,s,e),r:s,stroke:"transparent",fill:"transparent"})}function ak({isReconnectable:e,reconnectRadius:r,edge:o,sourceX:s,sourceY:a,targetX:u,targetY:c,sourcePosition:h,targetPosition:p,onReconnect:y,onReconnectStart:w,onReconnectEnd:v,setReconnecting:g,setUpdateHover:x}){const S=Ke(),k=(j,L)=>{if(j.button!==0)return;const{autoPanOnConnect:$,domNode:F,connectionMode:U,connectionRadius:q,lib:te,onConnectStart:J,cancelConnection:ne,nodeLookup:Q,rfId:C,panBy:V,updateConnection:W}=S.getState(),Y=L.type==="target",M=(R,z)=>{g(!1),v==null||v(R,o,L.type,z)},D=R=>y==null?void 0:y(o,R),H=(R,z)=>{g(!0),w==null||w(j,o,L.type),J==null||J(R,z)};wc.onPointerDown(j.nativeEvent,{autoPanOnConnect:$,connectionMode:U,connectionRadius:q,domNode:F,handleId:L.id,nodeId:L.nodeId,nodeLookup:Q,isTarget:Y,edgeUpdaterType:L.type,lib:te,flowId:C,cancelConnection:ne,panBy:V,isValidConnection:(...R)=>{var z,re;return((re=(z=S.getState()).isValidConnection)==null?void 0:re.call(z,...R))??!0},onConnect:D,onConnectStart:H,onConnectEnd:(...R)=>{var z,re;return(re=(z=S.getState()).onConnectEnd)==null?void 0:re.call(z,...R)},onReconnectEnd:M,updateConnection:W,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:j.currentTarget})},b=j=>k(j,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),E=j=>k(j,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),I=()=>x(!0),_=()=>x(!1);return d.jsxs(d.Fragment,{children:[(e===!0||e==="source")&&d.jsx(wp,{position:h,centerX:s,centerY:a,radius:r,onMouseDown:b,onMouseEnter:I,onMouseOut:_,type:"source"}),(e===!0||e==="target")&&d.jsx(wp,{position:p,centerX:u,centerY:c,radius:r,onMouseDown:E,onMouseEnter:I,onMouseOut:_,type:"target"})]})}function lk({id:e,edgesFocusable:r,edgesReconnectable:o,elementsSelectable:s,onClick:a,onDoubleClick:u,onContextMenu:c,onMouseEnter:h,onMouseMove:p,onMouseLeave:y,reconnectRadius:w,onReconnect:v,onReconnectStart:g,onReconnectEnd:x,rfId:S,edgeTypes:k,noPanClassName:b,onError:E,disableKeyboardA11y:I}){let _=Fe(we=>we.edgeLookup.get(e));const j=Fe(we=>we.defaultEdgeOptions);_=j?{...j,..._}:_;let L=_.type||"default",$=(k==null?void 0:k[L])||yp[L];$===void 0&&(E==null||E("011",Sn.error011(L)),L="default",$=(k==null?void 0:k.default)||yp.default);const F=!!(_.focusable||r&&typeof _.focusable>"u"),U=typeof v<"u"&&(_.reconnectable||o&&typeof _.reconnectable>"u"),q=!!(_.selectable||s&&typeof _.selectable>"u"),te=A.useRef(null),[J,ne]=A.useState(!1),[Q,C]=A.useState(!1),V=Ke(),{zIndex:W=_.zIndex,sourceX:Y,sourceY:M,targetX:D,targetY:H,sourcePosition:R,targetPosition:z}=Fe(A.useCallback(we=>{const ye=we.nodeLookup.get(_.source),Me=we.nodeLookup.get(_.target);if(!ye||!Me)return vp;const Te=X1({id:e,sourceNode:ye,targetNode:Me,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:we.connectionMode,onError:E}),Le=F1({selected:_.selected,zIndex:_.zIndex,sourceNode:ye,targetNode:Me,elevateOnSelect:we.elevateEdgesOnSelect,zIndexMode:we.zIndexMode});return{...Te||vp,zIndex:Le}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex,E]),et),re=A.useMemo(()=>_.markerStart?`url('#${vc(_.markerStart,S)}')`:void 0,[_.markerStart,S]),oe=A.useMemo(()=>_.markerEnd?`url('#${vc(_.markerEnd,S)}')`:void 0,[_.markerEnd,S]);if(_.hidden||Y===null||M===null||D===null||H===null)return null;const fe=we=>{var Le;const{addSelectedEdges:ye,unselectNodesAndEdges:Me,multiSelectionActive:Te}=V.getState();q&&(V.setState({nodesSelectionActive:!1}),_.selected&&Te?(Me({nodes:[],edges:[_]}),(Le=te.current)==null||Le.blur()):ye([e])),a&&a(we,_)},le=u?we=>{u(we,{..._})}:void 0,he=c?we=>{c(we,{..._})}:void 0,Z=h?we=>{h(we,{..._})}:void 0,se=p?we=>{p(we,{..._})}:void 0,me=y?we=>{y(we,{..._})}:void 0,Ne=we=>{var ye;if(!I&&xg.includes(we.key)&&q){const{unselectNodesAndEdges:Me,addSelectedEdges:Te}=V.getState();we.key==="Escape"?((ye=te.current)==null||ye.blur(),Me({edges:[_]})):Te([e])}};return d.jsx("svg",{style:{zIndex:W},children:d.jsxs("g",{className:st(["react-flow__edge",`react-flow__edge-${L}`,_.className,b,{selected:_.selected,animated:_.animated,inactive:!q&&!a,updating:J,selectable:q}]),onClick:fe,onDoubleClick:le,onContextMenu:he,onMouseEnter:Z,onMouseMove:se,onMouseLeave:me,onKeyDown:F?Ne:void 0,tabIndex:F?0:void 0,role:_.ariaRole??(F?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":_.ariaLabel===null?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":F?`${Zg}-${S}`:void 0,ref:te,..._.domAttributes,children:[!Q&&d.jsx($,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:q,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:Y,sourceY:M,targetX:D,targetY:H,sourcePosition:R,targetPosition:z,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:re,markerEnd:oe,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),U&&d.jsx(ak,{edge:_,isReconnectable:U,reconnectRadius:w,onReconnect:v,onReconnectStart:g,onReconnectEnd:x,sourceX:Y,sourceY:M,targetX:D,targetY:H,sourcePosition:R,targetPosition:z,setUpdateHover:ne,setReconnecting:C})]})})}var uk=A.memo(lk);const ck=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Nm({defaultMarkerColor:e,onlyRenderVisibleElements:r,rfId:o,edgeTypes:s,noPanClassName:a,onReconnect:u,onEdgeContextMenu:c,onEdgeMouseEnter:h,onEdgeMouseMove:p,onEdgeMouseLeave:y,onEdgeClick:w,reconnectRadius:v,onEdgeDoubleClick:g,onReconnectStart:x,onReconnectEnd:S,disableKeyboardA11y:k}){const{edgesFocusable:b,edgesReconnectable:E,elementsSelectable:I,onError:_}=Fe(ck,et),j=XS(r);return d.jsxs("div",{className:"react-flow__edges",children:[d.jsx(JS,{defaultColor:e,rfId:o}),j.map(L=>d.jsx(uk,{id:L,edgesFocusable:b,edgesReconnectable:E,elementsSelectable:I,noPanClassName:a,onReconnect:u,onContextMenu:c,onMouseEnter:h,onMouseMove:p,onMouseLeave:y,onClick:w,reconnectRadius:v,onDoubleClick:g,onReconnectStart:x,onReconnectEnd:S,rfId:o,onError:_,edgeTypes:s,disableKeyboardA11y:k},L))]})}Nm.displayName="EdgeRenderer";const dk=A.memo(Nm),_p=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function fk({children:e}){const r=Ke(),o=A.useRef(null),[s]=A.useState(()=>r.getState().transform);return nm(()=>{let a=null;const u=()=>{const c=r.getState().transform;a&&c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]||(a=c,o.current&&(o.current.style.transform=_p(c)))};return u(),r.subscribe(u)},[r]),d.jsx("div",{ref:o,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:_p(s)},children:e})}function hk(e){const r=cl(),o=A.useRef(!1);A.useEffect(()=>{!o.current&&r.viewportInitialized&&e&&(setTimeout(()=>e(r),1),o.current=!0)},[e,r.viewportInitialized])}const pk=e=>{var r;return(r=e.panZoom)==null?void 0:r.syncViewport};function gk(e){const r=Fe(pk),o=Ke();return A.useEffect(()=>{e&&(r==null||r(e),o.setState({transform:[e.x,e.y,e.zoom]}))},[e,r]),null}function mk(e){return e.connection.inProgress?{...e.connection,to:ws(e.connection.to,e.transform)}:{...e.connection}}function yk(e){return mk}function vk(e){const r=yk();return Fe(r,et)}const xk=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function wk({containerStyle:e,style:r,type:o,component:s}){const{nodesConnectable:a,width:u,height:c,isValid:h,inProgress:p}=Fe(xk,et);return!(u&&a&&p)?null:d.jsx("svg",{style:e,width:u,height:c,className:"react-flow__connectionline react-flow__container",children:d.jsx("g",{className:st(["react-flow__connection",Sg(h)]),children:d.jsx(bm,{style:r,type:o,CustomComponent:s,isValid:h})})})}const bm=({style:e,type:r=Or.Bezier,CustomComponent:o,isValid:s})=>{const{inProgress:a,from:u,fromNode:c,fromHandle:h,fromPosition:p,to:y,toNode:w,toHandle:v,toPosition:g,pointer:x}=vk();if(!a)return;if(o)return d.jsx(o,{connectionLineType:r,connectionLineStyle:e,fromNode:c,fromHandle:h,fromX:u.x,fromY:u.y,toX:y.x,toY:y.y,fromPosition:p,toPosition:g,connectionStatus:Sg(s),toNode:w,toHandle:v,pointer:x});let S="";const k={sourceX:u.x,sourceY:u.y,sourcePosition:p,targetX:y.x,targetY:y.y,targetPosition:g};switch(r){case Or.Bezier:[S]=Ag(k);break;case Or.SimpleBezier:[S]=fm(k);break;case Or.Step:[S]=Xa({...k,borderRadius:0});break;case Or.SmoothStep:[S]=Xa(k);break;default:[S]=zg(k)}return d.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};bm.displayName="ConnectionLine";const _k={};function Sp(e=_k){A.useRef(e),Ke(),A.useEffect(()=>{},[e])}function Sk(){Ke(),A.useRef(!1),A.useEffect(()=>{},[])}function jm({nodeTypes:e,edgeTypes:r,onInit:o,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:u,onEdgeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:p,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:v,onSelectionStart:g,onSelectionEnd:x,connectionLineType:S,connectionLineStyle:k,connectionLineComponent:b,connectionLineContainerStyle:E,selectionKeyCode:I,selectionOnDrag:_,selectionMode:j,multiSelectionKeyCode:L,panActivationKeyCode:$,zoomActivationKeyCode:F,deleteKeyCode:U,onlyRenderVisibleElements:q,elementsSelectable:te,defaultViewport:J,translateExtent:ne,minZoom:Q,maxZoom:C,preventScrolling:V,defaultMarkerColor:W,zoomOnScroll:Y,zoomOnPinch:M,panOnScroll:D,panOnScrollSpeed:H,panOnScrollMode:R,zoomOnDoubleClick:z,panOnDrag:re,autoPanOnSelection:oe,onPaneClick:fe,onPaneMouseEnter:le,onPaneMouseMove:he,onPaneMouseLeave:Z,onPaneScroll:se,onPaneContextMenu:me,paneClickDistance:Ne,nodeClickDistance:we,onEdgeContextMenu:ye,onEdgeMouseEnter:Me,onEdgeMouseMove:Te,onEdgeMouseLeave:Le,reconnectRadius:De,onReconnect:pe,onReconnectStart:$e,onReconnectEnd:Ve,noDragClassName:Ue,noWheelClassName:wt,noPanClassName:Xt,disableKeyboardA11y:gt,nodeExtent:mt,rfId:Mt,viewport:ct,onViewportChange:rt,nodesDraggable:Bn}){return Sp(e),Sp(r),Sk(),hk(o),gk(ct),d.jsx(DS,{onPaneClick:fe,onPaneMouseEnter:le,onPaneMouseMove:he,onPaneMouseLeave:Z,onPaneContextMenu:me,onPaneScroll:se,paneClickDistance:Ne,deleteKeyCode:U,selectionKeyCode:I,selectionOnDrag:_,selectionMode:j,onSelectionStart:g,onSelectionEnd:x,multiSelectionKeyCode:L,panActivationKeyCode:$,zoomActivationKeyCode:F,elementsSelectable:te,zoomOnScroll:Y,zoomOnPinch:M,zoomOnDoubleClick:z,panOnScroll:D,panOnScrollSpeed:H,panOnScrollMode:R,panOnDrag:re,autoPanOnSelection:oe,defaultViewport:J,translateExtent:ne,minZoom:Q,maxZoom:C,onSelectionContextMenu:v,preventScrolling:V,noDragClassName:Ue,noWheelClassName:wt,noPanClassName:Xt,disableKeyboardA11y:gt,onViewportChange:rt,isControlledViewport:!!ct,children:d.jsxs(fk,{children:[d.jsx(dk,{edgeTypes:r,onEdgeClick:a,onEdgeDoubleClick:c,onReconnect:pe,onReconnectStart:$e,onReconnectEnd:Ve,onlyRenderVisibleElements:q,onEdgeContextMenu:ye,onEdgeMouseEnter:Me,onEdgeMouseMove:Te,onEdgeMouseLeave:Le,reconnectRadius:De,defaultMarkerColor:W,noPanClassName:Xt,disableKeyboardA11y:gt,rfId:Mt}),d.jsx(wk,{style:k,type:S,component:b,containerStyle:E}),d.jsx("div",{className:"react-flow__edgelabel-renderer"}),d.jsx(YS,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:u,onNodeMouseEnter:h,onNodeMouseMove:p,onNodeMouseLeave:y,onNodeContextMenu:w,nodeClickDistance:we,onlyRenderVisibleElements:q,noPanClassName:Xt,noDragClassName:Ue,disableKeyboardA11y:gt,nodeExtent:mt,rfId:Mt,nodesDraggable:Bn}),d.jsx("div",{className:"react-flow__viewport-portal"})]})})}jm.displayName="GraphView";const kk=A.memo(jm),Nk=Cg(),kp=({nodes:e,edges:r,defaultNodes:o,defaultEdges:s,width:a,height:u,fitView:c,fitViewOptions:h,minZoom:p=.5,maxZoom:y=2,nodeOrigin:w,nodeExtent:v,zIndexMode:g="basic"}={})=>{const x=new Map,S=new Map,k=new Map,b=new Map,E=s??r??[],I=o??e??[],_=w??[0,0],j=v??ls;Fg(k,b,E);const{nodesInitialized:L}=xc(I,x,S,{nodeOrigin:_,nodeExtent:j,zIndexMode:g});let $=[0,0,1];if(c&&a&&u){const F=vs(x,{filter:J=>!!((J.width||J.initialWidth)&&(J.height||J.initialHeight))}),{x:U,y:q,zoom:te}=Tc(F,a,u,p,y,(h==null?void 0:h.padding)??.1);$=[U,q,te]}return{rfId:"1",width:a??0,height:u??0,transform:$,nodes:I,nodesInitialized:L,nodeLookup:x,parentLookup:S,edges:E,edgeLookup:b,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:o!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:p,maxZoom:y,translateExtent:ls,nodeExtent:j,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ii.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:_,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:c??!1,fitViewOptions:h,fitViewResolver:null,connection:{..._g},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Nk,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:wg,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},bk=({nodes:e,edges:r,defaultNodes:o,defaultEdges:s,width:a,height:u,fitView:c,fitViewOptions:h,minZoom:p,maxZoom:y,nodeOrigin:w,nodeExtent:v,zIndexMode:g})=>z_((x,S)=>{async function k(){const{nodeLookup:b,panZoom:E,fitViewOptions:I,fitViewResolver:_,width:j,height:L,minZoom:$,maxZoom:F}=S();E&&(await T1({nodes:b,width:j,height:L,panZoom:E,minZoom:$,maxZoom:F},I),_==null||_.resolve(!0),x({fitViewResolver:null}))}return{...kp({nodes:e,edges:r,width:a,height:u,fitView:c,fitViewOptions:h,minZoom:p,maxZoom:y,nodeOrigin:w,nodeExtent:v,defaultNodes:o,defaultEdges:s,zIndexMode:g}),setNodes:b=>{const{nodeLookup:E,parentLookup:I,nodeOrigin:_,nodeExtent:j,elevateNodesOnSelect:L,fitViewQueued:$,zIndexMode:F,nodesSelectionActive:U}=S(),{nodesInitialized:q,hasSelectedNodes:te}=xc(b,E,I,{nodeOrigin:_,nodeExtent:j,elevateNodesOnSelect:L,checkEquality:!0,zIndexMode:F}),J=U&&te;$&&q?(k(),x({nodes:b,nodesInitialized:q,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:J})):x({nodes:b,nodesInitialized:q,nodesSelectionActive:J})},setEdges:b=>{const{connectionLookup:E,edgeLookup:I}=S();Fg(E,I,b),x({edges:b})},setDefaultNodesAndEdges:(b,E)=>{if(b){const{setNodes:I}=S();I(b),x({hasDefaultNodes:!0})}if(E){const{setEdges:I}=S();I(E),x({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:E,nodeLookup:I,parentLookup:_,domNode:j,nodeOrigin:L,nodeExtent:$,debug:F,fitViewQueued:U,zIndexMode:q}=S(),{changes:te,updatedInternals:J}=n_(b,I,_,j,L,$,q);J&&(Z1(I,_,{nodeOrigin:L,nodeExtent:$,zIndexMode:q}),U?(k(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),(te==null?void 0:te.length)>0&&(F&&console.log("React Flow: trigger node changes",te),E==null||E(te)))},updateNodePositions:(b,E=!1)=>{const I=[];let _=[];const{nodeLookup:j,triggerNodeChanges:L,connection:$,updateConnection:F,onNodesChangeMiddlewareMap:U}=S();for(const[q,te]of b){const J=j.get(q),ne=!!(J!=null&&J.expandParent&&(J!=null&&J.parentId)&&(te!=null&&te.position)),Q={id:q,type:"position",position:ne?{x:Math.max(0,te.position.x),y:Math.max(0,te.position.y)}:te.position,dragging:E};if(J&&$.inProgress&&$.fromNode.id===J.id){const C=wo(J,$.fromHandle,ke.Left,!0);F({...$,from:C})}ne&&J.parentId&&I.push({id:q,parentId:J.parentId,rect:{...te.internals.positionAbsolute,width:te.measured.width??0,height:te.measured.height??0}}),_.push(Q)}if(I.length>0){const{parentLookup:q,nodeOrigin:te}=S(),J=Oc(I,j,q,te);_.push(...J)}for(const q of U.values())_=q(_);L(_)},triggerNodeChanges:b=>{const{onNodesChange:E,setNodes:I,nodes:_,hasDefaultNodes:j,debug:L}=S();if(b!=null&&b.length){if(j){const $=oS(b,_);I($)}L&&console.log("React Flow: trigger node changes",b),E==null||E(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:E,setEdges:I,edges:_,hasDefaultEdges:j,debug:L}=S();if(b!=null&&b.length){if(j){const $=iS(b,_);I($)}L&&console.log("React Flow: trigger edge changes",b),E==null||E(b)}},addSelectedNodes:b=>{const{multiSelectionActive:E,edgeLookup:I,nodeLookup:_,triggerNodeChanges:j,triggerEdgeChanges:L}=S();if(E){const $=b.map(F=>co(F,!0));j($);return}j(ei(_,new Set([...b]),!0)),L(ei(I))},addSelectedEdges:b=>{const{multiSelectionActive:E,edgeLookup:I,nodeLookup:_,triggerNodeChanges:j,triggerEdgeChanges:L}=S();if(E){const $=b.map(F=>co(F,!0));L($);return}L(ei(I,new Set([...b]))),j(ei(_,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:E}={})=>{const{edges:I,nodes:_,nodeLookup:j,triggerNodeChanges:L,triggerEdgeChanges:$}=S(),F=b||_,U=E||I,q=[];for(const J of F){if(!J.selected)continue;const ne=j.get(J.id);ne&&(ne.selected=!1),q.push(co(J.id,!1))}const te=[];for(const J of U)J.selected&&te.push(co(J.id,!1));L(q),$(te)},setMinZoom:b=>{const{panZoom:E,maxZoom:I}=S();E==null||E.setScaleExtent([b,I]),x({minZoom:b})},setMaxZoom:b=>{const{panZoom:E,minZoom:I}=S();E==null||E.setScaleExtent([I,b]),x({maxZoom:b})},setTranslateExtent:b=>{var E;(E=S().panZoom)==null||E.setTranslateExtent(b),x({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:E,triggerNodeChanges:I,triggerEdgeChanges:_,elementsSelectable:j}=S();if(!j)return;const L=E.reduce((F,U)=>U.selected?[...F,co(U.id,!1)]:F,[]),$=b.reduce((F,U)=>U.selected?[...F,co(U.id,!1)]:F,[]);I(L),_($)},setNodeExtent:b=>{const{nodes:E,nodeLookup:I,parentLookup:_,nodeOrigin:j,elevateNodesOnSelect:L,nodeExtent:$,zIndexMode:F}=S();b[0][0]===$[0][0]&&b[0][1]===$[0][1]&&b[1][0]===$[1][0]&&b[1][1]===$[1][1]||(xc(E,I,_,{nodeOrigin:j,nodeExtent:b,elevateNodesOnSelect:L,checkEquality:!1,zIndexMode:F}),x({nodeExtent:b}))},panBy:b=>{const{transform:E,width:I,height:_,panZoom:j,translateExtent:L}=S();return r_({delta:b,panZoom:j,transform:E,translateExtent:L,width:I,height:_})},setCenter:async(b,E,I)=>{const{width:_,height:j,maxZoom:L,panZoom:$}=S();if(!$)return!1;const F=typeof(I==null?void 0:I.zoom)<"u"?I.zoom:L;return await $.setViewport({x:_/2-b*F,y:j/2-E*F,zoom:F},{duration:I==null?void 0:I.duration,ease:I==null?void 0:I.ease,interpolate:I==null?void 0:I.interpolate}),!0},cancelConnection:()=>{x({connection:{..._g}})},updateConnection:b=>{x({connection:b})},reset:()=>x({...kp()})}},Object.is);function Em({initialNodes:e,initialEdges:r,defaultNodes:o,defaultEdges:s,initialWidth:a,initialHeight:u,initialMinZoom:c,initialMaxZoom:h,initialFitViewOptions:p,fitView:y,nodeOrigin:w,nodeExtent:v,zIndexMode:g,children:x}){const[S]=A.useState(()=>bk({nodes:e,edges:r,defaultNodes:o,defaultEdges:s,width:a,height:u,fitView:y,minZoom:c,maxZoom:h,fitViewOptions:p,nodeOrigin:w,nodeExtent:v,zIndexMode:g}));return d.jsx(D_,{value:S,children:d.jsx(cS,{children:d.jsx(bS,{children:x})})})}function jk({children:e,nodes:r,edges:o,defaultNodes:s,defaultEdges:a,width:u,height:c,fitView:h,fitViewOptions:p,minZoom:y,maxZoom:w,nodeOrigin:v,nodeExtent:g,zIndexMode:x}){return A.useContext(ll)?d.jsx(d.Fragment,{children:e}):d.jsx(Em,{initialNodes:r,initialEdges:o,defaultNodes:s,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:h,initialFitViewOptions:p,initialMinZoom:y,initialMaxZoom:w,nodeOrigin:v,nodeExtent:g,zIndexMode:x,children:e})}const Ek={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Ck({nodes:e,edges:r,defaultNodes:o,defaultEdges:s,className:a,nodeTypes:u,edgeTypes:c,onNodeClick:h,onEdgeClick:p,onInit:y,onMove:w,onMoveStart:v,onMoveEnd:g,onConnect:x,onConnectStart:S,onConnectEnd:k,onClickConnectStart:b,onClickConnectEnd:E,onNodeMouseEnter:I,onNodeMouseMove:_,onNodeMouseLeave:j,onNodeContextMenu:L,onNodeDoubleClick:$,onNodeDragStart:F,onNodeDrag:U,onNodeDragStop:q,onNodesDelete:te,onEdgesDelete:J,onDelete:ne,onSelectionChange:Q,onSelectionDragStart:C,onSelectionDrag:V,onSelectionDragStop:W,onSelectionContextMenu:Y,onSelectionStart:M,onSelectionEnd:D,onBeforeDelete:H,connectionMode:R,connectionLineType:z=Or.Bezier,connectionLineStyle:re,connectionLineComponent:oe,connectionLineContainerStyle:fe,deleteKeyCode:le="Backspace",selectionKeyCode:he="Shift",selectionOnDrag:Z=!1,selectionMode:se=us.Full,panActivationKeyCode:me="Space",multiSelectionKeyCode:Ne=fs()?"Meta":"Control",zoomActivationKeyCode:we=fs()?"Meta":"Control",snapToGrid:ye,snapGrid:Me,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:Le,nodesDraggable:De,autoPanOnNodeFocus:pe,nodesConnectable:$e,nodesFocusable:Ve,nodeOrigin:Ue=Jg,edgesFocusable:wt,edgesReconnectable:Xt,elementsSelectable:gt=!0,defaultViewport:mt=Q_,minZoom:Mt=.5,maxZoom:ct=2,translateExtent:rt=ls,preventScrolling:Bn=!0,nodeExtent:Pt,defaultMarkerColor:bn="#b1b1b7",zoomOnScroll:di=!0,zoomOnPinch:Vn=!0,panOnScroll:So=!1,panOnScrollSpeed:dr=.5,panOnScrollMode:Br=po.Free,zoomOnDoubleClick:Wn=!0,panOnDrag:Vr=!0,onPaneClick:fr,onPaneMouseEnter:hr,onPaneMouseMove:Ht,onPaneMouseLeave:dt,onPaneScroll:Un,onPaneContextMenu:Gn,paneClickDistance:jn=1,nodeClickDistance:Yn=0,children:En,onReconnect:at,onReconnectStart:pr,onReconnectEnd:Cn,onEdgeContextMenu:It,onEdgeDoubleClick:on,onEdgeMouseEnter:ko,onEdgeMouseMove:tt,onEdgeMouseLeave:We,reconnectRadius:Mn=10,onNodesChange:Xn,onEdgesChange:sn,noDragClassName:Wr="nodrag",noWheelClassName:an="nowheel",noPanClassName:Rt="nopan",fitView:qt,fitViewOptions:qn,connectOnClick:No,attributionPosition:bo,proOptions:Tt,defaultEdgeOptions:Kn,elevateNodesOnSelect:Ur=!0,elevateEdgesOnSelect:Qn=!1,disableKeyboardA11y:gr=!1,autoPanOnConnect:Ye,autoPanOnNodeDrag:fi,autoPanOnSelection:Gr=!0,autoPanSpeed:jo,connectionRadius:mr,isValidConnection:hi,onError:Eo,style:Pn,id:_t,nodeDragThreshold:pi,connectionDragThreshold:yt,viewport:gi,onViewportChange:mi,width:Yr,height:In,colorMode:Zn="light",debug:Rn,onScroll:Kt,ariaLabelConfig:Xr,zIndexMode:qr="basic",...yr},Kr){const ln=_t||"1",Jn=tS(Zn),Co=A.useCallback(vr=>{vr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Kt==null||Kt(vr)},[Kt]);return d.jsx("div",{"data-testid":"rf__wrapper",...yr,onScroll:Co,style:{...Pn,...Ek},ref:Kr,className:st(["react-flow",a,Jn]),id:_t,role:"application",children:d.jsxs(jk,{nodes:e,edges:r,width:Yr,height:In,fitView:qt,fitViewOptions:qn,minZoom:Mt,maxZoom:ct,nodeOrigin:Ue,nodeExtent:Pt,zIndexMode:qr,children:[d.jsx(eS,{nodes:e,edges:r,defaultNodes:o,defaultEdges:s,onConnect:x,onConnectStart:S,onConnectEnd:k,onClickConnectStart:b,onClickConnectEnd:E,nodesDraggable:De,autoPanOnNodeFocus:pe,nodesConnectable:$e,nodesFocusable:Ve,edgesFocusable:wt,edgesReconnectable:Xt,elementsSelectable:gt,elevateNodesOnSelect:Ur,elevateEdgesOnSelect:Qn,minZoom:Mt,maxZoom:ct,nodeExtent:Pt,onNodesChange:Xn,onEdgesChange:sn,snapToGrid:ye,snapGrid:Me,connectionMode:R,translateExtent:rt,connectOnClick:No,defaultEdgeOptions:Kn,fitView:qt,fitViewOptions:qn,onNodesDelete:te,onEdgesDelete:J,onDelete:ne,onNodeDragStart:F,onNodeDrag:U,onNodeDragStop:q,onSelectionDrag:V,onSelectionDragStart:C,onSelectionDragStop:W,onMove:w,onMoveStart:v,onMoveEnd:g,noPanClassName:Rt,nodeOrigin:Ue,rfId:ln,autoPanOnConnect:Ye,autoPanOnNodeDrag:fi,autoPanSpeed:jo,onError:Eo,connectionRadius:mr,isValidConnection:hi,selectNodesOnDrag:Le,nodeDragThreshold:pi,connectionDragThreshold:yt,onBeforeDelete:H,debug:Rn,ariaLabelConfig:Xr,zIndexMode:qr}),d.jsx(kk,{onInit:y,onNodeClick:h,onEdgeClick:p,onNodeMouseEnter:I,onNodeMouseMove:_,onNodeMouseLeave:j,onNodeContextMenu:L,onNodeDoubleClick:$,nodeTypes:u,edgeTypes:c,connectionLineType:z,connectionLineStyle:re,connectionLineComponent:oe,connectionLineContainerStyle:fe,selectionKeyCode:he,selectionOnDrag:Z,selectionMode:se,deleteKeyCode:le,multiSelectionKeyCode:Ne,panActivationKeyCode:me,zoomActivationKeyCode:we,onlyRenderVisibleElements:Te,defaultViewport:mt,translateExtent:rt,minZoom:Mt,maxZoom:ct,preventScrolling:Bn,zoomOnScroll:di,zoomOnPinch:Vn,zoomOnDoubleClick:Wn,panOnScroll:So,panOnScrollSpeed:dr,panOnScrollMode:Br,panOnDrag:Vr,autoPanOnSelection:Gr,onPaneClick:fr,onPaneMouseEnter:hr,onPaneMouseMove:Ht,onPaneMouseLeave:dt,onPaneScroll:Un,onPaneContextMenu:Gn,paneClickDistance:jn,nodeClickDistance:Yn,onSelectionContextMenu:Y,onSelectionStart:M,onSelectionEnd:D,onReconnect:at,onReconnectStart:pr,onReconnectEnd:Cn,onEdgeContextMenu:It,onEdgeDoubleClick:on,onEdgeMouseEnter:ko,onEdgeMouseMove:tt,onEdgeMouseLeave:We,reconnectRadius:Mn,defaultMarkerColor:bn,noDragClassName:Wr,noWheelClassName:an,noPanClassName:Rt,rfId:ln,disableKeyboardA11y:gr,nodeExtent:Pt,viewport:gi,onViewportChange:mi,nodesDraggable:De}),d.jsx(K_,{onSelectionChange:Q}),En,d.jsx(U_,{proOptions:Tt,position:bo}),d.jsx(W_,{rfId:ln,disableKeyboardA11y:gr})]})})}var Mk=tm(Ck);function Pk({dimensions:e,lineWidth:r,variant:o,className:s}){return d.jsx("path",{strokeWidth:r,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:st(["react-flow__background-pattern",o,s])})}function Ik({radius:e,className:r}){return d.jsx("circle",{cx:e,cy:e,r:e,className:st(["react-flow__background-pattern","dots",r])})}var Fr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Fr||(Fr={}));const Rk={[Fr.Dots]:1,[Fr.Lines]:1,[Fr.Cross]:6},Tk=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Cm({id:e,variant:r=Fr.Dots,gap:o=20,size:s,lineWidth:a=1,offset:u=0,color:c,bgColor:h,style:p,className:y,patternClassName:w}){const v=A.useRef(null),{transform:g,patternId:x}=Fe(Tk,et),S=s||Rk[r],k=r===Fr.Dots,b=r===Fr.Cross,E=Array.isArray(o)?o:[o,o],I=[E[0]*g[2]||1,E[1]*g[2]||1],_=S*g[2],j=Array.isArray(u)?u:[u,u],L=b?[_,_]:I,$=[j[0]*g[2]+L[0]/2,j[1]*g[2]+L[1]/2],F=`${x}${e||""}`;return d.jsxs("svg",{className:st(["react-flow__background",y]),style:{...p,...dl,"--xy-background-color-props":h,"--xy-background-pattern-color-props":c},ref:v,"data-testid":"rf__background",children:[d.jsx("pattern",{id:F,x:g[0]%I[0],y:g[1]%I[1],width:I[0],height:I[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${$[0]},-${$[1]})`,children:k?d.jsx(Ik,{radius:_/2,className:w}):d.jsx(Pk,{dimensions:L,lineWidth:a,variant:r,className:w})}),d.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${F})`})]})}Cm.displayName="Background";const Lk=A.memo(Cm);function Ak(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:d.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function $k(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:d.jsx("path",{d:"M0 0h32v4.2H0z"})})}function zk(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:d.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Dk(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Ok(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Ia({children:e,className:r,...o}){return d.jsx("button",{type:"button",className:st(["react-flow__controls-button",r]),...o,children:e})}const Fk=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Mm({style:e,showZoom:r=!0,showFitView:o=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:u,onZoomOut:c,onFitView:h,onInteractiveChange:p,className:y,children:w,position:v="bottom-left",orientation:g="vertical","aria-label":x}){const S=Ke(),{isInteractive:k,minZoomReached:b,maxZoomReached:E,ariaLabelConfig:I}=Fe(Fk,et),{zoomIn:_,zoomOut:j,fitView:L}=cl(),$=()=>{_(),u==null||u()},F=()=>{j(),c==null||c()},U=()=>{L(a),h==null||h()},q=()=>{S.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),p==null||p(!k)},te=g==="horizontal"?"horizontal":"vertical";return d.jsxs(ul,{className:st(["react-flow__controls",te,y]),position:v,style:e,"data-testid":"rf__controls","aria-label":x??I["controls.ariaLabel"],children:[r&&d.jsxs(d.Fragment,{children:[d.jsx(Ia,{onClick:$,className:"react-flow__controls-zoomin",title:I["controls.zoomIn.ariaLabel"],"aria-label":I["controls.zoomIn.ariaLabel"],disabled:E,children:d.jsx(Ak,{})}),d.jsx(Ia,{onClick:F,className:"react-flow__controls-zoomout",title:I["controls.zoomOut.ariaLabel"],"aria-label":I["controls.zoomOut.ariaLabel"],disabled:b,children:d.jsx($k,{})})]}),o&&d.jsx(Ia,{className:"react-flow__controls-fitview",onClick:U,title:I["controls.fitView.ariaLabel"],"aria-label":I["controls.fitView.ariaLabel"],children:d.jsx(zk,{})}),s&&d.jsx(Ia,{className:"react-flow__controls-interactive",onClick:q,title:I["controls.interactive.ariaLabel"],"aria-label":I["controls.interactive.ariaLabel"],children:k?d.jsx(Ok,{}):d.jsx(Dk,{})}),w]})}Mm.displayName="Controls";const Hk=A.memo(Mm);function Bk({id:e,x:r,y:o,width:s,height:a,style:u,color:c,strokeColor:h,strokeWidth:p,className:y,borderRadius:w,shapeRendering:v,selected:g,onClick:x}){const{background:S,backgroundColor:k}=u||{},b=c||S||k;return d.jsx("rect",{className:st(["react-flow__minimap-node",{selected:g},y]),x:r,y:o,rx:w,ry:w,width:s,height:a,style:{fill:b,stroke:h,strokeWidth:p},shapeRendering:v,onClick:x?E=>x(E,e):void 0})}const Vk=A.memo(Bk),Wk=e=>e.nodes.map(r=>r.id),oc=e=>e instanceof Function?e:()=>e;function Uk({nodeStrokeColor:e,nodeColor:r,nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:u=Vk,onClick:c}){const h=Fe(Wk,et),p=oc(r),y=oc(e),w=oc(o),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return d.jsx(d.Fragment,{children:h.map(g=>d.jsx(Yk,{id:g,nodeColorFunc:p,nodeStrokeColorFunc:y,nodeClassNameFunc:w,nodeBorderRadius:s,nodeStrokeWidth:a,NodeComponent:u,onClick:c,shapeRendering:v},g))})}function Gk({id:e,nodeColorFunc:r,nodeStrokeColorFunc:o,nodeClassNameFunc:s,nodeBorderRadius:a,nodeStrokeWidth:u,shapeRendering:c,NodeComponent:h,onClick:p}){const{node:y,x:w,y:v,width:g,height:x}=Fe(S=>{const k=S.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const b=k.internals.userNode,{x:E,y:I}=k.internals.positionAbsolute,{width:_,height:j}=Nn(b);return{node:b,x:E,y:I,width:_,height:j}},et);return!y||y.hidden||!Mg(y)?null:d.jsx(h,{x:w,y:v,width:g,height:x,style:y.style,selected:!!y.selected,className:s(y),color:r(y),borderRadius:a,strokeColor:o(y),strokeWidth:u,shapeRendering:c,onClick:p,id:y.id})}const Yk=A.memo(Gk);var Xk=A.memo(Uk);const qk=200,Kk=150,Qk=e=>!e.hidden,Zk=e=>{const r={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:r,boundingRect:e.nodeLookup.size>0?jg(vs(e.nodeLookup,{filter:Qk}),r):r,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Np=(e,r)=>e.x===r.x&&e.y===r.y&&e.width===r.width&&e.height===r.height,Jk=(e,r)=>Np(e.viewBB,r.viewBB)&&Np(e.boundingRect,r.boundingRect)&&e.rfId===r.rfId&&e.panZoom===r.panZoom&&e.translateExtent===r.translateExtent&&e.flowWidth===r.flowWidth&&e.flowHeight===r.flowHeight&&e.ariaLabelConfig===r.ariaLabelConfig,eN="react-flow__minimap-desc";function Pm({style:e,className:r,nodeStrokeColor:o,nodeColor:s,nodeClassName:a="",nodeBorderRadius:u=5,nodeStrokeWidth:c,nodeComponent:h,bgColor:p,maskColor:y,maskStrokeColor:w,maskStrokeWidth:v,position:g="bottom-right",onClick:x,onNodeClick:S,pannable:k=!1,zoomable:b=!1,ariaLabel:E,inversePan:I,zoomStep:_=1,offsetScale:j=5}){const L=Ke(),$=A.useRef(null),{boundingRect:F,viewBB:U,rfId:q,panZoom:te,translateExtent:J,flowWidth:ne,flowHeight:Q,ariaLabelConfig:C}=Fe(Zk,Jk),V=(e==null?void 0:e.width)??qk,W=(e==null?void 0:e.height)??Kk,Y=F.width/V,M=F.height/W,D=Math.max(Y,M),H=D*V,R=D*W,z=j*D,re=F.x-(H-F.width)/2-z,oe=F.y-(R-F.height)/2-z,fe=H+z*2,le=R+z*2,he=`${eN}-${q}`,Z=A.useRef(0),se=A.useRef();Z.current=D,A.useEffect(()=>{if($.current&&te)return se.current=f_({domNode:$.current,panZoom:te,getTransform:()=>L.getState().transform,getViewScale:()=>Z.current}),()=>{var ye;(ye=se.current)==null||ye.destroy()}},[te]),A.useEffect(()=>{var ye;(ye=se.current)==null||ye.update({translateExtent:J,width:ne,height:Q,inversePan:I,pannable:k,zoomStep:_,zoomable:b})},[k,b,I,_,J,ne,Q]);const me=x?ye=>{var Le;const[Me,Te]=((Le=se.current)==null?void 0:Le.pointer(ye))||[0,0];x(ye,{x:Me,y:Te})}:void 0,Ne=S?A.useCallback((ye,Me)=>{const Te=L.getState().nodeLookup.get(Me).internals.userNode;S(ye,Te)},[]):void 0,we=E??C["minimap.ariaLabel"];return d.jsx(ul,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-background-color-props":typeof y=="string"?y:void 0,"--xy-minimap-mask-stroke-color-props":typeof w=="string"?w:void 0,"--xy-minimap-mask-stroke-width-props":typeof v=="number"?v*D:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:st(["react-flow__minimap",r]),"data-testid":"rf__minimap",children:d.jsxs("svg",{width:V,height:W,viewBox:`${re} ${oe} ${fe} ${le}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":he,ref:$,onClick:me,children:[we&&d.jsx("title",{id:he,children:we}),d.jsx(Xk,{onClick:Ne,nodeColor:s,nodeStrokeColor:o,nodeBorderRadius:u,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:h}),d.jsx("path",{className:"react-flow__minimap-mask",d:`M${re-z},${oe-z}h${fe+z*2}v${le+z*2}h${-fe-z*2}z - M${U.x},${U.y}h${U.width}v${U.height}h${-U.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Pm.displayName="MiniMap";const tN=A.memo(Pm),nN=e=>r=>e?`${Math.max(1/r.transform[2],1)}`:void 0,rN={[li.Line]:"right",[li.Handle]:"bottom-right"};function oN({nodeId:e,position:r,variant:o=li.Handle,className:s,style:a=void 0,children:u,color:c,minWidth:h=10,minHeight:p=10,maxWidth:y=Number.MAX_VALUE,maxHeight:w=Number.MAX_VALUE,keepAspectRatio:v=!1,resizeDirection:g,autoScale:x=!0,shouldResize:S,onResizeStart:k,onResize:b,onResizeEnd:E}){const I=sm(),_=typeof e=="string"?e:I,j=Ke(),L=A.useRef(null),$=o===li.Handle,F=Fe(A.useCallback(nN($&&x),[$,x]),et),U=A.useRef(null),q=r??rN[o];A.useEffect(()=>{if(!(!L.current||!_))return U.current||(U.current=b_({domNode:L.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:J,transform:ne,snapGrid:Q,snapToGrid:C,nodeOrigin:V,domNode:W}=j.getState();return{nodeLookup:J,transform:ne,snapGrid:Q,snapToGrid:C,nodeOrigin:V,paneDomNode:W}},onChange:(J,ne)=>{const{triggerNodeChanges:Q,nodeLookup:C,parentLookup:V,nodeOrigin:W}=j.getState(),Y=[],M={x:J.x,y:J.y},D=C.get(_);if(D&&D.expandParent&&D.parentId){const H=D.origin??W,R=J.width??D.measured.width??0,z=J.height??D.measured.height??0,re={id:D.id,parentId:D.parentId,rect:{width:R,height:z,...Pg({x:J.x??D.position.x,y:J.y??D.position.y},{width:R,height:z},D.parentId,C,H)}},oe=Oc([re],C,V,W);Y.push(...oe),M.x=J.x?Math.max(H[0]*R,J.x):void 0,M.y=J.y?Math.max(H[1]*z,J.y):void 0}if(M.x!==void 0&&M.y!==void 0){const H={id:_,type:"position",position:{...M}};Y.push(H)}if(J.width!==void 0&&J.height!==void 0){const R={id:_,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:J.width,height:J.height}};Y.push(R)}for(const H of ne){const R={...H,type:"position"};Y.push(R)}Q(Y)},onEnd:({width:J,height:ne})=>{const Q={id:_,type:"dimensions",resizing:!1,dimensions:{width:J,height:ne}};j.getState().triggerNodeChanges([Q])}})),U.current.update({controlPosition:q,boundaries:{minWidth:h,minHeight:p,maxWidth:y,maxHeight:w},keepAspectRatio:v,resizeDirection:g,onResizeStart:k,onResize:b,onResizeEnd:E,shouldResize:S}),()=>{var J;(J=U.current)==null||J.destroy()}},[q,h,p,y,w,v,k,b,E,S]);const te=q.split("-");return d.jsx("div",{className:st(["react-flow__resize-control","nodrag",...te,o,s]),ref:L,style:{...a,scale:F,...c&&{[$?"backgroundColor":"borderColor"]:c}},children:u})}A.memo(oN);const iN={"arch.context":0,"django.app":0,"django.route":1,"django.websocket_route":1,"fastapi.route":1,"django.url_name":2,"django.view":3,"django.viewset_action":3,"django.permission":3,"django.throttle":3,"django.serializer":4,"django.form":4,"graphql.type":4,"fastapi.model":4,"django.serializer_field":5,"django.service":5,"graphql.field":5,"django.model":6,"django.field":7,"django.relation":7,"django.task":8,"django.receiver":8,"django.signal":8,"django.test":8,"django.migration_op":8,"django.admin":8,"django.management_command":8,"django.consumer":8,"django.cache_key":8,"django.feature_flag":8,"django.side_effect":8,"openapi.path":9,"graphql.operation":9,"react.api_client":10,"django.htmx":10,"react.query_key":11,"react.hook":11,"react.feature":11,"react.route":12,"react.page":12,"react.server_action":12,"django.template":12,"react.component":13,"react.context":13,"react.form_schema":14,"react.test":14};function On(e){return iN[e]??8}const jt=208,Fn=64,Hr=88,fl=28,sN=8;function aN(e){if(!e.length)return Number.NaN;const r=[...e].sort((s,a)=>s-a),o=Math.floor(r.length/2);return r.length%2?r[o]:(r[o-1]+r[o])/2}function Im(e,r=[]){const o=new Map;if(!e.length)return o;const s=new Map;for(const _ of e){const j=On(_.type),L=s.get(j)??[];L.push(_),s.set(j,L)}const u=[...s.keys()].sort((_,j)=>_-j).map(_=>[...s.get(_)??[]].sort((j,L)=>j.name.localeCompare(L.name)||j.id.localeCompare(L.id))),c=new Set(e.map(_=>_.id)),h=new Map,p=new Map;for(const _ of e)h.set(_.id,[]),p.set(_.id,[]);for(const _ of r)!c.has(_.src)||!c.has(_.dst)||_.src===_.dst||(p.get(_.src).push(_.dst),h.get(_.dst).push(_.src));const y=new Map;u.forEach((_,j)=>{for(const L of _)y.set(L.id,j)});const w=new Map,v=()=>{for(const _ of u)_.forEach((j,L)=>w.set(j.id,L))};v();const g=(_,j)=>{const L=_.map(($,F)=>{const U=j($.id).map(te=>w.get(te)).filter(te=>te!==void 0),q=aN(U);return{n:$,bary:Number.isNaN(q)?F:q,name:$.name,id:$.id}});return L.sort(($,F)=>$.bary-F.bary||$.name.localeCompare(F.name)||$.id.localeCompare(F.id)),L.map($=>$.n)},x=_=>j=>y.get(j)===_;for(let _=0;_(h.get(L)??[]).filter(x(j-1))),v();for(let j=u.length-2;j>=0;j--)u[j]=g(u[j],L=>(p.get(L)??[]).filter(x(j+1))),v()}const S=jt+Hr,k=Fn+fl,b=Math.max(...u.map(_=>_.length),1),E=[];let I=0;for(let _=0;_U.id)),L=new Set((u[_+1]??[]).map(U=>U.id));let $=0;if(L.size)for(const U of r)j.has(U.src)&&L.has(U.dst)&&($+=1);const F=Math.min(120,Math.max(0,($-2)*12));I+=S+F}return u.forEach((_,j)=>{const L=(b-_.length)*k/2;_.forEach(($,F)=>{o.set($.id,{x:E[j]??0,y:L+F*k})})}),o}const Sc=[{id:"layers",label:"Architecture layers"},{id:"flow",label:"Edge flow"},{id:"tree",label:"Spanning tree"},{id:"radial",label:"Radial"},{id:"concentric",label:"Concentric layers"},{id:"circle",label:"Circle"},{id:"clusters",label:"Type clusters"},{id:"grid",label:"Compact grid"},{id:"force",label:"Force directed"}],lN=new Set(Sc.map(e=>e.id)),Rm="loadpath.graphLayout",uN=8,cN=64,dN=jt+32,go=jt+Hr,Ka=Fn+fl,Tm=new Set(["django.route","react.route","react.page","react.server_action","django.task","django.migration_op","django.permission","openapi.path","django.consumer","django.websocket_route","django.template","graphql.operation","fastapi.route"]),Lm=90;function fN(e=()=>document.createElement("canvas")){var r;try{const o=e(),s=o.getContext("webgl2")||o.getContext("webgl")||o.getContext("experimental-webgl");if(!s)return!1;const a=(r=s.getExtension)==null?void 0:r.call(s,"WEBGL_lose_context");return a==null||a.loseContext(),!0}catch{return!1}}function hN(e,r,o){return e==="3d"&&r==null&&o!==!0?"2d":e}const Am=new Set(["django.field","django.serializer_field","django.relation","django.test","react.test","graphql.field","django.url_name","django.throttle"]),bp={"arch.context":"#edf2f4","django.app":"#8d99ae","django.route":"#4cc9f0","django.url_name":"#4cc9f0","django.view":"#4895ef","django.viewset_action":"#4361ee","django.permission":"#7b8cde","django.serializer":"#f4a261","django.form":"#e9c46a","django.serializer_field":"#e9c46a","django.service":"#90be6d","django.model":"#2a9d8f","django.field":"#8ac926","django.task":"#e76f51","django.receiver":"#e85d04","django.signal":"#f4a261","django.test":"#6c757d","django.admin":"#adb5bd","django.migration_op":"#9d4edd","django.consumer":"#e76f51","django.websocket_route":"#4cc9f0","django.template":"#c77dff","django.htmx":"#ff6b6b","django.cache_key":"#6c757d","django.feature_flag":"#f4a261","django.side_effect":"#e85d04","graphql.type":"#00bbf9","graphql.operation":"#00bbf9","fastapi.route":"#4cc9f0","fastapi.model":"#f4a261","openapi.path":"#00bbf9","react.api_client":"#ff6b6b","react.query_key":"#adb5bd","react.hook":"#7b2cbf","react.feature":"#9d4edd","react.route":"#c77dff","react.page":"#c77dff","react.server_action":"#e76f51","react.component":"#9d4edd","react.form_schema":"#ffd166","react.test":"#6c757d"},pN=160,gN=.42,mN=100,jp=.45,yN=.8,$m={0:"context",1:"routes",2:"url names",3:"views",4:"serializers",5:"services",6:"models",7:"fields",8:"jobs / signals",9:"openapi",10:"api client",11:"hooks",12:"pages",13:"components",14:"forms / tests"};function zm(e){return e.startsWith("react.")?"react":e.startsWith("openapi.")||e.startsWith("graphql.")||e.startsWith("fastapi.")?"stitch":e.startsWith("arch.")?"arch":"django"}function Ob(e){return bp[e]?bp[e]:e.startsWith("react.")?"#9d4edd":e.startsWith("openapi.")?"#00bbf9":"#4a5568"}function vN(e,r=typeof navigator<"u"&&!!navigator.webdriver){return r?"2d":e>=Lm?"3d":"2d"}function xN(e){return e>=Lm?"overview":"full"}function wN(e,r,o=1){const s=new Set([e]);let a=new Set([e]);for(let u=0;uo.families.has(zm(h.type)));o.detail==="overview"&&(s=s.filter(h=>!Am.has(h.type)));const a=new Set(s.map(h=>h.id)),u=r.filter(h=>a.has(h.src)&&a.has(h.dst)),c=o.focusId?wN(o.focusId,u,1):new Set;if(o.neighborhoodOnly&&o.focusId&&c.size){s=s.filter(p=>c.has(p.id));const h=new Set(s.map(p=>p.id));return{nodes:s,edges:u.filter(p=>h.has(p.src)&&h.has(p.dst)),neighborIds:c}}return{nodes:s,edges:u,neighborIds:c}}function SN(e,r){const o=r.trim().toLowerCase();return o?e.filter(s=>`${s.name} ${s.qualified_name} ${s.type} ${s.file_path||""} ${s.context||""}`.toLowerCase().includes(o)).slice(0,24):[]}function kN(e,r,o,s){const a=new Set(e.map(k=>k.id));if(!a.has(o))return{nodeIds:new Set,edgeIds:new Set};const u=new Map,c=new Map;for(const k of r){if(!a.has(k.src)||!a.has(k.dst))continue;const b=u.get(k.src)??[];b.push({dst:k.dst,id:k.id}),u.set(k.src,b);const E=c.get(k.dst)??[];E.push({src:k.src,id:k.id}),c.set(k.dst,E)}const h=new Set(e.filter(k=>Tm.has(k.type)).map(k=>k.id)),p=h.size?h:a,y=new Set,w=[o];for(;w.length;){const k=w.pop();if(!y.has(k)){y.add(k);for(const b of u.get(k)??[])y.has(b.dst)||w.push(b.dst)}}const v=new Set([o]),g=[...p].filter(k=>y.has(k)),x=new Set(g);for(;g.length;){const k=g.pop();v.add(k);for(const b of c.get(k)??[])y.has(b.src)&&!x.has(b.src)&&(x.add(b.src),g.push(b.src))}const S=new Set;for(const k of r)v.has(k.src)&&v.has(k.dst)&&S.add(k.id);return{nodeIds:v,edgeIds:S}}const Ep=16,NN=28;function Cp(e){return(e.context||"").trim()}function Fb(e){return e.confidence!g&&x?1:g&&!x?-1:g.localeCompare(x));const h=new Map(u.map((g,x)=>[g,x])),p=(u.length-1)/2,y=Om(o),w=[...new Set([...s.values()].map(g=>g.x))].sort((g,x)=>g-x),v=new Map(w.map((g,x)=>[g,x]));for(const g of e){const x=s.get(g.id)??{x:0,y:0},k=((h.get(Cp(g))??0)-p)*mN;if(y){const b=v.get(x.x)??0;a.set(g.id,{x:b*pN,y:-x.y*gN,z:k})}else a.set(g.id,{x:x.x*jp,y:-x.y*jp,z:k})}return a}function jN(e){return e==="layers"||e==="flow"?"slab":e==="radial"||e==="concentric"||e==="circle"?"ring":"none"}function Bb(e,r,o="layers"){var u;if(!e.length)return[];const s=jN(o);if(s==="none")return[];if(s==="ring")return CN(e,r);const a=new Map;for(const c of e){const h=Math.round((((u=r.get(c.id))==null?void 0:u.x)??0)*10)/10,p=a.get(h)??[];p.push(c),a.set(h,p)}return[...a.entries()].sort((c,h)=>c[0]-h[0]).map(([,c])=>EN(c,r,o))}function Dm(e,r){const o=new Map;for(const u of e){const c=On(u.type);o.set(c,(o.get(c)||0)+1)}let s=-1,a=0;for(const[u,c]of o)c>a&&(s=u,a=c);return r==="flow"&&as[0]-a[0]).map(([,s])=>{let a=0,u=0;for(const h of s){const p=r.get(h.id)??{x:0,y:0,z:0};a+=Math.hypot(p.x,p.y),u+=p.z}const c=a/s.length;return{shape:"ring",x:0,y:0,z:u/s.length,extentY:0,extentZ:0,radius:c,label:c<12?"":Dm(s,"radial"),count:s.length}}).filter(s=>s.radius>=12)}function MN(){try{if(typeof localStorage>"u")return"layers";const e=localStorage.getItem(Rm);return e&&lN.has(e)?e:"layers"}catch{return"layers"}}function PN(e){try{if(typeof localStorage>"u")return;localStorage.setItem(Rm,e)}catch{}}function Om(e){return e==="layers"||e==="flow"}function IN(e){if(!e.length)return Number.NaN;const r=[...e].sort((s,a)=>s-a),o=Math.floor(r.length/2);return r.length%2?r[o]:(r[o-1]+r[o])/2}function rn(e,r){return e.name.localeCompare(r.name)||e.id.localeCompare(r.id)}function Fm(e,r){return On(e.type)-On(r.type)||rn(e,r)}function Hc(e,r,o){e.forEach((s,a)=>{const u=-Math.PI/2+2*Math.PI*a/Math.max(e.length,1);o.set(s.id,{x:Math.cos(u)*r,y:Math.sin(u)*r})})}function Bc(e,r){return Math.max(r*go,e<=1?r===0?0:jt:e*dN/(2*Math.PI))}function RN(e,r){const o=new Map;if(!e.length)return o;const s=new Set(e.flat().map(S=>S.id)),a=new Map,u=new Map;for(const S of e.flat())a.set(S.id,[]),u.set(S.id,[]);for(const S of r)!s.has(S.src)||!s.has(S.dst)||S.src===S.dst||(u.get(S.src).push(S.dst),a.get(S.dst).push(S.src));const c=new Map;e.forEach((S,k)=>{for(const b of S)c.set(b.id,k)});const h=new Map,p=()=>{for(const S of e)S.forEach((k,b)=>h.set(k.id,b))};p();const y=(S,k)=>{const b=S.map((E,I)=>{const _=k(E.id).map(L=>h.get(L)).filter(L=>L!==void 0),j=IN(_);return{n:E,bary:Number.isNaN(j)?I:j,name:E.name,id:E.id}});return b.sort((E,I)=>E.bary-I.bary||E.name.localeCompare(I.name)||E.id.localeCompare(I.id)),b.map(E=>E.n)},w=S=>k=>c.get(k)===S;for(let S=0;S(a.get(b)??[]).filter(w(k-1))),p();for(let k=e.length-2;k>=0;k--)e[k]=y(e[k],b=>(u.get(b)??[]).filter(w(k+1))),p()}const v=jt+Hr,g=Fn+fl,x=Math.max(...e.map(S=>S.length),1);return e.forEach((S,k)=>{const b=(x-S.length)*g/2;S.forEach((E,I)=>{o.set(E.id,{x:k*v,y:b+I*g})})}),o}function TN(e,r){const o=new Set(e.map(h=>h.id)),s=Math.max(e.length-1,0),a=new Map;for(const h of e)a.set(h.id,0);for(let h=0;h(a.get(y.dst)||0)&&(a.set(y.dst,w),p=!0)}if(!p)break}const u=new Map;for(const h of e){const p=a.get(h.id)||0,y=u.get(p)??[];y.push(h),u.set(p,y)}const c=[...u.keys()].sort((h,p)=>h-p).map(h=>(u.get(h)??[]).sort(rn));return RN(c,r)}function LN(e,r){const o=new Map;if(!e.length)return o;const s=new Set(e.map(g=>g.id)),a=new Map,u=new Map;for(const g of e)a.set(g.id,[]),u.set(g.id,0);for(const g of r)!s.has(g.src)||!s.has(g.dst)||g.src===g.dst||(a.get(g.src).push(g.dst),a.get(g.dst).push(g.src),u.set(g.src,(u.get(g.src)||0)+1),u.set(g.dst,(u.get(g.dst)||0)+1));const c=[...e].sort((g,x)=>(u.get(x.id)||0)-(u.get(g.id)||0)||rn(g,x))[0]??e[0],h=new Map,p=[[c]];h.set(c.id,0);const y=[c];for(;y.length;){const g=y.shift(),x=h.get(g.id)||0,S=(a.get(g.id)??[]).map(k=>e.find(b=>b.id===k)).filter(k=>!!k).sort(rn);for(const k of S){if(h.has(k.id))continue;h.set(k.id,x+1);const b=p[x+1]??[];b.push(k),p[x+1]=b,y.push(k)}}const w=e.filter(g=>!h.has(g.id)).sort(rn);w.length&&p.push(w);const v=jt+32;return p.forEach((g,x)=>{if(x===0&&g.length===1){o.set(g[0].id,{x:0,y:0});return}const S=Math.max(x*(jt+Hr),g.length<=1?jt:g.length*v/(2*Math.PI));g.forEach((k,b)=>{const E=-Math.PI/2+2*Math.PI*b/g.length;o.set(k.id,{x:Math.cos(E)*S,y:Math.sin(E)*S})})}),o}function AN(e){const r=new Map,o=[...e].sort((c,h)=>On(c.type)-On(h.type)||rn(c,h)),s=Math.max(1,Math.ceil(Math.sqrt(o.length))),a=jt+Hr,u=Fn+fl;return o.forEach((c,h)=>{r.set(c.id,{x:h%s*a,y:Math.floor(h/s)*u})}),r}function $N(e){const r=new Map,o=[...e].sort(Fm);return o.length<=1?(o[0]&&r.set(o[0].id,{x:0,y:0}),r):(Hc(o,Bc(o.length,1),r),r)}function zN(e){const r=new Map;if(!e.length)return r;const o=new Map;for(const a of e){const u=On(a.type),c=o.get(u)??[];c.push(a),o.set(u,c)}return[...o.keys()].sort((a,u)=>a-u).forEach((a,u)=>{const c=(o.get(a)??[]).sort(rn);if(u===0&&c.length===1){r.set(c[0].id,{x:0,y:0});return}Hc(c,Bc(c.length,u===0?1:u),r)}),r}function DN(e){const r=new Map;if(!e.length)return r;const o=new Map;for(const h of e){const p=o.get(h.type)??[];p.push(h),o.set(h.type,p)}const a=[...o.keys()].sort((h,p)=>On(h)-On(p)||h.localeCompare(p)).map(h=>{const p=(o.get(h)??[]).sort(rn),y=Math.max(1,Math.ceil(Math.sqrt(p.length))),w=Math.ceil(p.length/y);return{members:p,cols:y,width:Math.max(0,y-1)*go,height:Math.max(0,w-1)*Ka}}),u=Math.max(...a.map(h=>Math.hypot(h.width,h.height)/2+jt),jt),c=a.length<=1?0:Math.max(go,a.length*(u*2+Hr)/(2*Math.PI));return a.forEach((h,p)=>{const y=a.length===1?0:-Math.PI/2+2*Math.PI*p/a.length,w=Math.cos(y)*c,v=Math.sin(y)*c;h.members.forEach((g,x)=>{const S=x%h.cols,k=Math.floor(x/h.cols);r.set(g.id,{x:w-h.width/2+S*go,y:v-h.height/2+k*Ka})})}),r}function ON(e,r){const o=new Map;if(!e.length)return o;const s=new Map(e.map(x=>[x.id,x])),a=new Set(s.keys()),u=new Map,c=new Map;for(const x of e)u.set(x.id,[]),c.set(x.id,0);for(const x of r)!a.has(x.src)||!a.has(x.dst)||x.src===x.dst||(u.get(x.src).push(x.dst),c.set(x.dst,(c.get(x.dst)||0)+1));for(const[x,S]of u){const k=[...new Set(S)];k.sort((b,E)=>rn(s.get(b),s.get(E))),u.set(x,k)}const h=e.filter(x=>(c.get(x.id)||0)===0).sort(rn);if(!h.length){const x=[...e].sort((S,k)=>{var b,E;return(((b=u.get(k.id))==null?void 0:b.length)||0)-(((E=u.get(S.id))==null?void 0:E.length)||0)||rn(S,k)})[0];h.push(x)}const p=new Set,y=new Map;for(const x of e)y.set(x.id,[]);const w=x=>{p.add(x);for(const S of u.get(x)??[])p.has(S)||(y.get(x).push(S),w(S))};for(const x of h)p.has(x.id)||w(x.id);for(const x of[...e].sort(rn))p.has(x.id)||(h.push(x),w(x.id));let v=0;const g=(x,S)=>{const k=y.get(x)??[];if(!k.length){o.set(x,{x:v*go,y:S*Ka}),v+=1;return}const b=v;for(const E of k)g(E,S+1);o.set(x,{x:(b+v-1)/2*go,y:S*Ka})};for(const x of h)o.has(x.id)||g(x.id,0);return o}function FN(e,r){const o=jt+24,s=Fn+16;for(let a=0;a<8;a++)for(let u=0;ug.id)),h=[],p=new Set;for(const g of r){if(!c.has(g.src)||!c.has(g.dst)||g.src===g.dst)continue;const x=g.src[g.id,g])),a=[];VN.has(e.type)&&a.push("sink"),WN.has(e.type)&&a.push("contract");const u=e.extra??{};u.inferred&&a.push("inferred"),u.generated&&a.push("generated"),u.mutation&&a.push("mutation"),u.fbv&&a.push("function view"),u.ninja&&a.push("ninja"),u.ninja_schema&&a.push("ninja schema"),u.next_app&&a.push("app router"),u.typed_client&&a.push(String(u.typed_client)),u.e2e&&a.push("e2e"),u.filterset===!0&&a.push("filterset");const c=o.filter(g=>g.dst===e.id),h=o.filter(g=>g.src===e.id),p=c.slice(0,Ra).map(g=>Ta(g,s,g.src)),y=h.slice(0,Ra).map(g=>Ta(g,s,g.dst)),w=e.file_path?`${e.file_path}${e.start_line?`:${e.start_line}`:""}`:void 0,v={type:e.type,typeLabel:rs(ci(e.type)),layer:$m[On(e.type)]??"other",purpose:XN(e.type),name:e.name,qualifiedName:e.qualified_name,file:w,context:e.context,roles:a,facts:QN(u).filter(g=>!(g.key==="app"&&g.value===e.context)),inputs:p,outputs:y,extraInputs:Math.max(0,c.length-Ra),extraOutputs:Math.max(0,h.length-Ra),degreeIn:c.length,degreeOut:h.length,inputKinds:Rp(c.map(g=>Ta(g,s,g.src))),outputKinds:Rp(h.map(g=>Ta(g,s,g.dst))),pathSummary:""};return v.pathSummary=KN(v),v}function Rp(e){const r=new Map;for(const o of e){const s=o.edgeLabel||o.edgeType.replaceAll("_"," ");r.set(s,(r.get(s)||0)+1)}return[...r.entries()].sort((o,s)=>s[1]-o[1]||o[0].localeCompare(s[0])).map(([o,s])=>({label:o,count:s}))}function KN(e){const r=e.inputKinds.map(s=>`${s.label} ×${s.count}`).join(", "),o=e.outputKinds.map(s=>`${s.label} ×${s.count}`).join(", ");return r&&o?`${r} → this → ${o}`:o?`this → ${o}`:r?`${r} → this`:""}function Ta(e,r,o){const s=r.get(o),a=o.includes(":")?o.slice(o.indexOf(":")+1):o;return{id:o,name:(s==null?void 0:s.name)||a,type:(s==null?void 0:s.type)||"",typeLabel:s?rs(ci(s.type)):"",edgeType:e.type,edgeLabel:rs(e.type),inferred:e.confidence<.8}}function QN(e){const r=[...Pp.filter(a=>a in e),...Object.keys(e).filter(a=>!Pp.includes(a)&&!Ip.has(a))],o=[],s=new Set;for(const a of r){if(s.has(a)||Ip.has(a)||YN.has(a))continue;s.add(a);const u=ZN(a,e[a]);u!=null&&o.push({key:a,label:UN[a]??rs(a),value:u})}return o}function ZN(e,r){if(r==null)return null;if(typeof r=="boolean")return!r&&!GN.has(e)?null:r?"yes":"no";if(typeof r=="number")return String(r);if(typeof r=="string")return r.trim()||null;if(Array.isArray(r)){if(r.some(u=>u&&typeof u=="object"))return JN(e,r);const o=r.map(u=>typeof u=="string"||typeof u=="number"?String(u):"").filter(Boolean);if(!o.length)return null;const s=o.slice(0,BN),a=o.length-s.length;return a>0?`${s.join(", ")} +${a} more`:s.join(", ")}return null}function JN(e,r){const o=r.slice(0,4).map(a=>{if(e==="nplusone"){const c=String(a.queryset||"queryset"),h=Array.isArray(a.accessed)?a.accessed.join("."):"",p=a.line?` L${a.line}`:"";return h?`${c} → ${h}${p}`:`${c}${p}`}if(e==="lookups"){const c=Array.isArray(a.fields)?a.fields.join(", "):"",h=String(a.kind||"filter");return c?`${h} ${c}`:h}return Object.entries(a).filter(([,c])=>c!=null&&(typeof c=="string"||typeof c=="number")).slice(0,3).map(([c,h])=>`${c}=${h}`).join(" ")});if(!o.some(Boolean))return null;const s=r.length-o.length;return s>0?`${o.join("; ")} +${s} more`:o.join("; ")}const Tp=12,Lp=.2,eb=.8,Qa=20,tb=Fn;function nb(e,r,o){const s=o??Im(e,r),a=[...new Set([...s.values()].map(p=>p.x))].sort((p,y)=>p-y),u=[];for(const p of r){const y=s.get(p.src),w=s.get(p.dst);if(!y||!w)continue;const v=y.y+Fn/2,g=w.y+Fn/2;if(Math.abs(v-g)S.y0-k.y0||S.y1-k.y1||S.id.localeCompare(k.id)),w=ib(y),v=Math.max(0,...w.values())+1,g=y[0].sourceX,x=rb(a,g);for(const S of y){const k=sb(w.get(S.id)??0,v),b=g+Qa+Math.max(1,x-2*Qa)*k;h.set(S.id,ob(S.sourceX,S.targetX,b))}}return h}function rb(e,r){const o=r-jt,s=e.find(a=>a>o+1);return s===void 0?Hr:Math.max(Hr,s-r)}function ob(e,r,o){const s=r-e-2*Qa;return s<1?.5:Math.min(1,Math.max(0,(o-e-Qa)/s))}function ib(e){const r=[],o=new Map;for(const s of e){let a=-1;for(let u=0;ur[u]+tb){a=u;break}a<0?(a=r.length,r.push(s.y1)):r[a]=Math.max(r[a],s.y1),o.set(s.id,a)}return o}function sb(e,r){return r<=1?.5:Lp+(eb-Lp)*e/(r-1)}const ab=new Set,lb=A.lazy(()=>q0(()=>import("./LayeredGraph3D-DIGrA9CU.js"),[],import.meta.url).then(e=>({default:e.LayeredGraph3D})));class Bm extends A.Component{constructor(){super(...arguments);ih(this,"state",{failed:!1})}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}}const Ap=d.jsx("p",{className:"muted graph-3d-hint","data-testid":"graph-3d-fallback",children:"WebGL is unavailable in this browser, so the 3D view cannot start. Switch back to 2D map."}),ub={cheap:"var(--edge-cheap)",expensive:"var(--edge-expensive)",critical:"var(--edge-critical)"},Za={n:ke.Top,e:ke.Right,s:ke.Bottom,w:ke.Left};function cb(e,r){const o=r.x-e.x,s=r.y-e.y;return Math.abs(o)>=Math.abs(s)?o>=0?{source:"e",target:"w"}:{source:"w",target:"e"}:s>=0?{source:"s",target:"n"}:{source:"n",target:"s"}}function db({data:e,selected:r}){const o=(e.roles||[]).map(s=>`role-${s}`).join(" ");return d.jsxs("div",{className:["lp-node",r?"selected":"",e.dim?"dim":"",o].filter(Boolean).join(" "),children:[["n","e","s","w"].map(s=>d.jsx(ui,{id:`tgt-${s}`,type:"target",position:Za[s],isConnectable:!1},`tgt-${s}`)),d.jsx("div",{className:"t",children:ci(e.type)}),d.jsx("div",{className:"n",title:e.name,children:Dr(e.name)}),["n","e","s","w"].map(s=>d.jsx(ui,{id:`src-${s}`,type:"source",position:Za[s],isConnectable:!1},`src-${s}`))]})}const fb={load:db},hb=new Set(["django","react","stitch","arch"]);function pb({id:e,sourceX:r,sourceY:o,targetX:s,targetY:a,sourcePosition:u,targetPosition:c,style:h,markerEnd:p,markerStart:y,label:w,labelStyle:v,labelShowBg:g,labelBgStyle:x,labelBgPadding:S,labelBgBorderRadius:k,data:b,interactionWidth:E}){const[I,_,j]=Xa({sourceX:r,sourceY:o,sourcePosition:u,targetX:s,targetY:a,targetPosition:c,borderRadius:8,stepPosition:(b==null?void 0:b.stepPosition)??.5});return d.jsx(_s,{id:e,path:I,labelX:_,labelY:j,label:w,labelStyle:v,labelShowBg:g,labelBgStyle:x,labelBgPadding:S,labelBgBorderRadius:k,style:h,markerEnd:p,markerStart:y,interactionWidth:E})}const gb={loadstep:pb};function mb({topologyKey:e}){const{fitView:r}=cl();return A.useEffect(()=>{let o=0;const s=requestAnimationFrame(()=>{o=requestAnimationFrame(()=>{r({padding:.2,maxZoom:1.15})})});return()=>{cancelAnimationFrame(s),cancelAnimationFrame(o)}},[r,e]),null}function yb(e,r,o=null,s={}){const a=new Map(e.map(v=>[v.id,v])),u=s.layout??"layers",c=Om(u),h=Hm(e,r,u),p=nb(e,r,h),y=e.map(v=>{var S;const g=((S=s.roles)==null?void 0:S[v.id])||[],x=!!s.testOverlay&&!g.includes("tested")&&!g.includes("untested")&&!g.includes("test")&&!g.includes("seed");return{id:v.id,type:"load",position:h.get(v.id)??{x:0,y:0},data:{name:v.name,type:v.type,file:v.file_path,roles:g,dim:x},selected:o===v.id,sourcePosition:ke.Right,targetPosition:ke.Left,width:jt,height:Fn,style:{width:jt,height:Fn}}}),w=r.filter(v=>a.has(v.src)&&a.has(v.dst)).map(v=>{const g=ub[v.weight]||"var(--edge-cheap)",x=!!(o&&(v.src===o||v.dst===o)),S=h.get(v.src)??{x:0,y:0},k=h.get(v.dst)??{x:0,y:0},b=c?{source:"e",target:"w"}:cb(S,k);return{id:v.id,source:v.src,target:v.dst,sourceHandle:`src-${b.source}`,targetHandle:`tgt-${b.target}`,sourcePosition:Za[b.source],targetPosition:Za[b.target],type:c?"loadstep":"default",animated:v.weight==="critical",data:{stepPosition:p.get(v.id)??.5},style:{stroke:g,strokeWidth:v.weight==="critical"?2.4:1.2,strokeDasharray:v.confidence<.8?"6 4":void 0},markerEnd:{type:cs.ArrowClosed,width:14,height:14,color:g},label:x?v.type.replaceAll("_"," "):void 0,labelStyle:x?{fill:"var(--ink)",fontSize:10,fontWeight:600}:void 0,labelBgStyle:x?{fill:"var(--graph-bg)",fillOpacity:.92}:void 0,labelBgPadding:x?[3,5]:void 0,labelBgBorderRadius:x?4:void 0}});return{rfNodes:y,rfEdges:w}}function vb({node:e,nodes:r,edges:o,onClose:s,onWhatIf:a,onSelect:u,onOpenFile:c,pinned:h,onPin:p,onIsolate:y}){const w=qN(e,r,o);return A.useEffect(()=>{const v=g=>{g.key==="Escape"&&s()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[s]),d.jsxs("aside",{className:"inspector","data-testid":"graph-inspector",children:[d.jsxs("div",{className:"inspector-head",children:[d.jsx("div",{className:"t",children:w.typeLabel}),d.jsx("div",{className:"inspector-roles",children:w.roles.map(v=>d.jsx("span",{className:"inspector-chip",children:v},v))}),d.jsx("button",{type:"button",className:"inspector-close","data-testid":"graph-inspector-close","aria-label":"Close inspector",onClick:s,children:"×"})]}),d.jsx("div",{className:"n",children:Dr(w.name)}),d.jsx("p",{className:"inspector-purpose","data-testid":"graph-inspector-purpose",children:w.purpose}),w.context?d.jsx("div",{className:"muted",children:Dr(w.context)}):null,w.file?d.jsxs("div",{className:"file-row",children:[d.jsx("div",{className:"file",children:Dr(w.file)}),c&&e.file_path?d.jsx("button",{type:"button",className:"btn","data-testid":"btn-open-editor",onClick:()=>c(e.file_path,e.start_line),children:"Open in editor"}):null]}):null,d.jsx("div",{className:"muted",children:Dr(w.qualifiedName)}),d.jsxs("div",{className:"muted inspector-layer",children:["layer · ",w.layer]}),d.jsxs("div",{className:"muted inspector-degree","data-testid":"graph-inspector-degree",children:[w.degreeIn," in · ",w.degreeOut," out"]}),w.pathSummary?d.jsx("p",{className:"inspector-path","data-testid":"graph-inspector-path",children:w.pathSummary}):null,w.facts.length?d.jsx("dl",{className:"inspector-facts","data-testid":"graph-inspector-facts",children:w.facts.map(v=>d.jsxs("div",{className:"inspector-fact",children:[d.jsx("dt",{children:v.label}),d.jsx("dd",{children:Dr(v.value)})]},v.key))}):null,d.jsx($p,{title:"Inputs",testId:"graph-inspector-inputs",links:w.inputs,extra:w.extraInputs,empty:"Nothing in this graph points here.",onSelect:u}),d.jsx($p,{title:"Outputs",testId:"graph-inspector-outputs",links:w.outputs,extra:w.extraOutputs,empty:"This node does not point at anything in this graph.",onSelect:u}),a?d.jsx("p",{className:"whatif-hint","data-testid":"whatif-hint",children:y?"Walks a new path from this node with no git range. Isolate (next) only hides the rest of this map.":"Walks a new path from this node with no git range — as if this changed, regardless of Base/Head."}):null,d.jsxs("div",{className:"btn-row",children:[a?d.jsx("button",{type:"button",className:"btn","data-testid":"btn-whatif",title:"Start a hypothetical walk from this node. Does not use Base/Head.",onClick:()=>a(e.id),children:"What if this changes"}):null,y?d.jsx("button",{type:"button",className:"btn","data-testid":"btn-isolate",title:"Hide nodes that are not on a path from here to a sink. Does not start a new walk.",onClick:()=>y(e.id),children:"Isolate path to sinks"}):null,p?d.jsx("button",{type:"button",className:h?"btn primary":"btn","data-testid":"btn-pin-node",onClick:()=>p(h?null:e.id),children:h?"Unpin":"Pin"}):null]})]})}function $p({title:e,testId:r,links:o,extra:s,empty:a,onSelect:u}){return d.jsxs("section",{className:"inspector-section","data-testid":r,children:[d.jsxs("h3",{children:[e,d.jsx("span",{className:"count",children:o.length+s})]}),o.length?d.jsx("ul",{children:o.map((c,h)=>d.jsx("li",{children:u?d.jsxs("button",{type:"button",className:"inspector-link",onClick:()=>u(c.id),children:[d.jsx("span",{className:"inspector-link-name",title:c.name,children:Dr(c.name)}),d.jsxs("span",{className:"inspector-link-meta",children:[c.typeLabel?`${c.typeLabel} · `:"",c.edgeLabel,c.inferred?" · inferred":""]})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"inspector-link-name",title:c.name,children:Dr(c.name)}),d.jsxs("span",{className:"inspector-link-meta",children:[c.typeLabel?`${c.typeLabel} · `:"",c.edgeLabel,c.inferred?" · inferred":""]})]})},`${c.edgeType}:${c.id}:${h}`))}):d.jsx("p",{className:"muted",children:a}),s?d.jsxs("p",{className:"muted",children:["+",s," more"]}):null]})}function xb({nodes:e,edges:r,onWhatIf:o,focusPath:s,selectedId:a,onSelect:u,nodeRoles:c,testOverlay:h=!1,isolateSource:p,onIsolate:y,repoPath:w,onOpenFile:v,pinnedId:g,onPin:x}){const[S,k]=A.useState(null),b=a!==void 0?a:S,E=pe=>{a===void 0&&k(pe),u==null||u(pe)},[I,_]=A.useState(null),[j,L]=A.useState(null),[$,F]=A.useState(()=>MN()),[U,q]=A.useState(new Set(hb)),[te,J]=A.useState(!1),[ne,Q]=A.useState(""),[C,V]=A.useState(!1),[W,Y]=A.useState(null),M=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;A.useEffect(()=>{const pe=()=>Y(fN());if(typeof window.requestIdleCallback=="function"){const Ve=window.requestIdleCallback(pe);return()=>window.cancelIdleCallback(Ve)}const $e=window.setTimeout(pe,0);return()=>window.clearTimeout($e)},[]);const D=I??vN(e.length),H=hN(D,I,W),R=j??xN(e.length),z=te?b:null,re=A.useMemo(()=>p?kN(e,r,p):null,[e,r,p]),oe=re?e.filter(pe=>re.nodeIds.has(pe.id)):e,fe=re?r.filter(pe=>re.edgeIds.has(pe.id)):r,le=A.useMemo(()=>_N(oe,fe,{detail:R,families:U,focusId:z,neighborhoodOnly:!!z}),[oe,fe,R,U,z]),he=A.useMemo(()=>`${$}|${le.nodes.map(pe=>pe.id).join("\0")}|${le.edges.map(pe=>pe.id).join("\0")}`,[$,le.nodes,le.edges]),Z=b?e.find(pe=>pe.id===b)??null:null,{rfNodes:se,rfEdges:me}=A.useMemo(()=>{const pe=yb(le.nodes,le.edges,b,{roles:c,testOverlay:h,layout:$});return M&&(pe.rfEdges=pe.rfEdges.map($e=>({...$e,animated:!1}))),pe},[le.nodes,le.edges,b,M,c,h,$]);A.useEffect(()=>{if(!s)return;const pe=e.find($e=>$e.file_path===s);pe&&E(pe.id)},[s,e]);const Ne=A.useMemo(()=>SN(e,ne),[e,ne]),we=(pe,$e)=>{E($e.id)},ye=()=>{E(null),J(!1)},Me=Z?d.jsx(vb,{node:Z,nodes:e,edges:r,onClose:ye,onWhatIf:o,onSelect:E,onOpenFile:v,pinned:g===Z.id,onPin:x,onIsolate:y?pe=>{y(p===pe?null:pe)}:void 0}):null,Te=pe=>{q($e=>{const Ve=new Set($e);if(Ve.has(pe)){if(Ve.size===1)return $e;Ve.delete(pe)}else Ve.add(pe);return Ve})},Le=A.useMemo(()=>{const pe=new Set;for(const $e of e)pe.add(zm($e.type));return pe},[e]),De=e.length-le.nodes.length;return d.jsxs("div",{className:"impact-graph",style:{flex:1,minHeight:0,position:"relative",display:"flex",flexDirection:"column"},children:[d.jsxs("div",{className:"graph-toolbar","data-testid":"graph-toolbar",children:[d.jsxs("div",{className:"seg","aria-label":"Graph projection",children:[d.jsx("button",{type:"button","data-testid":"graph-view-2d",className:H==="2d"?"active":"","aria-pressed":H==="2d",onClick:()=>_("2d"),children:"2D map"}),d.jsx("button",{type:"button","data-testid":"graph-view-3d",className:H==="3d"?"active":"","aria-pressed":H==="3d",onClick:()=>_("3d"),children:"3D layers"})]}),d.jsxs("div",{className:"seg","aria-label":"Graph detail",children:[d.jsx("button",{type:"button","data-testid":"graph-detail-overview",className:R==="overview"?"active":"","aria-pressed":R==="overview",onClick:()=>L("overview"),children:"Overview"}),d.jsx("button",{type:"button","data-testid":"graph-detail-full",className:R==="full"?"active":"","aria-pressed":R==="full",onClick:()=>L("full"),children:"Full"})]}),d.jsx("div",{className:"seg","aria-label":"Graph families",children:["django","stitch","react"].filter(pe=>Le.has(pe)).map(pe=>d.jsx("button",{type:"button","data-testid":`graph-family-${pe}`,className:U.has(pe)?"active":"","aria-pressed":U.has(pe),onClick:()=>Te(pe),children:pe},pe))}),d.jsxs("label",{className:"graph-layout",children:["Layout",d.jsx("select",{id:"graph-layout","data-testid":"graph-layout",value:$,"aria-label":"Graph layout algorithm",onChange:pe=>{var Ve;const $e=(Ve=Sc.find(Ue=>Ue.id===pe.target.value))==null?void 0:Ve.id;$e&&(F($e),PN($e))},children:Sc.map(pe=>d.jsx("option",{value:pe.id,children:pe.label},pe.id))})]}),d.jsx("button",{type:"button",className:te?"chip-btn active":"chip-btn","data-testid":"graph-neighborhood",disabled:!b,onClick:()=>J(pe=>!pe),children:te?"Neighborhood":"Focus neighbors"}),p?d.jsx("button",{type:"button",className:"chip-btn active","data-testid":"graph-isolate-clear",onClick:()=>y==null?void 0:y(null),children:"Path isolate"}):null,d.jsxs("label",{className:"graph-search",children:[d.jsx("span",{className:"sr-only",children:"Search nodes"}),d.jsx("input",{"data-testid":"graph-search",placeholder:"Find a node",value:ne,onChange:pe=>{Q(pe.target.value),V(!0)},onFocus:()=>V(!0),onBlur:()=>window.setTimeout(()=>V(!1),150)}),C&&ne.trim()&&Ne.length?d.jsx("ul",{className:"graph-search-hits","data-testid":"graph-search-hits",children:Ne.map(pe=>d.jsx("li",{children:d.jsxs("button",{type:"button",onMouseDown:$e=>$e.preventDefault(),onClick:()=>{E(pe.id),Q(""),V(!1)},children:[pe.name,d.jsx("span",{className:"muted",children:ci(pe.type)})]})},pe.id))}):null]}),d.jsxs("span",{className:"muted graph-count",children:[le.nodes.length," nodes · ",le.edges.length," edges",De?` · ${De} hidden`:""]})]}),d.jsx("div",{className:"graph-stage",children:e.length===0?d.jsxs("div",{className:"empty graph-walk-empty","data-testid":"graph-walk-empty",children:[d.jsx("h2",{children:"No typed nodes on this walk"}),d.jsx("p",{children:"This range did not hit models, views, routes, or React pages Loadpath extracts. Open the architecture map for the indexed graph."})]}):H==="3d"?d.jsxs("div",{className:"graph-3d","data-testid":"graph-3d",children:[d.jsx("p",{className:"graph-3d-hint",children:"Same layout as the 2D map, with bounded context on the depth axis. Dashed edges are inferred. Drag to orbit, scroll to zoom, click a node to inspect it."}),W===!1?Ap:W===null?d.jsx("p",{className:"muted graph-3d-hint",children:"Loading 3D layers…"}):d.jsx(Bm,{fallback:Ap,children:d.jsx(A.Suspense,{fallback:d.jsx("p",{className:"muted graph-3d-hint",children:"Loading 3D layers…"}),children:d.jsx(lb,{nodes:le.nodes,edges:le.edges,selectedId:b,neighborIds:z?le.neighborIds:ab,layout:$,nodeRoles:c,testOverlay:h,onSelect:pe=>{E(pe),pe||J(!1)}})})}),Me]}):d.jsxs(Em,{children:[d.jsxs(Mk,{nodes:se,edges:me,nodeTypes:fb,edgeTypes:gb,fitView:!1,minZoom:.25,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,deleteKeyCode:null,onNodeClick:we,onPaneClick:ye,proOptions:{hideAttribution:!1},"data-testid":"impact-graph",children:[d.jsx(mb,{topologyKey:he}),d.jsx(Lk,{}),d.jsx(tN,{pannable:!0,zoomable:!0,ariaLabel:"Impact graph overview",nodeColor:"var(--muted)",nodeStrokeColor:"transparent",nodeStrokeWidth:0,maskColor:"rgba(0, 0, 0, 0.45)",maskStrokeColor:"var(--accent)",maskStrokeWidth:1.4,bgColor:"var(--graph-bg)",style:{width:184,height:128}}),d.jsx(Hk,{})]}),Me]})})]})}function ic(e){return d.jsx(Bm,{fallback:d.jsx("p",{className:"muted graph-3d-hint","data-testid":"graph-crash-fallback",children:"The graph failed to render. Switch to 2D map or another layout."}),children:d.jsx(xb,{...e})})}function Vm(){const e=localStorage.getItem("loadpath.editor")||"auto";return e==="cursor"||e==="vscode"||e==="system"?e:"auto"}function wb(e){localStorage.setItem("loadpath.editor",e)}async function _b(e,r,o,s=Vm()){try{const a=await Re.openEditor(e,r,o??void 0,s);if(a.ok)return{ok:!0,message:`Opened ${r} in ${a.opened_with||"editor"}`};const u=a.urls||{},c=s==="vscode"?u.vscode:s==="cursor"?u.cursor:u.cursor||u.vscode;return c?(window.open(c,"_blank","noopener,noreferrer"),{ok:!0,message:`Opening ${r} via editor URL`}):{ok:!1,message:a.error||"Could not open editor"}}catch(a){return{ok:!1,message:a instanceof Error?a.message:String(a)}}}const zp=[{value:"HEAD",label:"HEAD",group:"preset"},{value:"HEAD~1",label:"HEAD~1",group:"preset"}],Sb=["preset","branch","tag","commit"];function kb(e){var a;if(!(e!=null&&e.git))return[...zp];const r=((a=e.presets)!=null&&a.length?e.presets:zp.map(u=>u.value)).map(u=>({value:u,label:u,group:"preset"})),o=new Set(r.map(u=>u.value)),s=[...r];for(const u of e.branches||[])o.has(u.name)||(o.add(u.name),s.push({value:u.name,label:u.current?`${u.name} (current)`:u.name,detail:u.subject,group:"branch"}));for(const u of e.tags||[])o.has(u.name)||(o.add(u.name),s.push({value:u.name,label:u.name,detail:u.subject,group:"tag"}));for(const u of e.commits||[])o.has(u.sha)||(o.add(u.sha),s.push({value:u.sha,label:u.short,detail:u.subject,group:"commit"}));return s}function Nb(e,r){const o=r.trim().toLowerCase();return o?e.filter(s=>s.value.toLowerCase().includes(o)||s.label.toLowerCase().includes(o)||(s.detail||"").toLowerCase().includes(o)):e}function bb(e){return Sb.map(r=>({group:r,items:e.filter(o=>o.group===r)})).filter(r=>r.items.length>0)}function jb(e){return e==="preset"?"Common":e==="branch"?"Branches":e==="tag"?"Tags":"Recent commits"}function Dp({value:e,onChange:r,placeholder:o,testId:s,menuTestId:a,refs:u,onNeedRefs:c}){const h=A.useId(),p=A.useRef(null),[y,w]=A.useState(!1),[v,g]=A.useState(null),[x,S]=A.useState(0),k=A.useMemo(()=>{const j=kb(u);return v===null?j:Nb(j,v)},[u,v]),b=A.useMemo(()=>bb(k),[k]);A.useEffect(()=>{y&&c()},[y,c]),A.useEffect(()=>{S(0)},[v,y]);const E=()=>{w(!1),g(null)},I=j=>{r(j.value),E()},_=j=>{if(j.key==="ArrowDown"){if(j.preventDefault(),!y){w(!0);return}S(L=>Math.min(L+1,Math.max(k.length-1,0)))}else if(j.key==="ArrowUp"){if(j.preventDefault(),!y)return;S(L=>Math.max(L-1,0))}else if(j.key==="Enter"&&y){j.preventDefault();const L=k[x];L&&I(L)}else j.key==="Escape"&&y&&(j.preventDefault(),E())};return d.jsxs("div",{className:"combo",ref:p,onBlur:j=>{j.currentTarget.contains(j.relatedTarget)||E()},children:[d.jsxs("div",{className:"combo-row",children:[d.jsx("input",{"data-testid":s,value:e,placeholder:o,spellCheck:!1,role:"combobox","aria-expanded":y,"aria-controls":h,"aria-autocomplete":"list",onChange:j=>{r(j.target.value),y&&g(j.target.value)},onKeyDown:_}),d.jsx("button",{type:"button",className:"icon-btn combo-toggle","data-testid":`${s}-toggle`,"aria-label":"Show recent refs","aria-expanded":y,onMouseDown:j=>j.preventDefault(),onClick:()=>y?E():w(!0),children:d.jsx(G0,{})})]}),y?d.jsx("div",{className:"combo-menu",id:h,role:"listbox","data-testid":a,children:b.length===0?d.jsx("div",{className:"combo-empty muted",children:"No matching refs — the typed value is kept"}):b.map(j=>d.jsxs("div",{className:"combo-group",children:[d.jsx("div",{className:"combo-heading",children:jb(j.group)}),j.items.map(L=>{const $=k.indexOf(L);return d.jsxs("button",{type:"button",role:"option","aria-selected":$===x,className:$===x?"combo-option active":"combo-option","data-testid":`ref-option-${L.group}`,onMouseDown:F=>F.preventDefault(),onMouseEnter:()=>S($),onClick:()=>I(L),children:[d.jsx("span",{className:"combo-label",children:L.label}),L.detail?d.jsx("span",{className:"combo-detail",children:L.detail}):null]},`${L.group}:${L.value}`)})]},j.group))}):null]})}function Eb({initialPath:e,onSelect:r,onClose:o}){const[s,a]=A.useState(null),[u,c]=A.useState(e),[h,p]=A.useState(null),[y,w]=A.useState(""),[v,g]=A.useState(!1),x=A.useRef(null),S=A.useRef(0),k=async _=>{const j=S.current+1;S.current=j,g(!0);try{const L=await Re.browse(_);if(S.current!==j)return;a(L),c(L.path),p(L.is_git?L.path:null),w("")}catch(L){if(S.current!==j)return;w(L instanceof Error?L.message:String(L))}finally{S.current===j&&g(!1)}};A.useEffect(()=>{var _,j;k(e),(_=x.current)==null||_.focus(),(j=x.current)==null||j.select()},[e]);const b=h||(s==null?void 0:s.path)||u,E=h&&h!==(s==null?void 0:s.path)?h.split(/[\\/]/).filter(Boolean).pop():s!=null&&s.is_git?"this repository":"this folder",I=_=>{_.key==="Escape"&&(_.preventDefault(),o())};return d.jsx("div",{className:"modal-backdrop","data-testid":"repo-explorer","data-overlay":"true",onClick:o,onKeyDown:I,children:d.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"explorer-title",onClick:_=>_.stopPropagation(),children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{children:[d.jsx("h2",{id:"explorer-title",children:"Select repository"}),d.jsx("p",{className:"muted",children:"Browse to a git root, or paste the full path."})]}),d.jsx("button",{type:"button",className:"btn ghost","data-testid":"explorer-cancel",onClick:o,children:"Cancel"})]}),d.jsxs("form",{className:"explorer-path",onSubmit:_=>{_.preventDefault(),k(u)},children:[d.jsx("input",{ref:x,"data-testid":"explorer-path",value:u,onChange:_=>c(_.target.value),spellCheck:!1,"aria-label":"Directory path"}),d.jsx("button",{type:"button",className:"btn",disabled:!(s!=null&&s.parent),onClick:()=>(s==null?void 0:s.parent)&&void k(s.parent),children:"Up"}),d.jsx("button",{type:"button",className:"btn",onClick:()=>s&&void k(s.home),children:"Home"}),d.jsx("button",{type:"submit",className:"btn",children:"Go"})]}),y?d.jsx("div",{className:"error",role:"alert",children:y}):null,d.jsx("div",{className:"explorer-list",role:"listbox","aria-label":"Folders","aria-busy":v,children:s!=null&&s.entries.length?s.entries.map(_=>{const j=h===_.path;return d.jsxs("button",{type:"button",role:"option","aria-selected":j,className:j?"explorer-row active":"explorer-row","data-testid":"explorer-entry","data-path":_.path,onClick:()=>p(_.path),onDoubleClick:()=>void k(_.path),children:[d.jsx(Bp,{}),d.jsx("span",{className:"explorer-name",children:_.name}),_.is_git?d.jsx("span",{className:"chip git-badge",children:"git"}):null]},_.path)}):d.jsx("div",{className:"muted explorer-empty",children:v?"Loading…":"No folders here"})}),d.jsxs("div",{className:"modal-foot",children:[d.jsx("span",{className:"muted explorer-current",title:b,children:b}),d.jsxs("button",{type:"button",className:"btn primary","data-testid":"explorer-use",disabled:!b,onClick:()=>b&&r(b),children:["Use ",E]})]})]})})}const Cb={scan:{start:0,end:20},extract:{start:20,end:88},boot:{start:88,end:94},stitch:{start:94,end:99},skipped:{start:100,end:100},done:{start:100,end:100}},Mb=new Set(["scan","extract","boot","stitch"]);function Pb(e){const r=e.phase||"";if(!r||r==="idle")return null;const o=Cb[r];if(!o)return null;if(o.start===o.end)return o.end;const s=e.total||0;if(s<=0)return o.start;const a=Math.min(1,Math.max(0,(e.done||0)/s));return Math.round(o.start+(o.end-o.start)*a)}function Ib(e){return!e.phase||e.phase==="idle"?null:typeof e.percent=="number"&&Number.isFinite(e.percent)?Math.max(0,Math.min(100,Math.round(e.percent))):Pb(e)}const Ja=[{id:"obsidian",label:"Obsidian",group:"dark"},{id:"nord",label:"Nord",group:"dark"},{id:"solarized-dark",label:"Solarized Dark",group:"dark"},{id:"forest",label:"Forest",group:"dark"},{id:"rose",label:"Rose Pine",group:"dark"},{id:"amber",label:"Midnight Amber",group:"dark"},{id:"volcano",label:"Volcano",group:"dark"},{id:"lavender",label:"Lavender",group:"dark"},{id:"neon-noir",label:"Neon Noir",group:"dark"},{id:"synthwave",label:"Synthwave",group:"dark"},{id:"phosphor",label:"Phosphor",group:"dark"},{id:"aurora",label:"Aurora",group:"dark"},{id:"biolume",label:"Biolume",group:"dark"},{id:"carbon",label:"Carbon",group:"dark"},{id:"paper",label:"Paper",group:"light"},{id:"solarized-light",label:"Solarized Light",group:"light"},{id:"seafoam",label:"Seafoam",group:"light"},{id:"high-contrast",label:"High Contrast",group:"light"},{id:"sakura",label:"Sakura",group:"light"},{id:"citrus",label:"Citrus",group:"light"},{id:"peach",label:"Peach Fuzz",group:"light"},{id:"candy",label:"Cotton Candy",group:"light"},{id:"sky",label:"Clear Sky",group:"light"},{id:"coral",label:"Coral Reef",group:"light"}],Rb="obsidian",Wm="loadpath.theme";function Tb(e){return Ja.some(r=>r.id===e)}function Um(){try{const e=localStorage.getItem(Wm)||"";if(Tb(e))return e}catch{}return Rb}function Lb(e){var r;return((r=Ja.find(o=>o.id===e))==null?void 0:r.group)==="light"?"light":"dark"}function Gm(e){document.documentElement.dataset.theme=e,document.documentElement.style.colorScheme=Lb(e);try{localStorage.setItem(Wm,e)}catch{}}const sc=[{id:"review",label:"Review",testId:"tab-review",shortcut:"1",icon:H0},{id:"architecture",label:"Architecture",testId:"tab-architecture",shortcut:"2",icon:B0},{id:"graph",label:"Impact graph",testId:"tab-graph",shortcut:"3",icon:V0},{id:"prs",label:"Pull requests",testId:"tab-prs",shortcut:"4",icon:W0},{id:"settings",label:"Settings",testId:"tab-settings",shortcut:"5",icon:U0}];function ac(e,r,o){let s;try{s=new URL(e)}catch{return}if(s.protocol!=="https:"||s.username||s.password)return;const a=s.hostname.toLowerCase();a!==r&&!a.endsWith(`.${r}`)||s.pathname.startsWith(o)&&window.open(s.toString(),"_blank","noopener,noreferrer")}function Ab(){var yi,Mo,vi,xi,wi,Po,Qr,un,cn,dn;const[e,r]=A.useState("review"),[o,s]=A.useState(localStorage.getItem("loadpath.repo")||""),[a,u]=A.useState(localStorage.getItem("loadpath.base")||"HEAD~1"),[c,h]=A.useState(localStorage.getItem("loadpath.head")||"HEAD"),[p,y]=A.useState(null),[w,v]=A.useState(null),[g,x]=A.useState(null),[S,k]=A.useState([]),[b,E]=A.useState("review"),[I,_]=A.useState(""),[j,L]=A.useState(""),[$,F]=A.useState(null),[U,q]=A.useState(!1),[te,J]=A.useState(!1),[ne,Q]=A.useState(""),[C,V]=A.useState({}),[W,Y]=A.useState([]),[M,D]=A.useState([]),[H,R]=A.useState(localStorage.getItem("loadpath.scmRepo")||""),[z,re]=A.useState(localStorage.getItem("loadpath.provider")||"github"),[oe,fe]=A.useState(localStorage.getItem("loadpath.prNumber")||""),[le,he]=A.useState(localStorage.getItem("loadpath.dirty")==="1"),[Z,se]=A.useState(0),[me,Ne]=A.useState(""),[we,ye]=A.useState(Um),[Me,Te]=A.useState(!1),[Le,De]=A.useState(!1),[pe,$e]=A.useState(!1),[Ve,Ue]=A.useState(null),[wt,Xt]=A.useState(null),[gt,mt]=A.useState(localStorage.getItem("loadpath.testOverlay")==="1"),[Mt,ct]=A.useState(null),[rt,Bn]=A.useState(localStorage.getItem("loadpath.watch")==="1"),[Pt,bn]=A.useState([]),[di,Vn]=A.useState(null),[So,dr]=A.useState(null),[Br,Wn]=A.useState(null),[Vr,fr]=A.useState(()=>{try{return!!(localStorage.getItem("loadpath.lastReviewId")&&(localStorage.getItem("loadpath.repo")||"").trim())}catch{return!1}}),[hr,Ht]=A.useState(null),[dt,Un]=A.useState(null),[Gn,jn]=A.useState(!1),[Yn,En]=A.useState(!1),at=A.useRef(o);at.current=o;const pr=A.useRef(le);pr.current=le;const Cn=A.useRef(!1);Cn.current=Le;const It=A.useRef(""),on=A.useRef(""),ko=P=>{ye(P),Gm(P)},tt=A.useRef(""),We=P=>{tt.current=P,L(P)},Mn=P=>{let G=0,ce=!1;F(0);const Ee=()=>{Re.indexProgress(P).then(Ie=>{if(!tt.current)return;if(Ie.phase&&Ie.phase!=="idle"&&Ie.message&&We(Ie.message),Mb.has(Ie.phase))ce=!0;else if(!ce)return;const xr=Ib(Ie);xr!=null&&(Ie.phase==="scan"&&!Ie.done?G=xr:G=Math.max(G,xr),F(G))}).catch(()=>{})};Ee();const Pe=window.setInterval(Ee,250);return()=>{window.clearInterval(Pe),F(null)}};A.useEffect(()=>{Re.settings().then(V).catch(()=>{}).finally(()=>Te(!0)),Re.repos().then(P=>k(P.repos)).catch(()=>{})},[]);const Xn=()=>o.trim()?!0:(_("Point at a local repository path first."),!1);A.useEffect(()=>{if(e!=="architecture"||!o.trim())return;const P=o;let G=!1;return on.current!==P&&Kn(P),Re.config(P).then(ce=>{!G&&at.current===P&&dr(ce)}).catch(()=>{}),Re.architectureHealth(P).then(ce=>{!G&&at.current===P&&Wn(ce)}).catch(()=>{}),()=>{G=!0}},[e,o]);const sn=P=>{at.current=P,s(P),localStorage.setItem("loadpath.repo",P),P.trim()!==It.current&&(It.current="",Ht(null))},Wr=A.useCallback(P=>{const G=(P??at.current).trim();return!G||It.current===G?Promise.resolve():(It.current=G,Re.gitRefs(G).then(ce=>{at.current.trim()===G&&Ht(ce)}).catch(()=>{It.current===G&&(It.current="",Ht(null))}))},[]),an=(P,G)=>{u(P),h(G),localStorage.setItem("loadpath.base",P),localStorage.setItem("loadpath.head",G)},Rt=(P,G,ce)=>{re(P),R(G),localStorage.setItem("loadpath.provider",P),localStorage.setItem("loadpath.scmRepo",G),ce!==void 0&&(fe(ce),localStorage.setItem("loadpath.prNumber",ce))},qt=P=>{y(P),se(0),Ue(wt&&P.nodes.some(G=>G.id===wt)?wt:null),ct(null),Vn(null),P.what_if||(v(P),P.id&&localStorage.setItem("loadpath.lastReviewId",P.id))},qn=async P=>{try{const G=await Re.reviews(P);bn(G.reviews)}catch{bn([])}},No=async P=>{try{Wn(await Re.architectureHealth(P))}catch{Wn(null)}},bo=P=>P==="github"?!!C.github_token_set:P==="gitlab"?!!C.gitlab_token_set:!!C.bitbucket_token_set,Tt=A.useCallback(async(P=z)=>{var G;try{const ce=await Re.scmRepos(P);D(ce.repos),(G=ce.user)!=null&&G.login&&V(Ee=>({...Ee,...P==="github"?{github_user:ce.user.login}:P==="gitlab"?{gitlab_user:ce.user.login}:{bitbucket_user:ce.user.login}}))}catch{D([])}},[z]);A.useEffect(()=>{if(e!=="prs")return;let P=!1;return Tt(z).catch(()=>{P||D([])}),()=>{P=!0}},[e,z,Tt]),A.useEffect(()=>{if(!dt)return;let P=!1,G=0;const ce=async()=>{try{const Ee=await Re.githubOAuthPoll(dt.flow_id);if(P)return;if(Ee.status==="complete"){Un(null);const Pe=await Re.settings();V(Pe),Q(Ee.user?`Signed in to GitHub as ${Ee.user}`:"Signed in to GitHub"),Tt("github");return}if(Ee.status==="pending"||Ee.status==="slow_down"){G=window.setTimeout(ce,Math.max(Ee.interval||dt.interval,5)*1e3);return}Un(null),_(Ee.status==="denied"?"GitHub sign-in was denied.":"GitHub sign-in expired. Try again.")}catch(Ee){if(P)return;Un(null),_(Ee instanceof Error?Ee.message:String(Ee))}};return G=window.setTimeout(ce,Math.max(dt.interval,5)*1e3),()=>{P=!0,window.clearTimeout(G)}},[dt,Tt]),A.useEffect(()=>{if(!Gn)return;let P=!1,G=0;const ce=Date.now(),Ee=async()=>{try{const Pe=await Re.oauthStatus();if(P)return;if(Pe.bitbucket.connected){jn(!1);const Ie=await Re.settings();V(Ie),Q(Pe.bitbucket.user?`Signed in to Bitbucket as ${Pe.bitbucket.user}`:"Signed in to Bitbucket"),Tt("bitbucket");return}if(Date.now()-ce>18e4){jn(!1),_("Bitbucket sign-in timed out. Finish in the browser, or try again.");return}G=window.setTimeout(Ee,1500)}catch(Pe){if(P)return;jn(!1),_(Pe instanceof Error?Pe.message:String(Pe))}};return G=window.setTimeout(Ee,1500),()=>{P=!0,window.clearTimeout(G)}},[Gn,Tt]),A.useEffect(()=>{if(!Yn)return;let P=!1,G=0;const ce=Date.now(),Ee=async()=>{try{const Pe=await Re.oauthStatus();if(P)return;if(Pe.gitlab.connected){En(!1);const Ie=await Re.settings();V(Ie),Q(Pe.gitlab.user?`Signed in to GitLab as ${Pe.gitlab.user}`:"Signed in to GitLab"),Tt("gitlab");return}if(Date.now()-ce>18e4){En(!1),_("GitLab sign-in timed out. Finish in the browser, or try again.");return}G=window.setTimeout(Ee,1500)}catch(Pe){if(P)return;En(!1),_(Pe instanceof Error?Pe.message:String(Pe))}};return G=window.setTimeout(Ee,1500),()=>{P=!0,window.clearTimeout(G)}},[Yn,Tt]);const Kn=async(P=o,G=!1)=>{if(!P.trim())return null;on.current=P,J(!0);try{const ce=await Re.architecture(P,!1);at.current===P&&x(ce);const Ee=Re.architectureGraph(P).then(Pe=>{at.current===P&&x(Ie=>Ie&&{...Ie,nodes:Pe.nodes,edges:Pe.edges,graph_pending:!1})});return Ee.catch(()=>{x(Pe=>Pe&&at.current===P?{...Pe,graph_pending:!1}:Pe)}).finally(()=>{on.current===P&&J(!1)}),G&&await Ee,ce}catch(ce){throw at.current===P&&J(!1),ce}},Ur=async P=>{const G=P.trim();if(!(!G||G===at.current)){if(tt.current){_("Wait for the current job to finish before switching workspace.");return}_(""),Q(""),y(null),v(null),x(null),E("architecture"),sn(G),q(!0),We(`Loading ${F0(G)}…`);try{await Promise.all([Kn(G),Wr(G)])}catch(ce){at.current===G&&_(ce instanceof Error?ce.message:String(ce))}finally{at.current===G&&(We(""),q(!1))}}},Qn=async()=>{if(tt.current||!Xn())return;_(""),Q(""),We("Tracing load path…"),sn(o),an(a,c);const P=Mn(o);try{const G=await Re.review(o,a,c,!0,pr.current);qt(G),E("review"),r("review"),await Re.repos().then(ce=>k(ce.repos)).catch(()=>{}),await Promise.all([Kn(o),qn(o),No(o)])}catch(G){_(G instanceof Error?G.message:String(G))}finally{P(),We("")}},gr=async(P=!0)=>{if(tt.current||!Xn())return;_(""),Q(""),We(P?"Indexing…":"Full reindex…"),sn(o);const G=Mn(o);try{await Re.index(o,P);const ce=await Kn(o);await Re.repos().then(Ee=>k(Ee.repos)).catch(()=>{}),ce!=null&&ce.indexed&&(E("architecture"),r("architecture"))}catch(ce){_(ce instanceof Error?ce.message:String(ce))}finally{G(),We("")}},Ye=async()=>{if(!tt.current&&Xn()){_(""),Q(""),We("Detecting layout…"),sn(o);try{const P=await Re.init(o);Q(P.message),await Re.repos().then(G=>k(G.repos)).catch(()=>{})}catch(P){_(P instanceof Error?P.message:String(P))}finally{We("")}}},fi=async()=>{if(p!=null&&p.markdown)try{await navigator.clipboard.writeText(p.markdown),Q("Copied markdown brief")}catch(P){_(P instanceof Error?P.message:String(P))}},Gr=async()=>{if(!tt.current){if(p!=null&&p.what_if){_("What-if walks are hypothetical — they are not posted to a pull request. Restore the git-range walk first.");return}if(!(p!=null&&p.markdown)||!H||!oe){_("Pick a pull request first (Pull requests tab), then post the brief.");return}We("Posting Loadpath brief…");try{const P=await Re.postComment(z,H,Number(oe),p.markdown);Q(P.updated?"Updated the Loadpath PR comment":"Posted the Loadpath PR comment")}catch(P){_(P instanceof Error?P.message:String(P))}finally{We("")}}},jo=async()=>{if(!tt.current){_(""),We("Fetching pull requests…");try{const P=await Re.prs(z,H,"open",o.trim()||void 0);Y(P.pull_requests);const G=M.find(ce=>ce.slug.toLowerCase()===H.trim().toLowerCase());G!=null&&G.local_path&&sn(G.local_path)}catch(P){_(P instanceof Error?P.message:String(P))}finally{We("")}}},mr=async()=>{_("");try{const P=await Re.githubOAuthStart();Un(P),ac(P.verification_uri_complete,"github.com","/login/device")}catch(P){_(P instanceof Error?P.message:String(P))}},hi=async()=>{_("");try{const P=await Re.bitbucketOAuthStart();jn(!0),ac(P.authorize_url,"bitbucket.org","/site/oauth2/authorize")}catch(P){jn(!1),_(P instanceof Error?P.message:String(P))}},Eo=async()=>{_("");try{const P=await Re.gitlabOAuthStart();En(!0),ac(P.authorize_url,new URL(P.authorize_url).hostname,"/oauth/authorize")}catch(P){En(!1),_(P instanceof Error?P.message:String(P))}},Pn=async P=>{if(!(tt.current||!o.trim())){_(""),We("Walking what-if path…");try{const G=await Re.whatIf(o,P);Q(`${G.title} — ${G.confidence.level} · ${(G.sinks||[]).length} sinks`),qt({...G,markdown:G.markdown||"",index:G.index||(p==null?void 0:p.index),workspace:G.workspace||(p==null?void 0:p.workspace)}),E("review"),r("review")}catch(G){_(G instanceof Error?G.message:String(G))}finally{We("")}}},_t=()=>{if(w){qt(w),E("review"),r("review"),Q("Restored the last git-range walk");return}y(null),se(0),Ue(null),ct(null),Vn(null),E("architecture"),r("architecture"),Q("")},pi=async P=>{var Pe;if(tt.current)return;Rt(P.provider,P.repo,String(P.number));const G=M.find(Ie=>Ie.slug.toLowerCase()===P.repo.toLowerCase());G!=null&&G.local_path&&sn(G.local_path),_(""),We(`Fetching ${P.provider} #${P.number}…`);const ce=(G==null?void 0:G.local_path)||o,Ee=ce?Mn(ce):()=>{};try{const Ie=await Re.reviewPr(P.provider,P.repo,P.number,(G==null?void 0:G.local_path)||o||void 0);qt(Ie),Ie.pull_request&&typeof Ie.pull_request.repo_path=="string"&&sn(Ie.pull_request.repo_path),an(String(Ie.base||P.target_branch),String(Ie.head||P.source_branch)),E("review"),r("review"),typeof((Pe=Ie.pull_request)==null?void 0:Pe.repo_path)=="string"&&qn(Ie.pull_request.repo_path)}catch(Ie){an(P.base_sha||P.target_branch,P.head_sha||P.source_branch),r("review"),_(Ie instanceof Error?Ie.message:String(Ie))}finally{Ee(),We("")}},yt=async P=>{_("");try{V(await Re.oauthDisconnect(P)),z===P&&D([]),Q(`Disconnected ${P}`)}catch(G){_(G instanceof Error?G.message:String(G))}},gi=async P=>{P.preventDefault();const G=new FormData(P.currentTarget),ce={github_token:String(G.get("github_token")||""),github_oauth_client_id:String(G.get("github_oauth_client_id")||""),github_host:String(G.get("github_host")||""),gitlab_token:String(G.get("gitlab_token")||""),gitlab_host:String(G.get("gitlab_host")||""),gitlab_oauth_client_id:String(G.get("gitlab_oauth_client_id")||""),gitlab_oauth_client_secret:String(G.get("gitlab_oauth_client_secret")||""),bitbucket_token:String(G.get("bitbucket_token")||""),bitbucket_username:String(G.get("bitbucket_username")||""),bitbucket_oauth_client_id:String(G.get("bitbucket_oauth_client_id")||""),bitbucket_oauth_client_secret:String(G.get("bitbucket_oauth_client_secret")||""),ai_provider:String(G.get("ai_provider")||"none"),ai_api_key:String(G.get("ai_api_key")||""),ai_model:String(G.get("ai_model")||""),ai_base_url:String(G.get("ai_base_url")||"")},Ee=S.length?{...ce,workspaces:S.map(Pe=>({path:Pe.path,name:Pe.name}))}:ce;try{V(await Re.saveSettings(Ee)),Q("Settings saved on this machine")}catch(Pe){_(Pe instanceof Error?Pe.message:String(Pe))}},mi=async()=>{if(!(!p||tt.current)){We("Residual analysis…");try{const P=await Re.residual(p);Ne(P.note)}catch(P){_(P instanceof Error?P.message:String(P))}finally{We("")}}},Yr=A.useRef(Qn);Yr.current=Qn;const In=A.useRef(e);In.current=e;const Zn=A.useRef(!1);Zn.current=pe;const Rn=A.useRef(p);Rn.current=p;const Kt=A.useRef(Z);Kt.current=Z,A.useEffect(()=>{const P=localStorage.getItem("loadpath.lastReviewId"),G=(localStorage.getItem("loadpath.repo")||"").trim();if(!P||!G){fr(!1);return}let ce=!1;return Re.getReview(G,P).then(Ee=>{ce||(qt(Ee),an(Ee.base||localStorage.getItem("loadpath.base")||"HEAD~1",Ee.head||localStorage.getItem("loadpath.head")||"HEAD"),qn(G),No(G))}).catch(()=>{}).finally(()=>{ce||fr(!1)}),()=>{ce=!0}},[]);const Xr=A.useRef("");A.useEffect(()=>{if(!rt||!o.trim())return;let P=!1;const G=async()=>{try{const Ee=await Re.workspaceStatus(o);if(P)return;Xr.current&&Ee.fingerprint!==Xr.current&&!tt.current&&(he(!0),pr.current=!0,localStorage.setItem("loadpath.dirty","1"),Yr.current()),Xr.current=Ee.fingerprint}catch{}};G();const ce=window.setInterval(G,2e3);return()=>{P=!0,window.clearInterval(ce)}},[rt,o]),A.useEffect(()=>{const P=G=>{var Pe;if((G.metaKey||G.ctrlKey)&&G.key.toLowerCase()==="k"){G.preventDefault(),$e(Ie=>!Ie);return}if(Zn.current){G.key==="Escape"&&(G.preventDefault(),$e(!1));return}if(Cn.current){G.key==="Escape"&&(G.preventDefault(),De(!1));return}const ce=G.target;if(ce&&(ce.tagName==="INPUT"||ce.tagName==="TEXTAREA"||ce.tagName==="SELECT"||ce.isContentEditable)){G.key==="Escape"&&ce.blur();return}if(G.key==="Escape"){_(""),Q(""),Ue(wt),ct(null);return}if(G.key==="j"||G.key==="k"){const Ie=((Pe=Rn.current)==null?void 0:Pe.read_order)||[];if(!Ie.length)return;G.preventDefault();const _i=Kt.current,xr=G.key==="j"?Math.min(Ie.length-1,_i+1):Math.max(0,_i-1);se(xr);return}const Ee=sc.find(Ie=>Ie.shortcut===G.key);if(Ee&&!G.metaKey&&!G.ctrlKey&&!G.altKey&&r(Ee.id),(G.metaKey||G.ctrlKey)&&G.key==="Enter"){if(In.current==="settings"||In.current==="prs"||tt.current)return;G.preventDefault(),Yr.current()}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[wt]);const qr=async(P,G)=>{if(!o.trim())return;const ce=await _b(o,P,G);ce.ok?Q(ce.message):_(ce.message)},yr=async()=>{if(p)try{const P=await Re.exportHtml(p),G=URL.createObjectURL(P),ce=document.createElement("a");ce.href=G,ce.download=`loadpath-${(p.id||"review").slice(0,8)}.html`,ce.click(),URL.revokeObjectURL(G),Q("Saved HTML brief")}catch(P){_(P instanceof Error?P.message:String(P))}},Kr=async P=>{if(o.trim()){We("Loading stored review…");try{const G=await Re.getReview(o,P);qt(G),an(G.base||a,G.head||c),E("review"),r("review");const ce=Pt.findIndex(Pe=>Pe.id===P),Ee=ce>=0?Pt[ce+1]:void 0;if(Ee)try{Vn(await Re.reviewDiff(o,P,Ee.id))}catch{Vn(null)}}catch(G){_(G instanceof Error?G.message:String(G))}finally{We("")}}},ln={selectedId:Ve,onSelect:Ue,nodeRoles:p==null?void 0:p.node_roles,testOverlay:gt,isolateSource:Mt,onIsolate:ct,repoPath:o,onOpenFile:qr,pinnedId:wt,onPin:Xt},Jn=[{id:"review",group:"Run",label:"Review this range",hint:"⌘/Ctrl+Enter",run:()=>void Qn()},...p!=null&&p.what_if?[{id:"exit-whatif",group:"Review",label:w?"Back to git-range walk":"Exit what-if walk",run:_t}]:[],{id:"index",group:"Run",label:"Index repository",run:()=>void gr(!0)},{id:"watch",group:"Run",label:rt?"Stop watching working tree":"Watch working tree",run:()=>{const P=!rt;Bn(P),localStorage.setItem("loadpath.watch",P?"1":"0")}},{id:"tests",group:"Graph",label:gt?"Hide test overlay":"Show test overlay",run:()=>{const P=!gt;mt(P),localStorage.setItem("loadpath.testOverlay",P?"1":"0")}},{id:"export",group:"Review",label:"Export HTML brief",run:()=>void yr()},...sc.map(P=>({id:`tab-${P.id}`,group:"Tabs",label:`Go to ${P.label}`,hint:P.shortcut,run:()=>r(P.id)})),...((p==null?void 0:p.nodes)||[]).slice(0,30).map(P=>({id:`node-${P.id}`,group:"Nodes",label:P.name,hint:ci(P.type),run:()=>{Ue(P.id),r("graph")}})),...Pt.slice(0,12).map(P=>({id:`hist-${P.id}`,group:"History",label:P.title||P.id,hint:`${P.level||""} ${P.created_at||""}`.trim(),run:()=>void Kr(P.id)}))],Co=A.useMemo(()=>b==="architecture"?(g==null?void 0:g.nodes)??[]:(p==null?void 0:p.nodes)??[],[b,g,p]),vr=A.useMemo(()=>b==="architecture"?(g==null?void 0:g.edges)??[]:(p==null?void 0:p.edges)??[],[b,g,p]),Be=p!=null&&p.index?`${p.index.counts.nodes} nodes · ${p.index.counts.edges} edges`:g!=null&&g.indexed?`${g.counts.nodes} nodes · ${g.counts.edges} edges`:"Not indexed",Ss=((p==null?void 0:p.findings)||[]).filter(P=>!P.waived);return d.jsxs("div",{className:"app",children:[d.jsx("a",{className:"skip",href:"#main",children:"Skip to content"}),d.jsxs("nav",{className:"rail","data-testid":"rail","aria-label":"Primary",children:[d.jsxs("div",{className:"brand",children:[d.jsx("div",{className:"brand-mark",children:"Loadpath"}),d.jsx("div",{className:"brand-sub",children:"Load-path review"})]}),sc.map(P=>{const G=P.icon,ce=e===P.id;return d.jsxs("button",{type:"button","data-testid":P.testId,className:ce?"nav-item active":"nav-item","aria-current":ce?"page":void 0,"aria-label":P.label,onClick:()=>r(P.id),children:[d.jsx(G,{}),d.jsx("span",{children:P.label})]},P.id)}),d.jsxs("div",{className:"theme-pick",children:[d.jsx("label",{htmlFor:"theme-select",children:"Theme"}),d.jsx("select",{id:"theme-select","data-testid":"theme-select",value:we,onChange:P=>ko(P.target.value),children:["dark","light"].map(P=>d.jsx("optgroup",{label:P==="dark"?"Dark":"Light",children:Ja.filter(G=>G.group===P).map(G=>d.jsx("option",{value:G.id,children:G.label},G.id))},P))})]}),d.jsxs("div",{className:"rail-foot",children:[d.jsx("div",{className:"muted",role:"status",children:j||Be}),d.jsxs("div",{className:"kbd-hint",children:[d.jsx("kbd",{children:"1"}),"–",d.jsx("kbd",{children:"5"})," tabs · ",d.jsx("kbd",{children:"⌘"}),d.jsx("kbd",{children:"K"})," palette · ",d.jsx("kbd",{children:"j"}),"/",d.jsx("kbd",{children:"k"})," read order"]})]})]}),d.jsxs("div",{className:"main",id:"main",children:[j?d.jsxs("div",{className:$!=null?"progress determinate":"progress",role:$!=null?"progressbar":"status","aria-label":j,"aria-live":"polite","aria-busy":"true","aria-valuemin":$!=null?0:void 0,"aria-valuemax":$!=null?100:void 0,"aria-valuenow":$??void 0,"data-testid":"progress",children:[d.jsx("i",{style:$!=null?{width:`${$}%`}:void 0}),d.jsx("span",{className:"sr-only",children:j})]}):null,d.jsxs("header",{className:"topbar","data-testid":"topbar",children:[S.length>0?d.jsxs("label",{className:"field workspace",children:[d.jsx("span",{children:"Workspace"}),d.jsxs("select",{"data-testid":"workspace-select",value:S.some(P=>P.path===o)?o:"",disabled:!!j,"aria-busy":U,onChange:P=>{P.target.value&&Ur(P.target.value)},children:[d.jsx("option",{value:"",children:"Indexed repos…"}),S.map(P=>d.jsxs("option",{value:P.path,children:[P.name,P.indexed?` (${P.counts.nodes})`:""]},P.path))]})]}):null,d.jsxs("label",{className:"field path",children:[d.jsx("span",{children:"Repository"}),d.jsxs("div",{className:"path-row",children:[d.jsx("input",{"data-testid":"repo-path",placeholder:"Local monorepo path",value:o,onChange:P=>{const G=P.target.value;s(G),G.trim()!==It.current&&(It.current="",Ht(null))},spellCheck:!1}),d.jsx("button",{type:"button",className:"icon-btn","data-testid":"btn-browse-repo","aria-label":"Browse for a local repository",onClick:()=>De(!0),children:d.jsx(Bp,{})})]})]}),d.jsxs("label",{className:"field ref",children:[d.jsx("span",{children:"Base"}),d.jsx(Dp,{testId:"base-ref",menuTestId:"base-ref-menu",value:a,onChange:P=>an(P,c),placeholder:"base",refs:hr,onNeedRefs:Wr})]}),d.jsxs("label",{className:"field ref",children:[d.jsx("span",{children:"Head"}),d.jsx(Dp,{testId:"head-ref",menuTestId:"head-ref-menu",value:c,onChange:P=>an(a,P),placeholder:"head",refs:hr,onNeedRefs:Wr})]}),d.jsxs("label",{className:"field dirty",children:[d.jsx("span",{children:"Working tree"}),d.jsx("button",{type:"button",className:le?"chip-btn active":"chip-btn","data-testid":"btn-dirty","aria-pressed":le,onClick:()=>{const P=!le;he(P),localStorage.setItem("loadpath.dirty",P?"1":"0")},children:le?"Include uncommitted":"Committed range"})]}),d.jsxs("label",{className:"field dirty",children:[d.jsx("span",{children:"Watch"}),d.jsx("button",{type:"button",className:rt?"chip-btn active":"chip-btn","data-testid":"btn-watch","aria-pressed":rt,onClick:()=>{const P=!rt;Bn(P),localStorage.setItem("loadpath.watch",P?"1":"0")},children:rt?"Watching":"Paused"})]}),p?d.jsxs("div",{className:`merge-box compact ${p.confidence.level}`,"data-testid":"merge-box",children:[d.jsx("div",{className:`level ${p.confidence.level}`,children:p.confidence.level.toUpperCase()}),d.jsxs("div",{className:"muted",children:[p.what_if?"what-if · ":"",p.confidence.covered_sinks,"/",p.confidence.sinks," sinks"]})]}):null,d.jsxs("div",{className:"topbar-actions",children:[d.jsx("button",{type:"button","data-testid":"btn-init",disabled:!!j,onClick:Ye,children:"Draft config"}),d.jsx("button",{type:"button","data-testid":"btn-index",disabled:!!j,onClick:()=>gr(!0),children:"Index"}),d.jsx("button",{type:"button","data-testid":"btn-review",className:"btn primary",disabled:!!j,onClick:Qn,children:"Review"})]})]}),d.jsxs("div",{className:"alerts",children:[I?d.jsxs("div",{className:"error","data-testid":"error",role:"alert",children:[d.jsx("span",{children:I}),d.jsx("button",{type:"button",className:"dismiss",onClick:()=>_(""),"aria-label":"Dismiss error",children:"×"})]}):null,ne?d.jsxs("div",{className:"banner","data-testid":"status-note",children:[d.jsx("span",{children:ne}),d.jsx("button",{type:"button",className:"dismiss",onClick:()=>Q(""),"aria-label":"Dismiss",children:"×"})]}):null,((yi=p==null?void 0:p.index)!=null&&yi.stale||g!=null&&g.stale)&&(e==="review"||e==="architecture")?d.jsx("div",{className:"banner stale","data-testid":"index-stale",children:"Index is stale — files changed since the last extract. Index again before trusting this walk."}):null,((Mo=p==null?void 0:p.index)==null?void 0:Mo.django_boot)==="failed"||(g==null?void 0:g.django_boot)==="failed"?d.jsx("div",{className:"banner warn","data-testid":"django-boot-failed",children:((vi=p==null?void 0:p.index)==null?void 0:vi.django_boot_detail)||(g==null?void 0:g.django_boot_detail)||"django.setup() failed"}):null,(xi=p==null?void 0:p.workspace)!=null&&xi.dirty_overlaps_review&&e==="review"?d.jsxs("div",{className:"banner warn","data-testid":"dirty-tree",children:["Uncommitted files overlap this review: ",(p.workspace.dirty_overlap||[]).slice(0,6).join(", ")]}):null,p!=null&&p.what_if?d.jsxs("div",{className:"banner whatif","data-testid":"whatif-banner",children:[d.jsxs("span",{children:["Hypothetical walk from"," ",d.jsx("strong",{children:((wi=p.node)==null?void 0:wi.name)||"this node"}),". Loadpath ignored Base/Head and asked which sinks would feel this node change — not a filter of the current map."]}),d.jsx("button",{type:"button",className:"btn","data-testid":"btn-exit-whatif",onClick:_t,children:w?"Back to git range":"Back to architecture"})]}):null,U?d.jsx("div",{className:"banner","data-testid":"workspace-loading",children:j||"Loading workspace…"}):null]}),d.jsxs("div",{className:"stage","aria-busy":U||te,children:[e==="review"&&d.jsxs("div",{className:"content","data-testid":"review-layout",children:[d.jsx("aside",{className:"brief","data-testid":"brief",children:p?d.jsx($b,{review:p,findings:Ss,aiNote:me,busy:!!j,tourIndex:Z,onTour:se,onAskAi:mi,onCopy:fi,onPost:Gr,onSelect:Ue,onOpenFile:qr,onExport:yr,history:Pt,diff:di,onReopen:Kr,onWaiver:(P,G)=>{o.trim()&&Re.addWaiver(o,P,G||void 0,"from review").then(ce=>{dr(ce),Q(`Waived ${P} in loadpath.yml`)})}}):Vr?d.jsxs("div",{className:"empty","data-testid":"review-restoring",children:[d.jsx("h2",{children:"Restoring last review"}),d.jsx("p",{children:"Loading the walk this machine stored last time Loadpath was open."})]}):d.jsxs("div",{className:"empty","data-testid":"review-empty",children:[d.jsx("h2",{children:"Trace the force of this diff"}),d.jsx("p",{children:"The graph is the architecture. The brief is where this change travels — not a hunk list."}),d.jsxs("ol",{children:[d.jsx("li",{children:"Point at a Django + React monorepo, or pick an indexed workspace."}),d.jsxs("li",{children:["Index it. Missing ",d.jsx("code",{children:"loadpath.yml"})," is drafted from ",d.jsx("code",{children:"manage.py"})," and"," ",d.jsx("code",{children:"src/features"}),"."]}),d.jsx("li",{children:"Review a git range, or open a pull request so base/head become a three-dot merge-base."})]})]})}),d.jsx("div",{className:"graph-wrap","data-testid":"review-graph",children:p?d.jsx(ic,{nodes:p.nodes,edges:p.edges,onWhatIf:Pn,focusPath:(Po=p.read_order[Z])==null?void 0:Po.path,...ln}):null})]}),e==="architecture"&&d.jsxs("div",{className:"content","data-testid":"architecture-panel",children:[d.jsx("aside",{className:"brief","data-testid":"architecture-brief",children:g!=null&&g.indexed?d.jsx(zb,{architecture:g,busy:!!j,onReindex:()=>gr(!1),onReview:Qn,onSelect:Ue,config:So,health:Br,onSaveConfig:P=>{Re.saveConfig(o,P).then(G=>{dr(G),Q("Wrote loadpath.yml")})},onWaiver:(P,G,ce)=>{Re.addWaiver(o,P,G,ce).then(Ee=>{dr(Ee),Q(`Waived ${P}`)})}}):U?d.jsx("p",{className:"muted","data-testid":"architecture-loading",children:"Loading the index summary…"}):d.jsx("p",{className:"muted","data-testid":"architecture-empty",children:"Index this repo to build the architecture graph. Review then walks that same graph for a git range — it does not start from a hunk list."})}),d.jsx("div",{className:"graph-wrap","data-testid":"architecture-graph",children:(te||g!=null&&g.graph_pending)&&!((g==null?void 0:g.nodes)||[]).length?d.jsxs("div",{className:"empty graph-loading","data-testid":"graph-loading",children:[d.jsx("h2",{children:"Drawing the architecture map…"}),d.jsx("p",{children:(Qr=g==null?void 0:g.counts)!=null&&Qr.nodes?`${g.counts.nodes} indexed nodes. The brief is ready while the graph loads.`:"Fetching the indexed graph."})]}):g!=null&&g.indexed?d.jsx(ic,{nodes:g.nodes,edges:g.edges,onWhatIf:Pn,...ln,isolateSource:null,onIsolate:void 0}):null})]}),e==="graph"&&d.jsxs("div",{className:"graph-wrap","data-testid":"graph-full",style:{height:"100%"},children:[d.jsxs("div",{className:"graph-modes",children:[d.jsxs("div",{className:"seg","aria-label":"Graph scope",children:[d.jsx("button",{type:"button","aria-pressed":b==="review","data-testid":"graph-mode-review",className:b==="review"?"active":"",onClick:()=>E("review"),children:"This review"}),d.jsx("button",{type:"button","aria-pressed":b==="architecture","data-testid":"graph-mode-architecture",className:b==="architecture"?"active":"",onClick:()=>E("architecture"),children:"Indexed architecture"})]}),d.jsxs("div",{className:"legend","aria-hidden":"true",children:[d.jsxs("span",{children:[d.jsx("i",{})," cheap"]}),d.jsxs("span",{children:[d.jsx("i",{className:"exp"})," expensive"]}),d.jsxs("span",{children:[d.jsx("i",{className:"crit"})," critical"]}),d.jsxs("span",{children:[d.jsx("i",{className:"dash"})," inferred"]}),d.jsxs("span",{children:[d.jsx("i",{className:"seed"})," changed"]}),d.jsxs("span",{children:[d.jsx("i",{className:"down"})," downstream"]})]}),d.jsx("button",{type:"button",className:gt?"chip-btn active":"chip-btn","data-testid":"graph-test-overlay","aria-pressed":gt,onClick:()=>{const P=!gt;mt(P),localStorage.setItem("loadpath.testOverlay",P?"1":"0")},children:"Tests"})]}),Co.length||b==="review"&&p||g!=null&&g.indexed&&!(te||g!=null&&g.graph_pending)?d.jsx(ic,{nodes:Co,edges:vr,onWhatIf:Pn,...ln,...b==="architecture"?{isolateSource:null,onIsolate:void 0,nodeRoles:void 0,testOverlay:!1}:{}}):te||g!=null&&g.graph_pending?d.jsx("p",{className:"empty","data-testid":"graph-loading",children:"Drawing the architecture map…"}):d.jsx("p",{className:"empty","data-testid":"graph-empty",children:"Index the repo or run a review first. Click a node to inspect it."})]}),e==="prs"&&d.jsxs("div",{className:"pr-list","data-testid":"pr-list",children:[d.jsxs("div",{className:"pr-toolbar",children:[d.jsxs("label",{className:"field provider",children:[d.jsx("span",{children:"Provider"}),d.jsxs("select",{"data-testid":"pr-provider",value:z,onChange:P=>Rt(P.target.value,H,oe),children:[d.jsx("option",{value:"github",children:"GitHub"}),d.jsx("option",{value:"gitlab",children:"GitLab"}),d.jsx("option",{value:"bitbucket",children:"Bitbucket"})]})]}),d.jsxs("label",{className:"field",children:[d.jsx("span",{children:"Repository"}),d.jsx("input",{"data-testid":"pr-repo",placeholder:M.length?"Search your repos":"owner/repo",value:H,onChange:P=>Rt(z,P.target.value,oe),list:"scm-repos",spellCheck:!1}),d.jsx("datalist",{id:"scm-repos",children:M.map(P=>d.jsxs("option",{value:P.slug,children:[P.private?"private":"public",P.local_path?" · local":""]},P.slug))})]}),d.jsx("button",{type:"button","data-testid":"btn-refresh-repos",className:"btn",disabled:!!j||!bo(z),onClick:()=>{Tt(z)},children:"My repos"}),d.jsx("button",{type:"button","data-testid":"btn-list-prs",className:"btn",disabled:!!j,onClick:jo,children:"List PRs"})]}),M.length>0?d.jsxs("p",{className:"muted scm-count","data-testid":"scm-repo-count",children:[M.length," ",z," repositor",M.length===1?"y":"ies",z==="github"&&C.github_user?` · @${String(C.github_user)}`:"",z==="gitlab"&&C.gitlab_user?` · @${String(C.gitlab_user)}`:"",z==="bitbucket"&&C.bitbucket_user?` · ${String(C.bitbucket_user)}`:""]}):null,W.length===0?d.jsxs("div",{className:"empty","data-testid":"pr-empty",children:[d.jsx("h2",{children:"No pull requests loaded"}),d.jsx("p",{children:"Sign in under Settings (or paste a token), load your repositories, then list open PRs. Reviewing a PR fills base and head from its SHAs."})]}):W.map(P=>{var G;return d.jsxs("article",{className:"pr","data-testid":`pr-${P.number}`,children:[d.jsxs("h3",{children:["#",P.number," ",P.title]}),d.jsxs("div",{className:"pr-meta muted",children:[d.jsx("span",{className:`chip ${P.draft?"":"open"}`,children:P.draft?"draft":P.state}),d.jsx("span",{children:P.author}),d.jsxs("span",{children:[P.source_branch," → ",P.target_branch]}),P.loadpath?d.jsxs("span",{className:`chip ${P.loadpath.level||""}`,"data-testid":`pr-loadpath-${P.number}`,children:[((G=P.loadpath.level)==null?void 0:G.toUpperCase())||"REVIEWED",P.loadpath.contract_break&&P.loadpath.contract_break!=="none"?` · ${P.loadpath.contract_break}`:""]}):d.jsx("span",{className:"muted",children:"no Loadpath walk yet"})]}),d.jsxs("div",{className:"pr-actions",children:[d.jsxs("a",{href:P.url,target:"_blank",rel:"noreferrer",children:["Open on ",P.provider]}),d.jsx("button",{type:"button",className:"btn primary","data-testid":`pr-review-${P.number}`,onClick:()=>void pi(P),children:"Review this PR"})]})]},`${P.provider}-${P.number}`)})]}),e==="settings"&&Me&&d.jsxs("form",{className:"settings","data-testid":"settings-form",onSubmit:gi,children:[d.jsxs("div",{children:[d.jsx("h1",{children:"Settings"}),d.jsx("p",{className:"muted",children:"Tokens stay on this machine in ~/.loadpath/settings.json. AI runs only on residual uncertainty the graph could not close."})]}),d.jsxs("section",{className:"settings-card",children:[d.jsx("h2",{children:"Appearance"}),d.jsx("p",{className:"muted",children:"Local to this browser. High contrast is a first-class theme, not an afterthought."}),d.jsx("div",{className:"theme-grid","data-testid":"theme-grid",children:Ja.map(P=>d.jsxs("button",{type:"button","data-theme":P.id,className:we===P.id?"theme-swatch active":"theme-swatch","data-testid":`theme-${P.id}`,onClick:()=>ko(P.id),children:[d.jsx("div",{className:"swatch-bar","aria-hidden":"true"}),d.jsx("div",{className:"name",children:P.label}),d.jsx("div",{className:"group",children:P.group})]},P.id))})]}),d.jsxs("section",{className:"settings-card",children:[d.jsx("h2",{children:"Editor"}),d.jsx("p",{className:"muted",children:"Open files from the inspector and read-order in Cursor, VS Code, or the system handler."}),d.jsx("label",{htmlFor:"editor-pref",children:"Preferred editor"}),d.jsxs("select",{id:"editor-pref","data-testid":"editor-pref",defaultValue:Vm(),onChange:P=>wb(P.target.value),children:[d.jsx("option",{value:"auto",children:"Auto (Cursor, then VS Code)"}),d.jsx("option",{value:"cursor",children:"Cursor"}),d.jsx("option",{value:"vscode",children:"VS Code"}),d.jsx("option",{value:"system",children:"System default"})]})]}),d.jsxs("section",{className:"settings-card",children:[d.jsx("h2",{children:"Source control"}),d.jsx("p",{className:"muted",children:"Sign in with OAuth to list every repository the account can access. Tokens stay in ~/.loadpath/settings.json. A classic PAT still works if you prefer not to register an OAuth app."}),d.jsxs("div",{className:"scm-login","data-testid":"scm-github",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"GitHub"}),d.jsx("p",{className:"muted",children:C.github_token_set?C.github_user?`Signed in as @${String(C.github_user)}`:"Token saved on this machine":"Not connected"})]}),d.jsx("div",{className:"btn-row",children:C.github_token_set?d.jsx("button",{type:"button",className:"btn","data-testid":"btn-github-disconnect",onClick:()=>void yt("github"),children:"Disconnect"}):d.jsx("button",{type:"button",className:"btn primary","data-testid":"btn-github-login",disabled:!!dt||!C.github_oauth_ready,onClick:()=>void mr(),children:dt?"Waiting for GitHub…":"Sign in with GitHub"})})]}),dt?d.jsxs("p",{className:"oauth-code","data-testid":"github-user-code",children:["Enter ",d.jsx("code",{children:dt.user_code})," at GitHub if the browser did not fill it in."]}):null,C.github_oauth_ready?null:d.jsx("p",{className:"muted",children:"Sign-in needs a GitHub OAuth App with Device Flow enabled. Set LOADPATH_GITHUB_CLIENT_ID or paste the client ID below."}),d.jsx("label",{htmlFor:"github_oauth_client_id",children:"GitHub OAuth client ID"}),d.jsx("input",{id:"github_oauth_client_id",name:"github_oauth_client_id","data-testid":"github-oauth-client-id",placeholder:"Ov23…",defaultValue:String(C.github_oauth_client_id||""),autoComplete:"off"}),d.jsx("label",{htmlFor:"github_token",children:"GitHub token (optional PAT)"}),d.jsx("input",{id:"github_token",name:"github_token",type:"password",placeholder:"ghp_…",autoComplete:"off"}),d.jsx("label",{htmlFor:"github_host",children:"GitHub host (Enterprise)"}),d.jsx("input",{id:"github_host",name:"github_host","data-testid":"github-host",placeholder:"github.com",defaultValue:String(C.github_host||""),autoComplete:"off"}),d.jsxs("div",{className:"scm-login","data-testid":"scm-gitlab",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"GitLab"}),d.jsx("p",{className:"muted",children:C.gitlab_token_set?C.gitlab_user?`Signed in as @${String(C.gitlab_user)}`:"Token saved on this machine":"Not connected"})]}),d.jsx("div",{className:"btn-row",children:C.gitlab_token_set?d.jsx("button",{type:"button",className:"btn","data-testid":"btn-gitlab-disconnect",onClick:()=>void yt("gitlab"),children:"Disconnect"}):d.jsx("button",{type:"button",className:"btn primary","data-testid":"btn-gitlab-login",disabled:Yn||!C.gitlab_oauth_ready,onClick:()=>void Eo(),children:Yn?"Waiting for GitLab…":"Sign in with GitLab"})})]}),d.jsx("label",{htmlFor:"gitlab_host",children:"GitLab host"}),d.jsx("input",{id:"gitlab_host",name:"gitlab_host","data-testid":"gitlab-host",placeholder:"gitlab.com",defaultValue:String(C.gitlab_host||""),autoComplete:"off"}),d.jsx("label",{htmlFor:"gitlab_oauth_client_id",children:"GitLab OAuth application ID"}),d.jsx("input",{id:"gitlab_oauth_client_id",name:"gitlab_oauth_client_id","data-testid":"gitlab-oauth-client-id",defaultValue:String(C.gitlab_oauth_client_id||""),autoComplete:"off"}),d.jsx("label",{htmlFor:"gitlab_oauth_client_secret",children:"GitLab OAuth secret"}),d.jsx("input",{id:"gitlab_oauth_client_secret",name:"gitlab_oauth_client_secret",type:"password",autoComplete:"off"}),d.jsx("label",{htmlFor:"gitlab_token",children:"GitLab token (optional PAT)"}),d.jsx("input",{id:"gitlab_token",name:"gitlab_token",type:"password",placeholder:"glpat-…",autoComplete:"off"}),d.jsxs("div",{className:"scm-login","data-testid":"scm-bitbucket",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"Bitbucket"}),d.jsx("p",{className:"muted",children:C.bitbucket_token_set?C.bitbucket_user?`Signed in as ${String(C.bitbucket_user)}`:"Token saved on this machine":"Not connected"})]}),d.jsx("div",{className:"btn-row",children:C.bitbucket_token_set?d.jsx("button",{type:"button",className:"btn","data-testid":"btn-bitbucket-disconnect",onClick:()=>void yt("bitbucket"),children:"Disconnect"}):d.jsx("button",{type:"button",className:"btn primary","data-testid":"btn-bitbucket-login",disabled:Gn||!C.bitbucket_oauth_ready,onClick:()=>void hi(),children:Gn?"Waiting for Bitbucket…":"Sign in with Bitbucket"})})]}),C.bitbucket_oauth_ready?null:d.jsxs("p",{className:"muted",children:["Sign-in needs a Bitbucket OAuth consumer (key + secret). Callback URL:"," ",d.jsx("code",{children:"/api/oauth/bitbucket/callback"})," on this app origin."]}),d.jsx("label",{htmlFor:"bitbucket_oauth_client_id",children:"Bitbucket OAuth key"}),d.jsx("input",{id:"bitbucket_oauth_client_id",name:"bitbucket_oauth_client_id","data-testid":"bitbucket-oauth-client-id",defaultValue:String(C.bitbucket_oauth_client_id||""),autoComplete:"off"}),d.jsx("label",{htmlFor:"bitbucket_oauth_client_secret",children:"Bitbucket OAuth secret"}),d.jsx("input",{id:"bitbucket_oauth_client_secret",name:"bitbucket_oauth_client_secret",type:"password",autoComplete:"off"}),d.jsx("label",{htmlFor:"bitbucket_token",children:"Bitbucket token (optional app password)"}),d.jsx("input",{id:"bitbucket_token",name:"bitbucket_token",type:"password",autoComplete:"off"}),d.jsx("label",{htmlFor:"bitbucket_username",children:"Bitbucket username (app passwords)"}),d.jsx("input",{id:"bitbucket_username",name:"bitbucket_username",defaultValue:String(C.bitbucket_username||"")})]}),d.jsxs("section",{className:"settings-card",children:[d.jsx("h2",{children:"Residual AI"}),d.jsx("label",{htmlFor:"ai_provider",children:"Provider"}),d.jsxs("select",{id:"ai_provider",name:"ai_provider",defaultValue:String(((un=C.ai)==null?void 0:un.provider)||"none"),children:[d.jsx("option",{value:"none",children:"none (graph only)"}),d.jsx("option",{value:"anthropic",children:"Anthropic"}),d.jsx("option",{value:"openai",children:"OpenAI"}),d.jsx("option",{value:"grok",children:"Grok / xAI"}),d.jsx("option",{value:"deepseek",children:"DeepSeek"}),d.jsx("option",{value:"cursor",children:"Cursor-compatible (OpenAI protocol)"}),d.jsx("option",{value:"ollama",children:"Ollama local"})]}),d.jsx("label",{htmlFor:"ai_api_key",children:"API key"}),d.jsx("input",{id:"ai_api_key",name:"ai_api_key",type:"password",autoComplete:"off"}),d.jsx("label",{htmlFor:"ai_model",children:"Model"}),d.jsx("input",{id:"ai_model",name:"ai_model","data-testid":"ai-model",placeholder:"optional override",defaultValue:String(((cn=C.ai)==null?void 0:cn.model)||"")}),d.jsx("label",{htmlFor:"ai_base_url",children:"Base URL"}),d.jsx("input",{id:"ai_base_url",name:"ai_base_url","data-testid":"ai-base-url",placeholder:"optional, OpenAI-compatible",defaultValue:String(((dn=C.ai)==null?void 0:dn.base_url)||"")}),d.jsx("button",{className:"btn primary",type:"submit","data-testid":"btn-save-settings",children:"Save"})]})]})]})]}),d.jsx(z0,{open:pe,actions:Jn,onClose:()=>$e(!1)}),Le?d.jsx(Eb,{initialPath:o,onClose:()=>De(!1),onSelect:P=>{if(tt.current){_("Wait for the current job to finish before switching workspace.");return}De(!1),Ur(P)}}):null]})}function $b({review:e,findings:r,aiNote:o,busy:s,tourIndex:a,onTour:u,onAskAi:c,onCopy:h,onPost:p,onSelect:y,onOpenFile:w,onExport:v,history:g,diff:x,onReopen:S,onWaiver:k}){var E,I,_,j,L,$,F,U,q,te,J,ne,Q,C,V,W,Y;const b=[...new Set(e.confidence.reasons||[])];return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`merge-box ${e.confidence.level}`,children:[d.jsxs("div",{className:`level ${e.confidence.level}`,children:[e.confidence.level.toUpperCase()," — ",e.title]}),b.length?d.jsx("ul",{className:"reasons",children:b.map(M=>d.jsx("li",{children:M},M))}):null,e.what_if?d.jsx("span",{className:"chip whatif","data-testid":"whatif-chip",children:"what-if"}):null,e.low_risk?d.jsx("span",{className:"chip",children:"low-risk"}):null,e.change_kinds.map(M=>d.jsx("span",{className:"chip",children:rs(M)},M)),(E=e.contract_break)!=null&&E.kind&&e.contract_break.kind!=="none"?d.jsxs("span",{className:`chip ${e.contract_break.kind==="breaking"?"blocker":""}`,"data-testid":"contract-kind",children:["contract ",e.contract_break.kind]}):null]}),d.jsxs("div",{className:"metrics",children:[d.jsxs("div",{className:"metric",children:[d.jsxs("div",{className:"n",children:[e.confidence.covered_sinks,"/",e.confidence.sinks]}),d.jsx("div",{className:"l",children:"Sinks tested"})]}),d.jsxs("div",{className:"metric",children:[d.jsx("div",{className:"n",children:r.length}),d.jsx("div",{className:"l",children:"Findings"})]}),d.jsxs("div",{className:"metric",children:[d.jsx("div",{className:"n",children:e.residuals.length}),d.jsx("div",{className:"l",children:"Residuals"})]})]}),d.jsx("pre",{className:"headline",children:e.headline}),(e.checklist||[]).length?d.jsxs("details",{className:"section",open:!0,"data-testid":"merge-checklist",children:[d.jsxs("summary",{children:["Merge checklist"," ",d.jsx("span",{className:"count",children:(e.checklist||[]).filter(M=>M.status==="todo").length})]}),(e.checklist||[]).map(M=>d.jsxs("div",{className:`check-item ${M.status}`,children:[d.jsxs("button",{type:"button",className:"linkish",onClick:()=>M.node_id&&y(M.node_id),children:[d.jsx("span",{className:`chip ${M.status}`,children:M.status}),M.title]}),M.detail?d.jsx("div",{className:"why",children:M.detail}):null,M.body?d.jsx("button",{type:"button",className:"btn",onClick:()=>{navigator.clipboard.writeText(M.body||"")},children:"Copy test"}):null,M.kind==="finding"&&M.status==="todo"&&M.rule?d.jsx("button",{type:"button",className:"btn",onClick:()=>k(M.rule,M.node_id),children:"Waive in loadpath.yml"}):null]},M.id))]}):null,e.index?d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Index ",d.jsx("span",{className:"count",children:e.index.counts.nodes})]}),d.jsxs("div",{className:"muted",children:["Walked ",e.index.counts.nodes," nodes / ",e.index.counts.edges," edges",e.index.reindex_skipped?" from an unchanged index":e.index.reindexed?" after an incremental refresh":" from the existing index",e.index.django_boot&&e.index.django_boot!=="off"?` · Django boot ${e.index.django_boot}`:"",(I=e.workspace)!=null&&I.three_dot?" · three-dot range":""]})]}):null,d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Read this ",d.jsx("span",{className:"count",children:e.read_order.length})]}),e.read_order.map((M,D)=>d.jsxs("div",{className:D===a?"read-item tour-current":"read-item",children:[d.jsxs("button",{type:"button",className:"linkish file",onClick:()=>u(D),children:[D+1,". ",M.path]}),d.jsx("div",{className:"why",children:M.why}),d.jsx("button",{type:"button",className:"btn",onClick:()=>w(M.path),children:"Open"})]},M.path)),e.read_order.length>0?d.jsxs("div",{className:"btn-row tour-row",children:[d.jsx("button",{type:"button",className:"btn","data-testid":"btn-tour-prev",disabled:a<=0,onClick:()=>u(Math.max(0,a-1)),children:"Previous"}),d.jsx("button",{type:"button",className:"btn primary","data-testid":"btn-tour-next",disabled:a>=e.read_order.length-1,onClick:()=>u(Math.min(e.read_order.length-1,a+1)),children:"Next in read order"}),d.jsxs("span",{className:"muted",children:[a+1,"/",e.read_order.length]})]}):null]}),d.jsxs("details",{className:"section",children:[d.jsxs("summary",{children:["Clusters ",d.jsx("span",{className:"count",children:e.clusters.length})]}),e.clusters.map(M=>d.jsxs("div",{className:"muted",children:[d.jsx("strong",{children:M.title})," — ",M.files.join(", ")]},M.id))]}),d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Architecture ",d.jsx("span",{className:"count",children:r.length})]}),r.length===0?d.jsx("div",{className:"muted",children:e.architecture_note}):r.map(M=>d.jsx("div",{className:"finding",children:d.jsxs("button",{type:"button",className:"linkish",onClick:()=>M.node_id&&y(M.node_id),children:[d.jsx("span",{className:`chip ${M.severity}`,children:M.severity}),M.message]})},M.rule+M.message))]}),d.jsx(Ym,{cards:e.deepening}),(j=(_=e.contract_break)==null?void 0:_.reasons)!=null&&j.length?d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Contract ",d.jsx("span",{className:"count",children:e.contract_break.kind})]}),e.contract_break.reasons.map(M=>d.jsx("div",{className:"muted",children:M},M)),($=(L=e.contract_break.sides)==null?void 0:L.rows)!=null&&$.length?d.jsxs("table",{className:"type-table","data-testid":"contract-sides",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Field"}),d.jsx("th",{children:"Serializer"}),d.jsx("th",{children:"Zod"}),d.jsx("th",{children:"GraphQL"})]})}),d.jsx("tbody",{children:e.contract_break.sides.rows.map(M=>d.jsxs("tr",{className:M.status,children:[d.jsx("td",{children:M.field}),d.jsx("td",{children:M.serializer?"yes":"—"}),d.jsx("td",{children:M.zod?"yes":"—"}),d.jsx("td",{children:M.graphql?"yes":"—"})]},M.field))})]}):null]}):null,(F=e.auth)!=null&&F.note?d.jsxs("details",{className:"section",open:!0,children:[d.jsx("summary",{children:"Auth"}),d.jsx("div",{className:"muted",children:e.auth.note}),(e.auth.missing_permissions||[]).map(M=>d.jsxs("div",{className:"finding",children:[d.jsx("span",{className:"chip warning",children:"missing"}),M.name]},M.id))]}):null,(e.suggested_tests||[]).length?d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Suggested tests ",d.jsx("span",{className:"count",children:(U=e.suggested_tests)==null?void 0:U.length})]}),(e.suggested_tests||[]).map(M=>d.jsxs("div",{className:"residual",children:[d.jsx("strong",{children:M.title}),d.jsx("pre",{className:"headline",children:M.body}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{navigator.clipboard.writeText(M.body)},children:"Copy sketch"})]},M.title))]}):null,(q=e.trend)!=null&&q.note?d.jsxs("details",{className:"section",children:[d.jsx("summary",{children:"Confidence trend"}),d.jsx("div",{className:"muted",children:e.trend.note}),(e.trend.points||[]).slice(0,6).map(M=>d.jsxs("div",{className:"muted",children:[M.level," · ",lc(M.created_at),M.sinks!=null?` · ${M.sinks} sinks`:""]},M.id))]}):null,d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Residual ",d.jsx("span",{className:"count",children:e.residuals.length})]}),d.jsx("p",{className:"muted",children:"AI is only used here, on what the graph could not close."}),e.residuals.map(M=>d.jsx("div",{className:"residual muted",children:M},M))]}),g.length?d.jsxs("details",{className:"section","data-testid":"review-history",children:[d.jsxs("summary",{children:["History ",d.jsx("span",{className:"count",children:g.length})]}),x?d.jsx("div",{className:"muted",children:x.note}):null,g.slice(0,12).map(M=>d.jsxs("button",{type:"button",className:M.id===e.id?"history-item current":"history-item",onClick:()=>S(M.id),children:[d.jsx("span",{className:`chip ${M.level||""}`,children:M.level||"walk"}),M.title||M.id.slice(0,8),d.jsx("span",{className:"muted",children:M.created_at?lc(M.created_at):""})]},M.id))]}):null,(J=(te=e.evolution)==null?void 0:te.notes)!=null&&J.length||(Q=(ne=e.evolution)==null?void 0:ne.hotspots)!=null&&Q.some(M=>M.commits)?d.jsxs("details",{className:"section",children:[d.jsx("summary",{children:"Churn & coupling"}),(((C=e.evolution)==null?void 0:C.notes)||[]).map(M=>d.jsx("div",{className:"muted",children:M},M)),(((V=e.evolution)==null?void 0:V.hotspots)||[]).filter(M=>M.commits).slice(0,6).map(M=>d.jsxs("div",{className:"muted",children:[d.jsx("span",{className:"file",children:M.path})," — ",M.commits," commits, bus factor ",M.bus_factor]},M.path))]}):null,d.jsxs("div",{className:"btn-row",children:[d.jsx("button",{type:"button",className:"btn",disabled:s,onClick:c,children:"Ask configured model"}),d.jsx("button",{type:"button",className:"btn","data-testid":"btn-copy-markdown",onClick:h,children:"Copy markdown"}),d.jsx("button",{type:"button",className:"btn","data-testid":"btn-export-html",onClick:v,children:"Save HTML"}),d.jsx("button",{type:"button",className:"btn","data-testid":"btn-post-comment",disabled:s||!!e.what_if,title:e.what_if?"Hypothetical walks are not posted to a pull request":void 0,onClick:p,children:"Post to PR"})]}),o?d.jsx("pre",{className:"headline",children:o}):null,d.jsx("div",{className:"kicker",children:"Reviewers"}),d.jsx("div",{className:"muted",children:e.suggested_reviewers.join(", ")||"—"}),(W=e.codeowners_reviewers)!=null&&W.length?d.jsxs("div",{className:"muted",children:["CODEOWNERS: ",e.codeowners_reviewers.join(", ")]}):null,(Y=e.knowledge_owners)!=null&&Y.length?d.jsxs("div",{className:"muted",children:["Knowledge: ",e.knowledge_owners.join(", ")]}):null]})}function zb({architecture:e,busy:r,onReindex:o,onReview:s,onSelect:a,config:u,health:c,onSaveConfig:h,onWaiver:p}){var w;const y=e.findings.filter(v=>!v.waived);return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"merge-box high",children:[d.jsxs("div",{className:"level high",children:["INDEXED — ",e.counts.nodes," nodes"]}),d.jsxs("div",{className:"muted",style:{marginTop:8},children:[e.indexed_at?`Last index ${lc(e.indexed_at)}`:"Indexed",e.incremental?" · incremental":" · full",e.stale?" · stale":"",e.django_boot&&e.django_boot!=="off"?` · Django boot ${e.django_boot}`:""]}),d.jsxs("span",{className:"chip",children:[e.counts.edges," edges"]}),e.has_config?d.jsx("span",{className:"chip",children:"loadpath.yml"}):null]}),d.jsxs("details",{className:"section",open:!0,children:[d.jsx("summary",{children:"Bounded contexts"}),Object.values(e.contexts).map(v=>d.jsxs("div",{className:"muted",children:[d.jsx("strong",{children:v.name})," — ",(v.django_apps||[]).join(", ")||"no apps"," ·"," ",(v.owners||[]).join(", ")||"unowned"]},v.name))]}),d.jsxs("details",{className:"section",children:[d.jsxs("summary",{children:["Rules ",d.jsx("span",{className:"count",children:(e.rules||[]).length})]}),(e.rules||[]).map(v=>d.jsx("div",{className:"muted",children:v},v))]}),d.jsxs("details",{className:"section",open:!0,children:[d.jsxs("summary",{children:["Findings ",d.jsx("span",{className:"count",children:y.length})]}),y.length===0?d.jsx("div",{className:"muted",children:"No architecture rule hits on the full graph."}):y.map(v=>d.jsx("div",{className:"finding",children:d.jsxs("button",{type:"button",className:"linkish",onClick:()=>v.node_id&&a(v.node_id),children:[d.jsx("span",{className:`chip ${v.severity}`,children:v.severity}),v.message]})},v.rule+v.message))]}),d.jsx(Ym,{cards:e.deepening}),(w=c==null?void 0:c.points)!=null&&w.length?d.jsxs("details",{className:"section",open:!0,"data-testid":"architecture-health",children:[d.jsxs("summary",{children:["Health over time ",d.jsx("span",{className:"count",children:c.points.length})]}),d.jsx("div",{className:"sparkline","aria-hidden":"true",children:c.points.map(v=>d.jsx("i",{className:v.level||"",title:`${v.level} · ${v.findings} findings`,style:{height:`${8+Math.min(24,(v.findings||0)*4)}px`}},v.id||v.created_at))}),Object.entries(c.contexts).map(([v,g])=>{var x;return d.jsxs("div",{className:"muted",children:[d.jsx("strong",{children:v})," — last ",((x=g[g.length-1])==null?void 0:x.findings)??0," findings"]},v)})]}):null,u?d.jsxs("details",{className:"section",open:!0,children:[d.jsx("summary",{children:"loadpath.yml"}),d.jsx(D0,{config:u,busy:r,onSave:h,onWaiver:p})]}):null,d.jsxs("details",{className:"section",open:!0,children:[d.jsx("summary",{children:"Types"}),d.jsx("table",{className:"type-table",children:d.jsx("tbody",{children:Object.entries(e.type_counts||{}).sort((v,g)=>g[1]-v[1]).slice(0,12).map(([v,g])=>d.jsxs("tr",{children:[d.jsx("td",{children:ci(v)}),d.jsx("td",{children:g})]},v))})})]}),d.jsxs("div",{className:"btn-row",children:[d.jsx("button",{type:"button",className:"btn",disabled:r,onClick:o,"data-testid":"btn-full-reindex",children:"Full reindex"}),d.jsx("button",{type:"button",className:"btn primary",disabled:r,onClick:s,children:"Review against this index"})]})]})}function Ym({cards:e}){const r=e||[];return r.length?d.jsxs("details",{className:"section",open:!0,"data-testid":"deepening-list",children:[d.jsxs("summary",{children:["Depth ",d.jsx("span",{className:"count",children:r.length})]}),d.jsx("p",{className:"muted",children:"Deepening opportunities: more behaviour behind a smaller interface, at a real seam."}),r.map(o=>d.jsxs("div",{className:"finding","data-testid":"deepening-card",children:[d.jsx("span",{className:`chip ${o.strength}`,children:O0(o.strength)}),o.top?d.jsx("span",{className:"chip",children:"top"}):null,d.jsx("strong",{children:o.title}),d.jsx("div",{className:"why",children:o.message}),o.deletion_test?d.jsxs("div",{className:"muted",children:["Deletion test: ",o.deletion_test]}):null,o.before&&o.after?d.jsxs("div",{className:"muted",children:[o.before," → ",o.after]}):null]},o.rule+o.title))]}):null}Gm(Um());L0.createRoot(document.getElementById("root")).render(d.jsx(A.StrictMode,{children:d.jsx(Ab,{})}));export{Bb as a,Ob as c,Fb as i,d as j,Hb as l,bN as n,A as r,ci as t}; diff --git a/src/loadpath/static/assets/index-DyJR4VJX.js b/src/loadpath/static/assets/index-DyJR4VJX.js new file mode 100644 index 0000000..098b389 --- /dev/null +++ b/src/loadpath/static/assets/index-DyJR4VJX.js @@ -0,0 +1,14 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){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,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},m={};function h(e){return l.call(m,e)?!0:l.call(p,e)?!1:d.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(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){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(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 t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{V=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?B(e):``}function H(e){switch(e.tag){case 5:return B(e.type);case 16:return B(`Lazy`);case 13:return B(`Suspense`);case 19:return B(`SuspenseList`);case 0:case 2:case 15:return e=te(e.type,!1),e;case 11:return e=te(e.type.render,!1),e;case 1:return e=te(e.type,!0),e;default:return``}}function U(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 E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?U(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return U(e(t))}catch{}}return null}function ne(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return U(t);case 8:return t===D?`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 t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function re(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ie(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ae(e){var t=ie(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oe(e){e._valueTracker||=ae(e)}function se(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ie(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ce(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function le(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ue(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=re(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function de(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function fe(e,t){de(e,t);var n=re(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?me(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&me(e,t.type,re(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function me(e,t,n){(t!==`number`||ce(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var he=Array.isArray;function ge(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=Ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Te(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ee={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},De=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ee).forEach(function(e){De.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ee[t]=Ee[e]})});function Oe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ee.hasOwnProperty(e)&&Ee[e]?(``+t).trim():t+`px`}function ke(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Oe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ae=R({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 je(e,t){if(t){if(Ae[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Me(e,t){if(e.indexOf(`-`)===-1)return typeof t.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 Ne=null;function Pe(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fe=null,Ie=null,Le=null;function Re(e){if(e=Ii(e)){if(typeof Fe!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ri(t),Fe(e.stateNode,e.type,t))}}function ze(e){Ie?Le?Le.push(e):Le=[e]:Ie=e}function Be(){if(Ie){var e=Ie,t=Le;if(Le=Ie=null,Re(e),t)for(e=0;e>>=0,e===0?32:31-(St(e)/Ct|0)|0}var Tt=64,Et=4194304;function Dt(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 Ot(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Dt(a))):r=Dt(s)}else o=n&~i,o===0?a!==0&&(r=Dt(a)):r=Dt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Pt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-xt(t),e[t]=n}function Ft(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Xn),$n=` `,er=!1;function tr(e,t){switch(e){case`keyup`:return Jn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function nr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var rr=!1;function ir(e,t){switch(e){case`compositionend`:return nr(t);case`keypress`:return t.which===32?(er=!0,$n):null;case`textInput`:return e=t.data,e===$n&&er?null:e;default:return null}}function ar(e,t){if(rr)return e===`compositionend`||!Yn&&tr(e,t)?(e=yn(),vn=_n=gn=null,rr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Dr(n)}}function kr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ar(){for(var e=window,t=ce();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ce(e.document)}return t}function jr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Mr(e){var t=Ar(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&kr(n.ownerDocument.documentElement,n)){if(r!==null&&jr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Or(n,a);var o=Or(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,Pr=null,Fr=null,Ir=null,Lr=!1;function Rr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Lr||Pr==null||Pr!==ce(r)||(r=Pr,`selectionStart`in r&&jr(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}),Ir&&Er(Ir,r)||(Ir=r,r=li(Fr,`onSelect`),0Bi||(e.current=zi[Bi],zi[Bi]=null,Bi--)}function J(e,t){Bi++,zi[Bi]=e.current,e.current=t}var Hi={},Ui=Vi(Hi),Wi=Vi(!1),Gi=Hi;function Ki(e,t){var n=e.type.contextTypes;if(!n)return Hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function qi(e){return e=e.childContextTypes,e!=null}function Ji(){q(Wi),q(Ui)}function Yi(e,t,n){if(Ui.current!==Hi)throw Error(r(168));J(Ui,t),J(Wi,n)}function Xi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ne(e)||`Unknown`,a));return R({},n,i)}function Zi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Hi,Gi=Ui.current,J(Ui,e),J(Wi,Wi.current),!0}function Qi(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Xi(e,t,Gi),i.__reactInternalMemoizedMergedChildContext=e,q(Wi),q(Ui),J(Ui,e)):q(Wi),J(Wi,n)}var $i=null,ea=!1,ta=!1;function na(e){$i===null?$i=[e]:$i.push(e)}function ra(e){ea=!0,na(e)}function ia(){if(!ta&&$i!==null){ta=!0;var e=0,t=G;try{var n=$i;for(G=1;e>=o,i-=o,fa=1<<32-xt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Y&&ma(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Y&&ma(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Y&&ma(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Y&&ma(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&Na(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=ja(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===E?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=ja(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(he(i))return h(e,r,i,o);if(ee(i))return g(e,r,i,o);Ma(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Fa=Pa(!0),Ia=Pa(!1),La=Vi(null),Ra=null,za=null,X=null;function Ba(){X=za=Ra=null}function Va(e){var t=La.current;q(La),e._currentValue=t}function Ha(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ua(e,t){Ra=e,X=za=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ns=!0),e.firstContext=null)}function Wa(e){var t=e._currentValue;if(X!==e){if(e={context:e,memoizedValue:t,next:null},za===null){if(Ra===null)throw Error(r(308));za=e,Ra.dependencies={lanes:0,firstContext:e}}else za=za.next=e}return t}var Ga=null;function Ka(e){Ga===null?Ga=[e]:Ga.push(e)}function qa(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ka(t)):(n.next=i.next,i.next=n),t.interleaved=n,Ja(e,r)}function Ja(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ya=!1;function Xa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Za(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Qa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function $a(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Ja(e,n)}return i=r.interleaved,i===null?(t.next=t,Ka(r)):(t.next=i.next,i.next=t),r.interleaved=t,Ja(e,n)}function eo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,It(e,n)}}function to(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function no(e,t,n,r){var i=e.updateQueue;Ya=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=R({},d,f);break a;case 2:Ya=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Jc|=o,e.lanes=o,e.memoizedState=d}}function ro(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=yo.transition;yo.transition={};try{e(!1),t()}finally{G=n,yo.transition=r}}function os(){return No().memoizedState}function ss(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ls(e))us(t,n);else if(n=qa(e,t,n,r),n!==null){var i=fl();ml(n,e,r,i),ds(n,t,r)}}function cs(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ls(e))us(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Tr(s,o)){var c=t.interleaved;c===null?(i.next=i,Ka(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=qa(e,t,i,r),n!==null&&(i=fl(),ml(n,e,r,i),ds(n,t,r))}}function ls(e){var t=e.alternate;return e===xo||t!==null&&t===xo}function us(e,t){To=wo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ds(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,It(e,n)}}var fs={readContext:Wa,useCallback:Oo,useContext:Oo,useEffect:Oo,useImperativeHandle:Oo,useInsertionEffect:Oo,useLayoutEffect:Oo,useMemo:Oo,useReducer:Oo,useRef:Oo,useState:Oo,useDebugValue:Oo,useDeferredValue:Oo,useTransition:Oo,useMutableSource:Oo,useSyncExternalStore:Oo,useId:Oo,unstable_isNewReconciler:!1},ps={readContext:Wa,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:Wa,useEffect:Yo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),qo(4194308,4,$o.bind(null,t,e),n)},useLayoutEffect:function(e,t){return qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return qo(4,2,e,t)},useMemo:function(e,t){var n=Mo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Mo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ss.bind(null,xo,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:Wo,useDebugValue:ts,useDeferredValue:function(e){return Mo().memoizedState=e},useTransition:function(){var e=Wo(!1),t=e[0];return e=as.bind(null,e[1]),Mo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=xo,a=Mo();if(Y){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Vc===null)throw Error(r(349));bo&30||zo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Yo(Vo.bind(null,i,o,e),[e]),i.flags|=2048,Go(9,Bo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Mo(),t=Vc.identifierPrefix;if(Y){var n=pa,r=fa;n=(r&~(1<<32-xt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Eo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ki]=t,e[Ai]=i,rc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Me(n,i),n){case`dialog`:K(`cancel`,e),K(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:K(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<$r.length;o++)K($r[o],e);o=i;break;case`source`:K(`error`,e),o=i;break;case`img`:case`image`:case`link`:K(`error`,e),K(`load`,e),o=i;break;case`details`:K(`toggle`,e),o=i;break;case`input`:ue(e,i),o=le(e,i),K(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),K(`invalid`,e);break;case`textarea`:ve(e,i),o=_e(e,i),K(`invalid`,e);break;default:o=i}for(s in je(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?ke(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&we(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Te(e,u):typeof u==`number`&&Te(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&K(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:oe(e),pe(e,i,!1);break;case`textarea`:oe(e),be(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+re(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&ge(e,!!i.multiple,i.defaultValue,!0):ge(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=gi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return sc(t),null;case 6:if(e&&t.stateNode!=null)ac(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=co(so.current),co(ao.current),Ea(t)){if(i=t.stateNode,n=t.memoizedProps,i[ki]=t,(s=i.nodeValue!==n)&&(e=va,e!==null))switch(e.tag){case 3:hi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&hi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ki]=t,t.stateNode=i}return sc(t),null;case 13:if(q(mo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Y&&ya!==null&&t.mode&1&&!(t.flags&128))Da(),Oa(),t.flags|=98560,s=!1;else if(s=Ea(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[ki]=t}else Oa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;sc(t),s=!1}else ba!==null&&(vl(ba),ba=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||mo.current&1?Kc===0&&(Kc=3):Ol())),t.updateQueue!==null&&(t.flags|=4),sc(t),null);case 4:return uo(),e===null&&ai(t.stateNode.containerInfo),sc(t),null;case 10:return Va(t.type._context),sc(t),null;case 17:return qi(t.type)&&Ji(),sc(t),null;case 19:if(q(mo),s=t.memoizedState,s===null)return sc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)oc(s,!1);else{if(Kc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=ho(e),c!==null){for(t.flags|=128,oc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return J(mo,mo.current&1|2),t.child}e=e.sibling}s.tail!==null&&W()>el&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=ho(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Y)return sc(t),null}else 2*W()-s.renderingStartTime>el&&n!==1073741824&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(sc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=W(),t.sibling=null,n=mo.current,J(mo,i?n&1|2:n&1),t);case 22:case 23:return wl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Wc&1073741824&&(sc(t),t.subtreeFlags&6&&(t.flags|=8192)):sc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function lc(e,t){switch(_a(t),t.tag){case 1:return qi(t.type)&&Ji(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return uo(),q(Wi),q(Ui),_o(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return po(t),null;case 13:if(q(mo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Oa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(mo),null;case 4:return uo(),null;case 10:return Va(t.type._context),null;case 22:case 23:return wl(),null;case 24:return null;default:return null}}var uc=!1,dc=!1,fc=typeof WeakSet==`function`?WeakSet:Set,Z=null;function pc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Rl(e,t,n)}else n.current=null}}function mc(e,t,n){try{n()}catch(n){Rl(e,t,n)}}var hc=!1;function gc(e,t){if(_i=ln,e=Ar(),jr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(vi={focusedElem:e,selectionRange:n},ln=!1,Z=t;Z!==null;)if(t=Z,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:gs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Rl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return h=hc,hc=!1,h}function _c(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&mc(t,n,a)}i=i.next}while(i!==r)}}function vc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function yc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function bc(e){var t=e.alternate;t!==null&&(e.alternate=null,bc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ki],delete t[Ai],delete t[Mi],delete t[Ni],delete t[Pi])),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 xc(e){return e.tag===5||e.tag===3||e.tag===4}function Sc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||xc(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 a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gi));else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}function wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}var Tc=null,Ec=!1;function Dc(e,t,n){for(n=n.child;n!==null;)Oc(e,t,n),n=n.sibling}function Oc(e,t,n){if(yt&&typeof yt.onCommitFiberUnmount==`function`)try{yt.onCommitFiberUnmount(vt,n)}catch{}switch(n.tag){case 5:dc||pc(n,t);case 6:var r=Tc,i=Ec;Tc=null,Dc(e,t,n),Tc=r,Ec=i,Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tc.removeChild(n.stateNode));break;case 18:Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?Ti(e.parentNode,n):e.nodeType===1&&Ti(e,n),sn(e)):Ti(Tc,n.stateNode));break;case 4:r=Tc,i=Ec,Tc=n.stateNode.containerInfo,Ec=!0,Dc(e,t,n),Tc=r,Ec=i;break;case 0:case 11:case 14:case 15:if(!dc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&mc(n,t,o),i=i.next}while(i!==r)}Dc(e,t,n);break;case 1:if(!dc&&(pc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Rl(n,t,e)}Dc(e,t,n);break;case 21:Dc(e,t,n);break;case 22:n.mode&1?(dc=(r=dc)||n.memoizedState!==null,Dc(e,t,n),dc=r):Dc(e,t,n);break;default:Dc(e,t,n)}}function kc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ac(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=W()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Lc(i/1960))-i,10e?16:e,ol===null)var i=!1;else{if(e=ol,ol=null,sl=0,$&6)throw Error(r(331));var a=$;for($|=4,Z=e.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lW()-$c?Tl(e,0):Xc|=n),hl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Et,Et<<=1,!(Et&130023424)&&(Et=4194304)):t=1);var n=fl();e=Ja(e,t),e!==null&&(Pt(e,t,n),hl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Wi.current)Ns=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ns=!1,nc(e,t,n);Ns=!!(e.flags&131072)}}else Ns=!1,Y&&t.flags&1048576&&ha(t,ca,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ec(e,t),e=t.pendingProps;var a=Ki(t,Ui.current);Ua(t,n),a=Ao(null,t,i,e,a,n);var o=jo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,qi(i)?(o=!0,Zi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Xa(t),a.updater=vs,t.stateNode=a,a._reactInternals=t,Ss(t,i,e,n),t=Hs(null,t,i,!0,o,n)):(t.tag=0,Y&&o&&ga(t),Ps(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ec(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=gs(i,e),a){case 0:t=Bs(null,t,i,e,n);break a;case 1:t=Vs(null,t,i,e,n);break a;case 11:t=Fs(null,t,i,e,n);break a;case 14:t=Is(null,t,i,gs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Bs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Vs(e,t,i,a,n);case 3:a:{if(Us(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Za(e,t),no(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Cs(Error(r(423)),t),t=Ws(e,t,i,n,a);break a}if(i!==a){a=Cs(Error(r(424)),t),t=Ws(e,t,i,n,a);break a}for(ya=Ei(t.stateNode.containerInfo.firstChild),va=t,Y=!0,ba=null,n=Ia(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Oa(),i===a){t=tc(e,t,n);break a}Ps(e,t,i,n)}t=t.child}return t;case 5:return fo(t),e===null&&wa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,yi(i,a)?s=null:o!==null&&yi(i,o)&&(t.flags|=32),zs(e,t),Ps(e,t,s,n),t.child;case 6:return e===null&&wa(t),null;case 13:return qs(e,t,n);case 4:return lo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Fa(t,null,i,n):Ps(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Fs(e,t,i,a,n);case 7:return Ps(e,t,t.pendingProps,n),t.child;case 8:return Ps(e,t,t.pendingProps.children,n),t.child;case 12:return Ps(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,J(La,i._currentValue),i._currentValue=s,o!==null){if(Tr(o.value,s)){if(o.children===a.children&&!Wi.current){t=tc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=Qa(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ha(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ha(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Ps(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ua(t,n),a=Wa(a),i=i(a),t.flags|=1,Ps(e,t,i,n),t.child;case 14:return i=t.type,a=gs(i,t.pendingProps),a=gs(i.type,a),Is(e,t,i,a,n);case 15:return Ls(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),ec(e,t),t.tag=1,qi(i)?(e=!0,Zi(t)):e=!1,Ua(t,n),bs(t,i,a),Ss(t,i,a,n),Hs(null,t,i,!0,e,n);case 19:return $s(e,t,n);case 22:return Rs(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return ct(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return Zl(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Kl(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Kl(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Kl(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,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=Nt(0),this.expirationTimes=Nt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xa(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),g=c(u(),1),_=h();function v(e,t=`Request failed`){let n=(e||``).trim();if(!n)return t;try{let e=JSON.parse(n).detail;if(typeof e==`string`&&e.trim())return e;if(Array.isArray(e)){let t=e.map(e=>typeof e==`string`?e:e&&typeof e==`object`&&`msg`in e?String(e.msg):``).filter(Boolean);if(t.length)return t.join(`; `)}}catch{}return n}async function y(e,t){let n=await fetch(e,{...t,headers:{"Content-Type":`application/json`,...t?.headers||{}}});if(!n.ok){let e=await n.text();throw Error(v(e,n.statusText||`Request failed`))}return n.json()}var b=[`github_token`,`gitlab_token`,`gitlab_oauth_client_secret`,`bitbucket_token`,`bitbucket_oauth_client_secret`,`ai_api_key`,`ai_model`,`ai_base_url`],x={health:()=>y(`/api/health`),settings:()=>y(`/api/settings`),saveSettings:e=>{let t={...e};for(let e of b)t[e]===``&&delete t[e];return y(`/api/settings`,{method:`PUT`,body:JSON.stringify(t)})},repos:()=>y(`/api/repos`),browse:e=>y(`/api/fs${e?`?path=${encodeURIComponent(e)}`:``}`),gitRefs:(e,t=50)=>y(`/api/git/refs?repo_path=${encodeURIComponent(e)}&limit=${t}`),index:(e,t=!0)=>y(`/api/index`,{method:`POST`,body:JSON.stringify({repo_path:e,incremental:t})}),indexStatus:e=>y(`/api/index?repo_path=${encodeURIComponent(e)}`),indexProgress:e=>y(`/api/index/progress?repo_path=${encodeURIComponent(e)}`),architecture:(e,t=!0)=>y(`/api/architecture?repo_path=${encodeURIComponent(e)}&graph=${t?`1`:`0`}`),architectureGraph:e=>y(`/api/architecture/graph?repo_path=${encodeURIComponent(e)}`),review:(e,t,n,r=!0,i=!1)=>y(`/api/review`,{method:`POST`,body:JSON.stringify({repo_path:e,base:t,head:n||null,reindex:r,incremental:!0,three_dot:!0,dirty:i})}),whatIf:(e,t)=>y(`/api/whatif`,{method:`POST`,body:JSON.stringify({repo_path:e,node_id:t})}),reviewPr:(e,t,n,r)=>y(`/api/prs/review`,{method:`POST`,body:JSON.stringify({provider:e,repo:t,number:n,repo_path:r||null})}),init:(e,t=!1)=>y(`/api/init`,{method:`POST`,body:JSON.stringify({repo_path:e,overwrite:t})}),postComment:(e,t,n,r)=>y(`/api/prs/comment`,{method:`POST`,body:JSON.stringify({provider:e,repo:t,number:n,markdown:r})}),graph:(e,t=`full`)=>y(`/api/graph?repo_path=${encodeURIComponent(e)}&scope=${t}`),prs:(e,t,n=`open`,r)=>y(`/api/prs`,{method:`POST`,body:JSON.stringify({provider:e,repo:t,state:n,repo_path:r||null})}),scmRepos:e=>y(`/api/scm/repos?provider=${encodeURIComponent(e)}`),oauthStatus:()=>y(`/api/oauth/status`),githubOAuthStart:()=>y(`/api/oauth/github/start`,{method:`POST`,body:`{}`}),githubOAuthPoll:e=>y(`/api/oauth/github/poll`,{method:`POST`,body:JSON.stringify({flow_id:e})}),bitbucketOAuthStart:()=>y(`/api/oauth/bitbucket/start`),gitlabOAuthStart:()=>y(`/api/oauth/gitlab/start`),oauthDisconnect:e=>y(`/api/oauth/disconnect`,{method:`POST`,body:JSON.stringify({provider:e})}),residual:e=>y(`/api/ai/residual`,{method:`POST`,body:JSON.stringify({review:e})}),reviews:e=>y(`/api/reviews?repo_path=${encodeURIComponent(e)}`),getReview:(e,t)=>y(`/api/reviews/${encodeURIComponent(t)}?repo_path=${encodeURIComponent(e)}`),reviewDiff:(e,t,n)=>y(`/api/reviews/${encodeURIComponent(t)}/diff?repo_path=${encodeURIComponent(e)}&other=${encodeURIComponent(n)}`),config:e=>y(`/api/config?repo_path=${encodeURIComponent(e)}`),saveConfig:(e,t)=>y(`/api/config`,{method:`PUT`,body:JSON.stringify({repo_path:e,...t})}),addWaiver:(e,t,n,r)=>y(`/api/config/waiver`,{method:`POST`,body:JSON.stringify({repo_path:e,rule:t,node:n||null,reason:r||``})}),marks:(e,t)=>y(`/api/marks?repo_path=${encodeURIComponent(e)}${t?`&review_id=${encodeURIComponent(t)}`:``}`),architectureHealth:e=>y(`/api/architecture/health?repo_path=${encodeURIComponent(e)}`),workspaceStatus:e=>y(`/api/workspace/status?repo_path=${encodeURIComponent(e)}`),openEditor:(e,t,n,r)=>y(`/api/open`,{method:`POST`,body:JSON.stringify({repo_path:e,path:t,line:n||null,editor:r||null})}),exportHtml:e=>fetch(`/api/export/html`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({review:e})}).then(async e=>{if(!e.ok){let t=await e.text();throw Error(v(t,e.statusText||`Request failed`))}return e.blob()}),isolate:(e,t,n,r)=>y(`/api/graph/isolate`,{method:`POST`,body:JSON.stringify({nodes:e,edges:t,source_id:n,target_id:r||null})})},S=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),C=o(((e,t)=>{t.exports=S()})),w=C();function T(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.label.toLowerCase().includes(n)||(e.hint||``).toLowerCase().includes(n)||(e.group||``).toLowerCase().includes(n)):e}function E({open:e,actions:t,onClose:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(0),s=(0,g.useRef)(null),c=(0,g.useMemo)(()=>T(t,r),[t,r]);if((0,g.useEffect)(()=>{if(!e)return;i(``),o(0);let t=window.setTimeout(()=>s.current?.focus(),0);return()=>window.clearTimeout(t)},[e]),(0,g.useEffect)(()=>{o(0)},[r]),!e)return null;let l=c.slice(0,40),u=l[Math.min(a,Math.max(l.length-1,0))],d=e=>{e&&(n(),e.run())};return(0,w.jsx)(`div`,{className:`palette-scrim`,"data-testid":`command-palette`,onClick:e=>{e.target===e.currentTarget&&n()},children:(0,w.jsxs)(`div`,{className:`palette`,role:`dialog`,"aria-label":`Command palette`,children:[(0,w.jsx)(`input`,{ref:s,"data-testid":`command-palette-input`,placeholder:`Jump to a node, run a review, toggle overlays…`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),n()):e.key===`ArrowDown`?(e.preventDefault(),o(e=>Math.min(Math.max(l.length-1,0),e+1))):e.key===`ArrowUp`?(e.preventDefault(),o(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),d(u))}}),(0,w.jsxs)(`ul`,{children:[l.length===0?(0,w.jsx)(`li`,{className:`muted`,children:`No matches`}):null,l.map((e,t)=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,className:t===a?`active`:``,onMouseEnter:()=>o(t),onClick:()=>d(e),children:[(0,w.jsx)(`span`,{children:e.label}),e.hint?(0,w.jsx)(`span`,{className:`muted`,children:e.hint}):null]})},e.id))]}),(0,w.jsxs)(`div`,{className:`palette-foot muted`,children:[(0,w.jsx)(`kbd`,{children:`↑`}),(0,w.jsx)(`kbd`,{children:`↓`}),` move · `,(0,w.jsx)(`kbd`,{children:`Enter`}),` run · `,(0,w.jsx)(`kbd`,{children:`Esc`}),` close`]})]})})}function D({config:e,busy:t,onSave:n,onWaiver:r}){let[i,a]=(0,g.useState)(e),[o,s]=(0,g.useState)(e.available_rules[0]||``),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(``);(0,g.useEffect)(()=>{a(e)},[e]);let f=Object.entries(i.contexts||{}),p=(e,t,n)=>{let r=i.contexts[e];if(!r)return;let o=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);a({...i,contexts:{...i.contexts,[e]:{...r,[t]:t===`name`?n:o(n)}}})},m=(e,t)=>{let n=t.trim();if(!n||n===e)return;let{[e]:r,...o}=i.contexts;r&&a({...i,contexts:{...o,[n]:{...r,name:n}}})},h=()=>{let e=1;for(;i.contexts[`context-${e}`];)e+=1;let t=`context-${e}`;a({...i,contexts:{...i.contexts,[t]:{name:t,django_apps:[],react:[],public_api:[],owners:[]}}})},_=e=>{let{[e]:t,...n}=i.contexts;a({...i,contexts:n})},v=e=>{let t=i.rules.includes(e);a({...i,rules:t?i.rules.filter(t=>t!==e):[...i.rules,e]})};return(0,w.jsxs)(`div`,{className:`config-editor`,"data-testid":`config-editor`,children:[(0,w.jsx)(`p`,{className:`muted`,children:i.exists?i.path:`No loadpath.yml yet — saving writes one at the repo root.`}),f.map(([e,t])=>(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Context `,(0,w.jsx)(`span`,{className:`count`,children:e})]}),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`Name`}),(0,w.jsx)(`input`,{defaultValue:e,"data-testid":`config-context-name-${e}`,onBlur:t=>m(e,t.target.value)})]}),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`Django apps`}),(0,w.jsx)(`input`,{value:(t.django_apps||[]).join(`, `),onChange:t=>p(e,`django_apps`,t.target.value)})]}),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`React folders`}),(0,w.jsx)(`input`,{value:(t.react||[]).join(`, `),onChange:t=>p(e,`react`,t.target.value)})]}),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`Public API`}),(0,w.jsx)(`input`,{value:(t.public_api||[]).join(`, `),onChange:t=>p(e,`public_api`,t.target.value)})]}),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`Owners`}),(0,w.jsx)(`input`,{value:(t.owners||[]).join(`, `),onChange:t=>p(e,`owners`,t.target.value)})]}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>_(e),children:`Remove context`})]},e)),(0,w.jsx)(`div`,{className:`btn-row`,children:(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`config-add-context`,onClick:h,children:`Add context`})}),(0,w.jsxs)(`details`,{className:`section`,children:[(0,w.jsxs)(`summary`,{children:[`Rules `,(0,w.jsx)(`span`,{className:`count`,children:i.rules.length})]}),(i.available_rules.length?i.available_rules:i.rules).map(e=>(0,w.jsxs)(`label`,{className:`check-row`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:i.rules.includes(e),onChange:()=>v(e)}),e]},e))]}),(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Waivers `,(0,w.jsx)(`span`,{className:`count`,children:(i.waivers||[]).length})]}),(i.waivers||[]).map((e,t)=>(0,w.jsxs)(`div`,{className:`muted`,children:[(0,w.jsx)(`strong`,{children:e.rule}),e.node?` · ${e.node}`:``,e.reason?` — ${e.reason}`:``]},`${e.rule}:${e.node}:${t}`)),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`Rule`}),(0,w.jsx)(`select`,{value:o,onChange:e=>s(e.target.value),children:(i.available_rules.length?i.available_rules:i.rules).map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))})]}),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`Node id (optional)`}),(0,w.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`django.view:…`})]}),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`Reason`}),(0,w.jsx)(`input`,{value:u,onChange:e=>d(e.target.value)})]}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`config-add-waiver`,disabled:t||!o,onClick:()=>r?.(o,c,u),children:`Add waiver`})]}),(0,w.jsx)(`div`,{className:`btn-row`,children:(0,w.jsx)(`button`,{type:`button`,className:`btn primary`,"data-testid":`config-save`,disabled:t,onClick:()=>n(i),children:`Save loadpath.yml`})})]})}function O(e){return e.replaceAll(`_`,` `)}function k(e){return e.replaceAll(`_`,` `)}function A(e){return e.split(`.`).pop()||e}function j(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function M(e){return e.split(/[\\/]/).filter(Boolean).pop()||e}function N(e){return e.replace(/([/\\._:@-])/g,`$1​`)}function P({className:e,children:t}){return(0,w.jsx)(`svg`,{className:e,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:t})}function F({className:e}){return(0,w.jsxs)(P,{className:e,children:[(0,w.jsx)(`path`,{d:`M3 3.5h6.5L13 7v5.5H3z`}),(0,w.jsx)(`path`,{d:`M9.5 3.5V7H13`}),(0,w.jsx)(`path`,{d:`M5.5 9.5h5M5.5 11.5h3.5`})]})}function I({className:e}){return(0,w.jsxs)(P,{className:e,children:[(0,w.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`4.5`,height:`4.5`,rx:`0.8`}),(0,w.jsx)(`rect`,{x:`9`,y:`2.5`,width:`4.5`,height:`4.5`,rx:`0.8`}),(0,w.jsx)(`rect`,{x:`2.5`,y:`9`,width:`4.5`,height:`4.5`,rx:`0.8`}),(0,w.jsx)(`rect`,{x:`9`,y:`9`,width:`4.5`,height:`4.5`,rx:`0.8`})]})}function L({className:e}){return(0,w.jsxs)(P,{className:e,children:[(0,w.jsx)(`circle`,{cx:`4`,cy:`8`,r:`1.6`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`4`,r:`1.6`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.6`}),(0,w.jsx)(`path`,{d:`M5.5 7.2 10.4 4.8M5.5 8.8 10.4 11.2`})]})}function ee({className:e}){return(0,w.jsxs)(P,{className:e,children:[(0,w.jsx)(`circle`,{cx:`4.5`,cy:`4`,r:`1.4`}),(0,w.jsx)(`circle`,{cx:`4.5`,cy:`12`,r:`1.4`}),(0,w.jsx)(`circle`,{cx:`11.5`,cy:`12`,r:`1.4`}),(0,w.jsx)(`path`,{d:`M4.5 5.5v5M4.5 8h4.2a3 3 0 0 1 3 3`})]})}function R({className:e}){return(0,w.jsxs)(P,{className:e,children:[(0,w.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2.1`}),(0,w.jsx)(`path`,{d:`M8 2.5v1.6M8 11.9v1.6M2.5 8h1.6M11.9 8h1.6M4.1 4.1l1.1 1.1M10.8 10.8l1.1 1.1M11.9 4.1l-1.1 1.1M5.2 10.8l-1.1 1.1`})]})}function z({className:e}){return(0,w.jsx)(P,{className:e,children:(0,w.jsx)(`path`,{d:`M2.5 4.5h4L8 6h5.5v6.5h-11z`})})}function B({className:e}){return(0,w.jsx)(P,{className:e,children:(0,w.jsx)(`path`,{d:`M4 6.5 8 10.5 12 6.5`})})}function V(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n{}};function H(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}U.prototype=H.prototype={constructor:U,on:function(e,t){var n=this._,r=ne(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),ae.hasOwnProperty(t)?{space:ae[t],local:e}:e}function se(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function ce(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function le(e){var t=oe(e);return(t.local?ce:se)(t)}function ue(){}function de(e){return e==null?ue:function(){return this.querySelector(e)}}function fe(e){typeof e!=`function`&&(e=de(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function He(e){e||=Ue;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function We(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ge(){return Array.from(this)}function Ke(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?it:typeof t==`function`?ot:at)(e,t,n??``)):ct(this.node(),e)}function ct(e,t){return e.style.getPropertyValue(t)||rt(e).getComputedStyle(e,null).getPropertyValue(t)}function lt(e){return function(){delete this[e]}}function ut(e,t){return function(){this[e]=t}}function dt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function W(e,t){return arguments.length>1?this.each((t==null?lt:typeof t==`function`?dt:ut)(e,t)):this.node()[e]}function ft(e){return e.trim().split(/^|\s+/)}function pt(e){return e.classList||new mt(e)}function mt(e){this._node=e,this._names=ft(e.getAttribute(`class`)||``)}mt.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function ht(e,t){for(var n=pt(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Ut(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function fn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}fn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pn(e){return!e.ctrlKey&&!e.button}function mn(){return this.parentNode}function hn(e,t){return t??{x:e.x,y:e.y}}function gn(){return navigator.maxTouchPoints||`ontouchstart`in this}function _n(){var e=pn,t=mn,n=hn,r=gn,i={},a=H(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,an).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(tn(n.view).on(`mousemove.drag`,m,on).on(`mouseup.drag`,h,on),ln(n.view),sn(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(cn(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){tn(e.view).on(`mousemove.drag mouseup.drag`,null),un(e.view,l),cn(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Bn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Bn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Dn.exec(e))?new Un(t[1],t[2],t[3],1):(t=On.exec(e))?new Un(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kn.exec(e))?Bn(t[1],t[2],t[3],t[4]):(t=An.exec(e))?Bn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jn.exec(e))?Xn(t[1],t[2]/100,t[3]/100,1):(t=Mn.exec(e))?Xn(t[1],t[2]/100,t[3]/100,t[4]):Nn.hasOwnProperty(e)?zn(Nn[e]):e===`transparent`?new Un(NaN,NaN,NaN,0):null}function zn(e){return new Un(e>>16&255,e>>8&255,e&255,1)}function Bn(e,t,n,r){return r<=0&&(e=t=n=NaN),new Un(e,t,n,r)}function Vn(e){return e instanceof bn||(e=Rn(e)),e?(e=e.rgb(),new Un(e.r,e.g,e.b,e.opacity)):new Un}function Hn(e,t,n,r){return arguments.length===1?Vn(e):new Un(e,t,n,r??1)}function Un(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}vn(Un,Hn,yn(bn,{brighter(e){return e=e==null?Sn:Sn**+e,new Un(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xn:xn**+e,new Un(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Un(Jn(this.r),Jn(this.g),Jn(this.b),qn(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:Wn,formatHex:Wn,formatHex8:Gn,formatRgb:Kn,toString:Kn}));function Wn(){return`#${Yn(this.r)}${Yn(this.g)}${Yn(this.b)}`}function Gn(){return`#${Yn(this.r)}${Yn(this.g)}${Yn(this.b)}${Yn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Kn(){let e=qn(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Jn(this.r)}, ${Jn(this.g)}, ${Jn(this.b)}${e===1?`)`:`, ${e})`}`}function qn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Yn(e){return e=Jn(e),(e<16?`0`:``)+e.toString(16)}function Xn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $n(e,t,n,r)}function Zn(e){if(e instanceof $n)return new $n(e.h,e.s,e.l,e.opacity);if(e instanceof bn||(e=Rn(e)),!e)return new $n;if(e instanceof $n)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new $n(o,s,c,e.opacity)}function Qn(e,t,n,r){return arguments.length===1?Zn(e):new $n(e,t,n,r??1)}function $n(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}vn($n,Qn,yn(bn,{brighter(e){return e=e==null?Sn:Sn**+e,new $n(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xn:xn**+e,new $n(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Un(nr(e>=240?e-240:e+120,i,r),nr(e,i,r),nr(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new $n(er(this.h),tr(this.s),tr(this.l),qn(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(){let e=qn(this.opacity);return`${e===1?`hsl(`:`hsla(`}${er(this.h)}, ${tr(this.s)*100}%, ${tr(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function er(e){return e=(e||0)%360,e<0?e+360:e}function tr(e){return Math.max(0,Math.min(1,e||0))}function nr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var rr=e=>()=>e;function ir(e,t){return function(n){return e+n*t}}function ar(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function or(e){return(e=+e)==1?sr:function(t,n){return n-t?ar(t,n,e):rr(isNaN(t)?n:t)}}function sr(e,t){var n=t-e;return n?ir(e,n):rr(isNaN(e)?t:e)}var cr=(function e(t){var n=or(t);function r(e,t){var r=n((e=Hn(e)).r,(t=Hn(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=sr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function lr(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:pr(r,i)})),n=gr.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:pr(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:pr(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:pr(e,n)},{i:s-2,x:pr(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t=0&&e._call.call(void 0,t),e=e._next;--Fr}function Zr(){Hr=(Vr=Wr.now())+Ur,Fr=Ir=0;try{Xr()}finally{Fr=0,$r(),Hr=0}}function Qr(){var e=Wr.now(),t=e-Vr;t>Rr&&(Ur-=t,Vr=e)}function $r(){for(var e,t=zr,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:zr=n);Br=e,ei(r)}function ei(e){Fr||(Ir&&=clearTimeout(Ir),e-Hr>24?(e<1/0&&(Ir=setTimeout(Zr,e-Wr.now()-Ur)),Lr&&=clearInterval(Lr)):(Lr||=(Vr=Wr.now(),setInterval(Qr,Rr)),Fr=1,Gr(Zr)))}function ti(e,t,n){var r=new Jr;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var ni=H(`start`,`end`,`cancel`,`interrupt`),K=[];function ri(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;si(e,n,{name:t,index:r,group:i,on:ni,tween:K,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ii(e,t){var n=oi(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function ai(e,t){var n=oi(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function oi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function si(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Yr(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return ti(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function li(e){return this.each(function(){ci(this,e)})}function ui(e,t){var n,r;return function(){var i=ai(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Bi(e,t,n){var r,i,a=zi(t)?ii:ai;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Vi(e,t){var n=this._id;return arguments.length<2?oi(this.node(),n).on.on(e):this.each(Bi(n,e,t))}function q(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function J(){return this.on(`end.remove`,q(this._id))}function Hi(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=de(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function va(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ya(e,t,n){this.k=e,this.x=t,this.y=n}ya.prototype={constructor:ya,scale:function(e){return e===1?this:new ya(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ya(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Y=new ya(1,0,0);ba.prototype=ya.prototype;function ba(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Y;return e.__zoom}function xa(e){e.stopImmediatePropagation()}function Sa(e){e.preventDefault(),e.stopImmediatePropagation()}function Ca(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function wa(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ta(){return this.__zoom||Y}function Ea(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Da(){return navigator.maxTouchPoints||`ontouchstart`in this}function Oa(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function ka(){var e=Ca,t=wa,n=Oa,r=Ea,i=Da,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Pr,l=H(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Ta).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Ta),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Y.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new ya(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new ya(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new ya(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=tn(this.that).datum();l.call(e,this.that,new va(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=rn(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],ci(this),s.start();Sa(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=tn(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=rn(t,i),l=t.clientX,u=t.clientY;ln(t.view),xa(t),a.mouse=[c,this.__zoom.invert(c)],ci(this),a.start();function d(e){if(Sa(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=rn(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),un(e.view,a.moved),Sa(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=rn(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Sa(r),s>0?tn(this).transition().duration(s).call(x,d,c,r):tn(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(xa(t),s=0;s`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},ja=[[-1/0,-1/0],[1/0,1/0]],Ma=[`Enter`,` `,`Escape`],Na={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},Pa;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Pa||={});var Fa;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Fa||={});var Ia;(function(e){e.Partial=`partial`,e.Full=`full`})(Ia||={});var La={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Ra;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Ra||={});var za;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(za||={});var X;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(X||={});var Ba={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function Va(e){return e===null?null:e?`valid`:`invalid`}var Ha=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,Ua=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),Wa=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Ga=(e,t=[0,0])=>{let{width:n,height:r}=Eo(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ka=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):Wa(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,ao(e,lo(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?so(r):{x:0,y:0,width:0,height:0}},qa=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=ao(n,lo(e)),r=!0)}),r?so(n):{x:0,y:0,width:0,height:0}},Ja=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=fo(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Ya=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Xa(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=Eo(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Za({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Co(qa(Xa(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function Qa({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,Aa.error005());else{let{width:e,height:t}=Eo(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&To(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=To(d)?to(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Aa.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function $a({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Ya(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var eo=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),to=(e={x:0,y:0},t,n)=>({x:eo(e.x,t[0][0],t[1][0]-(n?.width??0)),y:eo(e.y,t[0][1],t[1][1]-(n?.height??0))});function no(e,t,n){let{width:r,height:i}=Eo(n),{x:a,y:o}=n.internals.positionAbsolute;return to(e,[[a,o],[a+r,o+i]],t)}var ro=(e,t,n)=>en?-eo(Math.abs(e-n),1,t)/t:0,io=(e,t,n=15,r=40)=>[ro(e.x,r,t.width-r)*n,ro(e.y,r,t.height-r)*n],ao=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),oo=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),so=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),co=(e,t=[0,0])=>{let{x:n,y:r}=Wa(e)?e.internals.positionAbsolute:Ga(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},lo=(e,t=[0,0])=>{let{x:n,y:r}=Wa(e)?e.internals.positionAbsolute:Ga(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},uo=(e,t)=>so(ao(oo(e),oo(t))),fo=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},po=(e,t)=>fo(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),mo=e=>ho(e.width)&&ho(e.height)&&ho(e.x)&&ho(e.y),ho=e=>!isNaN(e)&&isFinite(e),go=(e,t)=>(e,t)=>{},_o=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),vo=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?_o(s,o):s},yo=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function bo(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xo(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=bo(e,n),i=bo(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=bo(e.top??e.y??0,n),i=bo(e.bottom??e.y??0,n),a=bo(e.left??e.x??0,t),o=bo(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function So(e,t,n,r,i,a){let{x:o,y:s}=yo(e,[t,n,r]),{x:c,y:l}=yo({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Co=(e,t,n,r,i,a)=>{let o=xo(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=eo(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=So(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},wo=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function To(e){return e!=null&&e!==`parent`}function Eo(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Do(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Oo(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function ko(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Ao(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function jo(e){return{...Na,...e||{}}}function Mo(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Ro(e),s=vo({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?_o(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var No=e=>({width:e.offsetWidth,height:e.offsetHeight}),Po=e=>e?.getRootNode?.()||window?.document,Fo=[`INPUT`,`SELECT`,`TEXTAREA`];function Io(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Fo.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Lo=e=>`clientX`in e,Ro=(e,t)=>{let n=Lo(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},zo=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...No(t)}})};function Bo({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Vo(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ho({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case X.Left:return[t-Vo(t-r,a),n];case X.Right:return[t+Vo(r-t,a),n];case X.Top:return[t,n-Vo(n-i,a)];case X.Bottom:return[t,n+Vo(i-n,a)]}}function Uo({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:i,targetPosition:a=X.Top,curvature:o=.25}){let[s,c]=Ho({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Ho({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Bo({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Wo({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n0}var qo=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Jo=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Yo=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Aa.error006()),t;let r=n.getEdgeId||qo,i;return i=Ha(e)?{...e}:{...e,id:r(e)},Jo(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Xo({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Wo({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Zo={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Qo=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.xMath.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function es({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:r=X.Top,center:i,offset:a,stepPosition:o}){let s=Zo[t],c=Zo[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Qo({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Wo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function ts(e,t,n,r){let i=Math.min($o(e,t)/2,$o(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.xe.id===t):e[0])||null}function cs(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function ls(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=cs(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var us=1e3,ds=10,fs={nodeOrigin:[0,0],nodeExtent:ja,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},ps={...fs,checkEquality:!0};function ms(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function hs(e,t,n){let r=ms(fs,n);for(let n of e.values())if(n.parentId)bs(n,e,t,r);else{let e=to(Ga(n,r.nodeOrigin),To(n.extent)?n.extent:r.nodeExtent,Eo(n));n.internals.positionAbsolute=e}}function gs(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function _s(e){return e===`manual`}function vs(e,t,n,r={}){let i=ms(ps,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!_s(i.zIndexMode)?us:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=to(Ga(u,i.nodeOrigin),To(u.extent)?u.extent:i.nodeExtent,Eo(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:gs(u,e),z:xs(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&bs(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function ys(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function bs(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=ms(fs,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ys(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*ds),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Ss(e,u,o,s,a&&!_s(c)?us:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function xs(e,t,n){let r=ho(e.zIndex)?e.zIndex:0;return _s(n)?r:r+(e.selected?t:0)}function Ss(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Eo(e),l=Ga(e,n),u=To(e.extent)?to(l,e.extent,c):l,d=to({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=no(d,c,t));let f=xs(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Cs(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=uo(a.get(n.parentId)?.expandedRect??co(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Eo(a),l=a.origin??r,u=t.x0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width0){let e=Cs(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Ts({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Es(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Ds(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Es(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Es(`target`,s,c,e,i,o),t.set(r.id,r)}}function Os(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Os(n,t):!1}function ks(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function As(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Os(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function js({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Ms({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=_o(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Ns({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=tn(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?oo(qa(s)):null,x=v&&l?Ms({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:_o(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=Qa({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=js({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=io(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Mo(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=As(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=js({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=_n().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Mo(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Ro(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Mo(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Ro(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Ro(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=js({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!ks(t,`.${g}`,v))&&(!_||ks(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Ps(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())po(i,co(e))>0&&r.push(e);return r}var Fs=250;function Is(e,t,n,r){let i=[],a=1/0,o=Ps(e,n,t+Fs);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=os(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function Ls(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...os(o,c,c.position,!0)}:c}function Rs(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function zs(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Bs=()=>!0;function Vs(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Bs,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Po(e.target),E=0,D,{x:O,y:k}=Ro(e),A=Rs(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=Ls(i,A,r,c,t);if(!N)return;let P=Ro(e,j),F=!1,I=null,L=!1,ee=null;function R(){if(!u||!j)return;let[e,t]=io(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(R)}let z={...N,nodeId:i,type:A,position:N.position},B=c.get(i),V={inProgress:!0,isValid:null,from:os(B,z,X.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:B,to:P,toHandle:null,toPosition:Ba[z.position],toNode:null,pointer:P};function te(){M=!0,y(V),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&te();function H(e){if(!M){let{x:t,y:n}=Ro(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;te()}if(!x()||!z){U(e);return}let a=b();P=Ro(e,j),D=Is(vo(P,a,!1,[1,1]),n,c,z),F||=(R(),!0);let s=Hs(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});ee=s.handleDomNode,I=s.connection,L=zs(!!D,s.isValid);let u=c.get(i),f=u?os(u,z,X.Left,!0):V.from,p={...V,from:f,isValid:L,to:s.toHandle&&L?yo({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:Ba[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),V=p}function U(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||ee)&&I&&L&&h?.(I);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,ee=null,T.removeEventListener(`mousemove`,H),T.removeEventListener(`mouseup`,U),T.removeEventListener(`touchmove`,H),T.removeEventListener(`touchend`,U)}}T.addEventListener(`mousemove`,H),T.addEventListener(`mouseup`,U),T.addEventListener(`touchmove`,H),T.addEventListener(`touchend`,U)}function Hs(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Bs,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Ro(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Rs(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Pa.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Ls(t,e,a,u,n,!0)}return _}var Us={onPointerDown:Vs,isValid:Hs};function Ws({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=tn(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&wo()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=ka().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:rn}}var Gs=e=>({x:e.x,y:e.y,zoom:e.k}),Ks=({x:e,y:t,zoom:n})=>Y.translate(e,t).scale(n),qs=(e,t)=>e.target.closest(`.${t}`),Js=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Ys=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xs=(e,t=0,n=Ys,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Zs=e=>{let t=e.ctrlKey&&wo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Qs({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(qs(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=rn(u),t=d*2**Zs(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Fa.Vertical?0:u.deltaX*f,m=i===Fa.Horizontal?0:u.deltaY*f;!wo()&&u.shiftKey&&i!==Fa.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=Gs(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function $s({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=qs(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function ec({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Gs(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function tc({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Js(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Gs(a.transform))}}function nc({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Js(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Gs(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function rc({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(qs(f,`${u}-flow__node`)||qs(f,`${u}-flow__edge`)||qs(f,`${u}-flow__selection`)||qs(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||qs(f,c)&&h||qs(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function ic({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=ka().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=tn(e).call(f);y({x:i.x,y:i.y,zoom:eo(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(Zs);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?br:Pr).transform(Xs(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,panActivationKeyPressed:S=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&v();let k=i&&!C&&!r;f.clickDistance(O?1/0:!ho(D)||D<0?0:D);let A=k?Qs({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):$s({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=ec({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=tc({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=nc({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=rc({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=Ks(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=Ks(e);return await g(n,t),n}function x(e){if(p){let t=Ks(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?ba(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?br:Pr).scaleTo(Xs(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?br:Pr).scaleBy(Xs(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!ho(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var ac;(function(e){e.Line=`line`,e.Handle=`handle`})(ac||={});function oc({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function sc(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function cc(e,t){return Math.max(0,t-e)}function lc(e,t){return Math.max(0,e-t)}function uc(e,t,n){return Math.max(0,t-e,e-n)}function dc(e,t){return e?!t:t}function fc(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=uc(E,h,g),j=uc(D,_,v);if(o){let e=0,t=0;c&&w<0?e=cc(y+w+O,o[0][0]):!c&&w>0&&(e=lc(y+E+O,o[1][0])),l&&T<0?t=cc(b+T+k,o[0][1]):!l&&T>0&&(t=lc(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=lc(y+w,s[0][0]):!c&&w<0&&(e=cc(y+E,s[1][0])),l&&T>0?t=lc(b+T,s[0][1]):!l&&T<0&&(t=cc(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=uc(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?lc(b+k+E/C,o[1][1])*C:cc(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?cc(b+E/C,s[1][1])*C:lc(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=uc(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?lc(y+D*C+O,o[1][0])/C:cc(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?cc(y+D*C,s[1][0])/C:lc(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(dc(c,l)?-w:w)/C:w=(dc(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Z={width:0,height:0,x:0,y:0},pc={...Z,pointerX:0,pointerY:0,aspectRatio:1};function mc(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function hc({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=tn(e),o={controlDirection:sc(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Z},h={...pc};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:sc(e)};let g,_=null,v=[],y,b,x,S=!1,C=_n().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Mo(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=To(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=mc(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Mo(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=fc(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var gc=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),_c=o(((e,t)=>{t.exports=gc()})),vc=o((e=>{var t=u(),n=_c();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),yc=c(o(((e,t)=>{t.exports=vc()}))(),1),bc=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},xc=e=>e?bc(e):bc,{useDebugValue:Sc}=g.default,{useSyncExternalStoreWithSelector:Cc}=yc.default,wc=e=>e;function Tc(e,t=wc,n){let r=Cc(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Sc(r),r}var Ec=(e,t)=>{let n=xc(e),r=(e,r=t)=>Tc(n,e,r);return Object.assign(r,n),r},Dc=(e,t)=>e?Ec(e,t):Ec;function Oc(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}m();var kc=(0,g.createContext)(null),Ac=kc.Provider,jc=Aa.error001(`react`);function Q(e,t){let n=(0,g.useContext)(kc);if(n===null)throw Error(jc);return Tc(n,e,t)}function Mc(){let e=(0,g.useContext)(kc);if(e===null)throw Error(jc);return(0,g.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Nc={display:`none`},Pc={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Fc=`react-flow__node-desc`,Ic=`react-flow__edge-desc`,Lc=`react-flow__aria-live`,Rc=e=>e.ariaLiveMessage,zc=e=>e.ariaLabelConfig;function Bc({rfId:e}){let t=Q(Rc);return(0,w.jsx)(`div`,{id:`${Lc}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Pc,children:t})}function $({rfId:e,disableKeyboardA11y:t}){let n=Q(zc);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{id:`${Fc}-${e}`,style:Nc,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,w.jsx)(`div`,{id:`${Ic}-${e}`,style:Nc,children:n[`edge.a11yDescription.default`]}),!t&&(0,w.jsx)(Bc,{rfId:e})]})}var Vc=(0,g.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,w.jsx)(`div`,{className:V([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Vc.displayName=`Panel`;var Hc=`https://reactflow.dev?utm_source=attribution`;function Uc({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,w.jsx)(Vc,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Hc}`,children:(0,w.jsx)(`a`,{href:Hc,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var Wc=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Gc=e=>e.id;function Kc(e,t){return Oc(e.selectedNodes.map(Gc),t.selectedNodes.map(Gc))&&Oc(e.selectedEdges.map(Gc),t.selectedEdges.map(Gc))}function qc({onSelectionChange:e}){let t=Mc(),{selectedNodes:n,selectedEdges:r}=Q(Wc,Kc);return(0,g.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Jc=e=>!!e.onSelectionChangeHandlers;function Yc({onSelectionChange:e}){let t=Q(Jc);return e||t?(0,w.jsx)(qc,{onSelectionChange:e}):null}var Xc=[0,0],Zc={x:0,y:0,zoom:1},Qc=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],$c=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),el={translateExtent:ja,nodeOrigin:Xc,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function tl(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=Q($c,Oc),l=Mc();(0,g.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=el,s()}),[]);let u=(0,g.useRef)(el);return(0,g.useEffect)(()=>{for(let s of Qc){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:jo(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},Qc.map(t=>e[t])),null}function nl(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function rl(e){let[t,n]=(0,g.useState)(e===`system`?null:e);return(0,g.useEffect)(()=>{if(e!==`system`){n(e);return}let t=nl(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?nl()?.matches?`dark`:`light`:t}var il=typeof document<`u`?document:null;function al(e=null,t={target:il,actInsideInputWithModifier:!0}){let[n,r]=(0,g.useState)(!1),i=(0,g.useRef)(!1),a=(0,g.useRef)(new Set([])),[o,s]=(0,g.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,` +`).replace(` + +`,` ++`).split(` +`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,g.useEffect)(()=>{let n=t?.target??il,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&Io(e))return!1;let n=sl(e.code,s);if(a.current.add(e[n]),ol(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=sl(e.code,s);ol(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function ol(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function sl(e,t){return t.includes(e)?`code`:`key`}var cl=()=>{let e=Mc();return(0,g.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=Co(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return vo(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=yo(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function ll(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)ul(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function ul(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function dl(e,t){return ll(e,t)}function fl(e,t){return ll(e,t)}function pl(e,t){return{id:e,type:`select`,selected:t}}function ml(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(pl(a.id,e)))}return r}function hl({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function gl(e){return{id:e.id,type:`remove`}}var _l=go(`React Flow`,`https://reactflow.dev/`);function vl(e,t,n={}){return Yo(e,t,{...n,onError:n.onError??_l})}var yl=e=>Ua(e),bl=e=>Ha(e);function xl(e){return(0,g.forwardRef)(e)}var Sl=typeof window<`u`?g.useLayoutEffect:g.useEffect;function Cl(e){let[t,n]=(0,g.useState)(BigInt(0)),[r]=(0,g.useState)(()=>wl(()=>n(e=>e+BigInt(1))));return Sl(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function wl(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Tl=(0,g.createContext)(null);function El({children:e}){let t=Mc(),n=Cl((0,g.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=hl({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Cl((0,g.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(hl({items:s,lookup:o}))},[])),i=(0,g.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,w.jsx)(Tl.Provider,{value:i,children:e})}function Dl(){let e=(0,g.useContext)(Tl);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Ol=e=>!!e.panZoom;function kl(){let e=cl(),t=Mc(),n=Dl(),r=Q(Ol),i=(0,g.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=yl(e)?e:n.get(e.id),a=i.parentId?Oo(i.position,i.measured,i.parentId,n,r):i.position;return co({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&yl(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&bl(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await $a({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(gl);o?.(f),c(e)}if(m){let e=d.map(gl);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=mo(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=co(s?r:a),l=po(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=mo(e)?e:a(e);if(!r)return!1;let i=po(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Ka(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??Ao();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,g.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Al=e=>e.selected,jl=typeof window<`u`?window:void 0;function Ml({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=Mc(),{deleteElements:r}=kl(),i=al(e,{actInsideInputWithModifier:!1}),a=al(t,{target:jl});(0,g.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Al),edges:e.filter(Al)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,g.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Nl(e){let t=Mc();(0,g.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=No(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Aa.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Pl={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Fl=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Il({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=Fa.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:_,noPanClassName:v,onViewportChange:y,isControlledViewport:b,paneClickDistance:x,selectionOnDrag:S}){let C=Mc(),T=(0,g.useRef)(null),{userSelectionActive:E,lib:D,connectionInProgress:O}=Q(Fl,Oc),k=al(p),A=(0,g.useRef)();Nl(T);let j=(0,g.useCallback)(e=>{y?.({x:e[0],y:e[1],zoom:e[2]}),b||C.setState({transform:e})},[y,b]);return(0,g.useEffect)(()=>{if(T.current){A.current=ic({domNode:T.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>C.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=C.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=C.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=C.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=A.current.getViewport();return C.setState({panZoom:A.current,transform:[e,t,n],domNode:T.current.closest(`.react-flow`)}),()=>{A.current?.destroy()}}},[]),(0,g.useEffect)(()=>{A.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:k,preventScrolling:m,noPanClassName:v,userSelectionActive:E,noWheelClassName:_,lib:D,onTransformChange:j,connectionInProgress:O,selectionOnDrag:S,paneClickDistance:x})},[e,t,n,r,i,a,o,s,c,k,m,v,E,_,D,j,O,S,x]),(0,w.jsx)(`div`,{className:`react-flow__renderer`,ref:T,style:Pl,children:h})}var Ll=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Rl(){let{userSelectionActive:e,userSelectionRect:t}=Q(Ll,Oc);return e&&t?(0,w.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var zl=(e,t)=>n=>{n.target===t.current&&e?.(n)},Bl=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Vl({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ia.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let _=(0,g.useRef)(0),v=Mc(),{userSelectionActive:y,elementsSelectable:b,dragging:x,panBy:S,autoPanSpeed:C}=Q(Bl,Oc),T=b&&(e||y),E=(0,g.useRef)(null),D=(0,g.useRef)(),O=(0,g.useRef)(new Set),k=(0,g.useRef)(new Set),A=(0,g.useRef)(!1),j=(0,g.useRef)(!1),M=(0,g.useRef)({x:0,y:0}),N=(0,g.useRef)(!1),P=e=>{if(j.current||A.current||v.getState().connection.inProgress){j.current=!1,A.current=!1;return}l?.(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},F=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},I=d?e=>d(e):void 0,L=e=>{j.current&&=(e.stopPropagation(),!1)},ee=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=v.getState();if(D.current=i?.getBoundingClientRect(),!D.current)return;let s=n.target===E.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),j.current=!1;let{x:c,y:l}=Ro(n.nativeEvent,D.current),u=vo({x:c,y:l},a);v.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function R(e,t){let{userSelectionRect:r}=v.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=v.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=yo(d,i),m={startX:d.x,startY:d.y,x:ee.id)),k.current=new Set;let _=u?.selectable??!0;for(let e of O.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??_)&&k.current.add(e)}}ko(h,O.current)||c(ml(a,O.current,!0)),ko(g,k.current)||l(ml(o,k.current)),v.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function z(){if(!i||!D.current)return;let[e,t]=io(M.current,D.current,C);S({x:e,y:t}).then(e=>{if(!j.current||!e){_.current=requestAnimationFrame(z);return}let{x:t,y:n}=M.current;R(t,n),_.current=requestAnimationFrame(z)})}let B=()=>{cancelAnimationFrame(_.current),_.current=0,N.current=!1};(0,g.useEffect)(()=>()=>B(),[]);let te=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=v.getState();if(!D.current||!n)return;let{x:o,y:c}=Ro(e.nativeEvent,D.current);M.current={x:o,y:c};let l=yo({x:n.startX,y:n.startY},r);if(!j.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}j.current=!0,N.current||=(z(),!0),R(o,c)},H=e=>{if(!T){e.target===E.current&&v.getState().connection.inProgress&&(A.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!y&&e.target===E.current&&v.getState().userSelectionRect&&P?.(e),v.setState({userSelectionActive:!1,userSelectionRect:null}),j.current&&(c?.(e),v.setState({nodesSelectionActive:O.current.size>0})),B())},U=e=>{e.target?.releasePointerCapture?.(e.pointerId),B()},ne=r===!0||Array.isArray(r)&&r.includes(0);return(0,w.jsxs)(`div`,{className:V([`react-flow__pane`,{draggable:ne,dragging:x,selection:e}]),onClick:T?void 0:zl(P,E),onContextMenu:zl(F,E),onWheel:zl(I,E),onPointerEnter:T?void 0:f,onPointerMove:T?te:p,onPointerUp:H,onPointerCancel:T?U:void 0,onPointerDownCapture:T?ee:void 0,onClickCapture:T?L:void 0,onPointerLeave:m,ref:E,style:Pl,children:[h,(0,w.jsx)(Rl,{})]})}function Hl({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,Aa.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Ul({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=Mc(),[c,l]=(0,g.useState)(!1),u=(0,g.useRef)();return(0,g.useEffect)(()=>{if(!t)return u.current=Ns({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Hl({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,g.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var Wl=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Gl(){let e=Mc();return(0,g.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Wl(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=_o(t,i));let{position:a,positionAbsolute:s}=Qa({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Kl=(0,g.createContext)(null),ql=Kl.Provider;Kl.Consumer;var Jl=()=>(0,g.useContext)(Kl),Yl=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Xl=(0,g.createContext)(null);function Zl({children:e}){let t=Q(Yl,Oc);return(0,w.jsx)(Xl.Provider,{value:t,children:e})}function Ql(){let e=(0,g.useContext)(Xl);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var $l={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},eu=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return $l;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Pa.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function tu({type:e=`source`,position:t=X.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=Mc(),_=Jl(),{connectOnClick:v,noPanClassName:y,rfId:b}=Ql(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:T,connectionInProcess:E,clickConnectionInProcess:D,valid:O}=Q(eu(_,m,e),Oc);_||g.getState().onError?.(`010`,Aa.error010());let k=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(vl(i,e,{onError:n}))}n?.(i),s?.(i)},A=e=>{if(!_)return;let t=Lo(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Us.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:k,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,w.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:V([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:O,connectionindicator:r&&(!E||T)&&(E||D?a:i)}]),onMouseDown:A,onTouchStart:A,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=Po(t.target),h=n||c,{connection:v,isValid:y}=Us.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&k(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var nu=(0,g.memo)(xl(tu));function ru({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return(0,w.jsxs)(w.Fragment,{children:[e?.label,(0,w.jsx)(nu,{type:`source`,position:n,isConnectable:t})]})}function iu({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:r=X.Bottom}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(nu,{type:`target`,position:n,isConnectable:t}),e?.label,(0,w.jsx)(nu,{type:`source`,position:r,isConnectable:t})]})}function au(){return null}function ou({data:e,isConnectable:t,targetPosition:n=X.Top}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(nu,{type:`target`,position:n,isConnectable:t}),e?.label]})}var su={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},cu={input:ru,default:iu,output:ou,group:au};function lu(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var uu=e=>{let{width:t,height:n,x:r,y:i}=qa(e.nodeLookup,{filter:e=>!!e.selected});return{width:ho(t)?t:null,height:ho(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function du({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=Mc(),{width:i,height:a,transformString:o,userSelectionActive:s}=Q(uu,Oc),c=Gl(),l=(0,g.useRef)(null);(0,g.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Ul({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,w.jsx)(`div`,{className:V([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,w.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(su,e.key)&&(e.preventDefault(),c({direction:su[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var fu=typeof window<`u`?window:void 0,pu=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function mu({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:T,autoPanOnSelection:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,onSelectionContextMenu:M,noWheelClassName:N,noPanClassName:P,disableKeyboardA11y:F,onViewportChange:I,isControlledViewport:L}){let{nodesSelectionActive:ee,userSelectionActive:R}=Q(pu,Oc),z=al(l,{target:fu}),B=al(h,{target:fu}),V=B||T,te=B||b,H=u&&V!==!0,U=z||R||H;return Ml({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,w.jsx)(Il,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:te,panActivationKeyPressed:B,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!z&&V,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,zoomActivationKeyCode:g,preventScrolling:j,noWheelClassName:N,noPanClassName:P,onViewportChange:I,isControlledViewport:L,paneClickDistance:s,selectionOnDrag:H,children:(0,w.jsxs)(Vl,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:V,autoPanOnSelection:E,isSelecting:!!U,selectionMode:d,selectionKeyPressed:z,paneClickDistance:s,selectionOnDrag:H,children:[e,ee&&(0,w.jsx)(du,{onSelectionContextMenu:M,noPanClassName:P,disableKeyboardA11y:F})]})})}mu.displayName=`FlowRenderer`;var hu=(0,g.memo)(mu),gu=e=>t=>e?Ja(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function _u(e){return Q((0,g.useCallback)(gu(e),[e]),Oc)}var vu=e=>e.updateNodeInternals;function yu(){let e=Q(vu),[t]=(0,g.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,g.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function bu({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=Mc(),a=(0,g.useRef)(null),o=(0,g.useRef)(null),s=(0,g.useRef)(e.sourcePosition),c=(0,g.useRef)(e.targetPosition),l=(0,g.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,g.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,g.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,g.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function xu({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=Q(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},Oc),S=y.type||`default`,C=g?.[S]||cu[S];C===void 0&&(v?.(`003`,Aa.error003(S)),S=`default`,C=g?.default||cu.default);let T=!!(y.draggable||s&&y.draggable===void 0),E=!!(y.selectable||c&&y.selectable===void 0),D=!!(y.connectable||l&&y.connectable===void 0),O=!!(y.focusable||u&&y.focusable===void 0),k=Mc(),A=Do(y),j=bu({node:y,nodeType:S,hasDimensions:A,resizeObserver:d}),M=Ul({nodeRef:j,disabled:y.hidden||!T,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:E,nodeClickDistance:_}),N=Gl();if(y.hidden)return null;let P=Eo(y),F=lu(y),I=E||T||t||n||r||i,L=n?e=>n(e,{...b.userNode}):void 0,ee=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,z=a?e=>a(e,{...b.userNode}):void 0,B=o?e=>o(e,{...b.userNode}):void 0,te=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=k.getState();E&&(!r||!T||i>0)&&Hl({id:e,store:k,nodeRef:j}),t&&t(n,{...b.userNode})},H=t=>{if(!(Io(t.nativeEvent)||m)){if(Ma.includes(t.key)&&E){let n=t.key===`Escape`;Hl({id:e,store:k,unselect:n,nodeRef:j})}else if(T&&y.selected&&Object.prototype.hasOwnProperty.call(su,t.key)){t.preventDefault();let{ariaLabelConfig:e}=k.getState();k.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),N({direction:su[t.key],factor:t.shiftKey?4:1})}}},U=()=>{if(m||!j.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=k.getState();i&&(Ja(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+P.width/2,y.position.y+P.height/2,{zoom:t[2]}))};return(0,w.jsx)(`div`,{className:V([`react-flow__node`,`react-flow__node-${S}`,{[p]:T},y.className,{selected:y.selected,selectable:E,parent:x,draggable:T,dragging:M}]),ref:j,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:I?`all`:`none`,visibility:A?`visible`:`hidden`,...y.style,...F},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:ee,onMouseLeave:R,onContextMenu:z,onClick:te,onDoubleClick:B,onKeyDown:O?H:void 0,tabIndex:O?0:void 0,onFocus:O?U:void 0,role:y.ariaRole??(O?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${Fc}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,w.jsx)(ql,{value:e,children:(0,w.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:E,draggable:T,deletable:y.deletable??!0,isConnectable:D,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:M,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...P})})})}var Su=(0,g.memo)(xu),Cu=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function wu(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=Q(Cu,Oc),a=_u(e.onlyRenderVisibleElements),o=yu();return(0,w.jsx)(`div`,{className:`react-flow__nodes`,style:Pl,children:a.map(a=>(0,w.jsx)(Su,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}wu.displayName=`NodeRenderer`;var Tu=(0,g.memo)(wu);function Eu(e){return Q((0,g.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Ko({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),Oc)}var Du=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,w.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},Ou=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,w.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},ku={[za.Arrow]:Du,[za.ArrowClosed]:Ou};function Au(e){let t=Mc();return(0,g.useMemo)(()=>Object.prototype.hasOwnProperty.call(ku,e)?ku[e]:(t.getState().onError?.(`009`,Aa.error009(e)),null),[e])}var ju=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Au(t);return c?(0,w.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,w.jsx)(c,{color:n,strokeWidth:o})}):null},Mu=({defaultColor:e,rfId:t})=>{let n=Q(e=>e.edges),r=Q(e=>e.defaultEdgeOptions),i=(0,g.useMemo)(()=>ls(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,w.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,w.jsx)(`defs`,{children:i.map(e=>(0,w.jsx)(ju,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Mu.displayName=`MarkerDefinitions`;var Nu=(0,g.memo)(Mu);function Pu({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,g.useState)({x:1,y:0,width:0,height:0}),p=V([`react-flow__edge-textwrapper`,l]),m=(0,g.useRef)(null);return(0,g.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,w.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,w.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,w.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Pu.displayName=`EdgeText`;var Fu=(0,g.memo)(Pu);function Iu({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`path`,{...u,d:e,fill:`none`,className:V([`react-flow__edge-path`,u.className])}),l?(0,w.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&ho(t)&&ho(n)?(0,w.jsx)(Fu,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Lu({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===X.Left||e===X.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Ru({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:i,targetPosition:a=X.Top}){let[o,s]=Lu({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Lu({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Bo({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function zu(e){return(0,g.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Ru({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,w.jsx)(Iu,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Bu=zu({isInternal:!1}),Vu=zu({isInternal:!0});Bu.displayName=`SimpleBezierEdge`,Vu.displayName=`SimpleBezierEdgeInternal`;function Hu(e){return(0,g.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=X.Bottom,targetPosition:m=X.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=ns({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,w.jsx)(Iu,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var Uu=Hu({isInternal:!1}),Wu=Hu({isInternal:!0});Uu.displayName=`SmoothStepEdge`,Wu.displayName=`SmoothStepEdgeInternal`;function Gu(e){return(0,g.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,w.jsx)(Uu,{...n,id:r,pathOptions:(0,g.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Ku=Gu({isInternal:!1}),qu=Gu({isInternal:!0});Ku.displayName=`StepEdge`,qu.displayName=`StepEdgeInternal`;function Ju(e){return(0,g.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Xo({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,w.jsx)(Iu,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var Yu=Ju({isInternal:!1}),Xu=Ju({isInternal:!0});Yu.displayName=`StraightEdge`,Xu.displayName=`StraightEdgeInternal`;function Zu(e){return(0,g.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=X.Bottom,targetPosition:s=X.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Uo({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,w.jsx)(Iu,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var Qu=Zu({isInternal:!1}),$u=Zu({isInternal:!0});Qu.displayName=`BezierEdge`,$u.displayName=`BezierEdgeInternal`;var ed={default:$u,straight:Xu,step:qu,smoothstep:Wu,simplebezier:Vu},td={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},nd=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,rd=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,id=`react-flow__edgeupdater`;function ad({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,w.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:V([id,`${id}-${s}`]),cx:nd(t,r,e),cy:rd(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function od({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=Mc(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Us.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,w.jsxs)(w.Fragment,{children:[(e===!0||e===`source`)&&(0,w.jsx)(ad,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,w.jsx)(ad,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function sd({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:_,onError:v,disableKeyboardA11y:y}){let b=Q(t=>t.edgeLookup.get(e)),x=Q(e=>e.defaultEdgeOptions);b=x?{...x,...b}:b;let S=b.type||`default`,C=h?.[S]||ed[S];C===void 0&&(v?.(`011`,Aa.error011(S)),S=`default`,C=h?.default||ed.default);let T=!!(b.focusable||t&&b.focusable===void 0),E=d!==void 0&&(b.reconnectable||n&&b.reconnectable===void 0),D=!!(b.selectable||r&&b.selectable===void 0),O=(0,g.useRef)(null),[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(!1),N=Mc(),{zIndex:P=b.zIndex,sourceX:F,sourceY:I,targetX:L,targetY:ee,sourcePosition:R,targetPosition:z}=Q((0,g.useCallback)(t=>{let n=t.nodeLookup.get(b.source),r=t.nodeLookup.get(b.target);if(!n||!r)return td;let i=is({id:e,sourceNode:n,targetNode:r,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:t.connectionMode,onError:v}),a=Go({selected:b.selected,zIndex:b.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||td,zIndex:a}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex,v]),Oc),B=(0,g.useMemo)(()=>b.markerStart?`url('#${cs(b.markerStart,m)}')`:void 0,[b.markerStart,m]),te=(0,g.useMemo)(()=>b.markerEnd?`url('#${cs(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||F===null||I===null||L===null||ee===null)return null;let H=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=N.getState();D&&(N.setState({nodesSelectionActive:!1}),b.selected&&a?(r({nodes:[],edges:[b]}),O.current?.blur()):n([e])),i&&i(t,b)},U=a?e=>{a(e,{...b})}:void 0,ne=o?e=>{o(e,{...b})}:void 0,re=s?e=>{s(e,{...b})}:void 0,ie=c?e=>{c(e,{...b})}:void 0,ae=l?e=>{l(e,{...b})}:void 0;return(0,w.jsx)(`svg`,{style:{zIndex:P},children:(0,w.jsxs)(`g`,{className:V([`react-flow__edge`,`react-flow__edge-${S}`,b.className,_,{selected:b.selected,animated:b.animated,inactive:!D&&!i,updating:k,selectable:D}]),onClick:H,onDoubleClick:U,onContextMenu:ne,onMouseEnter:re,onMouseMove:ie,onMouseLeave:ae,onKeyDown:T?t=>{if(!y&&Ma.includes(t.key)&&D){let{unselectNodesAndEdges:n,addSelectedEdges:r}=N.getState();t.key===`Escape`?(O.current?.blur(),n({edges:[b]})):r([e])}}:void 0,tabIndex:T?0:void 0,role:b.ariaRole??(T?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":T?`${Ic}-${m}`:void 0,ref:O,...b.domAttributes,children:[!j&&(0,w.jsx)(C,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:D,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:F,sourceY:I,targetX:L,targetY:ee,sourcePosition:R,targetPosition:z,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:B,markerEnd:te,pathOptions:`pathOptions`in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),E&&(0,w.jsx)(od,{edge:b,isReconnectable:E,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:F,sourceY:I,targetX:L,targetY:ee,sourcePosition:R,targetPosition:z,setUpdateHover:A,setReconnecting:M})]})})}var cd=(0,g.memo)(sd),ld=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ud({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=Q(ld,Oc),b=Eu(t);return(0,w.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,w.jsx)(Nu,{defaultColor:e,rfId:n}),b.map(e=>(0,w.jsx)(cd,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}ud.displayName=`EdgeRenderer`;var dd=(0,g.memo)(ud),fd=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function pd({children:e}){let t=Mc(),n=(0,g.useRef)(null),[r]=(0,g.useState)(()=>t.getState().transform);return Sl(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=fd(r)))};return r(),t.subscribe(r)},[t]),(0,w.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:fd(r)},children:e})}function md(e){let t=kl(),n=(0,g.useRef)(!1);(0,g.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var hd=e=>e.panZoom?.syncViewport;function gd(e){let t=Q(hd),n=Mc();return(0,g.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function _d(e){return e.connection.inProgress?{...e.connection,to:vo(e.connection.to,e.transform)}:{...e.connection}}function vd(e){return e?t=>e(_d(t)):_d}function yd(e){return Q(vd(e),Oc)}var bd=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function xd({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=Q(bd,Oc);return a&&i&&c?(0,w.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,w.jsx)(`g`,{className:V([`react-flow__connection`,Va(s)]),children:(0,w.jsx)(Sd,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Sd=({style:e,type:t=Ra.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=yd();if(!i)return;if(n)return(0,w.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Va(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Ra.Bezier:[m]=Uo(h);break;case Ra.SimpleBezier:[m]=Ru(h);break;case Ra.Step:[m]=ns({...h,borderRadius:0});break;case Ra.SmoothStep:[m]=ns(h);break;default:[m]=Xo(h)}return(0,w.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};Sd.displayName=`ConnectionLine`;var Cd={};function wd(e=Cd){(0,g.useRef)(e),Mc(),(0,g.useEffect)(()=>{},[e])}function Td(){Mc(),(0,g.useRef)(!1),(0,g.useEffect)(()=>{},[])}function Ed({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:T,onlyRenderVisibleElements:E,elementsSelectable:D,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,preventScrolling:M,defaultMarkerColor:N,zoomOnScroll:P,zoomOnPinch:F,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:ee,zoomOnDoubleClick:R,panOnDrag:z,autoPanOnSelection:B,onPaneClick:V,onPaneMouseEnter:te,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneScroll:ne,onPaneContextMenu:re,paneClickDistance:ie,nodeClickDistance:ae,onEdgeContextMenu:oe,onEdgeMouseEnter:se,onEdgeMouseMove:ce,onEdgeMouseLeave:le,reconnectRadius:ue,onReconnect:de,onReconnectStart:fe,onReconnectEnd:pe,noDragClassName:me,noWheelClassName:he,noPanClassName:ge,disableKeyboardA11y:_e,nodeExtent:ve,rfId:ye,viewport:be,onViewportChange:xe,nodesDraggable:Se}){return wd(e),wd(t),Td(),md(n),gd(be),(0,w.jsx)(hu,{onPaneClick:V,onPaneMouseEnter:te,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneContextMenu:re,onPaneScroll:ne,paneClickDistance:ie,deleteKeyCode:T,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:D,zoomOnScroll:P,zoomOnPinch:F,zoomOnDoubleClick:R,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:ee,panOnDrag:z,autoPanOnSelection:B,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,onSelectionContextMenu:d,preventScrolling:M,noDragClassName:me,noWheelClassName:he,noPanClassName:ge,disableKeyboardA11y:_e,onViewportChange:xe,isControlledViewport:!!be,children:(0,w.jsxs)(pd,{children:[(0,w.jsx)(dd,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:de,onReconnectStart:fe,onReconnectEnd:pe,onlyRenderVisibleElements:E,onEdgeContextMenu:oe,onEdgeMouseEnter:se,onEdgeMouseMove:ce,onEdgeMouseLeave:le,reconnectRadius:ue,defaultMarkerColor:N,noPanClassName:ge,disableKeyboardA11y:_e,rfId:ye}),(0,w.jsx)(xd,{style:h,type:m,component:g,containerStyle:_}),(0,w.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,w.jsx)(Tu,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ae,onlyRenderVisibleElements:E,noPanClassName:ge,noDragClassName:me,disableKeyboardA11y:_e,nodeExtent:ve,rfId:ye,nodesDraggable:Se}),(0,w.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}Ed.displayName=`GraphView`;var Dd=(0,g.memo)(Ed),Od=go(`React Flow`,`https://reactflow.dev/`),kd=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??ja;Ds(h,g,_);let{nodesInitialized:x}=vs(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=Co(qa(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:ja,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Pa.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...La},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Od,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Na,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Ad=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>Dc((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Za({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...kd({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=vs(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();Ds(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=ws(e,n,r,i,a,o,l);d&&(hs(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=os(e,o.fromHandle,X.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Cs(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(dl(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(fl(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>pl(e,!0)));return}i(ml(r,new Set([...e]),!0)),a(ml(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>pl(e,!0)));return}a(ml(n,new Set([...e]))),i(ml(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(pl(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(pl(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,pl(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,pl(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(vs(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return Ts({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...La}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...kd()})}},Object.is);function jd({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,g.useState)(()=>Ad({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,w.jsx)(Ac,{value:m,children:(0,w.jsx)(El,{children:(0,w.jsx)(Zl,{children:p})})})}function Md({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,g.useContext)(kc)?(0,w.jsx)(w.Fragment,{children:e}):(0,w.jsx)(jd,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var Nd={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Pd({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:_,onClickConnectEnd:v,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:x,onNodeContextMenu:S,onNodeDoubleClick:C,onNodeDragStart:T,onNodeDrag:E,onNodeDragStop:D,onNodesDelete:O,onEdgesDelete:k,onDelete:A,onSelectionChange:j,onSelectionDragStart:M,onSelectionDrag:N,onSelectionDragStop:P,onSelectionContextMenu:F,onSelectionStart:I,onSelectionEnd:L,onBeforeDelete:ee,connectionMode:R,connectionLineType:z=Ra.Bezier,connectionLineStyle:B,connectionLineComponent:te,connectionLineContainerStyle:H,deleteKeyCode:U=`Backspace`,selectionKeyCode:ne=`Shift`,selectionOnDrag:re=!1,selectionMode:ie=Ia.Full,panActivationKeyCode:ae=`Space`,multiSelectionKeyCode:oe=wo()?`Meta`:`Control`,zoomActivationKeyCode:se=wo()?`Meta`:`Control`,snapToGrid:ce,snapGrid:le,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:de,nodesDraggable:fe,autoPanOnNodeFocus:pe,nodesConnectable:me,nodesFocusable:he,nodeOrigin:ge=Xc,edgesFocusable:_e,edgesReconnectable:ve,elementsSelectable:ye=!0,defaultViewport:be=Zc,minZoom:xe=.5,maxZoom:Se=2,translateExtent:Ce=ja,preventScrolling:we=!0,nodeExtent:Te,defaultMarkerColor:Ee=`#b1b1b7`,zoomOnScroll:De=!0,zoomOnPinch:Oe=!0,panOnScroll:ke=!1,panOnScrollSpeed:Ae=.5,panOnScrollMode:je=Fa.Free,zoomOnDoubleClick:Me=!0,panOnDrag:Ne=!0,onPaneClick:Pe,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be=1,nodeClickDistance:Ve=0,children:He,onReconnect:Ue,onReconnectStart:We,onReconnectEnd:Ge,onEdgeContextMenu:Ke,onEdgeDoubleClick:qe,onEdgeMouseEnter:Je,onEdgeMouseMove:Ye,onEdgeMouseLeave:Xe,reconnectRadius:Ze=10,onNodesChange:Qe,onEdgesChange:$e,noDragClassName:et=`nodrag`,noWheelClassName:tt=`nowheel`,noPanClassName:nt=`nopan`,fitView:rt,fitViewOptions:it,connectOnClick:at,attributionPosition:ot,proOptions:st,defaultEdgeOptions:ct,elevateNodesOnSelect:lt=!0,elevateEdgesOnSelect:ut=!1,disableKeyboardA11y:dt=!1,autoPanOnConnect:W,autoPanOnNodeDrag:ft,autoPanOnSelection:pt=!0,autoPanSpeed:mt,connectionRadius:ht,isValidConnection:gt,onError:_t,style:vt,id:yt,nodeDragThreshold:bt,connectionDragThreshold:xt,viewport:St,onViewportChange:Ct,width:wt,height:Tt,colorMode:Et=`light`,debug:Dt,onScroll:Ot,ariaLabelConfig:kt,zIndexMode:At=`basic`,...jt},Mt){let Nt=yt||`1`,Pt=rl(Et),Ft=(0,g.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Ot?.(e)},[Ot]);return(0,w.jsx)(`div`,{"data-testid":`rf__wrapper`,...jt,onScroll:Ft,style:{...vt,...Nd},ref:Mt,className:V([`react-flow`,i,Pt]),id:yt,role:`application`,children:(0,w.jsxs)(Md,{nodes:e,edges:t,width:wt,height:Tt,fitView:rt,fitViewOptions:it,minZoom:xe,maxZoom:Se,nodeOrigin:ge,nodeExtent:Te,zIndexMode:At,children:[(0,w.jsx)(tl,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:_,onClickConnectEnd:v,nodesDraggable:fe,autoPanOnNodeFocus:pe,nodesConnectable:me,nodesFocusable:he,edgesFocusable:_e,edgesReconnectable:ve,elementsSelectable:ye,elevateNodesOnSelect:lt,elevateEdgesOnSelect:ut,minZoom:xe,maxZoom:Se,nodeExtent:Te,onNodesChange:Qe,onEdgesChange:$e,snapToGrid:ce,snapGrid:le,connectionMode:R,translateExtent:Ce,connectOnClick:at,defaultEdgeOptions:ct,fitView:rt,fitViewOptions:it,onNodesDelete:O,onEdgesDelete:k,onDelete:A,onNodeDragStart:T,onNodeDrag:E,onNodeDragStop:D,onSelectionDrag:N,onSelectionDragStart:M,onSelectionDragStop:P,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:nt,nodeOrigin:ge,rfId:Nt,autoPanOnConnect:W,autoPanOnNodeDrag:ft,autoPanSpeed:mt,onError:_t,connectionRadius:ht,isValidConnection:gt,selectNodesOnDrag:de,nodeDragThreshold:bt,connectionDragThreshold:xt,onBeforeDelete:ee,debug:Dt,ariaLabelConfig:kt,zIndexMode:At}),(0,w.jsx)(Dd,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:x,onNodeContextMenu:S,onNodeDoubleClick:C,nodeTypes:a,edgeTypes:o,connectionLineType:z,connectionLineStyle:B,connectionLineComponent:te,connectionLineContainerStyle:H,selectionKeyCode:ne,selectionOnDrag:re,selectionMode:ie,deleteKeyCode:U,multiSelectionKeyCode:oe,panActivationKeyCode:ae,zoomActivationKeyCode:se,onlyRenderVisibleElements:ue,defaultViewport:be,translateExtent:Ce,minZoom:xe,maxZoom:Se,preventScrolling:we,zoomOnScroll:De,zoomOnPinch:Oe,zoomOnDoubleClick:Me,panOnScroll:ke,panOnScrollSpeed:Ae,panOnScrollMode:je,panOnDrag:Ne,autoPanOnSelection:pt,onPaneClick:Pe,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be,nodeClickDistance:Ve,onSelectionContextMenu:F,onSelectionStart:I,onSelectionEnd:L,onReconnect:Ue,onReconnectStart:We,onReconnectEnd:Ge,onEdgeContextMenu:Ke,onEdgeDoubleClick:qe,onEdgeMouseEnter:Je,onEdgeMouseMove:Ye,onEdgeMouseLeave:Xe,reconnectRadius:Ze,defaultMarkerColor:Ee,noDragClassName:et,noWheelClassName:tt,noPanClassName:nt,rfId:Nt,disableKeyboardA11y:dt,nodeExtent:Te,viewport:St,onViewportChange:Ct,nodesDraggable:fe}),(0,w.jsx)(Yc,{onSelectionChange:j}),He,(0,w.jsx)(Uc,{proOptions:st,position:ot}),(0,w.jsx)($,{rfId:Nt,disableKeyboardA11y:dt})]})})}var Fd=xl(Pd);Aa.error014();function Id({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,w.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:V([`react-flow__background-pattern`,n,r])})}function Ld({radius:e,className:t}){return(0,w.jsx)(`circle`,{cx:e,cy:e,r:e,className:V([`react-flow__background-pattern`,`dots`,t])})}var Rd;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(Rd||={});var zd={[Rd.Dots]:1,[Rd.Lines]:1,[Rd.Cross]:6},Bd=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Vd({id:e,variant:t=Rd.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,g.useRef)(null),{transform:f,patternId:p}=Q(Bd,Oc),m=r||zd[t],h=t===Rd.Dots,_=t===Rd.Cross,v=Array.isArray(n)?n:[n,n],y=[v[0]*f[2]||1,v[1]*f[2]||1],b=m*f[2],x=Array.isArray(a)?a:[a,a],S=_?[b,b]:y,C=[x[0]*f[2]+S[0]/2,x[1]*f[2]+S[1]/2],T=`${p}${e||``}`;return(0,w.jsxs)(`svg`,{className:V([`react-flow__background`,l]),style:{...c,...Pl,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,w.jsx)(`pattern`,{id:T,x:f[0]%y[0],y:f[1]%y[1],width:y[0],height:y[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${C[0]},-${C[1]})`,children:h?(0,w.jsx)(Ld,{radius:b/2,className:u}):(0,w.jsx)(Id,{dimensions:S,lineWidth:i,variant:t,className:u})}),(0,w.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${T})`})]})}Vd.displayName=`Background`;var Hd=(0,g.memo)(Vd);function Ud(){return(0,w.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,w.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function Wd(){return(0,w.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,w.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function Gd(){return(0,w.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,w.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function Kd(){return(0,w.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,w.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function qd(){return(0,w.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,w.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function Jd({children:e,className:t,...n}){return(0,w.jsx)(`button`,{type:`button`,className:V([`react-flow__controls-button`,t]),...n,children:e})}var Yd=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Xd({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=Mc(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=Q(Yd,Oc),{zoomIn:y,zoomOut:b,fitView:x}=kl();return(0,w.jsxs)(Vc,{className:V([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Jd,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,w.jsx)(Ud,{})}),(0,w.jsx)(Jd,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,w.jsx)(Wd,{})})]}),n&&(0,w.jsx)(Jd,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,w.jsx)(Gd,{})}),r&&(0,w.jsx)(Jd,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,w.jsx)(qd,{}):(0,w.jsx)(Kd,{})}),u]})}Xd.displayName=`Controls`;var Zd=(0,g.memo)(Xd);function Qd({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,w.jsx)(`rect`,{className:V([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var $d=(0,g.memo)(Qd),ef=e=>e.nodes.map(e=>e.id),tf=e=>e instanceof Function?e:()=>e;function nf({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=$d,onClick:o}){let s=Q(ef,Oc),c=tf(t),l=tf(e),u=tf(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,w.jsx)(w.Fragment,{children:s.map(e=>(0,w.jsx)(af,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function rf({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=Q(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=Eo(r);return{node:r,x:i,y:a,width:o,height:s}},Oc);return!l||l.hidden||!Do(l)?null:(0,w.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var af=(0,g.memo)(rf),of=(0,g.memo)(nf),sf=200,cf=150,lf=e=>!e.hidden,uf=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?uo(qa(e.nodeLookup,{filter:lf}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},df=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ff=(e,t)=>df(e.viewBB,t.viewBB)&&df(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,pf=`react-flow__minimap-desc`;function mf({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:_=!1,ariaLabel:v,inversePan:y,zoomStep:b=1,offsetScale:x=5}){let S=Mc(),C=(0,g.useRef)(null),{boundingRect:T,viewBB:E,rfId:D,panZoom:O,translateExtent:k,flowWidth:A,flowHeight:j,ariaLabelConfig:M}=Q(uf,ff),N=e?.width??sf,P=e?.height??cf,F=T.width/N,I=T.height/P,L=Math.max(F,I),ee=L*N,R=L*P,z=x*L,B=T.x-(ee-T.width)/2-z,te=T.y-(R-T.height)/2-z,H=ee+z*2,U=R+z*2,ne=`${pf}-${D}`,re=(0,g.useRef)(0),ie=(0,g.useRef)();re.current=L,(0,g.useEffect)(()=>{if(C.current&&O)return ie.current=Ws({domNode:C.current,panZoom:O,getTransform:()=>S.getState().transform,getViewScale:()=>re.current}),()=>{ie.current?.destroy()}},[O]),(0,g.useEffect)(()=>{ie.current?.update({translateExtent:k,width:A,height:j,inversePan:y,pannable:h,zoomStep:b,zoomable:_})},[h,_,y,b,k,A,j]);let ae=p?e=>{let[t,n]=ie.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,oe=m?(0,g.useCallback)((e,t)=>{let n=S.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,se=v??M[`minimap.ariaLabel`];return(0,w.jsx)(Vc,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*L:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:V([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,w.jsxs)(`svg`,{width:N,height:P,viewBox:`${B} ${te} ${H} ${U}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ne,ref:C,onClick:ae,children:[se&&(0,w.jsx)(`title`,{id:ne,children:se}),(0,w.jsx)(of,{onClick:oe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,w.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${B-z},${te-z}h${H+z*2}v${U+z*2}h${-H-z*2}z + M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}mf.displayName=`MiniMap`;var hf=(0,g.memo)(mf),gf=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,_f={[ac.Line]:`right`,[ac.Handle]:`bottom-right`};function vf({nodeId:e,position:t,variant:n=ac.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:_,onResizeEnd:v}){let y=Jl(),b=typeof e==`string`?e:y,x=Mc(),S=(0,g.useRef)(null),C=n===ac.Handle,T=Q((0,g.useCallback)(gf(C&&p),[C,p]),Oc),E=(0,g.useRef)(null),D=t??_f[n];(0,g.useEffect)(()=>{if(!(!S.current||!b))return E.current||=hc({domNode:S.current,nodeId:b,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=x.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=x.getState(),o=[],s={x:e.x,y:e.y},c=r.get(b);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Cs([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Oo({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:b,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:b,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:b,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};x.getState().triggerNodeChanges([n])}}),E.current.update({controlPosition:D,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:_,onResizeEnd:v,shouldResize:m}),()=>{E.current?.destroy()}},[D,s,c,l,u,d,h,_,v,m]);let O=D.split(`-`);return(0,w.jsx)(`div`,{className:V([`react-flow__resize-control`,`nodrag`,...O,n,r]),ref:S,style:{...i,scale:T,...o&&{[C?`backgroundColor`:`borderColor`]:o}},children:a})}(0,g.memo)(vf);var yf={"arch.context":0,"django.app":0,"django.route":1,"django.websocket_route":1,"fastapi.route":1,"django.url_name":2,"django.view":3,"django.viewset_action":3,"django.permission":3,"django.throttle":3,"django.serializer":4,"django.form":4,"graphql.type":4,"fastapi.model":4,"django.serializer_field":5,"django.service":5,"graphql.field":5,"django.model":6,"django.field":7,"django.relation":7,"django.task":8,"django.receiver":8,"django.signal":8,"django.test":8,"django.migration_op":8,"django.admin":8,"django.management_command":8,"django.consumer":8,"django.cache_key":8,"django.feature_flag":8,"django.side_effect":8,"openapi.path":9,"graphql.operation":9,"react.api_client":10,"django.htmx":10,"react.query_key":11,"react.hook":11,"react.feature":11,"react.route":12,"react.page":12,"react.server_action":12,"django.template":12,"react.component":13,"react.context":13,"react.form_schema":14,"react.test":14};function bf(e){return yf[e]??8}var xf=8;function Sf(e){if(!e.length)return NaN;let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}function Cf(e,t=[]){let n=new Map;if(!e.length)return n;let r=new Map;for(let t of e){let e=bf(t.type),n=r.get(e)??[];n.push(t),r.set(e,n)}let i=[...r.keys()].sort((e,t)=>e-t).map(e=>[...r.get(e)??[]].sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id))),a=new Set(e.map(e=>e.id)),o=new Map,s=new Map;for(let t of e)o.set(t.id,[]),s.set(t.id,[]);for(let e of t)!a.has(e.src)||!a.has(e.dst)||e.src===e.dst||(s.get(e.src).push(e.dst),o.get(e.dst).push(e.src));let c=new Map;i.forEach((e,t)=>{for(let n of e)c.set(n.id,t)});let l=new Map,u=()=>{for(let e of i)e.forEach((e,t)=>l.set(e.id,t))};u();let d=(e,t)=>{let n=e.map((e,n)=>{let r=Sf(t(e.id).map(e=>l.get(e)).filter(e=>e!==void 0));return{n:e,bary:Number.isNaN(r)?n:r,name:e.name,id:e.id}});return n.sort((e,t)=>e.bary-t.bary||e.name.localeCompare(t.name)||e.id.localeCompare(t.id)),n.map(e=>e.n)},f=e=>t=>c.get(t)===e;for(let e=0;e(o.get(t)??[]).filter(f(e-1))),u();for(let e=i.length-2;e>=0;e--)i[e]=d(i[e],t=>(s.get(t)??[]).filter(f(e+1))),u()}let p=Math.max(...i.map(e=>e.length),1),m=[],h=0;for(let e=0;ee.id)),r=new Set((i[e+1]??[]).map(e=>e.id)),a=0;if(r.size)for(let e of t)n.has(e.src)&&r.has(e.dst)&&(a+=1);let o=Math.min(120,Math.max(0,(a-2)*12));h+=296+o}return i.forEach((e,t)=>{let r=(p-e.length)*92/2;e.forEach((e,i)=>{n.set(e.id,{x:m[t]??0,y:r+i*92})})}),n}var wf=[{id:`layers`,label:`Architecture layers`},{id:`flow`,label:`Edge flow`},{id:`tree`,label:`Spanning tree`},{id:`radial`,label:`Radial`},{id:`concentric`,label:`Concentric layers`},{id:`circle`,label:`Circle`},{id:`clusters`,label:`Type clusters`},{id:`grid`,label:`Compact grid`},{id:`force`,label:`Force directed`}],Tf=new Set(wf.map(e=>e.id)),Ef=`loadpath.graphLayout`,Df=8,Of=64,kf=240,Af=296,jf=92,Mf=new Set([`django.route`,`react.route`,`react.page`,`react.server_action`,`django.task`,`django.migration_op`,`django.permission`,`openapi.path`,`django.consumer`,`django.websocket_route`,`django.template`,`graphql.operation`,`fastapi.route`]);function Nf(e=()=>document.createElement(`canvas`)){try{let t=e(),n=t.getContext(`webgl2`)||t.getContext(`webgl`)||t.getContext(`experimental-webgl`);return n?((n.getExtension?.(`WEBGL_lose_context`))?.loseContext(),!0):!1}catch{return!1}}function Pf(e,t,n){return e===`3d`&&t==null&&n!==!0?`2d`:e}var Ff=new Set([`django.field`,`django.serializer_field`,`django.relation`,`django.test`,`react.test`,`graphql.field`,`django.url_name`,`django.throttle`]),If={"arch.context":`#edf2f4`,"django.app":`#8d99ae`,"django.route":`#4cc9f0`,"django.url_name":`#4cc9f0`,"django.view":`#4895ef`,"django.viewset_action":`#4361ee`,"django.permission":`#7b8cde`,"django.serializer":`#f4a261`,"django.form":`#e9c46a`,"django.serializer_field":`#e9c46a`,"django.service":`#90be6d`,"django.model":`#2a9d8f`,"django.field":`#8ac926`,"django.task":`#e76f51`,"django.receiver":`#e85d04`,"django.signal":`#f4a261`,"django.test":`#6c757d`,"django.admin":`#adb5bd`,"django.migration_op":`#9d4edd`,"django.consumer":`#e76f51`,"django.websocket_route":`#4cc9f0`,"django.template":`#c77dff`,"django.htmx":`#ff6b6b`,"django.cache_key":`#6c757d`,"django.feature_flag":`#f4a261`,"django.side_effect":`#e85d04`,"graphql.type":`#00bbf9`,"graphql.operation":`#00bbf9`,"fastapi.route":`#4cc9f0`,"fastapi.model":`#f4a261`,"openapi.path":`#00bbf9`,"react.api_client":`#ff6b6b`,"react.query_key":`#adb5bd`,"react.hook":`#7b2cbf`,"react.feature":`#9d4edd`,"react.route":`#c77dff`,"react.page":`#c77dff`,"react.server_action":`#e76f51`,"react.component":`#9d4edd`,"react.form_schema":`#ffd166`,"react.test":`#6c757d`},Lf=160,Rf=.42,zf=100,Bf=.45,Vf=.8,Hf={0:`context`,1:`routes`,2:`url names`,3:`views`,4:`serializers`,5:`services`,6:`models`,7:`fields`,8:`jobs / signals`,9:`openapi`,10:`api client`,11:`hooks`,12:`pages`,13:`components`,14:`forms / tests`};function Uf(e){return e.startsWith(`react.`)?`react`:e.startsWith(`openapi.`)||e.startsWith(`graphql.`)||e.startsWith(`fastapi.`)?`stitch`:e.startsWith(`arch.`)?`arch`:`django`}function Wf(e){return If[e]?If[e]:e.startsWith(`react.`)?`#9d4edd`:e.startsWith(`openapi.`)?`#00bbf9`:`#4a5568`}function Gf(e,t=typeof navigator<`u`&&!!navigator.webdriver){return t?`2d`:e>=90?`3d`:`2d`}function Kf(e){return e>=90?`overview`:`full`}function qf(e,t,n=1){let r=new Set([e]),i=new Set([e]);for(let e=0;en.families.has(Uf(e.type)));n.detail===`overview`&&(r=r.filter(e=>!Ff.has(e.type)));let i=new Set(r.map(e=>e.id)),a=t.filter(e=>i.has(e.src)&&i.has(e.dst)),o=n.focusId?qf(n.focusId,a,1):new Set;if(n.neighborhoodOnly&&n.focusId&&o.size){r=r.filter(e=>o.has(e.id));let e=new Set(r.map(e=>e.id));return{nodes:r,edges:a.filter(t=>e.has(t.src)&&e.has(t.dst)),neighborIds:o}}return{nodes:r,edges:a,neighborIds:o}}function Yf(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>`${e.name} ${e.qualified_name} ${e.type} ${e.file_path||``} ${e.context||``}`.toLowerCase().includes(n)).slice(0,24):[]}function Xf(e,t,n,r){let i=new Set(e.map(e=>e.id));if(!i.has(n))return{nodeIds:new Set,edgeIds:new Set};let a=new Map,o=new Map;for(let e of t){if(!i.has(e.src)||!i.has(e.dst))continue;let t=a.get(e.src)??[];t.push({dst:e.dst,id:e.id}),a.set(e.src,t);let n=o.get(e.dst)??[];n.push({src:e.src,id:e.id}),o.set(e.dst,n)}let s=new Set(e.filter(e=>Mf.has(e.type)).map(e=>e.id)),c=r&&i.has(r)?new Set([r]):s.size?s:i,l=new Set,u=[n];for(;u.length;){let e=u.pop();if(!l.has(e)){l.add(e);for(let t of a.get(e)??[])l.has(t.dst)||u.push(t.dst)}}let d=new Set([n]),f=[...c].filter(e=>l.has(e)),p=new Set(f);for(;f.length;){let e=f.pop();d.add(e);for(let t of o.get(e)??[])l.has(t.src)&&!p.has(t.src)&&(p.add(t.src),f.push(t.src))}let m=new Set;for(let e of t)d.has(e.src)&&d.has(e.dst)&&m.add(e.id);return{nodeIds:d,edgeIds:m}}var Zf=16,Qf=28;function $f(e){return(e.context||``).trim()}function ep(e){return e.confidence!e&&t?1:e&&!t?-1:e.localeCompare(t));let s=new Map(a.map((e,t)=>[e,t])),c=(a.length-1)/2,l=up(n),u=[...new Set([...r.values()].map(e=>e.x))].sort((e,t)=>e-t),d=new Map(u.map((e,t)=>[e,t]));for(let t of e){let e=r.get(t.id)??{x:0,y:0},n=((s.get($f(t))??0)-c)*zf;if(l){let r=d.get(e.x)??0;i.set(t.id,{x:r*Lf,y:-e.y*Rf,z:n})}else i.set(t.id,{x:e.x*Bf,y:-e.y*Bf,z:n})}return i}function rp(e){return e===`layers`||e===`flow`?`slab`:e===`radial`||e===`concentric`||e===`circle`?`ring`:`none`}function ip(e,t,n=`layers`){if(!e.length)return[];let r=rp(n);if(r===`none`)return[];if(r===`ring`)return sp(e,t);let i=new Map;for(let n of e){let e=Math.round((t.get(n.id)?.x??0)*10)/10,r=i.get(e)??[];r.push(n),i.set(e,r)}return[...i.entries()].sort((e,t)=>e[0]-t[0]).map(([,e])=>op(e,t,n))}function ap(e,t){let n=new Map;for(let t of e){let e=bf(t.type);n.set(e,(n.get(e)||0)+1)}let r=-1,i=0;for(let[e,t]of n)t>i&&(r=e,i=t);return t===`flow`&&ie[0]-t[0]).map(([,e])=>{let n=0,r=0;for(let i of e){let e=t.get(i.id)??{x:0,y:0,z:0};n+=Math.hypot(e.x,e.y),r+=e.z}let i=n/e.length;return{shape:`ring`,x:0,y:0,z:r/e.length,extentY:0,extentZ:0,radius:i,label:i<12?``:ap(e,`radial`),count:e.length}}).filter(e=>e.radius>=12)}function cp(){try{if(typeof localStorage>`u`)return`layers`;let e=localStorage.getItem(Ef);return e&&Tf.has(e)?e:`layers`}catch{return`layers`}}function lp(e){try{if(typeof localStorage>`u`)return;localStorage.setItem(Ef,e)}catch{}}function up(e){return e===`layers`||e===`flow`}function dp(e){if(!e.length)return NaN;let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}function fp(e,t){return e.name.localeCompare(t.name)||e.id.localeCompare(t.id)}function pp(e,t){return bf(e.type)-bf(t.type)||fp(e,t)}function mp(e,t,n){e.forEach((r,i)=>{let a=-Math.PI/2+2*Math.PI*i/Math.max(e.length,1);n.set(r.id,{x:Math.cos(a)*t,y:Math.sin(a)*t})})}function hp(e,t){return Math.max(t*Af,e<=1?t===0?0:208:e*kf/(2*Math.PI))}function gp(e,t){let n=new Map;if(!e.length)return n;let r=new Set(e.flat().map(e=>e.id)),i=new Map,a=new Map;for(let t of e.flat())i.set(t.id,[]),a.set(t.id,[]);for(let e of t)!r.has(e.src)||!r.has(e.dst)||e.src===e.dst||(a.get(e.src).push(e.dst),i.get(e.dst).push(e.src));let o=new Map;e.forEach((e,t)=>{for(let n of e)o.set(n.id,t)});let s=new Map,c=()=>{for(let t of e)t.forEach((e,t)=>s.set(e.id,t))};c();let l=(e,t)=>{let n=e.map((e,n)=>{let r=dp(t(e.id).map(e=>s.get(e)).filter(e=>e!==void 0));return{n:e,bary:Number.isNaN(r)?n:r,name:e.name,id:e.id}});return n.sort((e,t)=>e.bary-t.bary||e.name.localeCompare(t.name)||e.id.localeCompare(t.id)),n.map(e=>e.n)},u=e=>t=>o.get(t)===e;for(let t=0;t(i.get(e)??[]).filter(u(t-1))),c();for(let t=e.length-2;t>=0;t--)e[t]=l(e[t],e=>(a.get(e)??[]).filter(u(t+1))),c()}let d=Math.max(...e.map(e=>e.length),1);return e.forEach((e,t)=>{let r=(d-e.length)*92/2;e.forEach((e,i)=>{n.set(e.id,{x:t*296,y:r+i*92})})}),n}function _p(e,t){let n=new Set(e.map(e=>e.id)),r=Math.max(e.length-1,0),i=new Map;for(let t of e)i.set(t.id,0);for(let a=0;a(i.get(a.dst)||0)&&(i.set(a.dst,t),e=!0)}if(!e)break}let a=new Map;for(let t of e){let e=i.get(t.id)||0,n=a.get(e)??[];n.push(t),a.set(e,n)}return gp([...a.keys()].sort((e,t)=>e-t).map(e=>(a.get(e)??[]).sort(fp)),t)}function vp(e,t){let n=new Map;if(!e.length)return n;let r=new Set(e.map(e=>e.id)),i=new Map,a=new Map;for(let t of e)i.set(t.id,[]),a.set(t.id,0);for(let e of t)!r.has(e.src)||!r.has(e.dst)||e.src===e.dst||(i.get(e.src).push(e.dst),i.get(e.dst).push(e.src),a.set(e.src,(a.get(e.src)||0)+1),a.set(e.dst,(a.get(e.dst)||0)+1));let o=[...e].sort((e,t)=>(a.get(t.id)||0)-(a.get(e.id)||0)||fp(e,t))[0]??e[0],s=new Map,c=[[o]];s.set(o.id,0);let l=[o];for(;l.length;){let t=l.shift(),n=s.get(t.id)||0,r=(i.get(t.id)??[]).map(t=>e.find(e=>e.id===t)).filter(e=>!!e).sort(fp);for(let e of r){if(s.has(e.id))continue;s.set(e.id,n+1);let t=c[n+1]??[];t.push(e),c[n+1]=t,l.push(e)}}let u=e.filter(e=>!s.has(e.id)).sort(fp);return u.length&&c.push(u),c.forEach((e,t)=>{if(t===0&&e.length===1){n.set(e[0].id,{x:0,y:0});return}let r=Math.max(t*296,e.length<=1?208:e.length*240/(2*Math.PI));e.forEach((t,i)=>{let a=-Math.PI/2+2*Math.PI*i/e.length;n.set(t.id,{x:Math.cos(a)*r,y:Math.sin(a)*r})})}),n}function yp(e){let t=new Map,n=[...e].sort((e,t)=>bf(e.type)-bf(t.type)||fp(e,t)),r=Math.max(1,Math.ceil(Math.sqrt(n.length)));return n.forEach((e,n)=>{t.set(e.id,{x:n%r*296,y:Math.floor(n/r)*92})}),t}function bp(e){let t=new Map,n=[...e].sort(pp);return n.length<=1?(n[0]&&t.set(n[0].id,{x:0,y:0}),t):(mp(n,hp(n.length,1),t),t)}function xp(e){let t=new Map;if(!e.length)return t;let n=new Map;for(let t of e){let e=bf(t.type),r=n.get(e)??[];r.push(t),n.set(e,r)}return[...n.keys()].sort((e,t)=>e-t).forEach((e,r)=>{let i=(n.get(e)??[]).sort(fp);if(r===0&&i.length===1){t.set(i[0].id,{x:0,y:0});return}mp(i,hp(i.length,r===0?1:r),t)}),t}function Sp(e){let t=new Map;if(!e.length)return t;let n=new Map;for(let t of e){let e=n.get(t.type)??[];e.push(t),n.set(t.type,e)}let r=[...n.keys()].sort((e,t)=>bf(e)-bf(t)||e.localeCompare(t)).map(e=>{let t=(n.get(e)??[]).sort(fp),r=Math.max(1,Math.ceil(Math.sqrt(t.length))),i=Math.ceil(t.length/r);return{members:t,cols:r,width:Math.max(0,r-1)*Af,height:Math.max(0,i-1)*jf}}),i=Math.max(...r.map(e=>Math.hypot(e.width,e.height)/2+208),208),a=r.length<=1?0:Math.max(Af,r.length*(i*2+88)/(2*Math.PI));return r.forEach((e,n)=>{let i=r.length===1?0:-Math.PI/2+2*Math.PI*n/r.length,o=Math.cos(i)*a,s=Math.sin(i)*a;e.members.forEach((n,r)=>{let i=r%e.cols,a=Math.floor(r/e.cols);t.set(n.id,{x:o-e.width/2+i*Af,y:s-e.height/2+a*jf})})}),t}function Cp(e,t){let n=new Map;if(!e.length)return n;let r=new Map(e.map(e=>[e.id,e])),i=new Set(r.keys()),a=new Map,o=new Map;for(let t of e)a.set(t.id,[]),o.set(t.id,0);for(let e of t)!i.has(e.src)||!i.has(e.dst)||e.src===e.dst||(a.get(e.src).push(e.dst),o.set(e.dst,(o.get(e.dst)||0)+1));for(let[e,t]of a){let n=[...new Set(t)];n.sort((e,t)=>fp(r.get(e),r.get(t))),a.set(e,n)}let s=e.filter(e=>(o.get(e.id)||0)===0).sort(fp);if(!s.length){let t=[...e].sort((e,t)=>(a.get(t.id)?.length||0)-(a.get(e.id)?.length||0)||fp(e,t))[0];s.push(t)}let c=new Set,l=new Map;for(let t of e)l.set(t.id,[]);let u=e=>{c.add(e);for(let t of a.get(e)??[])c.has(t)||(l.get(e).push(t),u(t))};for(let e of s)c.has(e.id)||u(e.id);for(let t of[...e].sort(fp))c.has(t.id)||(s.push(t),u(t.id));let d=0,f=(e,t)=>{let r=l.get(e)??[];if(!r.length){n.set(e,{x:d*Af,y:t*jf}),d+=1;return}let i=d;for(let e of r)f(e,t+1);n.set(e,{x:(i+d-1)/2*Af,y:t*jf})};for(let e of s)n.has(e.id)||f(e.id,0);return n}function wp(e,t){for(let n=0;n<8;n++)for(let n=0;ne.id)),s=[],c=new Set;for(let e of t){if(!o.has(e.src)||!o.has(e.dst)||e.src===e.dst)continue;let t=e.src[e.id,e])),i=[];kp.has(e.type)&&i.push(`sink`),Ap.has(e.type)&&i.push(`contract`);let a=e.extra??{};a.inferred&&i.push(`inferred`),a.generated&&i.push(`generated`),a.mutation&&i.push(`mutation`),a.fbv&&i.push(`function view`),a.ninja&&i.push(`ninja`),a.ninja_schema&&i.push(`ninja schema`),a.next_app&&i.push(`app router`),a.typed_client&&i.push(String(a.typed_client)),a.e2e&&i.push(`e2e`),a.filterset===!0&&i.push(`filterset`);let o=n.filter(t=>t.dst===e.id),s=n.filter(t=>t.src===e.id),c=o.slice(0,Dp).map(e=>Vp(e,r,e.src)),l=s.slice(0,Dp).map(e=>Vp(e,r,e.dst)),u=e.file_path?`${e.file_path}${e.start_line?`:${e.start_line}`:``}`:void 0,d={type:e.type,typeLabel:O(A(e.type)),layer:Hf[bf(e.type)]??`other`,purpose:Lp(e.type),name:e.name,qualifiedName:e.qualified_name,file:u,context:e.context,roles:i,facts:Hp(a).filter(t=>t.key!==`app`||t.value!==e.context),inputs:c,outputs:l,extraInputs:Math.max(0,o.length-Dp),extraOutputs:Math.max(0,s.length-Dp),degreeIn:o.length,degreeOut:s.length,inputKinds:zp(o.map(e=>Vp(e,r,e.src))),outputKinds:zp(s.map(e=>Vp(e,r,e.dst))),pathSummary:``};return d.pathSummary=Bp(d),d}function zp(e){let t=new Map;for(let n of e){let e=n.edgeLabel||n.edgeType.replaceAll(`_`,` `);t.set(e,(t.get(e)||0)+1)}return[...t.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>({label:e,count:t}))}function Bp(e){let t=e.inputKinds.map(e=>`${e.label} ×${e.count}`).join(`, `),n=e.outputKinds.map(e=>`${e.label} ×${e.count}`).join(`, `);return t&&n?`${t} → this → ${n}`:n?`this → ${n}`:t?`${t} → this`:``}function Vp(e,t,n){let r=t.get(n),i=n.includes(`:`)?n.slice(n.indexOf(`:`)+1):n;return{id:n,name:r?.name||i,type:r?.type||``,typeLabel:r?O(A(r.type)):``,edgeType:e.type,edgeLabel:O(e.type),inferred:e.confidence<.8}}function Hp(e){let t=[...Np.filter(t=>t in e),...Object.keys(e).filter(e=>!Np.includes(e)&&!Pp.has(e))],n=[],r=new Set;for(let i of t){if(r.has(i)||Pp.has(i)||Ip.has(i))continue;r.add(i);let t=Up(i,e[i]);t!=null&&n.push({key:i,label:Mp[i]??O(i),value:t})}return n}function Up(e,t){if(t==null)return null;if(typeof t==`boolean`)return!t&&!Fp.has(e)?null:t?`yes`:`no`;if(typeof t==`number`)return String(t);if(typeof t==`string`)return t.trim()||null;if(Array.isArray(t)){if(t.some(e=>e&&typeof e==`object`))return Wp(e,t);let n=t.map(e=>typeof e==`string`||typeof e==`number`?String(e):``).filter(Boolean);if(!n.length)return null;let r=n.slice(0,Op),i=n.length-r.length;return i>0?`${r.join(`, `)} +${i} more`:r.join(`, `)}return null}function Wp(e,t){let n=t.slice(0,4).map(t=>{if(e===`nplusone`){let e=String(t.queryset||`queryset`),n=Array.isArray(t.accessed)?t.accessed.join(`.`):``,r=t.line?` L${t.line}`:``;return n?`${e} → ${n}${r}`:`${e}${r}`}if(e===`lookups`){let e=Array.isArray(t.fields)?t.fields.join(`, `):``,n=String(t.kind||`filter`);return e?`${n} ${e}`:n}return Object.entries(t).filter(([,e])=>e!=null&&(typeof e==`string`||typeof e==`number`)).slice(0,3).map(([e,t])=>`${e}=${t}`).join(` `)});if(!n.some(Boolean))return null;let r=t.length-n.length;return r>0?`${n.join(`; `)} +${r} more`:n.join(`; `)}var Gp=12,Kp=.2,qp=20,Jp=64;function Yp(e,t,n){let r=n??Cf(e,t),i=[...new Set([...r.values()].map(e=>e.x))].sort((e,t)=>e-t),a=[];for(let e of t){let t=r.get(e.src),n=r.get(e.dst);if(!t||!n)continue;let i=t.y+32,o=n.y+32;if(Math.abs(i-o)e.y0-t.y0||e.y1-t.y1||e.id.localeCompare(t.id)),n=Qp(t),r=Math.max(0,...n.values())+1,a=t[0].sourceX,o=Xp(i,a);for(let e of t){let t=$p(n.get(e.id)??0,r),i=a+qp+Math.max(1,o-40)*t;s.set(e.id,Zp(e.sourceX,e.targetX,i))}}return s}function Xp(e,t){let n=t-208,r=e.find(e=>e>n+1);return r===void 0?88:Math.max(88,r-t)}function Zp(e,t,n){let r=t-e-40;return r<1?.5:Math.min(1,Math.max(0,(n-e-qp)/r))}function Qp(e){let t=[],n=new Map;for(let r of e){let e=-1;for(let n=0;nt[n]+Jp){e=n;break}e<0?(e=t.length,t.push(r.y1)):t[e]=Math.max(t[e],r.y1),n.set(r.id,e)}return n}function $p(e,t){return t<=1?.5:Kp+.6000000000000001*e/(t-1)}var em=`modulepreload`,tm=function(e,t){return new URL(e,t).href},nm={},rm=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=tm(t,n),t=s(t),t in nm)return;nm[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:em,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},im=new Set,am=(0,g.lazy)(()=>rm(()=>import(`./LayeredGraph3D-HVYd3pFj.js`).then(e=>({default:e.LayeredGraph3D})),[],import.meta.url)),om=class extends g.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}},sm=(0,w.jsx)(`p`,{className:`muted graph-3d-hint`,"data-testid":`graph-3d-fallback`,children:`WebGL is unavailable in this browser, so the 3D view cannot start. Switch back to 2D map.`}),cm={cheap:`var(--edge-cheap)`,expensive:`var(--edge-expensive)`,critical:`var(--edge-critical)`},lm={n:X.Top,e:X.Right,s:X.Bottom,w:X.Left};function um(e,t){let n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>=Math.abs(r)?n>=0?{source:`e`,target:`w`}:{source:`w`,target:`e`}:r>=0?{source:`s`,target:`n`}:{source:`n`,target:`s`}}function dm({data:e,selected:t}){let n=(e.roles||[]).map(e=>`role-${e}`).join(` `);return(0,w.jsxs)(`div`,{className:[`lp-node`,t?`selected`:``,e.dim?`dim`:``,n].filter(Boolean).join(` `),children:[[`n`,`e`,`s`,`w`].map(e=>(0,w.jsx)(nu,{id:`tgt-${e}`,type:`target`,position:lm[e],isConnectable:!1},`tgt-${e}`)),(0,w.jsx)(`div`,{className:`t`,children:A(e.type)}),(0,w.jsx)(`div`,{className:`n`,title:e.name,children:N(e.name)}),[`n`,`e`,`s`,`w`].map(e=>(0,w.jsx)(nu,{id:`src-${e}`,type:`source`,position:lm[e],isConnectable:!1},`src-${e}`))]})}var fm={load:dm},pm=new Set([`django`,`react`,`stitch`,`arch`]);function mm({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,style:s,markerEnd:c,markerStart:l,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:h,data:g,interactionWidth:_}){let[v,y,b]=ns({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o,borderRadius:8,stepPosition:g?.stepPosition??.5});return(0,w.jsx)(Iu,{id:e,path:v,labelX:y,labelY:b,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:h,style:s,markerEnd:c,markerStart:l,interactionWidth:_})}var hm={loadstep:mm};function gm({topologyKey:e}){let{fitView:t}=kl();return(0,g.useEffect)(()=>{let e=0,n=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>{t({padding:.2,maxZoom:1.15})})});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(e)}},[t,e]),null}function _m(e,t,n=null,r={}){let i=new Map(e.map(e=>[e.id,e])),a=r.layout??`layers`,o=up(a),s=Ep(e,t,a),c=Yp(e,t,s);return{rfNodes:e.map(e=>{let t=r.roles?.[e.id]||[],i=!!r.testOverlay&&!t.includes(`tested`)&&!t.includes(`untested`)&&!t.includes(`test`)&&!t.includes(`seed`);return{id:e.id,type:`load`,position:s.get(e.id)??{x:0,y:0},data:{name:e.name,type:e.type,file:e.file_path,roles:t,dim:i},selected:n===e.id,sourcePosition:X.Right,targetPosition:X.Left,width:208,height:64,style:{width:208,height:64}}}),rfEdges:t.filter(e=>i.has(e.src)&&i.has(e.dst)).map(e=>{let t=cm[e.weight]||`var(--edge-cheap)`,r=!!(n&&(e.src===n||e.dst===n)),i=s.get(e.src)??{x:0,y:0},a=s.get(e.dst)??{x:0,y:0},l=o?{source:`e`,target:`w`}:um(i,a);return{id:e.id,source:e.src,target:e.dst,sourceHandle:`src-${l.source}`,targetHandle:`tgt-${l.target}`,sourcePosition:lm[l.source],targetPosition:lm[l.target],type:o?`loadstep`:`default`,animated:e.weight===`critical`,data:{stepPosition:c.get(e.id)??.5},style:{stroke:t,strokeWidth:e.weight===`critical`?2.4:1.2,strokeDasharray:e.confidence<.8?`6 4`:void 0},markerEnd:{type:za.ArrowClosed,width:14,height:14,color:t},label:r?e.type.replaceAll(`_`,` `):void 0,labelStyle:r?{fill:`var(--ink)`,fontSize:10,fontWeight:600}:void 0,labelBgStyle:r?{fill:`var(--graph-bg)`,fillOpacity:.92}:void 0,labelBgPadding:r?[3,5]:void 0,labelBgBorderRadius:r?4:void 0}})}}function vm({node:e,nodes:t,edges:n,onClose:r,onWhatIf:i,onSelect:a,onOpenFile:o,pinned:s,onPin:c,onIsolate:l}){let u=Rp(e,t,n);return(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,w.jsxs)(`aside`,{className:`inspector`,"data-testid":`graph-inspector`,children:[(0,w.jsxs)(`div`,{className:`inspector-head`,children:[(0,w.jsx)(`div`,{className:`t`,children:u.typeLabel}),(0,w.jsx)(`div`,{className:`inspector-roles`,children:u.roles.map(e=>(0,w.jsx)(`span`,{className:`inspector-chip`,children:e},e))}),(0,w.jsx)(`button`,{type:`button`,className:`inspector-close`,"data-testid":`graph-inspector-close`,"aria-label":`Close inspector`,onClick:r,children:`×`})]}),(0,w.jsx)(`div`,{className:`n`,children:N(u.name)}),(0,w.jsx)(`p`,{className:`inspector-purpose`,"data-testid":`graph-inspector-purpose`,children:u.purpose}),u.context?(0,w.jsx)(`div`,{className:`muted`,children:N(u.context)}):null,u.file?(0,w.jsxs)(`div`,{className:`file-row`,children:[(0,w.jsx)(`div`,{className:`file`,children:N(u.file)}),o&&e.file_path?(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-open-editor`,onClick:()=>o(e.file_path,e.start_line),children:`Open in editor`}):null]}):null,(0,w.jsx)(`div`,{className:`muted`,children:N(u.qualifiedName)}),(0,w.jsxs)(`div`,{className:`muted inspector-layer`,children:[`layer · `,u.layer]}),(0,w.jsxs)(`div`,{className:`muted inspector-degree`,"data-testid":`graph-inspector-degree`,children:[u.degreeIn,` in · `,u.degreeOut,` out`]}),u.pathSummary?(0,w.jsx)(`p`,{className:`inspector-path`,"data-testid":`graph-inspector-path`,children:u.pathSummary}):null,u.facts.length?(0,w.jsx)(`dl`,{className:`inspector-facts`,"data-testid":`graph-inspector-facts`,children:u.facts.map(e=>(0,w.jsxs)(`div`,{className:`inspector-fact`,children:[(0,w.jsx)(`dt`,{children:e.label}),(0,w.jsx)(`dd`,{children:N(e.value)})]},e.key))}):null,(0,w.jsx)(ym,{title:`Inputs`,testId:`graph-inspector-inputs`,links:u.inputs,extra:u.extraInputs,empty:`Nothing in this graph points here.`,onSelect:a}),(0,w.jsx)(ym,{title:`Outputs`,testId:`graph-inspector-outputs`,links:u.outputs,extra:u.extraOutputs,empty:`This node does not point at anything in this graph.`,onSelect:a}),i?(0,w.jsx)(`p`,{className:`whatif-hint`,"data-testid":`whatif-hint`,children:l?`Walks a new path from this node with no git range. Isolate (next) only hides the rest of this map.`:`Walks a new path from this node with no git range — as if this changed, regardless of Base/Head.`}):null,(0,w.jsxs)(`div`,{className:`btn-row`,children:[i?(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-whatif`,title:`Start a hypothetical walk from this node. Does not use Base/Head.`,onClick:()=>i(e.id),children:`What if this changes`}):null,l?(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-isolate`,title:`Hide nodes that are not on a path from here to a sink. Does not start a new walk.`,onClick:()=>l(e.id),children:`Isolate path to sinks`}):null,c?(0,w.jsx)(`button`,{type:`button`,className:s?`btn primary`:`btn`,"data-testid":`btn-pin-node`,onClick:()=>c(s?null:e.id),children:s?`Unpin`:`Pin`}):null]})]})}function ym({title:e,testId:t,links:n,extra:r,empty:i,onSelect:a}){return(0,w.jsxs)(`section`,{className:`inspector-section`,"data-testid":t,children:[(0,w.jsxs)(`h3`,{children:[e,(0,w.jsx)(`span`,{className:`count`,children:n.length+r})]}),n.length?(0,w.jsx)(`ul`,{children:n.map((e,t)=>(0,w.jsx)(`li`,{children:a?(0,w.jsxs)(`button`,{type:`button`,className:`inspector-link`,onClick:()=>a(e.id),children:[(0,w.jsx)(`span`,{className:`inspector-link-name`,title:e.name,children:N(e.name)}),(0,w.jsxs)(`span`,{className:`inspector-link-meta`,children:[e.typeLabel?`${e.typeLabel} · `:``,e.edgeLabel,e.inferred?` · inferred`:``]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`inspector-link-name`,title:e.name,children:N(e.name)}),(0,w.jsxs)(`span`,{className:`inspector-link-meta`,children:[e.typeLabel?`${e.typeLabel} · `:``,e.edgeLabel,e.inferred?` · inferred`:``]})]})},`${e.edgeType}:${e.id}:${t}`))}):(0,w.jsx)(`p`,{className:`muted`,children:i}),r?(0,w.jsxs)(`p`,{className:`muted`,children:[`+`,r,` more`]}):null]})}function bm({nodes:e,edges:t,onWhatIf:n,focusPath:r,selectedId:i,onSelect:a,nodeRoles:o,testOverlay:s=!1,isolateSource:c,onIsolate:l,repoPath:u,onOpenFile:d,pinnedId:f,onPin:p}){let[m,h]=(0,g.useState)(null),_=i===void 0?m:i,v=e=>{i===void 0&&h(e),a?.(e)},[y,b]=(0,g.useState)(null),[x,S]=(0,g.useState)(null),[C,T]=(0,g.useState)(()=>cp()),[E,D]=(0,g.useState)(new Set(pm)),[O,k]=(0,g.useState)(!1),[j,M]=(0,g.useState)(``),[N,P]=(0,g.useState)(!1),[F,I]=(0,g.useState)(null),L=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;(0,g.useEffect)(()=>{let e=()=>I(Nf());if(typeof window.requestIdleCallback==`function`){let t=window.requestIdleCallback(e);return()=>window.cancelIdleCallback(t)}let t=window.setTimeout(e,0);return()=>window.clearTimeout(t)},[]);let ee=Pf(y??Gf(e.length),y,F),R=x??Kf(e.length),z=O?_:null,B=(0,g.useMemo)(()=>c?Xf(e,t,c):null,[e,t,c]),V=B?e.filter(e=>B.nodeIds.has(e.id)):e,te=B?t.filter(e=>B.edgeIds.has(e.id)):t,H=(0,g.useMemo)(()=>Jf(V,te,{detail:R,families:E,focusId:z,neighborhoodOnly:!!z}),[V,te,R,E,z]),U=(0,g.useMemo)(()=>`${C}|${H.nodes.map(e=>e.id).join(`\0`)}|${H.edges.map(e=>e.id).join(`\0`)}`,[C,H.nodes,H.edges]),ne=_?e.find(e=>e.id===_)??null:null,{rfNodes:re,rfEdges:ie}=(0,g.useMemo)(()=>{let e=_m(H.nodes,H.edges,_,{roles:o,testOverlay:s,layout:C});return L&&(e.rfEdges=e.rfEdges.map(e=>({...e,animated:!1}))),e},[H.nodes,H.edges,_,L,o,s,C]);(0,g.useEffect)(()=>{if(!r)return;let t=e.find(e=>e.file_path===r);t&&v(t.id)},[r,e]);let ae=(0,g.useMemo)(()=>Yf(e,j),[e,j]),oe=(e,t)=>{v(t.id)},se=()=>{v(null),k(!1)},ce=ne?(0,w.jsx)(vm,{node:ne,nodes:e,edges:t,onClose:se,onWhatIf:n,onSelect:v,onOpenFile:d,pinned:f===ne.id,onPin:p,onIsolate:l?e=>{l(c===e?null:e)}:void 0}):null,le=e=>{D(t=>{let n=new Set(t);if(n.has(e)){if(n.size===1)return t;n.delete(e)}else n.add(e);return n})},ue=(0,g.useMemo)(()=>{let t=new Set;for(let n of e)t.add(Uf(n.type));return t},[e]),de=e.length-H.nodes.length;return(0,w.jsxs)(`div`,{className:`impact-graph`,style:{flex:1,minHeight:0,position:`relative`,display:`flex`,flexDirection:`column`},children:[(0,w.jsxs)(`div`,{className:`graph-toolbar`,"data-testid":`graph-toolbar`,children:[(0,w.jsxs)(`div`,{className:`seg`,"aria-label":`Graph projection`,children:[(0,w.jsx)(`button`,{type:`button`,"data-testid":`graph-view-2d`,className:ee===`2d`?`active`:``,"aria-pressed":ee===`2d`,onClick:()=>b(`2d`),children:`2D map`}),(0,w.jsx)(`button`,{type:`button`,"data-testid":`graph-view-3d`,className:ee===`3d`?`active`:``,"aria-pressed":ee===`3d`,onClick:()=>b(`3d`),children:`3D layers`})]}),(0,w.jsxs)(`div`,{className:`seg`,"aria-label":`Graph detail`,children:[(0,w.jsx)(`button`,{type:`button`,"data-testid":`graph-detail-overview`,className:R===`overview`?`active`:``,"aria-pressed":R===`overview`,onClick:()=>S(`overview`),children:`Overview`}),(0,w.jsx)(`button`,{type:`button`,"data-testid":`graph-detail-full`,className:R===`full`?`active`:``,"aria-pressed":R===`full`,onClick:()=>S(`full`),children:`Full`})]}),(0,w.jsx)(`div`,{className:`seg`,"aria-label":`Graph families`,children:[`django`,`stitch`,`react`].filter(e=>ue.has(e)).map(e=>(0,w.jsx)(`button`,{type:`button`,"data-testid":`graph-family-${e}`,className:E.has(e)?`active`:``,"aria-pressed":E.has(e),onClick:()=>le(e),children:e},e))}),(0,w.jsxs)(`label`,{className:`graph-layout`,children:[`Layout`,(0,w.jsx)(`select`,{id:`graph-layout`,"data-testid":`graph-layout`,value:C,"aria-label":`Graph layout algorithm`,onChange:e=>{let t=wf.find(t=>t.id===e.target.value)?.id;t&&(T(t),lp(t))},children:wf.map(e=>(0,w.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,w.jsx)(`button`,{type:`button`,className:O?`chip-btn active`:`chip-btn`,"data-testid":`graph-neighborhood`,disabled:!_,onClick:()=>k(e=>!e),children:O?`Neighborhood`:`Focus neighbors`}),c?(0,w.jsx)(`button`,{type:`button`,className:`chip-btn active`,"data-testid":`graph-isolate-clear`,onClick:()=>l?.(null),children:`Path isolate`}):null,(0,w.jsxs)(`label`,{className:`graph-search`,children:[(0,w.jsx)(`span`,{className:`sr-only`,children:`Search nodes`}),(0,w.jsx)(`input`,{"data-testid":`graph-search`,placeholder:`Find a node`,value:j,onChange:e=>{M(e.target.value),P(!0)},onFocus:()=>P(!0),onBlur:()=>window.setTimeout(()=>P(!1),150)}),N&&j.trim()&&ae.length?(0,w.jsx)(`ul`,{className:`graph-search-hits`,"data-testid":`graph-search-hits`,children:ae.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{v(e.id),M(``),P(!1)},children:[e.name,(0,w.jsx)(`span`,{className:`muted`,children:A(e.type)})]})},e.id))}):null]}),(0,w.jsxs)(`span`,{className:`muted graph-count`,children:[H.nodes.length,` nodes · `,H.edges.length,` edges`,de?` · ${de} hidden`:``]})]}),(0,w.jsx)(`div`,{className:`graph-stage`,children:e.length===0?(0,w.jsxs)(`div`,{className:`empty graph-walk-empty`,"data-testid":`graph-walk-empty`,children:[(0,w.jsx)(`h2`,{children:`No typed nodes on this walk`}),(0,w.jsx)(`p`,{children:`This range did not hit models, views, routes, or React pages Loadpath extracts. Open the architecture map for the indexed graph.`})]}):ee===`3d`?(0,w.jsxs)(`div`,{className:`graph-3d`,"data-testid":`graph-3d`,children:[(0,w.jsx)(`p`,{className:`graph-3d-hint`,children:`Same layout as the 2D map, with bounded context on the depth axis. Dashed edges are inferred. Drag to orbit, scroll to zoom, click a node to inspect it.`}),F===!1?sm:F===null?(0,w.jsx)(`p`,{className:`muted graph-3d-hint`,children:`Loading 3D layers…`}):(0,w.jsx)(om,{fallback:sm,children:(0,w.jsx)(g.Suspense,{fallback:(0,w.jsx)(`p`,{className:`muted graph-3d-hint`,children:`Loading 3D layers…`}),children:(0,w.jsx)(am,{nodes:H.nodes,edges:H.edges,selectedId:_,neighborIds:z?H.neighborIds:im,layout:C,nodeRoles:o,testOverlay:s,onSelect:e=>{v(e),e||k(!1)}})})}),ce]}):(0,w.jsxs)(jd,{children:[(0,w.jsxs)(Fd,{nodes:re,edges:ie,nodeTypes:fm,edgeTypes:hm,fitView:!1,minZoom:.25,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,deleteKeyCode:null,onNodeClick:oe,onPaneClick:se,proOptions:{hideAttribution:!1},"data-testid":`impact-graph`,children:[(0,w.jsx)(gm,{topologyKey:U}),(0,w.jsx)(Hd,{}),(0,w.jsx)(hf,{pannable:!0,zoomable:!0,ariaLabel:`Impact graph overview`,nodeColor:`var(--muted)`,nodeStrokeColor:`transparent`,nodeStrokeWidth:0,maskColor:`rgba(0, 0, 0, 0.45)`,maskStrokeColor:`var(--accent)`,maskStrokeWidth:1.4,bgColor:`var(--graph-bg)`,style:{width:184,height:128}}),(0,w.jsx)(Zd,{})]}),ce]})})]})}function xm(e){return(0,w.jsx)(om,{fallback:(0,w.jsx)(`p`,{className:`muted graph-3d-hint`,"data-testid":`graph-crash-fallback`,children:`The graph failed to render. Switch to 2D map or another layout.`}),children:(0,w.jsx)(bm,{...e})})}function Sm(){let e=localStorage.getItem(`loadpath.editor`)||`auto`;return e===`cursor`||e===`vscode`||e===`system`?e:`auto`}function Cm(e){localStorage.setItem(`loadpath.editor`,e)}async function wm(e,t,n,r=Sm()){try{let i=await x.openEditor(e,t,n??void 0,r);if(i.ok)return{ok:!0,message:`Opened ${t} in ${i.opened_with||`editor`}`};let a=i.urls||{},o=r===`vscode`?a.vscode:r===`cursor`?a.cursor:a.cursor||a.vscode;return o?(window.open(o,`_blank`,`noopener,noreferrer`),{ok:!0,message:`Opening ${t} via editor URL`}):{ok:!1,message:i.error||`Could not open editor`}}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}var Tm=[{value:`HEAD`,label:`HEAD`,group:`preset`},{value:`HEAD~1`,label:`HEAD~1`,group:`preset`}],Em=[`preset`,`branch`,`tag`,`commit`];function Dm(e){if(!e?.git)return[...Tm];let t=(e.presets?.length?e.presets:Tm.map(e=>e.value)).map(e=>({value:e,label:e,group:`preset`})),n=new Set(t.map(e=>e.value)),r=[...t];for(let t of e.branches||[])n.has(t.name)||(n.add(t.name),r.push({value:t.name,label:t.current?`${t.name} (current)`:t.name,detail:t.subject,group:`branch`}));for(let t of e.tags||[])n.has(t.name)||(n.add(t.name),r.push({value:t.name,label:t.name,detail:t.subject,group:`tag`}));for(let t of e.commits||[])n.has(t.sha)||(n.add(t.sha),r.push({value:t.sha,label:t.short,detail:t.subject,group:`commit`}));return r}function Om(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.value.toLowerCase().includes(n)||e.label.toLowerCase().includes(n)||(e.detail||``).toLowerCase().includes(n)):e}function km(e){return Em.map(t=>({group:t,items:e.filter(e=>e.group===t)})).filter(e=>e.items.length>0)}function Am(e){return e===`preset`?`Common`:e===`branch`?`Branches`:e===`tag`?`Tags`:`Recent commits`}function jm({value:e,onChange:t,placeholder:n,testId:r,menuTestId:i,refs:a,onNeedRefs:o}){let s=(0,g.useId)(),c=(0,g.useRef)(null),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(0),h=(0,g.useMemo)(()=>{let e=Dm(a);return d===null?e:Om(e,d)},[a,d]),_=(0,g.useMemo)(()=>km(h),[h]);(0,g.useEffect)(()=>{l&&o()},[l,o]),(0,g.useEffect)(()=>{m(0)},[d,l]);let v=()=>{u(!1),f(null)},y=e=>{t(e.value),v()};return(0,w.jsxs)(`div`,{className:`combo`,ref:c,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||v()},children:[(0,w.jsxs)(`div`,{className:`combo-row`,children:[(0,w.jsx)(`input`,{"data-testid":r,value:e,placeholder:n,spellCheck:!1,role:`combobox`,"aria-expanded":l,"aria-controls":s,"aria-autocomplete":`list`,onChange:e=>{t(e.target.value),l&&f(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`){if(e.preventDefault(),!l){u(!0);return}m(e=>Math.min(e+1,Math.max(h.length-1,0)))}else if(e.key===`ArrowUp`){if(e.preventDefault(),!l)return;m(e=>Math.max(e-1,0))}else if(e.key===`Enter`&&l){e.preventDefault();let t=h[p];t&&y(t)}else e.key===`Escape`&&l&&(e.preventDefault(),v())}}),(0,w.jsx)(`button`,{type:`button`,className:`icon-btn combo-toggle`,"data-testid":`${r}-toggle`,"aria-label":`Show recent refs`,"aria-expanded":l,onMouseDown:e=>e.preventDefault(),onClick:()=>l?v():u(!0),children:(0,w.jsx)(B,{})})]}),l?(0,w.jsx)(`div`,{className:`combo-menu`,id:s,role:`listbox`,"data-testid":i,children:_.length===0?(0,w.jsx)(`div`,{className:`combo-empty muted`,children:`No matching refs — the typed value is kept`}):_.map(e=>(0,w.jsxs)(`div`,{className:`combo-group`,children:[(0,w.jsx)(`div`,{className:`combo-heading`,children:Am(e.group)}),e.items.map(e=>{let t=h.indexOf(e);return(0,w.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===p,className:t===p?`combo-option active`:`combo-option`,"data-testid":`ref-option-${e.group}`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>m(t),onClick:()=>y(e),children:[(0,w.jsx)(`span`,{className:`combo-label`,children:e.label}),e.detail?(0,w.jsx)(`span`,{className:`combo-detail`,children:e.detail}):null]},`${e.group}:${e.value}`)})]},e.group))}):null]})}function Mm({initialPath:e,onSelect:t,onClose:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(e),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(!1),p=(0,g.useRef)(null),m=(0,g.useRef)(0),h=async e=>{let t=m.current+1;m.current=t,f(!0);try{let n=await x.browse(e);if(m.current!==t)return;i(n),o(n.path),c(n.is_git?n.path:null),u(``)}catch(e){if(m.current!==t)return;u(e instanceof Error?e.message:String(e))}finally{m.current===t&&f(!1)}};(0,g.useEffect)(()=>{h(e),p.current?.focus(),p.current?.select()},[e]);let _=s||r?.path||a,v=s&&s!==r?.path?s.split(/[\\/]/).filter(Boolean).pop():r?.is_git?`this repository`:`this folder`;return(0,w.jsx)(`div`,{className:`modal-backdrop`,"data-testid":`repo-explorer`,"data-overlay":`true`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),n())},children:(0,w.jsxs)(`div`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`explorer-title`,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(`div`,{className:`modal-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{id:`explorer-title`,children:`Select repository`}),(0,w.jsx)(`p`,{className:`muted`,children:`Browse to a git root, or paste the full path.`})]}),(0,w.jsx)(`button`,{type:`button`,className:`btn ghost`,"data-testid":`explorer-cancel`,onClick:n,children:`Cancel`})]}),(0,w.jsxs)(`form`,{className:`explorer-path`,onSubmit:e=>{e.preventDefault(),h(a)},children:[(0,w.jsx)(`input`,{ref:p,"data-testid":`explorer-path`,value:a,onChange:e=>o(e.target.value),spellCheck:!1,"aria-label":`Directory path`}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,disabled:!r?.parent,onClick:()=>r?.parent&&void h(r.parent),children:`Up`}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>r&&void h(r.home),children:`Home`}),(0,w.jsx)(`button`,{type:`submit`,className:`btn`,children:`Go`})]}),l?(0,w.jsx)(`div`,{className:`error`,role:`alert`,children:l}):null,(0,w.jsx)(`div`,{className:`explorer-list`,role:`listbox`,"aria-label":`Folders`,"aria-busy":d,children:r?.entries.length?r.entries.map(e=>{let t=s===e.path;return(0,w.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,className:t?`explorer-row active`:`explorer-row`,"data-testid":`explorer-entry`,"data-path":e.path,onClick:()=>c(e.path),onDoubleClick:()=>void h(e.path),children:[(0,w.jsx)(z,{}),(0,w.jsx)(`span`,{className:`explorer-name`,children:e.name}),e.is_git?(0,w.jsx)(`span`,{className:`chip git-badge`,children:`git`}):null]},e.path)}):(0,w.jsx)(`div`,{className:`muted explorer-empty`,children:d?`Loading…`:`No folders here`})}),(0,w.jsxs)(`div`,{className:`modal-foot`,children:[(0,w.jsx)(`span`,{className:`muted explorer-current`,title:_,children:_}),(0,w.jsxs)(`button`,{type:`button`,className:`btn primary`,"data-testid":`explorer-use`,disabled:!_,onClick:()=>_&&t(_),children:[`Use `,v]})]})]})})}var Nm={scan:{start:0,end:20},extract:{start:20,end:88},boot:{start:88,end:94},stitch:{start:94,end:99},skipped:{start:100,end:100},done:{start:100,end:100}},Pm=new Set([`scan`,`extract`,`boot`,`stitch`]);function Fm(e){let t=e.phase||``;if(!t||t===`idle`)return null;let n=Nm[t];if(!n)return null;if(n.start===n.end)return n.end;let r=e.total||0;if(r<=0)return n.start;let i=Math.min(1,Math.max(0,(e.done||0)/r));return Math.round(n.start+(n.end-n.start)*i)}function Im(e){return!e.phase||e.phase===`idle`?null:typeof e.percent==`number`&&Number.isFinite(e.percent)?Math.max(0,Math.min(100,Math.round(e.percent))):Fm(e)}var Lm=[{id:`obsidian`,label:`Obsidian`,group:`dark`},{id:`nord`,label:`Nord`,group:`dark`},{id:`solarized-dark`,label:`Solarized Dark`,group:`dark`},{id:`forest`,label:`Forest`,group:`dark`},{id:`rose`,label:`Rose Pine`,group:`dark`},{id:`amber`,label:`Midnight Amber`,group:`dark`},{id:`volcano`,label:`Volcano`,group:`dark`},{id:`lavender`,label:`Lavender`,group:`dark`},{id:`neon-noir`,label:`Neon Noir`,group:`dark`},{id:`synthwave`,label:`Synthwave`,group:`dark`},{id:`phosphor`,label:`Phosphor`,group:`dark`},{id:`aurora`,label:`Aurora`,group:`dark`},{id:`biolume`,label:`Biolume`,group:`dark`},{id:`carbon`,label:`Carbon`,group:`dark`},{id:`paper`,label:`Paper`,group:`light`},{id:`solarized-light`,label:`Solarized Light`,group:`light`},{id:`seafoam`,label:`Seafoam`,group:`light`},{id:`high-contrast`,label:`High Contrast`,group:`light`},{id:`sakura`,label:`Sakura`,group:`light`},{id:`citrus`,label:`Citrus`,group:`light`},{id:`peach`,label:`Peach Fuzz`,group:`light`},{id:`candy`,label:`Cotton Candy`,group:`light`},{id:`sky`,label:`Clear Sky`,group:`light`},{id:`coral`,label:`Coral Reef`,group:`light`}],Rm=`obsidian`,zm=`loadpath.theme`;function Bm(e){return Lm.some(t=>t.id===e)}function Vm(){try{let e=localStorage.getItem(zm)||``;if(Bm(e))return e}catch{}return Rm}function Hm(e){return Lm.find(t=>t.id===e)?.group===`light`?`light`:`dark`}function Um(e){document.documentElement.dataset.theme=e,document.documentElement.style.colorScheme=Hm(e);try{localStorage.setItem(zm,e)}catch{}}var Wm=[{id:`review`,label:`Review`,testId:`tab-review`,shortcut:`1`,icon:F},{id:`architecture`,label:`Architecture`,testId:`tab-architecture`,shortcut:`2`,icon:I},{id:`graph`,label:`Impact graph`,testId:`tab-graph`,shortcut:`3`,icon:L},{id:`prs`,label:`Pull requests`,testId:`tab-prs`,shortcut:`4`,icon:ee},{id:`settings`,label:`Settings`,testId:`tab-settings`,shortcut:`5`,icon:R}];function Gm(e,t,n){let r;try{r=new URL(e)}catch{return}if(r.protocol!==`https:`||r.username||r.password)return;let i=r.hostname.toLowerCase();i!==t&&!i.endsWith(`.${t}`)||r.pathname.startsWith(n)&&window.open(r.toString(),`_blank`,`noopener,noreferrer`)}function Km(){let[e,t]=(0,g.useState)(`review`),[n,r]=(0,g.useState)(localStorage.getItem(`loadpath.repo`)||``),[i,a]=(0,g.useState)(localStorage.getItem(`loadpath.base`)||`HEAD~1`),[o,s]=(0,g.useState)(localStorage.getItem(`loadpath.head`)||`HEAD`),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(null),[m,h]=(0,g.useState)([]),[_,v]=(0,g.useState)(`review`),[y,b]=(0,g.useState)(``),[S,C]=(0,g.useState)(``),[T,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(!1),[j,N]=(0,g.useState)(!1),[P,F]=(0,g.useState)(``),[I,L]=(0,g.useState)({}),[ee,R]=(0,g.useState)([]),[B,V]=(0,g.useState)([]),[te,H]=(0,g.useState)(localStorage.getItem(`loadpath.scmRepo`)||``),[U,ne]=(0,g.useState)(localStorage.getItem(`loadpath.provider`)||`github`),[re,ie]=(0,g.useState)(localStorage.getItem(`loadpath.prNumber`)||``),[ae,oe]=(0,g.useState)(localStorage.getItem(`loadpath.dirty`)===`1`),[se,ce]=(0,g.useState)(0),[le,ue]=(0,g.useState)(``),[de,fe]=(0,g.useState)(Vm),[pe,me]=(0,g.useState)(!1),[he,ge]=(0,g.useState)(!1),[_e,ve]=(0,g.useState)(!1),[ye,be]=(0,g.useState)(null),[xe,Se]=(0,g.useState)(null),[Ce,we]=(0,g.useState)(localStorage.getItem(`loadpath.testOverlay`)===`1`),[Te,Ee]=(0,g.useState)(null),[De,Oe]=(0,g.useState)(localStorage.getItem(`loadpath.watch`)===`1`),[ke,Ae]=(0,g.useState)([]),[je,Me]=(0,g.useState)(null),[Ne,Pe]=(0,g.useState)(null),[Fe,Ie]=(0,g.useState)(null),[Le,Re]=(0,g.useState)(()=>{try{return!!(localStorage.getItem(`loadpath.lastReviewId`)&&(localStorage.getItem(`loadpath.repo`)||``).trim())}catch{return!1}}),[ze,Be]=(0,g.useState)(null),[Ve,He]=(0,g.useState)(null),[Ue,We]=(0,g.useState)(!1),[Ge,Ke]=(0,g.useState)(!1),qe=(0,g.useRef)(n);qe.current=n;let Je=(0,g.useRef)(ae);Je.current=ae;let Ye=(0,g.useRef)(!1);Ye.current=he;let Xe=(0,g.useRef)(``),Ze=(0,g.useRef)(``),Qe=e=>{fe(e),Um(e)},$e=(0,g.useRef)(``),et=e=>{$e.current=e,C(e)},tt=e=>{let t=0,n=!1;D(0);let r=()=>{x.indexProgress(e).then(e=>{if(!$e.current)return;if(e.phase&&e.phase!==`idle`&&e.message&&et(e.message),Pm.has(e.phase))n=!0;else if(!n)return;let r=Im(e);r!=null&&(t=e.phase===`scan`&&!e.done?r:Math.max(t,r),D(t))}).catch(()=>void 0)};r();let i=window.setInterval(r,250);return()=>{window.clearInterval(i),D(null)}};(0,g.useEffect)(()=>{x.settings().then(L).catch(()=>void 0).finally(()=>me(!0)),x.repos().then(e=>h(e.repos)).catch(()=>void 0)},[]);let nt=()=>n.trim()?!0:(b(`Point at a local repository path first.`),!1);(0,g.useEffect)(()=>{if(e!==`architecture`||!n.trim())return;let t=n,r=!1;return Ze.current!==t&&W(t),x.config(t).then(e=>{!r&&qe.current===t&&Pe(e)}).catch(()=>void 0),x.architectureHealth(t).then(e=>{!r&&qe.current===t&&Ie(e)}).catch(()=>void 0),()=>{r=!0}},[e,n]);let rt=e=>{qe.current=e,r(e),localStorage.setItem(`loadpath.repo`,e),e.trim()!==Xe.current&&(Xe.current=``,Be(null))},it=(0,g.useCallback)(e=>{let t=(e??qe.current).trim();return!t||Xe.current===t?Promise.resolve():(Xe.current=t,x.gitRefs(t).then(e=>{qe.current.trim()===t&&Be(e)}).catch(()=>{Xe.current===t&&(Xe.current=``,Be(null))}))},[]),at=(e,t)=>{a(e),s(t),localStorage.setItem(`loadpath.base`,e),localStorage.setItem(`loadpath.head`,t)},ot=(e,t,n)=>{ne(e),H(t),localStorage.setItem(`loadpath.provider`,e),localStorage.setItem(`loadpath.scmRepo`,t),n!==void 0&&(ie(n),localStorage.setItem(`loadpath.prNumber`,n))},st=e=>{l(e),ce(0),be(xe&&e.nodes.some(e=>e.id===xe)?xe:null),Ee(null),Me(null),e.what_if||(d(e),e.id&&localStorage.setItem(`loadpath.lastReviewId`,e.id))},ct=async e=>{try{let t=await x.reviews(e);Ae(t.reviews)}catch{Ae([])}},lt=async e=>{try{Ie(await x.architectureHealth(e))}catch{Ie(null)}},ut=e=>e===`github`?!!I.github_token_set:e===`gitlab`?!!I.gitlab_token_set:!!I.bitbucket_token_set,dt=(0,g.useCallback)(async(e=U)=>{try{let t=await x.scmRepos(e);V(t.repos),t.user?.login&&L(n=>({...n,...e===`github`?{github_user:t.user.login}:e===`gitlab`?{gitlab_user:t.user.login}:{bitbucket_user:t.user.login}}))}catch{V([])}},[U]);(0,g.useEffect)(()=>{if(e!==`prs`)return;let t=!1;return dt(U).catch(()=>{t||V([])}),()=>{t=!0}},[e,U,dt]),(0,g.useEffect)(()=>{if(!Ve)return;let e=!1,t=0,n=async()=>{try{let r=await x.githubOAuthPoll(Ve.flow_id);if(e)return;if(r.status===`complete`){He(null);let e=await x.settings();L(e),F(r.user?`Signed in to GitHub as ${r.user}`:`Signed in to GitHub`),dt(`github`);return}if(r.status===`pending`||r.status===`slow_down`){t=window.setTimeout(n,Math.max(r.interval||Ve.interval,5)*1e3);return}He(null),b(r.status===`denied`?`GitHub sign-in was denied.`:`GitHub sign-in expired. Try again.`)}catch(t){if(e)return;He(null),b(t instanceof Error?t.message:String(t))}};return t=window.setTimeout(n,Math.max(Ve.interval,5)*1e3),()=>{e=!0,window.clearTimeout(t)}},[Ve,dt]),(0,g.useEffect)(()=>{if(!Ue)return;let e=!1,t=0,n=Date.now(),r=async()=>{try{let i=await x.oauthStatus();if(e)return;if(i.bitbucket.connected){We(!1);let e=await x.settings();L(e),F(i.bitbucket.user?`Signed in to Bitbucket as ${i.bitbucket.user}`:`Signed in to Bitbucket`),dt(`bitbucket`);return}if(Date.now()-n>18e4){We(!1),b(`Bitbucket sign-in timed out. Finish in the browser, or try again.`);return}t=window.setTimeout(r,1500)}catch(t){if(e)return;We(!1),b(t instanceof Error?t.message:String(t))}};return t=window.setTimeout(r,1500),()=>{e=!0,window.clearTimeout(t)}},[Ue,dt]),(0,g.useEffect)(()=>{if(!Ge)return;let e=!1,t=0,n=Date.now(),r=async()=>{try{let i=await x.oauthStatus();if(e)return;if(i.gitlab.connected){Ke(!1);let e=await x.settings();L(e),F(i.gitlab.user?`Signed in to GitLab as ${i.gitlab.user}`:`Signed in to GitLab`),dt(`gitlab`);return}if(Date.now()-n>18e4){Ke(!1),b(`GitLab sign-in timed out. Finish in the browser, or try again.`);return}t=window.setTimeout(r,1500)}catch(t){if(e)return;Ke(!1),b(t instanceof Error?t.message:String(t))}};return t=window.setTimeout(r,1500),()=>{e=!0,window.clearTimeout(t)}},[Ge,dt]);let W=async(e=n,t=!1)=>{if(!e.trim())return null;Ze.current=e,N(!0);try{let n=await x.architecture(e,!1);qe.current===e&&p(n);let r=x.architectureGraph(e).then(t=>{qe.current===e&&p(e=>e&&{...e,nodes:t.nodes,edges:t.edges,graph_pending:!1})});return r.catch(()=>{p(t=>t&&qe.current===e?{...t,graph_pending:!1}:t)}).finally(()=>{Ze.current===e&&N(!1)}),t&&await r,n}catch(t){throw qe.current===e&&N(!1),t}},ft=async e=>{let t=e.trim();if(!(!t||t===qe.current)){if($e.current){b(`Wait for the current job to finish before switching workspace.`);return}b(``),F(``),l(null),d(null),p(null),v(`architecture`),rt(t),k(!0),et(`Loading ${M(t)}…`);try{await Promise.all([W(t),it(t)])}catch(e){qe.current===t&&b(e instanceof Error?e.message:String(e))}finally{qe.current===t&&(et(``),k(!1))}}},pt=async()=>{if($e.current||!nt())return;b(``),F(``),et(`Tracing load path…`),rt(n),at(i,o);let e=tt(n);try{let e=await x.review(n,i,o,!0,Je.current);st(e),v(`review`),t(`review`),await x.repos().then(e=>h(e.repos)).catch(()=>void 0),await Promise.all([W(n),ct(n),lt(n)])}catch(e){b(e instanceof Error?e.message:String(e))}finally{e(),et(``)}},mt=async(e=!0)=>{if($e.current||!nt())return;b(``),F(``),et(e?`Indexing…`:`Full reindex…`),rt(n);let r=tt(n);try{await x.index(n,e);let r=await W(n);await x.repos().then(e=>h(e.repos)).catch(()=>void 0),r?.indexed&&(v(`architecture`),t(`architecture`))}catch(e){b(e instanceof Error?e.message:String(e))}finally{r(),et(``)}},ht=async()=>{if(!$e.current&&nt()){b(``),F(``),et(`Detecting layout…`),rt(n);try{let e=await x.init(n);F(e.message),await x.repos().then(e=>h(e.repos)).catch(()=>void 0)}catch(e){b(e instanceof Error?e.message:String(e))}finally{et(``)}}},gt=async()=>{if(c?.markdown)try{await navigator.clipboard.writeText(c.markdown),F(`Copied markdown brief`)}catch(e){b(e instanceof Error?e.message:String(e))}},_t=async()=>{if(!$e.current){if(c?.what_if){b(`What-if walks are hypothetical — they are not posted to a pull request. Restore the git-range walk first.`);return}if(!c?.markdown||!te||!re){b(`Pick a pull request first (Pull requests tab), then post the brief.`);return}et(`Posting Loadpath brief…`);try{let e=await x.postComment(U,te,Number(re),c.markdown);F(e.updated?`Updated the Loadpath PR comment`:`Posted the Loadpath PR comment`)}catch(e){b(e instanceof Error?e.message:String(e))}finally{et(``)}}},vt=async()=>{if(!$e.current){b(``),et(`Fetching pull requests…`);try{let e=await x.prs(U,te,`open`,n.trim()||void 0);R(e.pull_requests);let t=B.find(e=>e.slug.toLowerCase()===te.trim().toLowerCase());t?.local_path&&rt(t.local_path)}catch(e){b(e instanceof Error?e.message:String(e))}finally{et(``)}}},yt=async()=>{b(``);try{let e=await x.githubOAuthStart();He(e),Gm(e.verification_uri_complete,`github.com`,`/login/device`)}catch(e){b(e instanceof Error?e.message:String(e))}},bt=async()=>{b(``);try{let e=await x.bitbucketOAuthStart();We(!0),Gm(e.authorize_url,`bitbucket.org`,`/site/oauth2/authorize`)}catch(e){We(!1),b(e instanceof Error?e.message:String(e))}},xt=async()=>{b(``);try{let e=await x.gitlabOAuthStart();Ke(!0),Gm(e.authorize_url,new URL(e.authorize_url).hostname,`/oauth/authorize`)}catch(e){Ke(!1),b(e instanceof Error?e.message:String(e))}},St=async e=>{if(!($e.current||!n.trim())){b(``),et(`Walking what-if path…`);try{let r=await x.whatIf(n,e);F(`${r.title} — ${r.confidence.level} · ${(r.sinks||[]).length} sinks`),st({...r,markdown:r.markdown||``,index:r.index||c?.index,workspace:r.workspace||c?.workspace}),v(`review`),t(`review`)}catch(e){b(e instanceof Error?e.message:String(e))}finally{et(``)}}},Ct=()=>{if(u){st(u),v(`review`),t(`review`),F(`Restored the last git-range walk`);return}l(null),ce(0),be(null),Ee(null),Me(null),v(`architecture`),t(`architecture`),F(``)},wt=async e=>{if($e.current)return;ot(e.provider,e.repo,String(e.number));let r=B.find(t=>t.slug.toLowerCase()===e.repo.toLowerCase());r?.local_path&&rt(r.local_path),b(``),et(`Fetching ${e.provider} #${e.number}…`);let i=r?.local_path||n,a=i?tt(i):()=>void 0;try{let i=await x.reviewPr(e.provider,e.repo,e.number,r?.local_path||n||void 0);st(i),i.pull_request&&typeof i.pull_request.repo_path==`string`&&rt(i.pull_request.repo_path),at(String(i.base||e.target_branch),String(i.head||e.source_branch)),v(`review`),t(`review`),typeof i.pull_request?.repo_path==`string`&&ct(i.pull_request.repo_path)}catch(n){at(e.base_sha||e.target_branch,e.head_sha||e.source_branch),t(`review`),b(n instanceof Error?n.message:String(n))}finally{a(),et(``)}},Tt=async e=>{b(``);try{L(await x.oauthDisconnect(e)),U===e&&V([]),F(`Disconnected ${e}`)}catch(e){b(e instanceof Error?e.message:String(e))}},Et=async e=>{e.preventDefault();let t=new FormData(e.currentTarget),n={github_token:String(t.get(`github_token`)||``),github_oauth_client_id:String(t.get(`github_oauth_client_id`)||``),github_host:String(t.get(`github_host`)||``),gitlab_token:String(t.get(`gitlab_token`)||``),gitlab_host:String(t.get(`gitlab_host`)||``),gitlab_oauth_client_id:String(t.get(`gitlab_oauth_client_id`)||``),gitlab_oauth_client_secret:String(t.get(`gitlab_oauth_client_secret`)||``),bitbucket_token:String(t.get(`bitbucket_token`)||``),bitbucket_username:String(t.get(`bitbucket_username`)||``),bitbucket_oauth_client_id:String(t.get(`bitbucket_oauth_client_id`)||``),bitbucket_oauth_client_secret:String(t.get(`bitbucket_oauth_client_secret`)||``),ai_provider:String(t.get(`ai_provider`)||`none`),ai_api_key:String(t.get(`ai_api_key`)||``),ai_model:String(t.get(`ai_model`)||``),ai_base_url:String(t.get(`ai_base_url`)||``)},r=m.length?{...n,workspaces:m.map(e=>({path:e.path,name:e.name}))}:n;try{L(await x.saveSettings(r)),F(`Settings saved on this machine`)}catch(e){b(e instanceof Error?e.message:String(e))}},Dt=async()=>{if(!(!c||$e.current)){et(`Residual analysis…`);try{let e=await x.residual(c);ue(e.note)}catch(e){b(e instanceof Error?e.message:String(e))}finally{et(``)}}},Ot=(0,g.useRef)(pt);Ot.current=pt;let kt=(0,g.useRef)(e);kt.current=e;let At=(0,g.useRef)(!1);At.current=_e;let jt=(0,g.useRef)(c);jt.current=c;let Mt=(0,g.useRef)(se);Mt.current=se,(0,g.useEffect)(()=>{let e=localStorage.getItem(`loadpath.lastReviewId`),t=(localStorage.getItem(`loadpath.repo`)||``).trim();if(!e||!t){Re(!1);return}let n=!1;return x.getReview(t,e).then(e=>{n||(st(e),at(e.base||localStorage.getItem(`loadpath.base`)||`HEAD~1`,e.head||localStorage.getItem(`loadpath.head`)||`HEAD`),ct(t),lt(t))}).catch(()=>void 0).finally(()=>{n||Re(!1)}),()=>{n=!0}},[]);let Nt=(0,g.useRef)(``);(0,g.useEffect)(()=>{if(!De||!n.trim())return;let e=!1,t=async()=>{try{let t=await x.workspaceStatus(n);if(e)return;Nt.current&&t.fingerprint!==Nt.current&&!$e.current&&(oe(!0),Je.current=!0,localStorage.setItem(`loadpath.dirty`,`1`),Ot.current()),Nt.current=t.fingerprint}catch{}};t();let r=window.setInterval(t,2e3);return()=>{e=!0,window.clearInterval(r)}},[De,n]),(0,g.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){e.preventDefault(),ve(e=>!e);return}if(At.current){e.key===`Escape`&&(e.preventDefault(),ve(!1));return}if(Ye.current){e.key===`Escape`&&(e.preventDefault(),ge(!1));return}let n=e.target;if(n&&(n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.tagName===`SELECT`||n.isContentEditable)){e.key===`Escape`&&n.blur();return}if(e.key===`Escape`){b(``),F(``),be(xe),Ee(null);return}if(e.key===`j`||e.key===`k`){let t=jt.current?.read_order||[];if(!t.length)return;e.preventDefault();let n=Mt.current,r=e.key===`j`?Math.min(t.length-1,n+1):Math.max(0,n-1);ce(r);return}let r=Wm.find(t=>t.shortcut===e.key);if(r&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&t(r.id),(e.metaKey||e.ctrlKey)&&e.key===`Enter`){if(kt.current===`settings`||kt.current===`prs`||$e.current)return;e.preventDefault(),Ot.current()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[xe]);let Pt=async(e,t)=>{if(!n.trim())return;let r=await wm(n,e,t);r.ok?F(r.message):b(r.message)},Ft=async()=>{if(c)try{let e=await x.exportHtml(c),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`loadpath-${(c.id||`review`).slice(0,8)}.html`,n.click(),URL.revokeObjectURL(t),F(`Saved HTML brief`)}catch(e){b(e instanceof Error?e.message:String(e))}},It=async e=>{if(n.trim()){et(`Loading stored review…`);try{let r=await x.getReview(n,e);st(r),at(r.base||i,r.head||o),v(`review`),t(`review`);let a=ke.findIndex(t=>t.id===e),s=a>=0?ke[a+1]:void 0;if(s)try{Me(await x.reviewDiff(n,e,s.id))}catch{Me(null)}}catch(e){b(e instanceof Error?e.message:String(e))}finally{et(``)}}},G={selectedId:ye,onSelect:be,nodeRoles:c?.node_roles,testOverlay:Ce,isolateSource:Te,onIsolate:Ee,repoPath:n,onOpenFile:Pt,pinnedId:xe,onPin:Se},Lt=[{id:`review`,group:`Run`,label:`Review this range`,hint:`⌘/Ctrl+Enter`,run:()=>void pt()},...c?.what_if?[{id:`exit-whatif`,group:`Review`,label:u?`Back to git-range walk`:`Exit what-if walk`,run:Ct}]:[],{id:`index`,group:`Run`,label:`Index repository`,run:()=>void mt(!0)},{id:`watch`,group:`Run`,label:De?`Stop watching working tree`:`Watch working tree`,run:()=>{let e=!De;Oe(e),localStorage.setItem(`loadpath.watch`,e?`1`:`0`)}},{id:`tests`,group:`Graph`,label:Ce?`Hide test overlay`:`Show test overlay`,run:()=>{let e=!Ce;we(e),localStorage.setItem(`loadpath.testOverlay`,e?`1`:`0`)}},{id:`export`,group:`Review`,label:`Export HTML brief`,run:()=>void Ft()},...Wm.map(e=>({id:`tab-${e.id}`,group:`Tabs`,label:`Go to ${e.label}`,hint:e.shortcut,run:()=>t(e.id)})),...(c?.nodes||[]).slice(0,30).map(e=>({id:`node-${e.id}`,group:`Nodes`,label:e.name,hint:A(e.type),run:()=>{be(e.id),t(`graph`)}})),...ke.slice(0,12).map(e=>({id:`hist-${e.id}`,group:`History`,label:e.title||e.id,hint:`${e.level||``} ${e.created_at||``}`.trim(),run:()=>void It(e.id)}))],Rt=(0,g.useMemo)(()=>_===`architecture`?f?.nodes??[]:c?.nodes??[],[_,f,c]),zt=(0,g.useMemo)(()=>_===`architecture`?f?.edges??[]:c?.edges??[],[_,f,c]),Bt=c?.index?`${c.index.counts.nodes} nodes · ${c.index.counts.edges} edges`:f?.indexed?`${f.counts.nodes} nodes · ${f.counts.edges} edges`:`Not indexed`,Vt=(c?.findings||[]).filter(e=>!e.waived);return(0,w.jsxs)(`div`,{className:`app`,children:[(0,w.jsx)(`a`,{className:`skip`,href:`#main`,children:`Skip to content`}),(0,w.jsxs)(`nav`,{className:`rail`,"data-testid":`rail`,"aria-label":`Primary`,children:[(0,w.jsxs)(`div`,{className:`brand`,children:[(0,w.jsx)(`div`,{className:`brand-mark`,children:`Loadpath`}),(0,w.jsx)(`div`,{className:`brand-sub`,children:`Load-path review`})]}),Wm.map(n=>{let r=n.icon,i=e===n.id;return(0,w.jsxs)(`button`,{type:`button`,"data-testid":n.testId,className:i?`nav-item active`:`nav-item`,"aria-current":i?`page`:void 0,"aria-label":n.label,onClick:()=>t(n.id),children:[(0,w.jsx)(r,{}),(0,w.jsx)(`span`,{children:n.label})]},n.id)}),(0,w.jsxs)(`div`,{className:`theme-pick`,children:[(0,w.jsx)(`label`,{htmlFor:`theme-select`,children:`Theme`}),(0,w.jsx)(`select`,{id:`theme-select`,"data-testid":`theme-select`,value:de,onChange:e=>Qe(e.target.value),children:[`dark`,`light`].map(e=>(0,w.jsx)(`optgroup`,{label:e===`dark`?`Dark`:`Light`,children:Lm.filter(t=>t.group===e).map(e=>(0,w.jsx)(`option`,{value:e.id,children:e.label},e.id))},e))})]}),(0,w.jsxs)(`div`,{className:`rail-foot`,children:[(0,w.jsx)(`div`,{className:`muted`,role:`status`,children:S||Bt}),(0,w.jsxs)(`div`,{className:`kbd-hint`,children:[(0,w.jsx)(`kbd`,{children:`1`}),`–`,(0,w.jsx)(`kbd`,{children:`5`}),` tabs · `,(0,w.jsx)(`kbd`,{children:`⌘`}),(0,w.jsx)(`kbd`,{children:`K`}),` palette · `,(0,w.jsx)(`kbd`,{children:`j`}),`/`,(0,w.jsx)(`kbd`,{children:`k`}),` read order`]})]})]}),(0,w.jsxs)(`div`,{className:`main`,id:`main`,children:[S?(0,w.jsxs)(`div`,{className:T==null?`progress`:`progress determinate`,role:T==null?`status`:`progressbar`,"aria-label":S,"aria-live":`polite`,"aria-busy":`true`,"aria-valuemin":T==null?void 0:0,"aria-valuemax":T==null?void 0:100,"aria-valuenow":T??void 0,"data-testid":`progress`,children:[(0,w.jsx)(`i`,{style:T==null?void 0:{width:`${T}%`}}),(0,w.jsx)(`span`,{className:`sr-only`,children:S})]}):null,(0,w.jsxs)(`header`,{className:`topbar`,"data-testid":`topbar`,children:[m.length>0?(0,w.jsxs)(`label`,{className:`field workspace`,children:[(0,w.jsx)(`span`,{children:`Workspace`}),(0,w.jsxs)(`select`,{"data-testid":`workspace-select`,value:m.some(e=>e.path===n)?n:``,disabled:!!S,"aria-busy":O,onChange:e=>{e.target.value&&ft(e.target.value)},children:[(0,w.jsx)(`option`,{value:``,children:`Indexed repos…`}),m.map(e=>(0,w.jsxs)(`option`,{value:e.path,children:[e.name,e.indexed?` (${e.counts.nodes})`:``]},e.path))]})]}):null,(0,w.jsxs)(`label`,{className:`field path`,children:[(0,w.jsx)(`span`,{children:`Repository`}),(0,w.jsxs)(`div`,{className:`path-row`,children:[(0,w.jsx)(`input`,{"data-testid":`repo-path`,placeholder:`Local monorepo path`,value:n,onChange:e=>{let t=e.target.value;r(t),t.trim()!==Xe.current&&(Xe.current=``,Be(null))},spellCheck:!1}),(0,w.jsx)(`button`,{type:`button`,className:`icon-btn`,"data-testid":`btn-browse-repo`,"aria-label":`Browse for a local repository`,onClick:()=>ge(!0),children:(0,w.jsx)(z,{})})]})]}),(0,w.jsxs)(`label`,{className:`field ref`,children:[(0,w.jsx)(`span`,{children:`Base`}),(0,w.jsx)(jm,{testId:`base-ref`,menuTestId:`base-ref-menu`,value:i,onChange:e=>at(e,o),placeholder:`base`,refs:ze,onNeedRefs:it})]}),(0,w.jsxs)(`label`,{className:`field ref`,children:[(0,w.jsx)(`span`,{children:`Head`}),(0,w.jsx)(jm,{testId:`head-ref`,menuTestId:`head-ref-menu`,value:o,onChange:e=>at(i,e),placeholder:`head`,refs:ze,onNeedRefs:it})]}),(0,w.jsxs)(`label`,{className:`field dirty`,children:[(0,w.jsx)(`span`,{children:`Working tree`}),(0,w.jsx)(`button`,{type:`button`,className:ae?`chip-btn active`:`chip-btn`,"data-testid":`btn-dirty`,"aria-pressed":ae,onClick:()=>{let e=!ae;oe(e),localStorage.setItem(`loadpath.dirty`,e?`1`:`0`)},children:ae?`Include uncommitted`:`Committed range`})]}),(0,w.jsxs)(`label`,{className:`field dirty`,children:[(0,w.jsx)(`span`,{children:`Watch`}),(0,w.jsx)(`button`,{type:`button`,className:De?`chip-btn active`:`chip-btn`,"data-testid":`btn-watch`,"aria-pressed":De,onClick:()=>{let e=!De;Oe(e),localStorage.setItem(`loadpath.watch`,e?`1`:`0`)},children:De?`Watching`:`Paused`})]}),c?(0,w.jsxs)(`div`,{className:`merge-box compact ${c.confidence.level}`,"data-testid":`merge-box`,children:[(0,w.jsx)(`div`,{className:`level ${c.confidence.level}`,children:c.confidence.level.toUpperCase()}),(0,w.jsxs)(`div`,{className:`muted`,children:[c.what_if?`what-if · `:``,c.confidence.covered_sinks,`/`,c.confidence.sinks,` sinks`]})]}):null,(0,w.jsxs)(`div`,{className:`topbar-actions`,children:[(0,w.jsx)(`button`,{type:`button`,"data-testid":`btn-init`,disabled:!!S,onClick:ht,children:`Draft config`}),(0,w.jsx)(`button`,{type:`button`,"data-testid":`btn-index`,disabled:!!S,onClick:()=>mt(!0),children:`Index`}),(0,w.jsx)(`button`,{type:`button`,"data-testid":`btn-review`,className:`btn primary`,disabled:!!S,onClick:pt,children:`Review`})]})]}),(0,w.jsxs)(`div`,{className:`alerts`,children:[y?(0,w.jsxs)(`div`,{className:`error`,"data-testid":`error`,role:`alert`,children:[(0,w.jsx)(`span`,{children:y}),(0,w.jsx)(`button`,{type:`button`,className:`dismiss`,onClick:()=>b(``),"aria-label":`Dismiss error`,children:`×`})]}):null,P?(0,w.jsxs)(`div`,{className:`banner`,"data-testid":`status-note`,children:[(0,w.jsx)(`span`,{children:P}),(0,w.jsx)(`button`,{type:`button`,className:`dismiss`,onClick:()=>F(``),"aria-label":`Dismiss`,children:`×`})]}):null,(c?.index?.stale||f?.stale)&&(e===`review`||e===`architecture`)?(0,w.jsx)(`div`,{className:`banner stale`,"data-testid":`index-stale`,children:`Index is stale — files changed since the last extract. Index again before trusting this walk.`}):null,c?.index?.django_boot===`failed`||f?.django_boot===`failed`?(0,w.jsx)(`div`,{className:`banner warn`,"data-testid":`django-boot-failed`,children:c?.index?.django_boot_detail||f?.django_boot_detail||`django.setup() failed`}):null,c?.workspace?.dirty_overlaps_review&&e===`review`?(0,w.jsxs)(`div`,{className:`banner warn`,"data-testid":`dirty-tree`,children:[`Uncommitted files overlap this review: `,(c.workspace.dirty_overlap||[]).slice(0,6).join(`, `)]}):null,c?.what_if?(0,w.jsxs)(`div`,{className:`banner whatif`,"data-testid":`whatif-banner`,children:[(0,w.jsxs)(`span`,{children:[`Hypothetical walk from`,` `,(0,w.jsx)(`strong`,{children:c.node?.name||`this node`}),`. Loadpath ignored Base/Head and asked which sinks would feel this node change — not a filter of the current map.`]}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-exit-whatif`,onClick:Ct,children:u?`Back to git range`:`Back to architecture`})]}):null,O?(0,w.jsx)(`div`,{className:`banner`,"data-testid":`workspace-loading`,children:S||`Loading workspace…`}):null]}),(0,w.jsxs)(`div`,{className:`stage`,"aria-busy":O||j,children:[e===`review`&&(0,w.jsxs)(`div`,{className:`content`,"data-testid":`review-layout`,children:[(0,w.jsx)(`aside`,{className:`brief`,"data-testid":`brief`,children:c?(0,w.jsx)(qm,{review:c,findings:Vt,aiNote:le,busy:!!S,tourIndex:se,onTour:ce,onAskAi:Dt,onCopy:gt,onPost:_t,onSelect:be,onOpenFile:Pt,onExport:Ft,history:ke,diff:je,onReopen:It,onWaiver:(e,t)=>{n.trim()&&x.addWaiver(n,e,t||void 0,`from review`).then(t=>{Pe(t),F(`Waived ${e} in loadpath.yml`)})}}):Le?(0,w.jsxs)(`div`,{className:`empty`,"data-testid":`review-restoring`,children:[(0,w.jsx)(`h2`,{children:`Restoring last review`}),(0,w.jsx)(`p`,{children:`Loading the walk this machine stored last time Loadpath was open.`})]}):(0,w.jsxs)(`div`,{className:`empty`,"data-testid":`review-empty`,children:[(0,w.jsx)(`h2`,{children:`Trace the force of this diff`}),(0,w.jsx)(`p`,{children:`The graph is the architecture. The brief is where this change travels — not a hunk list.`}),(0,w.jsxs)(`ol`,{children:[(0,w.jsx)(`li`,{children:`Point at a Django + React monorepo, or pick an indexed workspace.`}),(0,w.jsxs)(`li`,{children:[`Index it. Missing `,(0,w.jsx)(`code`,{children:`loadpath.yml`}),` is drafted from `,(0,w.jsx)(`code`,{children:`manage.py`}),` and`,` `,(0,w.jsx)(`code`,{children:`src/features`}),`.`]}),(0,w.jsx)(`li`,{children:`Review a git range, or open a pull request so base/head become a three-dot merge-base.`})]})]})}),(0,w.jsx)(`div`,{className:`graph-wrap`,"data-testid":`review-graph`,children:c?(0,w.jsx)(xm,{nodes:c.nodes,edges:c.edges,onWhatIf:St,focusPath:c.read_order[se]?.path,...G}):null})]}),e===`architecture`&&(0,w.jsxs)(`div`,{className:`content`,"data-testid":`architecture-panel`,children:[(0,w.jsx)(`aside`,{className:`brief`,"data-testid":`architecture-brief`,children:f?.indexed?(0,w.jsx)(Jm,{architecture:f,busy:!!S,onReindex:()=>mt(!1),onReview:pt,onSelect:be,config:Ne,health:Fe,onSaveConfig:e=>{x.saveConfig(n,e).then(e=>{Pe(e),F(`Wrote loadpath.yml`)})},onWaiver:(e,t,r)=>{x.addWaiver(n,e,t,r).then(t=>{Pe(t),F(`Waived ${e}`)})}}):O?(0,w.jsx)(`p`,{className:`muted`,"data-testid":`architecture-loading`,children:`Loading the index summary…`}):(0,w.jsx)(`p`,{className:`muted`,"data-testid":`architecture-empty`,children:`Index this repo to build the architecture graph. Review then walks that same graph for a git range — it does not start from a hunk list.`})}),(0,w.jsx)(`div`,{className:`graph-wrap`,"data-testid":`architecture-graph`,children:(j||f?.graph_pending)&&!(f?.nodes||[]).length?(0,w.jsxs)(`div`,{className:`empty graph-loading`,"data-testid":`graph-loading`,children:[(0,w.jsx)(`h2`,{children:`Drawing the architecture map…`}),(0,w.jsx)(`p`,{children:f?.counts?.nodes?`${f.counts.nodes} indexed nodes. The brief is ready while the graph loads.`:`Fetching the indexed graph.`})]}):f?.indexed?(0,w.jsx)(xm,{nodes:f.nodes,edges:f.edges,onWhatIf:St,...G,isolateSource:null,onIsolate:void 0}):null})]}),e===`graph`&&(0,w.jsxs)(`div`,{className:`graph-wrap`,"data-testid":`graph-full`,style:{height:`100%`},children:[(0,w.jsxs)(`div`,{className:`graph-modes`,children:[(0,w.jsxs)(`div`,{className:`seg`,"aria-label":`Graph scope`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-pressed":_===`review`,"data-testid":`graph-mode-review`,className:_===`review`?`active`:``,onClick:()=>v(`review`),children:`This review`}),(0,w.jsx)(`button`,{type:`button`,"aria-pressed":_===`architecture`,"data-testid":`graph-mode-architecture`,className:_===`architecture`?`active`:``,onClick:()=>v(`architecture`),children:`Indexed architecture`})]}),(0,w.jsxs)(`div`,{className:`legend`,"aria-hidden":`true`,children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`i`,{}),` cheap`]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`i`,{className:`exp`}),` expensive`]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`i`,{className:`crit`}),` critical`]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`i`,{className:`dash`}),` inferred`]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`i`,{className:`seed`}),` changed`]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`i`,{className:`down`}),` downstream`]})]}),(0,w.jsx)(`button`,{type:`button`,className:Ce?`chip-btn active`:`chip-btn`,"data-testid":`graph-test-overlay`,"aria-pressed":Ce,onClick:()=>{let e=!Ce;we(e),localStorage.setItem(`loadpath.testOverlay`,e?`1`:`0`)},children:`Tests`})]}),Rt.length||_===`review`&&c||f?.indexed&&!(j||f?.graph_pending)?(0,w.jsx)(xm,{nodes:Rt,edges:zt,onWhatIf:St,...G,..._===`architecture`?{isolateSource:null,onIsolate:void 0,nodeRoles:void 0,testOverlay:!1}:{}}):j||f?.graph_pending?(0,w.jsx)(`p`,{className:`empty`,"data-testid":`graph-loading`,children:`Drawing the architecture map…`}):(0,w.jsx)(`p`,{className:`empty`,"data-testid":`graph-empty`,children:`Index the repo or run a review first. Click a node to inspect it.`})]}),e===`prs`&&(0,w.jsxs)(`div`,{className:`pr-list`,"data-testid":`pr-list`,children:[(0,w.jsxs)(`div`,{className:`pr-toolbar`,children:[(0,w.jsxs)(`label`,{className:`field provider`,children:[(0,w.jsx)(`span`,{children:`Provider`}),(0,w.jsxs)(`select`,{"data-testid":`pr-provider`,value:U,onChange:e=>ot(e.target.value,te,re),children:[(0,w.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,w.jsx)(`option`,{value:`gitlab`,children:`GitLab`}),(0,w.jsx)(`option`,{value:`bitbucket`,children:`Bitbucket`})]})]}),(0,w.jsxs)(`label`,{className:`field`,children:[(0,w.jsx)(`span`,{children:`Repository`}),(0,w.jsx)(`input`,{"data-testid":`pr-repo`,placeholder:B.length?`Search your repos`:`owner/repo`,value:te,onChange:e=>ot(U,e.target.value,re),list:`scm-repos`,spellCheck:!1}),(0,w.jsx)(`datalist`,{id:`scm-repos`,children:B.map(e=>(0,w.jsxs)(`option`,{value:e.slug,children:[e.private?`private`:`public`,e.local_path?` · local`:``]},e.slug))})]}),(0,w.jsx)(`button`,{type:`button`,"data-testid":`btn-refresh-repos`,className:`btn`,disabled:!!S||!ut(U),onClick:()=>{dt(U)},children:`My repos`}),(0,w.jsx)(`button`,{type:`button`,"data-testid":`btn-list-prs`,className:`btn`,disabled:!!S,onClick:vt,children:`List PRs`})]}),B.length>0?(0,w.jsxs)(`p`,{className:`muted scm-count`,"data-testid":`scm-repo-count`,children:[B.length,` `,U,` repositor`,B.length===1?`y`:`ies`,U===`github`&&I.github_user?` · @${String(I.github_user)}`:``,U===`gitlab`&&I.gitlab_user?` · @${String(I.gitlab_user)}`:``,U===`bitbucket`&&I.bitbucket_user?` · ${String(I.bitbucket_user)}`:``]}):null,ee.length===0?(0,w.jsxs)(`div`,{className:`empty`,"data-testid":`pr-empty`,children:[(0,w.jsx)(`h2`,{children:`No pull requests loaded`}),(0,w.jsx)(`p`,{children:`Sign in under Settings (or paste a token), load your repositories, then list open PRs. Reviewing a PR fills base and head from its SHAs.`})]}):ee.map(e=>(0,w.jsxs)(`article`,{className:`pr`,"data-testid":`pr-${e.number}`,children:[(0,w.jsxs)(`h3`,{children:[`#`,e.number,` `,e.title]}),(0,w.jsxs)(`div`,{className:`pr-meta muted`,children:[(0,w.jsx)(`span`,{className:`chip ${e.draft?``:`open`}`,children:e.draft?`draft`:e.state}),(0,w.jsx)(`span`,{children:e.author}),(0,w.jsxs)(`span`,{children:[e.source_branch,` → `,e.target_branch]}),e.loadpath?(0,w.jsxs)(`span`,{className:`chip ${e.loadpath.level||``}`,"data-testid":`pr-loadpath-${e.number}`,children:[e.loadpath.level?.toUpperCase()||`REVIEWED`,e.loadpath.contract_break&&e.loadpath.contract_break!==`none`?` · ${e.loadpath.contract_break}`:``]}):(0,w.jsx)(`span`,{className:`muted`,children:`no Loadpath walk yet`})]}),(0,w.jsxs)(`div`,{className:`pr-actions`,children:[(0,w.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[`Open on `,e.provider]}),(0,w.jsx)(`button`,{type:`button`,className:`btn primary`,"data-testid":`pr-review-${e.number}`,onClick:()=>void wt(e),children:`Review this PR`})]})]},`${e.provider}-${e.number}`))]}),e===`settings`&&pe&&(0,w.jsxs)(`form`,{className:`settings`,"data-testid":`settings-form`,onSubmit:Et,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h1`,{children:`Settings`}),(0,w.jsx)(`p`,{className:`muted`,children:`Tokens stay on this machine in ~/.loadpath/settings.json. AI runs only on residual uncertainty the graph could not close.`})]}),(0,w.jsxs)(`section`,{className:`settings-card`,children:[(0,w.jsx)(`h2`,{children:`Appearance`}),(0,w.jsx)(`p`,{className:`muted`,children:`Local to this browser. High contrast is a first-class theme, not an afterthought.`}),(0,w.jsx)(`div`,{className:`theme-grid`,"data-testid":`theme-grid`,children:Lm.map(e=>(0,w.jsxs)(`button`,{type:`button`,"data-theme":e.id,className:de===e.id?`theme-swatch active`:`theme-swatch`,"data-testid":`theme-${e.id}`,onClick:()=>Qe(e.id),children:[(0,w.jsx)(`div`,{className:`swatch-bar`,"aria-hidden":`true`}),(0,w.jsx)(`div`,{className:`name`,children:e.label}),(0,w.jsx)(`div`,{className:`group`,children:e.group})]},e.id))})]}),(0,w.jsxs)(`section`,{className:`settings-card`,children:[(0,w.jsx)(`h2`,{children:`Editor`}),(0,w.jsx)(`p`,{className:`muted`,children:`Open files from the inspector and read-order in Cursor, VS Code, or the system handler.`}),(0,w.jsx)(`label`,{htmlFor:`editor-pref`,children:`Preferred editor`}),(0,w.jsxs)(`select`,{id:`editor-pref`,"data-testid":`editor-pref`,defaultValue:Sm(),onChange:e=>Cm(e.target.value),children:[(0,w.jsx)(`option`,{value:`auto`,children:`Auto (Cursor, then VS Code)`}),(0,w.jsx)(`option`,{value:`cursor`,children:`Cursor`}),(0,w.jsx)(`option`,{value:`vscode`,children:`VS Code`}),(0,w.jsx)(`option`,{value:`system`,children:`System default`})]})]}),(0,w.jsxs)(`section`,{className:`settings-card`,children:[(0,w.jsx)(`h2`,{children:`Source control`}),(0,w.jsx)(`p`,{className:`muted`,children:`Sign in with OAuth to list every repository the account can access. Tokens stay in ~/.loadpath/settings.json. A classic PAT still works if you prefer not to register an OAuth app.`}),(0,w.jsxs)(`div`,{className:`scm-login`,"data-testid":`scm-github`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`strong`,{children:`GitHub`}),(0,w.jsx)(`p`,{className:`muted`,children:I.github_token_set?I.github_user?`Signed in as @${String(I.github_user)}`:`Token saved on this machine`:`Not connected`})]}),(0,w.jsx)(`div`,{className:`btn-row`,children:I.github_token_set?(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-github-disconnect`,onClick:()=>void Tt(`github`),children:`Disconnect`}):(0,w.jsx)(`button`,{type:`button`,className:`btn primary`,"data-testid":`btn-github-login`,disabled:!!Ve||!I.github_oauth_ready,onClick:()=>void yt(),children:Ve?`Waiting for GitHub…`:`Sign in with GitHub`})})]}),Ve?(0,w.jsxs)(`p`,{className:`oauth-code`,"data-testid":`github-user-code`,children:[`Enter `,(0,w.jsx)(`code`,{children:Ve.user_code}),` at GitHub if the browser did not fill it in.`]}):null,I.github_oauth_ready?null:(0,w.jsx)(`p`,{className:`muted`,children:`Sign-in needs a GitHub OAuth App with Device Flow enabled. Set LOADPATH_GITHUB_CLIENT_ID or paste the client ID below.`}),(0,w.jsx)(`label`,{htmlFor:`github_oauth_client_id`,children:`GitHub OAuth client ID`}),(0,w.jsx)(`input`,{id:`github_oauth_client_id`,name:`github_oauth_client_id`,"data-testid":`github-oauth-client-id`,placeholder:`Ov23…`,defaultValue:String(I.github_oauth_client_id||``),autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`github_token`,children:`GitHub token (optional PAT)`}),(0,w.jsx)(`input`,{id:`github_token`,name:`github_token`,type:`password`,placeholder:`ghp_…`,autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`github_host`,children:`GitHub host (Enterprise)`}),(0,w.jsx)(`input`,{id:`github_host`,name:`github_host`,"data-testid":`github-host`,placeholder:`github.com`,defaultValue:String(I.github_host||``),autoComplete:`off`}),(0,w.jsxs)(`div`,{className:`scm-login`,"data-testid":`scm-gitlab`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`strong`,{children:`GitLab`}),(0,w.jsx)(`p`,{className:`muted`,children:I.gitlab_token_set?I.gitlab_user?`Signed in as @${String(I.gitlab_user)}`:`Token saved on this machine`:`Not connected`})]}),(0,w.jsx)(`div`,{className:`btn-row`,children:I.gitlab_token_set?(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-gitlab-disconnect`,onClick:()=>void Tt(`gitlab`),children:`Disconnect`}):(0,w.jsx)(`button`,{type:`button`,className:`btn primary`,"data-testid":`btn-gitlab-login`,disabled:Ge||!I.gitlab_oauth_ready,onClick:()=>void xt(),children:Ge?`Waiting for GitLab…`:`Sign in with GitLab`})})]}),(0,w.jsx)(`label`,{htmlFor:`gitlab_host`,children:`GitLab host`}),(0,w.jsx)(`input`,{id:`gitlab_host`,name:`gitlab_host`,"data-testid":`gitlab-host`,placeholder:`gitlab.com`,defaultValue:String(I.gitlab_host||``),autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`gitlab_oauth_client_id`,children:`GitLab OAuth application ID`}),(0,w.jsx)(`input`,{id:`gitlab_oauth_client_id`,name:`gitlab_oauth_client_id`,"data-testid":`gitlab-oauth-client-id`,defaultValue:String(I.gitlab_oauth_client_id||``),autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`gitlab_oauth_client_secret`,children:`GitLab OAuth secret`}),(0,w.jsx)(`input`,{id:`gitlab_oauth_client_secret`,name:`gitlab_oauth_client_secret`,type:`password`,autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`gitlab_token`,children:`GitLab token (optional PAT)`}),(0,w.jsx)(`input`,{id:`gitlab_token`,name:`gitlab_token`,type:`password`,placeholder:`glpat-…`,autoComplete:`off`}),(0,w.jsxs)(`div`,{className:`scm-login`,"data-testid":`scm-bitbucket`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`strong`,{children:`Bitbucket`}),(0,w.jsx)(`p`,{className:`muted`,children:I.bitbucket_token_set?I.bitbucket_user?`Signed in as ${String(I.bitbucket_user)}`:`Token saved on this machine`:`Not connected`})]}),(0,w.jsx)(`div`,{className:`btn-row`,children:I.bitbucket_token_set?(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-bitbucket-disconnect`,onClick:()=>void Tt(`bitbucket`),children:`Disconnect`}):(0,w.jsx)(`button`,{type:`button`,className:`btn primary`,"data-testid":`btn-bitbucket-login`,disabled:Ue||!I.bitbucket_oauth_ready,onClick:()=>void bt(),children:Ue?`Waiting for Bitbucket…`:`Sign in with Bitbucket`})})]}),I.bitbucket_oauth_ready?null:(0,w.jsxs)(`p`,{className:`muted`,children:[`Sign-in needs a Bitbucket OAuth consumer (key + secret). Callback URL:`,` `,(0,w.jsx)(`code`,{children:`/api/oauth/bitbucket/callback`}),` on this app origin.`]}),(0,w.jsx)(`label`,{htmlFor:`bitbucket_oauth_client_id`,children:`Bitbucket OAuth key`}),(0,w.jsx)(`input`,{id:`bitbucket_oauth_client_id`,name:`bitbucket_oauth_client_id`,"data-testid":`bitbucket-oauth-client-id`,defaultValue:String(I.bitbucket_oauth_client_id||``),autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`bitbucket_oauth_client_secret`,children:`Bitbucket OAuth secret`}),(0,w.jsx)(`input`,{id:`bitbucket_oauth_client_secret`,name:`bitbucket_oauth_client_secret`,type:`password`,autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`bitbucket_token`,children:`Bitbucket token (optional app password)`}),(0,w.jsx)(`input`,{id:`bitbucket_token`,name:`bitbucket_token`,type:`password`,autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`bitbucket_username`,children:`Bitbucket username (app passwords)`}),(0,w.jsx)(`input`,{id:`bitbucket_username`,name:`bitbucket_username`,defaultValue:String(I.bitbucket_username||``)})]}),(0,w.jsxs)(`section`,{className:`settings-card`,children:[(0,w.jsx)(`h2`,{children:`Residual AI`}),(0,w.jsx)(`label`,{htmlFor:`ai_provider`,children:`Provider`}),(0,w.jsxs)(`select`,{id:`ai_provider`,name:`ai_provider`,defaultValue:String(I.ai?.provider||`none`),children:[(0,w.jsx)(`option`,{value:`none`,children:`none (graph only)`}),(0,w.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,w.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,w.jsx)(`option`,{value:`grok`,children:`Grok / xAI`}),(0,w.jsx)(`option`,{value:`deepseek`,children:`DeepSeek`}),(0,w.jsx)(`option`,{value:`cursor`,children:`Cursor-compatible (OpenAI protocol)`}),(0,w.jsx)(`option`,{value:`ollama`,children:`Ollama local`})]}),(0,w.jsx)(`label`,{htmlFor:`ai_api_key`,children:`API key`}),(0,w.jsx)(`input`,{id:`ai_api_key`,name:`ai_api_key`,type:`password`,autoComplete:`off`}),(0,w.jsx)(`label`,{htmlFor:`ai_model`,children:`Model`}),(0,w.jsx)(`input`,{id:`ai_model`,name:`ai_model`,"data-testid":`ai-model`,placeholder:`optional override`,defaultValue:String(I.ai?.model||``)}),(0,w.jsx)(`label`,{htmlFor:`ai_base_url`,children:`Base URL`}),(0,w.jsx)(`input`,{id:`ai_base_url`,name:`ai_base_url`,"data-testid":`ai-base-url`,placeholder:`optional, OpenAI-compatible`,defaultValue:String(I.ai?.base_url||``)}),(0,w.jsx)(`button`,{className:`btn primary`,type:`submit`,"data-testid":`btn-save-settings`,children:`Save`})]})]})]})]}),(0,w.jsx)(E,{open:_e,actions:Lt,onClose:()=>ve(!1)}),he?(0,w.jsx)(Mm,{initialPath:n,onClose:()=>ge(!1),onSelect:e=>{if($e.current){b(`Wait for the current job to finish before switching workspace.`);return}ge(!1),ft(e)}}):null]})}function qm({review:e,findings:t,aiNote:n,busy:r,tourIndex:i,onTour:a,onAskAi:o,onCopy:s,onPost:c,onSelect:l,onOpenFile:u,onExport:d,history:f,diff:p,onReopen:m,onWaiver:h}){let g=[...new Set(e.confidence.reasons||[])];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`merge-box ${e.confidence.level}`,children:[(0,w.jsxs)(`div`,{className:`level ${e.confidence.level}`,children:[e.confidence.level.toUpperCase(),` — `,e.title]}),g.length?(0,w.jsx)(`ul`,{className:`reasons`,children:g.map(e=>(0,w.jsx)(`li`,{children:e},e))}):null,e.what_if?(0,w.jsx)(`span`,{className:`chip whatif`,"data-testid":`whatif-chip`,children:`what-if`}):null,e.low_risk?(0,w.jsx)(`span`,{className:`chip`,children:`low-risk`}):null,e.change_kinds.map(e=>(0,w.jsx)(`span`,{className:`chip`,children:O(e)},e)),e.contract_break?.kind&&e.contract_break.kind!==`none`?(0,w.jsxs)(`span`,{className:`chip ${e.contract_break.kind===`breaking`?`blocker`:``}`,"data-testid":`contract-kind`,children:[`contract `,e.contract_break.kind]}):null]}),(0,w.jsxs)(`div`,{className:`metrics`,children:[(0,w.jsxs)(`div`,{className:`metric`,children:[(0,w.jsxs)(`div`,{className:`n`,children:[e.confidence.covered_sinks,`/`,e.confidence.sinks]}),(0,w.jsx)(`div`,{className:`l`,children:`Sinks tested`})]}),(0,w.jsxs)(`div`,{className:`metric`,children:[(0,w.jsx)(`div`,{className:`n`,children:t.length}),(0,w.jsx)(`div`,{className:`l`,children:`Findings`})]}),(0,w.jsxs)(`div`,{className:`metric`,children:[(0,w.jsx)(`div`,{className:`n`,children:e.residuals.length}),(0,w.jsx)(`div`,{className:`l`,children:`Residuals`})]})]}),(0,w.jsx)(`pre`,{className:`headline`,children:e.headline}),(e.checklist||[]).length?(0,w.jsxs)(`details`,{className:`section`,open:!0,"data-testid":`merge-checklist`,children:[(0,w.jsxs)(`summary`,{children:[`Merge checklist`,` `,(0,w.jsx)(`span`,{className:`count`,children:(e.checklist||[]).filter(e=>e.status===`todo`).length})]}),(e.checklist||[]).map(e=>(0,w.jsxs)(`div`,{className:`check-item ${e.status}`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`linkish`,onClick:()=>e.node_id&&l(e.node_id),children:[(0,w.jsx)(`span`,{className:`chip ${e.status}`,children:e.status}),e.title]}),e.detail?(0,w.jsx)(`div`,{className:`why`,children:e.detail}):null,e.body?(0,w.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{navigator.clipboard.writeText(e.body||``)},children:`Copy test`}):null,e.kind===`finding`&&e.status===`todo`&&e.rule?(0,w.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>h(e.rule,e.node_id),children:`Waive in loadpath.yml`}):null]},e.id))]}):null,e.index?(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Index `,(0,w.jsx)(`span`,{className:`count`,children:e.index.counts.nodes})]}),(0,w.jsxs)(`div`,{className:`muted`,children:[`Walked `,e.index.counts.nodes,` nodes / `,e.index.counts.edges,` edges`,e.index.reindex_skipped?` from an unchanged index`:e.index.reindexed?` after an incremental refresh`:` from the existing index`,e.index.django_boot&&e.index.django_boot!==`off`?` · Django boot ${e.index.django_boot}`:``,e.workspace?.three_dot?` · three-dot range`:``]})]}):null,(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Read this `,(0,w.jsx)(`span`,{className:`count`,children:e.read_order.length})]}),e.read_order.map((e,t)=>(0,w.jsxs)(`div`,{className:t===i?`read-item tour-current`:`read-item`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`linkish file`,onClick:()=>a(t),children:[t+1,`. `,e.path]}),(0,w.jsx)(`div`,{className:`why`,children:e.why}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>u(e.path),children:`Open`})]},e.path)),e.read_order.length>0?(0,w.jsxs)(`div`,{className:`btn-row tour-row`,children:[(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-tour-prev`,disabled:i<=0,onClick:()=>a(Math.max(0,i-1)),children:`Previous`}),(0,w.jsx)(`button`,{type:`button`,className:`btn primary`,"data-testid":`btn-tour-next`,disabled:i>=e.read_order.length-1,onClick:()=>a(Math.min(e.read_order.length-1,i+1)),children:`Next in read order`}),(0,w.jsxs)(`span`,{className:`muted`,children:[i+1,`/`,e.read_order.length]})]}):null]}),(0,w.jsxs)(`details`,{className:`section`,children:[(0,w.jsxs)(`summary`,{children:[`Clusters `,(0,w.jsx)(`span`,{className:`count`,children:e.clusters.length})]}),e.clusters.map(e=>(0,w.jsxs)(`div`,{className:`muted`,children:[(0,w.jsx)(`strong`,{children:e.title}),` — `,e.files.join(`, `)]},e.id))]}),(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Architecture `,(0,w.jsx)(`span`,{className:`count`,children:t.length})]}),t.length===0?(0,w.jsx)(`div`,{className:`muted`,children:e.architecture_note}):t.map(e=>(0,w.jsx)(`div`,{className:`finding`,children:(0,w.jsxs)(`button`,{type:`button`,className:`linkish`,onClick:()=>e.node_id&&l(e.node_id),children:[(0,w.jsx)(`span`,{className:`chip ${e.severity}`,children:e.severity}),e.message]})},e.rule+e.message))]}),(0,w.jsx)(Ym,{cards:e.deepening}),e.contract_break?.reasons?.length?(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Contract `,(0,w.jsx)(`span`,{className:`count`,children:e.contract_break.kind})]}),e.contract_break.reasons.map(e=>(0,w.jsx)(`div`,{className:`muted`,children:e},e)),e.contract_break.sides?.rows?.length?(0,w.jsxs)(`table`,{className:`type-table`,"data-testid":`contract-sides`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{children:`Field`}),(0,w.jsx)(`th`,{children:`Serializer`}),(0,w.jsx)(`th`,{children:`Zod`}),(0,w.jsx)(`th`,{children:`GraphQL`})]})}),(0,w.jsx)(`tbody`,{children:e.contract_break.sides.rows.map(e=>(0,w.jsxs)(`tr`,{className:e.status,children:[(0,w.jsx)(`td`,{children:e.field}),(0,w.jsx)(`td`,{children:e.serializer?`yes`:`—`}),(0,w.jsx)(`td`,{children:e.zod?`yes`:`—`}),(0,w.jsx)(`td`,{children:e.graphql?`yes`:`—`})]},e.field))})]}):null]}):null,e.auth?.note?(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsx)(`summary`,{children:`Auth`}),(0,w.jsx)(`div`,{className:`muted`,children:e.auth.note}),(e.auth.missing_permissions||[]).map(e=>(0,w.jsxs)(`div`,{className:`finding`,children:[(0,w.jsx)(`span`,{className:`chip warning`,children:`missing`}),e.name]},e.id))]}):null,(e.suggested_tests||[]).length?(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Suggested tests `,(0,w.jsx)(`span`,{className:`count`,children:e.suggested_tests?.length})]}),(e.suggested_tests||[]).map(e=>(0,w.jsxs)(`div`,{className:`residual`,children:[(0,w.jsx)(`strong`,{children:e.title}),(0,w.jsx)(`pre`,{className:`headline`,children:e.body}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{navigator.clipboard.writeText(e.body)},children:`Copy sketch`})]},e.title))]}):null,e.trend?.note?(0,w.jsxs)(`details`,{className:`section`,children:[(0,w.jsx)(`summary`,{children:`Confidence trend`}),(0,w.jsx)(`div`,{className:`muted`,children:e.trend.note}),(e.trend.points||[]).slice(0,6).map(e=>(0,w.jsxs)(`div`,{className:`muted`,children:[e.level,` · `,j(e.created_at),e.sinks==null?``:` · ${e.sinks} sinks`]},e.id))]}):null,(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Residual `,(0,w.jsx)(`span`,{className:`count`,children:e.residuals.length})]}),(0,w.jsx)(`p`,{className:`muted`,children:`AI is only used here, on what the graph could not close.`}),e.residuals.map(e=>(0,w.jsx)(`div`,{className:`residual muted`,children:e},e))]}),f.length?(0,w.jsxs)(`details`,{className:`section`,"data-testid":`review-history`,children:[(0,w.jsxs)(`summary`,{children:[`History `,(0,w.jsx)(`span`,{className:`count`,children:f.length})]}),p?(0,w.jsx)(`div`,{className:`muted`,children:p.note}):null,f.slice(0,12).map(t=>(0,w.jsxs)(`button`,{type:`button`,className:t.id===e.id?`history-item current`:`history-item`,onClick:()=>m(t.id),children:[(0,w.jsx)(`span`,{className:`chip ${t.level||``}`,children:t.level||`walk`}),t.title||t.id.slice(0,8),(0,w.jsx)(`span`,{className:`muted`,children:t.created_at?j(t.created_at):``})]},t.id))]}):null,e.evolution?.notes?.length||e.evolution?.hotspots?.some(e=>e.commits)?(0,w.jsxs)(`details`,{className:`section`,children:[(0,w.jsx)(`summary`,{children:`Churn & coupling`}),(e.evolution?.notes||[]).map(e=>(0,w.jsx)(`div`,{className:`muted`,children:e},e)),(e.evolution?.hotspots||[]).filter(e=>e.commits).slice(0,6).map(e=>(0,w.jsxs)(`div`,{className:`muted`,children:[(0,w.jsx)(`span`,{className:`file`,children:e.path}),` — `,e.commits,` commits, bus factor `,e.bus_factor]},e.path))]}):null,(0,w.jsxs)(`div`,{className:`btn-row`,children:[(0,w.jsx)(`button`,{type:`button`,className:`btn`,disabled:r,onClick:o,children:`Ask configured model`}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-copy-markdown`,onClick:s,children:`Copy markdown`}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-export-html`,onClick:d,children:`Save HTML`}),(0,w.jsx)(`button`,{type:`button`,className:`btn`,"data-testid":`btn-post-comment`,disabled:r||!!e.what_if,title:e.what_if?`Hypothetical walks are not posted to a pull request`:void 0,onClick:c,children:`Post to PR`})]}),n?(0,w.jsx)(`pre`,{className:`headline`,children:n}):null,(0,w.jsx)(`div`,{className:`kicker`,children:`Reviewers`}),(0,w.jsx)(`div`,{className:`muted`,children:e.suggested_reviewers.join(`, `)||`—`}),e.codeowners_reviewers?.length?(0,w.jsxs)(`div`,{className:`muted`,children:[`CODEOWNERS: `,e.codeowners_reviewers.join(`, `)]}):null,e.knowledge_owners?.length?(0,w.jsxs)(`div`,{className:`muted`,children:[`Knowledge: `,e.knowledge_owners.join(`, `)]}):null]})}function Jm({architecture:e,busy:t,onReindex:n,onReview:r,onSelect:i,config:a,health:o,onSaveConfig:s,onWaiver:c}){let l=e.findings.filter(e=>!e.waived);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`merge-box high`,children:[(0,w.jsxs)(`div`,{className:`level high`,children:[`INDEXED — `,e.counts.nodes,` nodes`]}),(0,w.jsxs)(`div`,{className:`muted`,style:{marginTop:8},children:[e.indexed_at?`Last index ${j(e.indexed_at)}`:`Indexed`,e.incremental?` · incremental`:` · full`,e.stale?` · stale`:``,e.django_boot&&e.django_boot!==`off`?` · Django boot ${e.django_boot}`:``]}),(0,w.jsxs)(`span`,{className:`chip`,children:[e.counts.edges,` edges`]}),e.has_config?(0,w.jsx)(`span`,{className:`chip`,children:`loadpath.yml`}):null]}),(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsx)(`summary`,{children:`Bounded contexts`}),Object.values(e.contexts).map(e=>(0,w.jsxs)(`div`,{className:`muted`,children:[(0,w.jsx)(`strong`,{children:e.name}),` — `,(e.django_apps||[]).join(`, `)||`no apps`,` ·`,` `,(e.owners||[]).join(`, `)||`unowned`]},e.name))]}),(0,w.jsxs)(`details`,{className:`section`,children:[(0,w.jsxs)(`summary`,{children:[`Rules `,(0,w.jsx)(`span`,{className:`count`,children:(e.rules||[]).length})]}),(e.rules||[]).map(e=>(0,w.jsx)(`div`,{className:`muted`,children:e},e))]}),(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsxs)(`summary`,{children:[`Findings `,(0,w.jsx)(`span`,{className:`count`,children:l.length})]}),l.length===0?(0,w.jsx)(`div`,{className:`muted`,children:`No architecture rule hits on the full graph.`}):l.map(e=>(0,w.jsx)(`div`,{className:`finding`,children:(0,w.jsxs)(`button`,{type:`button`,className:`linkish`,onClick:()=>e.node_id&&i(e.node_id),children:[(0,w.jsx)(`span`,{className:`chip ${e.severity}`,children:e.severity}),e.message]})},e.rule+e.message))]}),(0,w.jsx)(Ym,{cards:e.deepening}),o?.points?.length?(0,w.jsxs)(`details`,{className:`section`,open:!0,"data-testid":`architecture-health`,children:[(0,w.jsxs)(`summary`,{children:[`Health over time `,(0,w.jsx)(`span`,{className:`count`,children:o.points.length})]}),(0,w.jsx)(`div`,{className:`sparkline`,"aria-hidden":`true`,children:o.points.map(e=>(0,w.jsx)(`i`,{className:e.level||``,title:`${e.level} · ${e.findings} findings`,style:{height:`${8+Math.min(24,(e.findings||0)*4)}px`}},e.id||e.created_at))}),Object.entries(o.contexts).map(([e,t])=>(0,w.jsxs)(`div`,{className:`muted`,children:[(0,w.jsx)(`strong`,{children:e}),` — last `,t[t.length-1]?.findings??0,` findings`]},e))]}):null,a?(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsx)(`summary`,{children:`loadpath.yml`}),(0,w.jsx)(D,{config:a,busy:t,onSave:s,onWaiver:c})]}):null,(0,w.jsxs)(`details`,{className:`section`,open:!0,children:[(0,w.jsx)(`summary`,{children:`Types`}),(0,w.jsx)(`table`,{className:`type-table`,children:(0,w.jsx)(`tbody`,{children:Object.entries(e.type_counts||{}).sort((e,t)=>t[1]-e[1]).slice(0,12).map(([e,t])=>(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`td`,{children:A(e)}),(0,w.jsx)(`td`,{children:t})]},e))})})]}),(0,w.jsxs)(`div`,{className:`btn-row`,children:[(0,w.jsx)(`button`,{type:`button`,className:`btn`,disabled:t,onClick:n,"data-testid":`btn-full-reindex`,children:`Full reindex`}),(0,w.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:t,onClick:r,children:`Review against this index`})]})]})}function Ym({cards:e}){let t=e||[];return t.length?(0,w.jsxs)(`details`,{className:`section`,open:!0,"data-testid":`deepening-list`,children:[(0,w.jsxs)(`summary`,{children:[`Depth `,(0,w.jsx)(`span`,{className:`count`,children:t.length})]}),(0,w.jsx)(`p`,{className:`muted`,children:`Deepening opportunities: more behaviour behind a smaller interface, at a real seam.`}),t.map(e=>(0,w.jsxs)(`div`,{className:`finding`,"data-testid":`deepening-card`,children:[(0,w.jsx)(`span`,{className:`chip ${e.strength}`,children:k(e.strength)}),e.top?(0,w.jsx)(`span`,{className:`chip`,children:`top`}):null,(0,w.jsx)(`strong`,{children:e.title}),(0,w.jsx)(`div`,{className:`why`,children:e.message}),e.deletion_test?(0,w.jsxs)(`div`,{className:`muted`,children:[`Deletion test: `,e.deletion_test]}):null,e.before&&e.after?(0,w.jsxs)(`div`,{className:`muted`,children:[e.before,` → `,e.after]}):null]},e.rule+e.title))]}):null}Um(Vm()),(0,_.createRoot)(document.getElementById(`root`)).render((0,w.jsx)(g.StrictMode,{children:(0,w.jsx)(Km,{})}));export{tp as a,u as c,np as i,c as l,ep as n,A as o,ip as r,C as s,Wf as t}; \ No newline at end of file diff --git a/src/loadpath/static/assets/index-Q9TpSg-b.css b/src/loadpath/static/assets/index-Q9TpSg-b.css deleted file mode 100644 index 3a56ef6..0000000 --- a/src/loadpath/static/assets/index-Q9TpSg-b.css +++ /dev/null @@ -1 +0,0 @@ -.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}:root,[data-theme=obsidian]{--bg: #070b10;--bg-2: #0d141c;--surface: #121a24;--line: #1e2c3c;--ink: #e7eef6;--muted: #8b9bb0;--high: #2a9d8f;--medium: #e9c46a;--low: #e76f51;--critical: #e85d04;--accent: #4cc9f0;--rail-from: #0b1219;--rail-to: #070b10;--rail-active: #15202c;--btn: #173044;--btn-line: #24506c;--btn-primary: #134e4a;--btn-primary-line: #2a9d8f;--node-bg: #101822;--node-line: #2a3d52;--graph-bg: #070b10;--graph-grid: rgba(42, 80, 120, .09);--edge-cheap: #4a5568;--edge-expensive: #f4a261;--edge-critical: #e85d04;--shadow: rgba(76, 201, 240, .08)}[data-theme=nord]{--bg: #2e3440;--bg-2: #3b4252;--surface: #434c5e;--line: #4c566a;--ink: #eceff4;--muted: #d8dee9;--high: #a3be8c;--medium: #ebcb8b;--low: #bf616a;--critical: #d08770;--accent: #88c0d0;--rail-from: #3b4252;--rail-to: #2e3440;--rail-active: #4c566a;--btn: #434c5e;--btn-line: #81a1c1;--btn-primary: #5e81ac;--btn-primary-line: #88c0d0;--node-bg: #3b4252;--node-line: #81a1c1;--graph-bg: #2e3440;--graph-grid: rgba(136, 192, 208, .12);--edge-cheap: #4c566a;--edge-expensive: #d08770;--edge-critical: #bf616a;--shadow: rgba(136, 192, 208, .12)}[data-theme=solarized-dark]{--bg: #002b36;--bg-2: #073642;--surface: #0a3944;--line: #16444f;--ink: #eee8d5;--muted: #93a1a1;--high: #859900;--medium: #b58900;--low: #dc322f;--critical: #cb4b16;--accent: #2aa198;--rail-from: #073642;--rail-to: #002b36;--rail-active: #16444f;--btn: #073642;--btn-line: #268bd2;--btn-primary: #0a4a42;--btn-primary-line: #2aa198;--node-bg: #073642;--node-line: #268bd2;--graph-bg: #002b36;--graph-grid: rgba(42, 161, 152, .12);--edge-cheap: #586e75;--edge-expensive: #cb4b16;--edge-critical: #dc322f;--shadow: rgba(42, 161, 152, .12)}[data-theme=forest]{--bg: #0e1510;--bg-2: #152019;--surface: #1b2a20;--line: #2c4334;--ink: #e4f0e6;--muted: #8eaa96;--high: #6ab04c;--medium: #c8a951;--low: #e17055;--critical: #d35400;--accent: #7bed9f;--rail-from: #152019;--rail-to: #0e1510;--rail-active: #1f3326;--btn: #1f3326;--btn-line: #3d6b4f;--btn-primary: #1e4d32;--btn-primary-line: #6ab04c;--node-bg: #16241b;--node-line: #3d6b4f;--graph-bg: #0e1510;--graph-grid: rgba(123, 237, 159, .1);--edge-cheap: #3d6b4f;--edge-expensive: #c8a951;--edge-critical: #d35400;--shadow: rgba(123, 237, 159, .1)}[data-theme=rose]{--bg: #191724;--bg-2: #1f1d2e;--surface: #26233a;--line: #403d52;--ink: #e0def4;--muted: #908caa;--high: #9ccfd8;--medium: #f6c177;--low: #eb6f92;--critical: #eb6f92;--accent: #c4a7e7;--rail-from: #1f1d2e;--rail-to: #191724;--rail-active: #26233a;--btn: #26233a;--btn-line: #c4a7e7;--btn-primary: #3a2f4d;--btn-primary-line: #c4a7e7;--node-bg: #1f1d2e;--node-line: #524f67;--graph-bg: #191724;--graph-grid: rgba(196, 167, 231, .12);--edge-cheap: #524f67;--edge-expensive: #f6c177;--edge-critical: #eb6f92;--shadow: rgba(196, 167, 231, .12)}[data-theme=amber]{--bg: #120e0a;--bg-2: #1c1610;--surface: #261e16;--line: #3d2f22;--ink: #f4e6d0;--muted: #b59a78;--high: #c4d6a0;--medium: #e9b44c;--low: #d8572a;--critical: #c0392b;--accent: #f0a05a;--rail-from: #1c1610;--rail-to: #120e0a;--rail-active: #2b2218;--btn: #2b2218;--btn-line: #8a5a2b;--btn-primary: #4a3418;--btn-primary-line: #f0a05a;--node-bg: #1c1610;--node-line: #8a5a2b;--graph-bg: #120e0a;--graph-grid: rgba(240, 160, 90, .12);--edge-cheap: #5c4a38;--edge-expensive: #e9b44c;--edge-critical: #d8572a;--shadow: rgba(240, 160, 90, .12)}[data-theme=volcano]{--bg: #14090a;--bg-2: #1e0e10;--surface: #2a1416;--line: #4a2226;--ink: #fde8e4;--muted: #c48b86;--high: #7bed9f;--medium: #f6c90e;--low: #ff6b6b;--critical: #ff3b3b;--accent: #ff7b54;--rail-from: #1e0e10;--rail-to: #14090a;--rail-active: #32181b;--btn: #32181b;--btn-line: #ff7b54;--btn-primary: #5a1f18;--btn-primary-line: #ff7b54;--node-bg: #1e0e10;--node-line: #7a3330;--graph-bg: #14090a;--graph-grid: rgba(255, 123, 84, .12);--edge-cheap: #5a3330;--edge-expensive: #ff7b54;--edge-critical: #ff3b3b;--shadow: rgba(255, 123, 84, .14)}[data-theme=lavender]{--bg: #12101c;--bg-2: #1a1730;--surface: #221e3c;--line: #3b3560;--ink: #efeaff;--muted: #b3a7d6;--high: #80ffdb;--medium: #ffd166;--low: #ff6b9d;--critical: #ff4d6d;--accent: #c77dff;--rail-from: #1a1730;--rail-to: #12101c;--rail-active: #2a2550;--btn: #2a2550;--btn-line: #c77dff;--btn-primary: #3d2a66;--btn-primary-line: #c77dff;--node-bg: #1a1730;--node-line: #5a4d8a;--graph-bg: #12101c;--graph-grid: rgba(199, 125, 255, .12);--edge-cheap: #5a4d8a;--edge-expensive: #ffd166;--edge-critical: #ff4d6d;--shadow: rgba(199, 125, 255, .14)}[data-theme=neon-noir]{--bg: #05060a;--bg-2: #0a0c14;--surface: #10131c;--line: #1e2436;--ink: #f0f4ff;--muted: #8b93b0;--high: #39ff88;--medium: #ffe66d;--low: #ff2d95;--critical: #ff3d5a;--accent: #00f0ff;--rail-from: #0a0c14;--rail-to: #05060a;--rail-active: #151a2a;--btn: #151a2a;--btn-line: #00f0ff;--btn-primary: #063a40;--btn-primary-line: #00f0ff;--node-bg: #0a0c14;--node-line: #2a3550;--graph-bg: #05060a;--graph-grid: rgba(0, 240, 255, .12);--edge-cheap: #3a4560;--edge-expensive: #ff2d95;--edge-critical: #ff3d5a;--shadow: rgba(0, 240, 255, .22)}[data-theme=synthwave]{--bg: #1a0a2e;--bg-2: #240b3d;--surface: #2d1250;--line: #4a1d7a;--ink: #ffe6fb;--muted: #c49ad8;--high: #00f5d4;--medium: #ffd60a;--low: #ff6b9d;--critical: #ff006e;--accent: #ff2bd6;--rail-from: #240b3d;--rail-to: #1a0a2e;--rail-active: #3a1570;--btn: #3a1570;--btn-line: #ff2bd6;--btn-primary: #5a0a4a;--btn-primary-line: #ff2bd6;--node-bg: #240b3d;--node-line: #7b2cbf;--graph-bg: #1a0a2e;--graph-grid: rgba(255, 43, 214, .16);--edge-cheap: #5a3a80;--edge-expensive: #ff9e00;--edge-critical: #ff006e;--shadow: rgba(255, 43, 214, .24)}[data-theme=phosphor]{--bg: #020804;--bg-2: #061208;--surface: #0a1a0e;--line: #163c1e;--ink: #c8ffc8;--muted: #5aaa5a;--high: #39ff14;--medium: #c8f542;--low: #ffb000;--critical: #ff5e00;--accent: #00ff66;--rail-from: #061208;--rail-to: #020804;--rail-active: #0e2414;--btn: #0e2414;--btn-line: #00ff66;--btn-primary: #0a3a18;--btn-primary-line: #00ff66;--node-bg: #061208;--node-line: #1e6a32;--graph-bg: #020804;--graph-grid: rgba(0, 255, 102, .12);--edge-cheap: #1e5a2a;--edge-expensive: #c8f542;--edge-critical: #ff5e00;--shadow: rgba(0, 255, 102, .2)}[data-theme=aurora]{--bg: #071018;--bg-2: #0c1c28;--surface: #122636;--line: #1e3d52;--ink: #e8fff6;--muted: #7eb8a8;--high: #5fffcf;--medium: #ffe566;--low: #ff7eb6;--critical: #ff4d6d;--accent: #7cffb2;--rail-from: #0c1c28;--rail-to: #071018;--rail-active: #163044;--btn: #163044;--btn-line: #7cffb2;--btn-primary: #0e3d3a;--btn-primary-line: #7cffb2;--node-bg: #0c1c28;--node-line: #2a6a78;--graph-bg: #071018;--graph-grid: rgba(124, 255, 178, .12);--edge-cheap: #2a5a68;--edge-expensive: #c9a0ff;--edge-critical: #ff4d6d;--shadow: rgba(124, 255, 178, .18)}[data-theme=biolume]{--bg: #02141c;--bg-2: #042430;--surface: #073040;--line: #0a4a5c;--ink: #e6fffb;--muted: #6eb8b0;--high: #5dffb0;--medium: #ffe066;--low: #ff79c6;--critical: #ff4d6d;--accent: #18e7d4;--rail-from: #042430;--rail-to: #02141c;--rail-active: #0a3848;--btn: #0a3848;--btn-line: #18e7d4;--btn-primary: #0a4a48;--btn-primary-line: #18e7d4;--node-bg: #042430;--node-line: #1a7080;--graph-bg: #02141c;--graph-grid: rgba(24, 231, 212, .12);--edge-cheap: #1a5a68;--edge-expensive: #ff79c6;--edge-critical: #ff4d6d;--shadow: rgba(24, 231, 212, .2)}[data-theme=carbon]{--bg: #0d0d0f;--bg-2: #16161a;--surface: #1e1e24;--line: #33333c;--ink: #f2f2f4;--muted: #9a9aa8;--high: #3dd68c;--medium: #f0c040;--low: #ff5a5a;--critical: #ff2a2a;--accent: #ff2a2a;--rail-from: #16161a;--rail-to: #0d0d0f;--rail-active: #24242c;--btn: #24242c;--btn-line: #ff2a2a;--btn-primary: #4a1212;--btn-primary-line: #ff2a2a;--node-bg: #16161a;--node-line: #4a4a55;--graph-bg: #0d0d0f;--graph-grid: rgba(255, 42, 42, .1);--edge-cheap: #4a4a55;--edge-expensive: #ff8a3d;--edge-critical: #ff2a2a;--shadow: rgba(255, 42, 42, .18)}[data-theme=paper]{--bg: #f6f1e8;--bg-2: #efe6d6;--surface: #fffaf2;--line: #d9cbb6;--ink: #2b241c;--muted: #6f6456;--high: #2a7a4b;--medium: #b5811a;--low: #c0392b;--critical: #a93226;--accent: #1d6a7a;--rail-from: #efe6d6;--rail-to: #e7dcc8;--rail-active: #e2d3bb;--btn: #fffaf2;--btn-line: #c9b79a;--btn-primary: #d7eee0;--btn-primary-line: #2a7a4b;--node-bg: #fffaf2;--node-line: #c9b79a;--graph-bg: #f6f1e8;--graph-grid: rgba(29, 106, 122, .1);--edge-cheap: #b7a48c;--edge-expensive: #c0392b;--edge-critical: #a93226;--shadow: rgba(43, 36, 28, .08)}[data-theme=solarized-light]{--bg: #fdf6e3;--bg-2: #eee8d5;--surface: #f5efdc;--line: #d6cba9;--ink: #657b83;--muted: #93a1a1;--high: #859900;--medium: #b58900;--low: #dc322f;--critical: #cb4b16;--accent: #268bd2;--rail-from: #eee8d5;--rail-to: #e6dfc8;--rail-active: #e0d9c0;--btn: #fdf6e3;--btn-line: #93a1a1;--btn-primary: #e8efc8;--btn-primary-line: #859900;--node-bg: #fdf6e3;--node-line: #93a1a1;--graph-bg: #fdf6e3;--graph-grid: rgba(38, 139, 210, .12);--edge-cheap: #93a1a1;--edge-expensive: #cb4b16;--edge-critical: #dc322f;--shadow: rgba(101, 123, 131, .1)}[data-theme=seafoam]{--bg: #eef7f4;--bg-2: #dff0ea;--surface: #ffffff;--line: #b7d5cc;--ink: #17332c;--muted: #4d7268;--high: #1b8a5a;--medium: #c48a14;--low: #c44536;--critical: #9b2d22;--accent: #1d9a8a;--rail-from: #dff0ea;--rail-to: #cfe6de;--rail-active: #c4ddd4;--btn: #ffffff;--btn-line: #8fbfb2;--btn-primary: #d4f0e4;--btn-primary-line: #1b8a5a;--node-bg: #ffffff;--node-line: #8fbfb2;--graph-bg: #eef7f4;--graph-grid: rgba(29, 154, 138, .12);--edge-cheap: #8fbfb2;--edge-expensive: #c48a14;--edge-critical: #c44536;--shadow: rgba(23, 51, 44, .08)}[data-theme=high-contrast]{--bg: #ffffff;--bg-2: #f2f2f2;--surface: #ffffff;--line: #111111;--ink: #000000;--muted: #222222;--high: #007a33;--medium: #8a5a00;--low: #b00000;--critical: #9b0000;--accent: #0033cc;--rail-from: #f2f2f2;--rail-to: #e6e6e6;--rail-active: #d9d9d9;--btn: #ffffff;--btn-line: #000000;--btn-primary: #d9f2e3;--btn-primary-line: #007a33;--node-bg: #ffffff;--node-line: #000000;--graph-bg: #ffffff;--graph-grid: rgba(0, 0, 0, .12);--edge-cheap: #444444;--edge-expensive: #8a5a00;--edge-critical: #b00000;--shadow: rgba(0, 0, 0, .12)}[data-theme=sakura]{--bg: #fff0f5;--bg-2: #ffe4ee;--surface: #fff7fa;--line: #f5b8cc;--ink: #4a1830;--muted: #a05a78;--high: #1a8a5c;--medium: #c48a14;--low: #d63d6e;--critical: #b01040;--accent: #e84a8a;--rail-from: #ffe4ee;--rail-to: #f8d4e0;--rail-active: #f5c8d8;--btn: #fff7fa;--btn-line: #e89ab0;--btn-primary: #ffd6e6;--btn-primary-line: #e84a8a;--node-bg: #fff7fa;--node-line: #e89ab0;--graph-bg: #fff0f5;--graph-grid: rgba(232, 74, 138, .12);--edge-cheap: #d4a0b0;--edge-expensive: #d63d6e;--edge-critical: #b01040;--shadow: rgba(74, 24, 48, .1)}[data-theme=citrus]{--bg: #fffce8;--bg-2: #fff3b0;--surface: #fffef5;--line: #e8d44a;--ink: #2a2a08;--muted: #6a6a20;--high: #2a8a20;--medium: #d4a000;--low: #e85d04;--critical: #c0392b;--accent: #5aad14;--rail-from: #fff3b0;--rail-to: #ffe98a;--rail-active: #ffe066;--btn: #fffef5;--btn-line: #d4c030;--btn-primary: #e8f5b8;--btn-primary-line: #5aad14;--node-bg: #fffef5;--node-line: #d4c030;--graph-bg: #fffce8;--graph-grid: rgba(90, 173, 20, .14);--edge-cheap: #c4b040;--edge-expensive: #e85d04;--edge-critical: #c0392b;--shadow: rgba(42, 42, 8, .1)}[data-theme=peach]{--bg: #fff3eb;--bg-2: #ffe0cc;--surface: #fffaf6;--line: #f0c4a8;--ink: #3a2218;--muted: #8a5a48;--high: #2a8a5c;--medium: #d48a14;--low: #e85d3a;--critical: #c0392b;--accent: #ff6b35;--rail-from: #ffe0cc;--rail-to: #ffd4b8;--rail-active: #ffc8a8;--btn: #fffaf6;--btn-line: #e8a888;--btn-primary: #ffe0cc;--btn-primary-line: #ff6b35;--node-bg: #fffaf6;--node-line: #e8a888;--graph-bg: #fff3eb;--graph-grid: rgba(255, 107, 53, .12);--edge-cheap: #d4a088;--edge-expensive: #e85d3a;--edge-critical: #c0392b;--shadow: rgba(58, 34, 24, .1)}[data-theme=candy]{--bg: #f4f0ff;--bg-2: #e8dcff;--surface: #fbf8ff;--line: #d4c0f0;--ink: #2a1848;--muted: #6a5890;--high: #1a8a6a;--medium: #c48a14;--low: #e84a8a;--critical: #c01060;--accent: #ff5eb1;--rail-from: #e8dcff;--rail-to: #ddd0ff;--rail-active: #d4c4ff;--btn: #fbf8ff;--btn-line: #c4a8e8;--btn-primary: #ffd6ec;--btn-primary-line: #ff5eb1;--node-bg: #fbf8ff;--node-line: #c4a8e8;--graph-bg: #f4f0ff;--graph-grid: rgba(255, 94, 177, .14);--edge-cheap: #b0a0d0;--edge-expensive: #e84a8a;--edge-critical: #c01060;--shadow: rgba(42, 24, 72, .1)}[data-theme=sky]{--bg: #e8f4ff;--bg-2: #cfe8ff;--surface: #f5faff;--line: #90c8f0;--ink: #0a2848;--muted: #3a6080;--high: #0a8a4a;--medium: #c48a14;--low: #e85d3a;--critical: #c0392b;--accent: #0077ff;--rail-from: #cfe8ff;--rail-to: #b8dcff;--rail-active: #a8d4ff;--btn: #f5faff;--btn-line: #70b0e0;--btn-primary: #cfe8ff;--btn-primary-line: #0077ff;--node-bg: #f5faff;--node-line: #70b0e0;--graph-bg: #e8f4ff;--graph-grid: rgba(0, 119, 255, .12);--edge-cheap: #80b0d0;--edge-expensive: #e85d3a;--edge-critical: #c0392b;--shadow: rgba(10, 40, 72, .1)}[data-theme=coral]{--bg: #fff1ee;--bg-2: #ffddd6;--surface: #fff8f6;--line: #f0b0a4;--ink: #3a1814;--muted: #8a5048;--high: #0d9488;--medium: #d48a14;--low: #e85d4a;--critical: #c0392b;--accent: #0d9488;--rail-from: #ffddd6;--rail-to: #ffd0c6;--rail-active: #ffc4b8;--btn: #fff8f6;--btn-line: #e89888;--btn-primary: #d4f4ee;--btn-primary-line: #0d9488;--node-bg: #fff8f6;--node-line: #e89888;--graph-bg: #fff1ee;--graph-grid: rgba(13, 148, 136, .14);--edge-cheap: #d4a098;--edge-expensive: #e85d4a;--edge-critical: #c0392b;--shadow: rgba(58, 24, 20, .1)}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}:root{--radius: 6px;--radius-lg: 10px;--control-h: 32px;--font: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;--focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);--space: 8px}body{background:var(--bg);color:var(--ink);font-family:var(--font);font-size:13px;line-height:1.45;-webkit-font-smoothing:antialiased}button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible,summary:focus-visible{outline:none;box-shadow:var(--focus-ring)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.skip{position:absolute;left:12px;top:-40px;z-index:50;background:var(--surface);color:var(--ink);border:1px solid var(--accent);border-radius:var(--radius);padding:8px 12px}.skip:focus{top:12px}.app{display:grid;grid-template-columns:232px 1fr;height:100%}.rail{border-right:1px solid var(--line);background:linear-gradient(180deg,var(--rail-from),var(--rail-to));padding:16px 12px;display:flex;flex-direction:column;gap:2px;min-width:0}.brand{display:flex;flex-direction:column;gap:2px;padding:4px 8px 16px}.brand-mark{font-family:var(--mono);letter-spacing:.16em;font-size:11px;text-transform:uppercase;color:var(--accent);font-weight:600}.brand-sub{font-size:11px;color:var(--muted)}.nav-item{display:flex;align-items:center;gap:10px;background:transparent;border:0;text-align:left;padding:8px 10px;border-radius:var(--radius);color:var(--muted);cursor:pointer;width:100%}.nav-item:hover{background:color-mix(in srgb,var(--rail-active) 70%,transparent);color:var(--ink)}.nav-item.active{background:var(--rail-active);color:var(--ink);font-weight:500}.nav-item svg{flex-shrink:0}.theme-pick{margin-top:14px;display:grid;gap:4px;padding:0 2px}.theme-pick label{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:500}.theme-pick select,.field select,.field input,.topbar input,.topbar select,.settings input,.settings select,.explorer-path input{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:0 10px;height:var(--control-h);width:100%}.rail-foot{margin-top:auto;padding:12px 8px 4px;border-top:1px solid var(--line);display:grid;gap:6px}.kbd-hint{font-size:11px;color:var(--muted)}kbd{font-family:var(--mono);font-size:10px;border:1px solid var(--line);border-radius:4px;padding:0 4px;background:var(--surface)}.main{display:flex;flex-direction:column;min-width:0;min-height:0;position:relative;background:var(--bg)}.progress{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;z-index:30;background:color-mix(in srgb,var(--accent) 20%,transparent)}.progress i{display:block;height:100%;width:32%;background:var(--accent);animation:indeterminate 1.1s ease-in-out infinite}.progress.determinate i{width:0;animation:none;transform:none;transition:width .2s ease-out}@keyframes indeterminate{0%{transform:translate(-120%)}to{transform:translate(400%)}}.topbar{display:flex;gap:10px;align-items:flex-end;padding:10px 16px;border-bottom:1px solid var(--line);background:var(--bg-2);flex-wrap:wrap}.field{display:grid;gap:4px;min-width:0}.field>span{font-size:11px;color:var(--muted);font-weight:500}.field.path{flex:1;min-width:180px}.field.ref{width:188px;flex:0 0 188px}.field.workspace{width:180px;flex:0 0 180px}.path-row,.combo-row{display:flex;min-width:0}.path-row input,.combo-row input{flex:1;min-width:0}.combo{position:relative;min-width:0}.combo-row input{border-top-right-radius:0;border-bottom-right-radius:0}.topbar .icon-btn{width:var(--control-h);padding:0;flex:0 0 var(--control-h)}.combo-toggle{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0}.combo-menu{position:absolute;top:calc(100% + 4px);right:0;left:auto;min-width:340px;max-width:min(480px,70vw);max-height:360px;overflow:auto;z-index:40;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 12px 32px var(--shadow);padding:6px 0}.combo-heading{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600;padding:8px 12px 4px}.combo-menu .combo-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;text-align:left;background:transparent;border:0;border-radius:0;height:auto;padding:6px 12px;color:var(--ink);cursor:pointer}.combo-menu .combo-option:hover,.combo-menu .combo-option.active{background:var(--rail-active)}.combo-label{font-family:var(--mono);font-size:12px}.combo-detail{color:var(--muted);font-size:12px;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.combo-empty{padding:10px 12px}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:50;background:color-mix(in srgb,var(--bg) 72%,transparent);display:grid;place-items:center;padding:24px}.modal{width:min(720px,100%);max-height:min(640px,90vh);background:var(--bg-2);border:1px solid var(--line);border-radius:var(--radius-lg);box-shadow:0 16px 48px var(--shadow);display:flex;flex-direction:column;overflow:hidden}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:14px 16px 10px;border-bottom:1px solid var(--line)}.modal-head h2{font-size:15px}.modal-head .muted{margin:4px 0 0}.explorer-path{display:flex;gap:8px;padding:12px 16px;border-bottom:1px solid var(--line)}.explorer-path input{flex:1;min-width:0}.explorer-list{flex:1;overflow:auto;padding:8px;min-height:220px}.explorer-row{display:flex;align-items:center;gap:8px;width:100%;text-align:left;background:transparent;border:0;border-radius:var(--radius);padding:8px 10px;color:var(--ink);cursor:pointer;height:auto}.explorer-row:hover,.explorer-row.active{background:var(--rail-active)}.explorer-name{min-width:0;overflow:hidden;text-overflow:ellipsis}.git-badge{margin-left:auto;margin-bottom:0}.explorer-empty{padding:18px 10px}.modal-foot{display:flex;align-items:center;gap:12px;padding:12px 16px;border-top:1px solid var(--line)}.explorer-current{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:12px}.topbar input,.topbar select{min-width:0}.topbar-actions{display:flex;gap:8px;margin-left:auto;align-items:center;padding-bottom:0}.btn,.topbar button{background:var(--btn);border:1px solid var(--btn-line);border-radius:var(--radius);height:var(--control-h);padding:0 12px;cursor:pointer;font-weight:500;display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}.btn:hover,.topbar button:hover{filter:brightness(1.08)}.btn:disabled,.topbar button:disabled{opacity:.55;cursor:not-allowed;filter:none}.btn.primary{background:var(--btn-primary);border-color:var(--btn-primary-line)}.btn.ghost{background:transparent}.alerts{display:grid;gap:8px;padding:10px 16px 0}.alerts:empty{display:none;padding:0}.stage{flex:1;min-height:0;display:flex;flex-direction:column}.content{flex:1;min-height:0;display:grid;grid-template-columns:minmax(340px,420px) 1fr}.brief{overflow:auto;border-right:1px solid var(--line);padding:16px 18px 24px;background:radial-gradient(circle at 0 0,color-mix(in srgb,var(--accent) 8%,transparent),transparent 42%),var(--bg)}.graph-wrap{position:relative;min-height:0;display:flex;flex-direction:column}.impact-graph{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.graph-toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:8px 14px;border-bottom:1px solid var(--line);background:var(--bg-2)}.graph-count{margin-left:auto;font-size:11px}.graph-layout{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--muted);letter-spacing:.04em}.graph-layout select{background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:0 10px;height:26px;min-width:11.5rem;color:var(--ink);font:inherit;font-size:12px;letter-spacing:0;cursor:pointer}.chip-btn{background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:4px 12px;color:var(--muted);cursor:pointer;height:26px}.chip-btn:hover{color:var(--ink)}.chip-btn.active{background:var(--rail-active);color:var(--ink)}.chip-btn:disabled{opacity:.45;cursor:not-allowed}.graph-stage{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.graph-stage .react-flow,.graph-3d,.graph-3d-host,.graph-3d-canvas-host{flex:1;width:100%;height:100%;min-height:280px}.graph-3d{position:relative;background:var(--graph-bg);display:flex;flex-direction:column}.graph-3d-host{position:relative;min-height:0;display:flex;flex-direction:column}.graph-3d-canvas-host{position:relative;min-height:0;background:var(--graph-bg)}.graph-3d canvas{display:block;width:100%;height:100%}.graph-3d-tip{position:absolute;pointer-events:none;z-index:2;max-width:320px;padding:6px 8px;border-radius:var(--radius);background:var(--surface);border:1px solid var(--line);color:var(--ink);font-size:11px;line-height:1.35;box-shadow:0 8px 24px var(--shadow)}.graph-3d-tip .t{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.graph-3d-tip .n{font-weight:600}.graph-3d-tip .f{color:var(--muted);font-size:10px;margin-top:2px;overflow-wrap:anywhere}.graph-3d-hint{position:absolute;left:10px;bottom:10px;z-index:2;margin:0;font-size:11px;color:var(--muted);max-width:min(420px,calc(100% - 24px));pointer-events:none}.graph-wrap .react-flow{background-color:var(--graph-bg);background-image:linear-gradient(var(--graph-grid) 1px,transparent 1px),linear-gradient(90deg,var(--graph-grid) 1px,transparent 1px);background-size:24px 24px}.react-flow__minimap{background:var(--graph-bg)!important;border:1px solid var(--line)!important;border-radius:var(--radius);overflow:hidden;box-shadow:0 8px 24px var(--shadow)}.react-flow__minimap-node{fill:var(--muted);stroke:none}.react-flow__minimap-node.selected{fill:var(--accent)}.react-flow__minimap-mask{fill:#00000073!important;stroke:var(--accent)!important}.react-flow__controls{box-shadow:none!important}.react-flow__controls-button{background:var(--surface)!important;border-bottom:1px solid var(--line)!important;fill:var(--ink)!important}h1{font-size:18px;margin:0 0 6px;font-weight:600}h2{font-size:13px;margin:0;font-weight:600}.merge-box{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-lg);padding:12px 14px;margin-bottom:12px}.merge-box.high{border-color:color-mix(in srgb,var(--high) 55%,var(--line))}.merge-box.medium{border-color:color-mix(in srgb,var(--medium) 55%,var(--line))}.merge-box.low{border-color:color-mix(in srgb,var(--low) 55%,var(--line))}.level{font-family:var(--mono);font-weight:600;font-size:14px}.level.high{color:var(--high)}.level.medium{color:var(--medium)}.level.low{color:var(--low)}.merge-title{margin-top:4px;font-size:13px;color:var(--ink)}.reasons{margin:10px 0 0;padding:0 0 0 18px;color:var(--muted)}.reasons li{margin:0 0 4px}.metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:0 0 14px}.metric{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);padding:8px 10px}.metric .n{font-family:var(--mono);font-size:16px;font-weight:600;font-variant-numeric:tabular-nums}.metric .l{font-size:11px;color:var(--muted);margin-top:2px}.section{border-top:1px solid var(--line);padding:8px 0 4px}.section>summary{cursor:pointer;list-style:none;display:flex;align-items:center;justify-content:space-between;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.07em;font-weight:600;padding:6px 0}.section>summary::-webkit-details-marker{display:none}.section>summary .count{font-family:var(--mono);letter-spacing:0;text-transform:none;border:1px solid var(--line);border-radius:999px;padding:0 7px;height:18px;display:inline-flex;align-items:center;font-size:11px}.kicker{color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.08em;margin:16px 0 6px;font-weight:600}.chip{display:inline-flex;align-items:center;font-size:11px;padding:2px 8px;border-radius:999px;border:1px solid var(--line);margin:0 6px 6px 0;color:var(--muted);background:var(--surface)}.chip.blocker{color:var(--low);border-color:var(--low)}.chip.warning{color:var(--medium);border-color:var(--medium)}.chip.strong{color:var(--low);border-color:var(--low)}.chip.worth_exploring{color:var(--medium);border-color:var(--medium)}.chip.speculative{color:var(--muted);border-color:var(--line)}.chip.open{color:var(--high);border-color:color-mix(in srgb,var(--high) 50%,var(--line))}.file{font-family:var(--mono);font-size:12px;color:var(--accent)}.read-item,.finding,.residual{padding:8px 0;border-bottom:1px solid color-mix(in srgb,var(--line) 70%,transparent)}.read-item:last-child,.finding:last-child{border-bottom:0}.read-item.tour-current{background:color-mix(in srgb,var(--accent) 12%,var(--surface));border-color:var(--accent)}.tour-row{margin-top:8px;align-items:center}.field.dirty .chip-btn{height:32px}.muted{color:var(--muted);font-size:13px;line-height:1.45}.error{color:var(--low);padding:8px 12px;border:1px solid var(--low);background:color-mix(in srgb,var(--low) 10%,var(--surface));border-radius:var(--radius);display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.banner{padding:8px 12px;border-radius:var(--radius);border:1px solid var(--line);background:var(--surface);font-size:13px;line-height:1.45;display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.banner.warn{border-color:var(--medium);color:var(--medium)}.banner.stale{border-color:var(--low);color:var(--low)}.banner.whatif{border-color:var(--accent);align-items:center}.banner.whatif .btn{flex:0 0 auto;white-space:nowrap}.chip.whatif{color:var(--accent);border-color:color-mix(in srgb,var(--accent) 55%,var(--line))}.whatif-hint{margin:10px 0 0;font-size:12px;line-height:1.4;color:var(--muted)}.banner .dismiss{background:transparent;border:0;color:inherit;cursor:pointer;height:auto;padding:0 2px;opacity:.7}.empty{padding:24px 8px;color:var(--muted);font-size:13px;line-height:1.55}.workspace-loading{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;min-height:220px;padding:48px 16px}.graph-walk-empty{flex:1;display:flex;flex-direction:column;justify-content:center;max-width:36rem;margin:0 auto}.empty ol{margin:12px 0 0 18px;padding:0}.empty code,code{font-family:var(--mono);font-size:12px;color:var(--accent)}.btn-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}.pr-list{padding:16px;overflow:auto}.pr-toolbar{display:flex;gap:8px;align-items:flex-end;margin-bottom:14px}.pr-toolbar .field{flex:1}.pr-toolbar .field.provider{flex:0 0 140px}.scm-count{margin:0 0 12px;font-size:12px}.scm-login{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:10px 0;border-top:1px solid var(--line)}.scm-login:first-of-type{border-top:0;padding-top:0}.scm-login .btn-row{margin-top:0}.scm-login p{margin:2px 0 0}.oauth-code{font-size:13px;margin:0}.oauth-code code{font-size:14px;letter-spacing:.08em}.pr{border:1px solid var(--line);background:var(--surface);padding:12px 14px;border-radius:var(--radius-lg);margin-bottom:10px}.pr h3{margin:0 0 4px;font-size:14px;font-weight:600}.pr-meta{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;margin:6px 0 10px}.pr-actions{display:flex;gap:8px;align-items:center}.settings{padding:24px;max-width:760px;overflow:auto;display:grid;gap:16px}.settings-card{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-lg);padding:16px;display:grid;gap:8px}.settings-card h2{font-size:14px;margin-bottom:2px}.settings label{font-size:12px;color:var(--muted);font-weight:500}.theme-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px}.theme-swatch{border:1px solid var(--line);background:var(--bg);color:var(--ink);border-radius:var(--radius);padding:10px;text-align:left;cursor:pointer;height:auto;box-shadow:0 1px 8px var(--shadow)}.theme-swatch.active{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent),0 1px 8px var(--shadow)}.theme-swatch .swatch-bar{height:6px;border-radius:3px;margin-bottom:8px;background:linear-gradient(90deg,var(--accent),var(--high),var(--medium),var(--low))}.theme-swatch .name{font-size:13px;font-weight:600}.theme-swatch .group{font-size:11px;color:var(--muted)}.headline{white-space:pre-wrap;font-family:var(--mono);font-size:12px;color:var(--muted);margin:8px 0 0}.graph-modes{display:flex;gap:8px;align-items:center;padding:8px 14px;border-bottom:1px solid var(--line);background:var(--bg-2)}.seg{display:inline-flex;border:1px solid var(--line);border-radius:999px;padding:2px;background:var(--surface)}.seg button,.graph-modes button{background:transparent;border:0;border-radius:999px;padding:4px 12px;color:var(--muted);cursor:pointer;height:26px}.seg button.active,.graph-modes button.active{background:var(--rail-active);color:var(--ink)}.legend{margin-left:auto;display:flex;gap:12px;color:var(--muted);font-size:11px}.legend i{display:inline-block;width:14px;height:2px;margin-right:6px;vertical-align:middle;background:var(--edge-cheap)}.legend i.exp{background:var(--edge-expensive)}.legend i.crit{background:var(--edge-critical);height:3px}.legend i.dash{border-top:2px dashed var(--muted);background:none;height:0}.legend i.seed{height:10px;width:10px;border-radius:2px;background:color-mix(in srgb,var(--medium) 70%,var(--node-bg))}.legend i.down{height:10px;width:10px;border-radius:2px;border:1px solid color-mix(in srgb,var(--accent) 45%,var(--node-line));background:var(--node-bg)}.inspector{position:absolute;top:12px;right:12px;z-index:5;width:300px;max-width:calc(100% - 24px);max-height:calc(100% - 24px);overflow-x:hidden;overflow-y:auto;overflow-wrap:break-word;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);padding:10px 12px;box-shadow:0 8px 24px var(--shadow);font-size:12px}.inspector .t{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}.inspector .n,.inspector .file,.inspector .muted{overflow-wrap:break-word}.inspector .n{font-weight:600;margin:4px 0}.inspector-head{display:flex;align-items:flex-start;gap:8px}.inspector-roles{display:flex;flex-wrap:wrap;justify-content:flex-end;flex:1;gap:4px}.inspector-chip{font-size:10px;text-transform:uppercase;letter-spacing:.04em;padding:1px 6px;border-radius:999px;border:1px solid var(--line);color:var(--muted);white-space:nowrap}.inspector-close{flex:0 0 auto;width:24px;height:24px;padding:0;border:1px solid var(--line);border-radius:var(--radius);background:transparent;color:var(--muted);font-size:16px;line-height:1;cursor:pointer}.inspector-close:hover{color:var(--ink)}.inspector-purpose{margin:6px 0 8px;color:var(--ink);font-size:12px;line-height:1.4}.inspector-layer{margin-top:4px;font-size:11px}.inspector-degree{font-size:11px}.inspector-path{margin:6px 0 0;font-size:12px;line-height:1.4;color:var(--muted)}.inspector-facts{margin:10px 0 0;padding-top:8px;border-top:1px solid var(--line)}.inspector-fact{display:grid;grid-template-columns:minmax(64px,92px) minmax(0,1fr);gap:8px;padding:3px 0;align-items:start}.inspector-fact dt{color:var(--muted);font-size:11px;margin:0}.inspector-fact dd{margin:0;overflow-wrap:break-word}.inspector-section{margin-top:10px;padding-top:8px;border-top:1px solid var(--line)}.inspector-section h3{margin:0 0 6px;display:flex;align-items:center;justify-content:space-between;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.07em;font-weight:600}.inspector-section .count{font-family:var(--mono);letter-spacing:0;text-transform:none;border:1px solid var(--line);border-radius:999px;padding:0 7px;height:18px;display:inline-flex;align-items:center;font-size:11px}.inspector-section ul{list-style:none;margin:0;padding:0}.inspector-section li{padding:4px 0;border-bottom:1px solid color-mix(in srgb,var(--line) 70%,transparent)}.inspector-section li:last-child{border-bottom:0}.inspector-link-name{display:block;font-weight:600;overflow-wrap:break-word}.inspector-link-meta{display:block;color:var(--muted);font-size:11px}.lp-node{padding:8px 10px;border-radius:var(--radius);border:1px solid var(--node-line);background:var(--node-bg);width:208px;max-width:100%;height:64px;box-sizing:border-box;box-shadow:0 0 0 1px var(--shadow);overflow:visible;position:relative}.lp-node .t{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.lp-node .n{font-size:13px;font-weight:600;line-height:1.2;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow-wrap:anywhere}.lp-node.selected{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}.lp-node.role-seed{border-color:var(--medium);background:color-mix(in srgb,var(--medium) 14%,var(--node-bg))}.lp-node.role-downstream{border-color:color-mix(in srgb,var(--accent) 45%,var(--node-line))}.lp-node.role-untested{box-shadow:inset 3px 0 0 var(--low)}.lp-node.role-tested{box-shadow:inset 3px 0 0 var(--high)}.lp-node.role-contract{outline:1px dashed color-mix(in srgb,var(--accent) 50%,transparent)}.lp-node.dim{opacity:.38}.merge-box.compact{padding:6px 10px;min-width:92px;margin:0}.merge-box.compact .level{font-size:12px}.palette-scrim{position:fixed;top:0;right:0;bottom:0;left:0;background:color-mix(in srgb,var(--bg) 55%,transparent);z-index:40;display:grid;place-items:start center;padding-top:12vh}.palette{width:min(640px,calc(100vw - 32px));background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 18px 60px var(--shadow);overflow:hidden}.palette input{width:100%;border:0;border-bottom:1px solid var(--line);background:transparent;color:var(--ink);padding:14px 16px;font:inherit}.palette ul{list-style:none;margin:0;padding:6px;max-height:360px;overflow:auto}.palette li button{width:100%;display:flex;justify-content:space-between;gap:12px;text-align:left;background:transparent;border:0;color:var(--ink);padding:8px 10px;border-radius:8px;cursor:pointer}.palette li button.active,.palette li button:hover{background:var(--rail-active)}.palette-foot{padding:8px 12px 10px}.graph-search{position:relative;min-width:140px}.graph-search input{width:100%;background:var(--bg-2);border:1px solid var(--line);color:var(--ink);border-radius:8px;padding:6px 8px;font:inherit}.graph-search-hits{position:absolute;z-index:5;left:0;right:0;top:calc(100% + 4px);background:var(--surface);border:1px solid var(--line);border-radius:8px;list-style:none;margin:0;padding:4px;max-height:240px;overflow:auto}.graph-search-hits button{width:100%;display:flex;justify-content:space-between;gap:8px;background:transparent;border:0;color:var(--ink);text-align:left;padding:6px 8px;cursor:pointer}.graph-search-hits button:hover{background:var(--rail-active)}.inspector-link{display:flex;flex-direction:column;width:100%;background:transparent;border:0;color:inherit;text-align:left;cursor:pointer;padding:0}.file-row{display:flex;flex-direction:column;gap:6px}.linkish{background:none;border:0;color:inherit;font:inherit;text-align:left;cursor:pointer;padding:0}.history-item,.check-item{display:flex;flex-wrap:wrap;gap:8px;align-items:baseline;width:100%;background:transparent;border:0;color:inherit;font:inherit;text-align:left;padding:6px 0;cursor:pointer}.history-item.current{color:var(--accent)}.check-row{display:flex;gap:8px;align-items:center;margin:4px 0}.sparkline{display:flex;align-items:flex-end;gap:3px;height:36px;margin:8px 0}.sparkline i{flex:1;background:var(--muted);border-radius:2px 2px 0 0;min-width:4px}.sparkline i.high{background:var(--high)}.sparkline i.medium{background:var(--medium)}.sparkline i.low{background:var(--low)}.config-editor .field{display:flex;flex-direction:column;gap:4px;margin:8px 0}.config-editor input,.config-editor select{background:var(--bg-2);border:1px solid var(--line);color:var(--ink);border-radius:8px;padding:6px 8px}.react-flow__node-load .react-flow__handle{width:8px;height:8px;border:none;background:transparent;opacity:0}.type-table{width:100%;border-collapse:collapse;font-size:12px}.type-table td{padding:3px 0}.type-table td:last-child{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--muted)}@media(prefers-reduced-motion:reduce){.progress i{animation:none;width:100%}.progress.determinate i{width:var(--progress, 100%)}*{scroll-behavior:auto!important}}@media(max-width:960px){.app{grid-template-columns:56px 1fr}.brand-sub,.nav-item span,.theme-pick,.kbd-hint,.rail-foot .muted{display:none}.nav-item{justify-content:center;padding:10px}.content{grid-template-columns:1fr}.brief{border-right:0;border-bottom:1px solid var(--line);max-height:42vh}} diff --git a/src/loadpath/static/index.html b/src/loadpath/static/index.html index 2a71cb3..b5e87ee 100644 --- a/src/loadpath/static/index.html +++ b/src/loadpath/static/index.html @@ -17,8 +17,8 @@ - - + +
diff --git a/ui/package-lock.json b/ui/package-lock.json index dd8a257..6278df7 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -17,10 +17,10 @@ "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@types/three": "^0.185.4", - "@vitejs/plugin-react": "^4.3.4", + "@vitejs/plugin-react": "^6.0.5", "jsdom": "^30.0.1", "typescript": "^5.6.3", - "vite": "^6.0.3", + "vite": "^8.2.1", "vitest": "^4.1.10" } }, @@ -77,288 +77,6 @@ "node": "20 || >=22" } }, - "node_modules/@babel/code-frame": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", - "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.29.7", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", - "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", - "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.7", - "@babel/generator": "^7.29.7", - "@babel/helper-compilation-targets": "^7.29.7", - "@babel/helper-module-transforms": "^7.29.7", - "@babel/helpers": "^7.29.7", - "@babel/parser": "^7.29.7", - "@babel/template": "^7.29.7", - "@babel/traverse": "^7.29.7", - "@babel/types": "^7.29.7", - "@jridgewell/remapping": "^2.3.5", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.29.8", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", - "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.29.8", - "@babel/types": "^7.29.8", - "@jridgewell/gen-mapping": "^0.3.12", - "@jridgewell/trace-mapping": "^0.3.28", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", - "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.29.7", - "@babel/helper-validator-option": "^7.29.7", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-globals": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", - "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", - "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.29.7", - "@babel/types": "^7.29.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", - "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.29.7", - "@babel/helper-validator-identifier": "^7.29.7", - "@babel/traverse": "^7.29.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", - "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", - "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", - "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", - "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", - "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.29.7", - "@babel/types": "^7.29.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.29.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz", - "integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.29.8" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", - "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.29.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", - "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.29.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", - "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.7", - "@babel/parser": "^7.29.7", - "@babel/types": "^7.29.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.29.8", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz", - "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.7", - "@babel/generator": "^7.29.8", - "@babel/helper-globals": "^7.29.7", - "@babel/parser": "^7.29.8", - "@babel/template": "^7.29.7", - "@babel/types": "^7.29.8", - "debug": "^4.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.29.8", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", - "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.29.7", - "@babel/helper-validator-identifier": "^7.29.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@bramus/specificity": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz", @@ -489,478 +207,36 @@ "peerDependenciesMeta": { "css-tree": { "optional": true - } - } - }, - "node_modules/@csstools/css-tokenizer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz", - "integrity": "sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/csstools" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - } - ], - "license": "MIT", - "engines": { - "node": ">=20.19.0" - } - }, - "node_modules/@dimforge/rapier3d-compat": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz", - "integrity": "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" + } } }, - "node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", - "cpu": [ - "x64" - ], + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz", + "integrity": "sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==", "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } ], + "license": "MIT", "engines": { - "node": ">=18" + "node": ">=20.19.0" } }, + "node_modules/@dimforge/rapier3d-compat": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz", + "integrity": "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/@exodus/bytes": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz", @@ -979,38 +255,6 @@ } } }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.5.5", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", @@ -1018,73 +262,37 @@ "dev": true, "license": "MIT" }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "node_modules/@oxc-project/types": { + "version": "0.144.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.144.0.tgz", + "integrity": "sha512-nuhZIOLuI6TFQ32I/WnUx+SCPY7SdSKwgnFHydAuoS1+Z4BRcaP+RRJmGzl9lw+0OFF7UmaESf7KQRXaNLHypg==", "dev": true, "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" + "funding": { + "url": "https://github.com/sponsors/Boshen" } }, - "node_modules/@napi-rs/lzma-linux-x64-gnu": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", - "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.4.tgz", + "integrity": "sha512-jHC2cnyKz5xU2fhECtFl8OZ83cYNt13GZQD+0uMJ/X3o+ijmd56okHhTUwxVSHPx1IRVIJEZ1/1pPzeLCU6XKA==", "cpu": [ - "x64" + "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "linux" + "android" ], "engines": { - "node": "^22.20 || ^24.12 || >=25" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-beta.27", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", - "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.4.tgz", - "integrity": "sha512-RrPokAb7dmbxFoeO3TloqHyOjgye8RkBhSqmp4aJMIex4c9r46ZstPnleDQOq1t46VOVjwIuwNogIqbodV1Vvg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.4.tgz", - "integrity": "sha512-JKuJc+pnpks2pjy7L/N3v/cAkZxYlnmuZoD840ldbMI5KDbC4iO9NKwPKYdjYFCMAIIlBzYSFHxIJVYzRo2/8A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.4.tgz", - "integrity": "sha512-krw5uS2STmvJ02x0uTXHbqQNuz+9eZ1iw+qXk9dmW2gvV4jV7O2hEoOnuhFrpOPiel1mBFtqbxYZZtC46hXLOw==", + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.4.tgz", + "integrity": "sha512-Dc5mPD8F5F/FS8i01syd7FTF6yB2fVthH/TRkjwJkzUK6EpoxHtqvZQP5Zwq80/5z19TWYHIg1KOHboCgVx/aQ==", "cpu": [ "arm64" ], @@ -1093,12 +301,15 @@ "optional": true, "os": [ "darwin" - ] + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.4.tgz", - "integrity": "sha512-wsTxtgApb4PrOsNJIm0FZ1h3WvCC+k9uxLJ4ad75hgoS4NiRes2SoJFlDAyMwiUY8IssDqGcHbXuN0sx1tfF1A==", + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.4.tgz", + "integrity": "sha512-fpDm4oBo6SqLvWUYCmFhdde3U9KH2fRNNMeAnAPAIwxRL345xutL0EtEUcuoxsoazdJGv/MuDBQHlCDrtbvqOg==", "cpu": [ "x64" ], @@ -1107,26 +318,15 @@ "optional": true, "os": [ "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.4.tgz", - "integrity": "sha512-GUOnQlyZe3yAXhWOtOMsn5Qkrv5E5mZXa0thbARWi5Ei2szlVXJFQhddZ4HbAzh8q92w5twp+CQvs/eFanz9YQ==", - "cpu": [ - "arm64" ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.4.tgz", - "integrity": "sha512-/Y7f3QuxjzPKsjA/rfEDa3+0vXqyjmJ50Ln8dPpCmWkKTrUoWHG1cWhTqaAMLob2m2nESWuC7yGrREz019Ztqg==", + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.4.tgz", + "integrity": "sha512-rSJoreDE/HoIzoaib6MTp5jQtCTdMHKIvItAKT/ImS6Y6Ww76oUaeMyp4Vc/fAgd/ehji068IxetHXAnqUwN9A==", "cpu": [ "x64" ], @@ -1135,26 +335,15 @@ "optional": true, "os": [ "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.4.tgz", - "integrity": "sha512-81wiiX3v7aqy+T+bT61TJ78yJjRquqFFTTbAPt08imfQQzkPIW8t6aJbkTagtCCrXMNc9D66+geqlK7ydLPNqA==", - "cpu": [ - "arm" ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.4.tgz", - "integrity": "sha512-9kmDIvNZqdoHOBZgNtpTBeLWYO/LVipM3H/j62P8848/l/VPEQL6N3uxU9pvP1oZAsXyC2MEnFP3ovRjo7WYNQ==", + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.4.tgz", + "integrity": "sha512-/jm8OGHgn7oGaJu3i/qZI9spUGcJ+y/lk43ttQ/iO1tOd9NissG6o97bighBCiL+BKRngmcDuR6ikfwYdJmVuQ==", "cpu": [ "arm" ], @@ -1163,26 +352,15 @@ "optional": true, "os": [ "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.4.tgz", - "integrity": "sha512-CcnXHWnXg69g+DX5VWL3FHts3qMRN2uVEHX+BZvGLdd07/gXkn3ePjYtO1LDJvxkGKVHMclKBRa1QUTH+6toYQ==", - "cpu": [ - "arm64" ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.4.tgz", - "integrity": "sha512-iFOibiHnTRuhrWLlRsOQFdZJJIa7S8OwkneJr4ocALP16u5yk6lWLINFwhHaEqBFMsKDUZofLkGos7+CPzGB3g==", + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.4.tgz", + "integrity": "sha512-tIP06BeD9EqvECBrPZ+sqdPlYrT+aYaAiu1wYziVx5elRK/ftm33JxVDy2bXGbr6J0CrtirCkR87/X5a2euEng==", "cpu": [ "arm64" ], @@ -1191,54 +369,32 @@ "optional": true, "os": [ "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.4.tgz", - "integrity": "sha512-XnWYMI7euHlb5a871xPja+Gm7DRCFU+FGRrtS2sMq9N8FvqtpagUy6gD4YOemC5MRk9xbh8+jYMEJbigFQwsgA==", - "cpu": [ - "loong64" ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.4.tgz", - "integrity": "sha512-qGDAlO0U8xedCcsdRm9oaoQY8DAx/QT7uIxJWhCdx0ceIWX783UC9QSYkdpzAe29wNiVfp24+bZdQmn49o45SQ==", + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.4.tgz", + "integrity": "sha512-Ql1Q0EQqVThvn9VAVlwNzsUvbSFtCMGjLpRRi4pk5i7NZZ4n5ISiLMjHYtus4VQ2PvkSw24zyaCVsiS+sXPj1w==", "cpu": [ - "loong64" + "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.4.tgz", - "integrity": "sha512-ru4H6ezD7ysA5EiEK6qkkaEb4modH8CTej6kUy/gQi20u3kB3G7Zn8snXXkeJSCOFKG/rbPPtM/+9Wgas1961w==", - "cpu": [ - "ppc64" ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.4.tgz", - "integrity": "sha512-2W4MO5WQVJnbJaZdvDb9rhBDuFU1nKIepPFpJUBsTh2k1YY2g+ODViaWuyOAjQ5cOP7NvrvLzt3wvHOoiAvc7w==", + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.4.tgz", + "integrity": "sha512-GjbjXD4XXfN19D0LZNbmiCBUoDiRACsYHr0yaIbbn8aFsXjHZifcYqu/W5Er5X2X990WjHXFrxarn5chzItorQ==", "cpu": [ "ppc64" ], @@ -1247,40 +403,15 @@ "optional": true, "os": [ "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.4.tgz", - "integrity": "sha512-+fxjfuoAmVMCYV5QyjoIpu0cp5DOiOTeqYFk1AVaxGr+/ravWLX89XfQmptsoWcaVy/TGf2hexzbUOrCQIL1CQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.4.tgz", - "integrity": "sha512-jTn8JfHGL4djjFxPuM06LmNUJDsst2jeVlsd9OmIH6zc5sC9K6rIuO4YajXatLUpBmBKl6b35ro1QZocLi+tcA==", - "cpu": [ - "riscv64" ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.4.tgz", - "integrity": "sha512-oCJCJL4pXsoDcP2QZ+JVlPTIRc6266zsIaeJJsWImmF7HO0W8nb6HuSgZlMWxJwaPf8ehbSw8yo0EUw925hKsA==", + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.4.tgz", + "integrity": "sha512-p5WR0NOwaRmJ/B1b6IjEFLLivwEsf3PrdBIhRbhTCQisbo2SvHHpG4ELB/+FgQNnB88LTOF86upmJmbvZdQ2lw==", "cpu": [ "s390x" ], @@ -1289,12 +420,15 @@ "optional": true, "os": [ "linux" - ] + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.4.tgz", - "integrity": "sha512-W69hukhZ3KKNRCaMIEzKvcFye42hh0FE1+YoYaf5+Ikacuftoco6yO/xouz0hc5d5W/s3yBro5jRiuEE/Q5vUw==", + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.4.tgz", + "integrity": "sha512-4/GyVjmhR+Tc6HLJvwc1sOhPqAZtySiSMesOZyX6JQ5XBxoTDEMKQzvo07NIK6nTon/SivlZqvhzvuVBNQhObQ==", "cpu": [ "x64" ], @@ -1303,12 +437,15 @@ "optional": true, "os": [ "linux" - ] + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.4.tgz", - "integrity": "sha512-qiXbGG2jkjXhzXpsFZSR2Xpb8DN/UaxYsbb/STbuR/6fpaDgRmmaq1B/LmtF2wQFOFOSsK2jdE0RZ3a0zHn4QA==", + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.4.tgz", + "integrity": "sha512-l9eeLsCNvPpmSXUej0etw/J1eqV0Jj1D5G/xG6YTijmE6dkv6E2QezgWbTfQk63v952DPqrjOCoiqxq7Bw0YUQ==", "cpu": [ "x64" ], @@ -1317,26 +454,15 @@ "optional": true, "os": [ "linux" - ] - }, - "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.4.tgz", - "integrity": "sha512-nWeM//hxv8mIo6jD7Hu4o48DVmV9pbV6gsKaWU+4NFyqHoPKwrkRiZGLKUhOBk8qNmDmpwFtPKg80Bo/Tn4xiQ==", - "cpu": [ - "x64" ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ] + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.4.tgz", - "integrity": "sha512-s62SQ/vgsRSvMwDkOEfTqfgASF0f26ZNaQuTA6Aok5lrikf89yI2W0gFHvZb2Jpgc6N8JnOKZgCK2iciO3CsxQ==", + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.4.tgz", + "integrity": "sha512-e0F355MSTMm3+UOqtV3L24gFUp2N5m1f8L/7d56deik6va+AXdrt9F8LbzGpeWGWRbZEDq4m8NVnJDeBtf9DZg==", "cpu": [ "arm64" ], @@ -1345,12 +471,15 @@ "optional": true, "os": [ "openharmony" - ] + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.4.tgz", - "integrity": "sha512-J6wGf8TVGbXJq+HH+ttTvrcfNKPbuZecV6KT1B8I18BC5IURUh5kl4Yl5OEP5eFIUoI5BWxCsyYMhFsDx8kekw==", + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.4.tgz", + "integrity": "sha512-AWLi0uBRYh6QlE7OKhiz+phZC0qwtij2QZmhmOdsLdFn64m7oMpooE9ICE3lhm9xMb4SpDo2WbHcxX1iFLFtqw==", "cpu": [ "arm64" ], @@ -1359,26 +488,15 @@ "optional": true, "os": [ "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.4.tgz", - "integrity": "sha512-zmfrQd/0wu6oJs8Vq8KwY/YtsKSsLtKe/HwAP4Wqy8LhWjeT55fHRAkOhYQ12wI3ayS4Tt12d5CDRD7N96SAYQ==", - "cpu": [ - "ia32" ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.4.tgz", - "integrity": "sha512-qPzHqdj9rfUD+w79dtE07zi/kFwKyCJqplp5K5ygeLTp7jLpAoc16OAH39HSmRC9UpozaecsleI8uAdEj6v2yw==", + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.4.tgz", + "integrity": "sha512-UwSDJOg3dqCAejWdxclJjCsh3Qq4vLYMDxmyHqo1btz3stK2VqgwNd3mm5tuIwzSlGIQ/1H9Hr+Zn09mrezNqQ==", "cpu": [ "x64" ], @@ -1387,21 +505,17 @@ "optional": true, "os": [ "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.4.tgz", - "integrity": "sha512-zD6NdeWEByGE9QF9vCrlJ5YQB4oq9q91kPZS37Jwj5hOkvR1lTBSpsKhKDw4IJtbQ35LsTS1HD9DZYGKIshU1Q==", - "cpu": [ - "x64" ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] + "license": "MIT" }, "node_modules/@standard-schema/spec": { "version": "1.1.0", @@ -1417,51 +531,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", - "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", - "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.2" - } - }, "node_modules/@types/chai": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", @@ -1594,24 +663,29 @@ "license": "MIT" }, "node_modules/@vitejs/plugin-react": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", - "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.0.5.tgz", + "integrity": "sha512-BOVzne/NL162sMdResB25mUv+vWMF5NoAjNf09TeGlE7ZpszZWSD3winycicLJw72yeVsoCn/2kOhEuCvEShMA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/core": "^7.28.0", - "@babel/plugin-transform-react-jsx-self": "^7.27.1", - "@babel/plugin-transform-react-jsx-source": "^7.27.1", - "@rolldown/pluginutils": "1.0.0-beta.27", - "@types/babel__core": "^7.20.5", - "react-refresh": "^0.17.0" + "@rolldown/pluginutils": "^1.0.1" }, "engines": { - "node": "^14.18.0 || >=16.0.0" + "node": "^20.19.0 || >=22.12.0" }, "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "babel-plugin-react-compiler": "^1.0.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + } } }, "node_modules/@vitest/expect": { @@ -1779,83 +853,15 @@ "node": ">=12" } }, - "node_modules/baseline-browser-mapping": { - "version": "2.11.14", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.14.tgz", - "integrity": "sha512-JyJ954WzuIR8/FFzX0o5krdSTrBAkcCSRfWSleRsIHSWV+cZe2FI1PKggVkFke1hBldRs+LRxUczzE9iPmgZww==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.cjs" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/bidi-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", "integrity": "sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==", "dev": true, - "license": "MIT", - "dependencies": { - "require-from-string": "^2.0.2" - } - }, - "node_modules/browserslist": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz", - "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.11.12", - "caniuse-lite": "^1.0.30001809", - "electron-to-chromium": "^1.5.402", - "node-releases": "^2.0.53", - "update-browserslist-db": "^1.3.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001809", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001809.tgz", - "integrity": "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } }, "node_modules/chai": { "version": "6.2.2", @@ -2035,24 +1041,6 @@ "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, "node_modules/decimal.js": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", @@ -2060,12 +1048,15 @@ "dev": true, "license": "MIT" }, - "node_modules/electron-to-chromium": { - "version": "1.5.406", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.406.tgz", - "integrity": "sha512-hWH5ORBi3d0IipnMh7BN5GDTaAmrSSSWmznwt2zltdiRNEWoEQyTwF0FFSBxzHO7hLSRT6loQu3IQGV0wg/Tvg==", + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", "dev": true, - "license": "ISC" + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } }, "node_modules/entities": { "version": "8.0.0", @@ -2087,58 +1078,6 @@ "dev": true, "license": "MIT" }, - "node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", @@ -2199,16 +1138,6 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/html-encoding-sniffer": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", @@ -2286,30 +1215,265 @@ "node": "20 || >=22" } }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" }, "engines": { - "node": ">=6" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, "node_modules/loose-envify": { @@ -2324,16 +1488,6 @@ "loose-envify": "cli.js" } }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, "node_modules/magic-string": { "version": "0.30.21", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", @@ -2358,13 +1512,6 @@ "dev": true, "license": "MIT" }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/nanoid": { "version": "3.3.18", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", @@ -2384,16 +1531,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/node-releases": { - "version": "2.0.53", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.53.tgz", - "integrity": "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, "node_modules/obug": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz", @@ -2512,16 +1649,6 @@ "react": "^18.3.1" } }, - "node_modules/react-refresh": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", - "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -2532,50 +1659,37 @@ "node": ">=0.10.0" } }, - "node_modules/rollup": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.4.tgz", - "integrity": "sha512-RXOqwaPsBGjMNMa4sQjDjHieHEZDFoj/Rdr46l2MU5DfEs16wHJPC2RPTPHWhNl+M3aI472LLqFkFKut4SblOg==", + "node_modules/rolldown": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.4.tgz", + "integrity": "sha512-rSr7irW0K7QRWzjdJXqZowkcRdDtjRduh43rBltnVKd0VFq839l1lJoDvGJb6gl7+4rTTCrPWu+YfujUL8Ug7w==", "dev": true, "license": "MIT", "dependencies": { - "@types/estree": "1.0.9" + "@oxc-project/types": "=0.144.0", + "@rolldown/pluginutils": "^1.0.0" }, "bin": { - "rollup": "dist/bin/rollup" + "rolldown": "bin/cli.mjs" }, "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" + "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@napi-rs/lzma-linux-x64-gnu": "1.5.1", - "@rollup/rollup-android-arm-eabi": "4.62.4", - "@rollup/rollup-android-arm64": "4.62.4", - "@rollup/rollup-darwin-arm64": "4.62.4", - "@rollup/rollup-darwin-x64": "4.62.4", - "@rollup/rollup-freebsd-arm64": "4.62.4", - "@rollup/rollup-freebsd-x64": "4.62.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.62.4", - "@rollup/rollup-linux-arm-musleabihf": "4.62.4", - "@rollup/rollup-linux-arm64-gnu": "4.62.4", - "@rollup/rollup-linux-arm64-musl": "4.62.4", - "@rollup/rollup-linux-loong64-gnu": "4.62.4", - "@rollup/rollup-linux-loong64-musl": "4.62.4", - "@rollup/rollup-linux-ppc64-gnu": "4.62.4", - "@rollup/rollup-linux-ppc64-musl": "4.62.4", - "@rollup/rollup-linux-riscv64-gnu": "4.62.4", - "@rollup/rollup-linux-riscv64-musl": "4.62.4", - "@rollup/rollup-linux-s390x-gnu": "4.62.4", - "@rollup/rollup-linux-x64-gnu": "4.62.4", - "@rollup/rollup-linux-x64-musl": "4.62.4", - "@rollup/rollup-openbsd-x64": "4.62.4", - "@rollup/rollup-openharmony-arm64": "4.62.4", - "@rollup/rollup-win32-arm64-msvc": "4.62.4", - "@rollup/rollup-win32-ia32-msvc": "4.62.4", - "@rollup/rollup-win32-x64-gnu": "4.62.4", - "@rollup/rollup-win32-x64-msvc": "4.62.4", - "fsevents": "~2.3.2" + "@rolldown/binding-android-arm64": "1.2.4", + "@rolldown/binding-darwin-arm64": "1.2.4", + "@rolldown/binding-darwin-x64": "1.2.4", + "@rolldown/binding-freebsd-x64": "1.2.4", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.4", + "@rolldown/binding-linux-arm64-gnu": "1.2.4", + "@rolldown/binding-linux-arm64-musl": "1.2.4", + "@rolldown/binding-linux-ppc64-gnu": "1.2.4", + "@rolldown/binding-linux-s390x-gnu": "1.2.4", + "@rolldown/binding-linux-x64-gnu": "1.2.4", + "@rolldown/binding-linux-x64-musl": "1.2.4", + "@rolldown/binding-openharmony-arm64": "1.2.4", + "@rolldown/binding-win32-arm64-msvc": "1.2.4", + "@rolldown/binding-win32-x64-msvc": "1.2.4" } }, "node_modules/saxes": { @@ -2600,16 +1714,6 @@ "loose-envify": "^1.1.0" } }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/siginfo": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", @@ -2768,37 +1872,6 @@ "node": ">=22.19.0" } }, - "node_modules/update-browserslist-db": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.1.tgz", - "integrity": "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, "node_modules/use-sync-external-store": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", @@ -2809,24 +1882,23 @@ } }, "node_modules/vite": { - "version": "6.4.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", - "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.1.tgz", + "integrity": "sha512-EU/eS7BH3XROHh2YnBefjM6DBKA6ZeMZEYQbj7NLWg5wHYlhB8B/Mayd5XsgWq+NFYccDOTemRpdETWR6Ka/lw==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" + "lightningcss": "^1.33.0", + "picomatch": "^4.0.5", + "postcss": "^8.5.25", + "rolldown": "~1.2.1", + "tinyglobby": "^0.2.17" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^20.19.0 || >=22.12.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -2835,14 +1907,15 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.4.0", + "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" @@ -2851,13 +1924,16 @@ "@types/node": { "optional": true }, - "jiti": { + "@vitejs/devtools": { "optional": true }, - "less": { + "esbuild": { "optional": true }, - "lightningcss": { + "jiti": { + "optional": true + }, + "less": { "optional": true }, "sass": { @@ -3055,13 +2131,6 @@ "dev": true, "license": "MIT" }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - }, "node_modules/zustand": { "version": "4.5.7", "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz", diff --git a/ui/package.json b/ui/package.json index adf5947..3b69601 100644 --- a/ui/package.json +++ b/ui/package.json @@ -19,10 +19,10 @@ "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@types/three": "^0.185.4", - "@vitejs/plugin-react": "^4.3.4", + "@vitejs/plugin-react": "^6.0.5", "jsdom": "^30.0.1", "typescript": "^5.6.3", - "vite": "^6.0.3", + "vite": "^8.2.1", "vitest": "^4.1.10" } }