@liveroom-tech/react-immersive 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +486 -57
- package/dist/binding-builder.css +1 -1
- package/dist/binding-builder.js +17 -13
- package/dist/binding-builder.mjs +1 -1
- package/dist/chunk-4NLJSD3S.mjs +1 -0
- package/dist/chunk-B7REIGDG.mjs +1 -0
- package/dist/{chunk-WN6GMMHF.mjs → chunk-HYFJ5DYJ.mjs} +1 -1
- package/dist/chunk-QC3NT76G.mjs +3 -0
- package/dist/chunk-T3M3BQ7H.mjs +32 -0
- package/dist/chunk-ZPK67UG7.mjs +1 -0
- package/dist/hosted.css +1 -1
- package/dist/hosted.d.mts +4 -3
- package/dist/hosted.d.ts +4 -3
- package/dist/hosted.js +16 -12
- package/dist/hosted.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +39 -8
- package/dist/index.d.ts +39 -8
- package/dist/index.js +14 -10
- package/dist/index.mjs +1 -1
- package/dist/materialVariants-DnZe9eMC.d.mts +309 -0
- package/dist/materialVariants-DnZe9eMC.d.ts +309 -0
- package/dist/modelInfo-BYebMPdZ.d.mts +43 -0
- package/dist/modelInfo-XfUQO7C_.d.ts +43 -0
- package/dist/{ModelViewer-Bj-KjiDL.d.mts → modelViewerProps-CIZ2R_Fv.d.ts} +82 -10
- package/dist/{ModelViewer-BkQ73y6N.d.ts → modelViewerProps-DoRiTZMn.d.mts} +82 -10
- package/dist/{objectCatalog-BIeXURoq.d.ts → rendererBackend-QwMzISTn.d.mts} +32 -4
- package/dist/{objectCatalog-BIeXURoq.d.mts → rendererBackend-QwMzISTn.d.ts} +32 -4
- package/dist/simple-model-viewer.css +1 -1
- package/dist/simple-model-viewer.d.mts +32 -4
- package/dist/simple-model-viewer.d.ts +32 -4
- package/dist/simple-model-viewer.js +3 -3
- package/dist/simple-model-viewer.mjs +1 -1
- package/dist/utils.d.mts +5 -4
- package/dist/utils.d.ts +5 -4
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-32WCLPTZ.mjs +0 -1
- package/dist/chunk-CSGNL4XU.mjs +0 -3
- package/dist/chunk-F2ILTIPG.mjs +0 -28
- package/dist/chunk-V6GALFL5.mjs +0 -1
- package/dist/modelInfo-DnkmTGMd.d.mts +0 -23
- package/dist/modelInfo-DnkmTGMd.d.ts +0 -23
package/dist/hosted.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";"use client";var l_=Object.create;var kl=Object.defineProperty;var c_=Object.getOwnPropertyDescriptor;var d_=Object.getOwnPropertyNames;var u_=Object.getPrototypeOf,p_=Object.prototype.hasOwnProperty;var h_=(e,t,n)=>t in e?kl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var m_=(e,t)=>()=>(e&&(t=e(e=0)),t);var Zg=(e,t)=>{for(var n in t)kl(e,n,{get:t[n],enumerable:!0})},Jg=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d_(t))!p_.call(e,r)&&r!==n&&kl(e,r,{get:()=>t[r],enumerable:!(i=c_(t,r))||i.enumerable});return e};var Qg=(e,t,n)=>(n=e!=null?l_(u_(e)):{},Jg(t||!e||!e.__esModule?kl(n,"default",{value:e,enumerable:!0}):n,e)),f_=e=>Jg(kl({},"__esModule",{value:!0}),e);var ch=(e,t,n)=>h_(e,typeof t!="symbol"?t+"":t,n);var eb={};Zg(eb,{bvhWorkerCode:()=>g_});var g_,tb=m_(()=>{"use strict";g_=`(()=>{var Ls=1;var Ds=3,wn=0,Ui=1,Fi=2;var di=0,pi=1,mi=2,gi=3,_i=4,xi=5,yi=6,vi=7,Ns=0,Us=1,Fs=2;var Bi=1,Oi=2,zi=3,Vi=4,ki=5,Gi=6,Hi=7;var Wi=300,Bs=301,Xi=302;var Os=306,Mi=1e3,Ie=1001,Si=1002;var zs=1006;var Vs=1008;var ks=1009;var Gs=1015;var Hs=1023;var De=2300,ln=2301,an=2302,bi=2303,Ti=2400,Ai=2401,Ei=2402;var qi="",_t="srgb",wi="srgb-linear",Ci="linear",cn="srgb";var Ri=35044;var Le=2e3,Pi=2001;function Fr(c){for(let t=c.length-1;t>=0;--t)if(c[t]>=65535)return!0;return!1}function Br(c){return ArrayBuffer.isView(c)&&!(c instanceof DataView)}function Ii(c){return document.createElementNS("http://www.w3.org/1999/xhtml",c)}var xs={},un=null;function Ws(c){let t=c[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=c[1];e&&e.isStackTrace?c[0]+=" "+e.getLocation():c[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return c}function Q(...c){c=Ws(c);let t="THREE."+c.shift();if(un)un("warn",t,...c);else{let e=c[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...c)}}function G(...c){c=Ws(c);let t="THREE."+c.shift();if(un)un("error",t,...c);else{let e=c[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...c)}}function Li(...c){let t=c.join(" ");t in xs||(xs[t]=!0,Q(...c))}var Or={[di]:pi,[mi]:yi,[_i]:vi,[gi]:xi,[pi]:di,[yi]:mi,[vi]:_i,[xi]:gi},Yt=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let i=n[t];if(i!==void 0){let s=i.indexOf(e);s!==-1&&i.splice(s,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,t);t.target=null}}},st=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var yl=Math.PI/180,zr=180/Math.PI;function Cn(){let c=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(st[c&255]+st[c>>8&255]+st[c>>16&255]+st[c>>24&255]+"-"+st[t&255]+st[t>>8&255]+"-"+st[t>>16&15|64]+st[t>>24&255]+"-"+st[e&63|128]+st[e>>8&255]+"-"+st[e>>16&255]+st[e>>24&255]+st[n&255]+st[n>>8&255]+st[n>>16&255]+st[n>>24&255]).toLowerCase()}function U(c,t,e){return Math.max(t,Math.min(e,c))}function Vr(c,t){return(c%t+t)%t}function Zn(c,t,e){return(1-e)*c+e*t}function Ee(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return c/4294967295;case Uint16Array:return c/65535;case Uint8Array:return c/255;case Int32Array:return Math.max(c/2147483647,-1);case Int16Array:return Math.max(c/32767,-1);case Int8Array:return Math.max(c/127,-1);default:throw new Error("Invalid component type.")}}function ut(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return Math.round(c*4294967295);case Uint16Array:return Math.round(c*65535);case Uint8Array:return Math.round(c*255);case Int32Array:return Math.round(c*2147483647);case Int16Array:return Math.round(c*32767);case Int8Array:return Math.round(c*127);default:throw new Error("Invalid component type.")}}var H=class c{static{c.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(U(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),i=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*n-r*i+t.x,this.y=s*i+r*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Lt=class{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,s,r,o){let a=n[i+0],l=n[i+1],u=n[i+2],f=n[i+3],h=s[r+0],d=s[r+1],p=s[r+2],m=s[r+3];if(f!==m||a!==h||l!==d||u!==p){let _=a*h+l*d+u*p+f*m;_<0&&(h=-h,d=-d,p=-p,m=-m,_=-_);let g=1-o;if(_<.9995){let x=Math.acos(_),y=Math.sin(x);g=Math.sin(g*x)/y,o=Math.sin(o*x)/y,a=a*g+h*o,l=l*g+d*o,u=u*g+p*o,f=f*g+m*o}else{a=a*g+h*o,l=l*g+d*o,u=u*g+p*o,f=f*g+m*o;let x=1/Math.sqrt(a*a+l*l+u*u+f*f);a*=x,l*=x,u*=x,f*=x}}t[e]=a,t[e+1]=l,t[e+2]=u,t[e+3]=f}static multiplyQuaternionsFlat(t,e,n,i,s,r){let o=n[i],a=n[i+1],l=n[i+2],u=n[i+3],f=s[r],h=s[r+1],d=s[r+2],p=s[r+3];return t[e]=o*p+u*f+a*d-l*h,t[e+1]=a*p+u*h+l*f-o*d,t[e+2]=l*p+u*d+o*h-a*f,t[e+3]=u*p-o*f-a*h-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,i=t._y,s=t._z,r=t._order,o=Math.cos,a=Math.sin,l=o(n/2),u=o(i/2),f=o(s/2),h=a(n/2),d=a(i/2),p=a(s/2);switch(r){case"XYZ":this._x=h*u*f+l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f-h*d*p;break;case"YXZ":this._x=h*u*f+l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f+h*d*p;break;case"ZXY":this._x=h*u*f-l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f-h*d*p;break;case"ZYX":this._x=h*u*f-l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f+h*d*p;break;case"YZX":this._x=h*u*f+l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f-h*d*p;break;case"XZY":this._x=h*u*f-l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f+h*d*p;break;default:Q("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],i=e[4],s=e[8],r=e[1],o=e[5],a=e[9],l=e[2],u=e[6],f=e[10],h=n+o+f;if(h>0){let d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-a)*d,this._y=(s-l)*d,this._z=(r-i)*d}else if(n>o&&n>f){let d=2*Math.sqrt(1+n-o-f);this._w=(u-a)/d,this._x=.25*d,this._y=(i+r)/d,this._z=(s+l)/d}else if(o>f){let d=2*Math.sqrt(1+o-n-f);this._w=(s-l)/d,this._x=(i+r)/d,this._y=.25*d,this._z=(a+u)/d}else{let d=2*Math.sqrt(1+f-n-o);this._w=(r-i)/d,this._x=(s+l)/d,this._y=(a+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(U(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,i=t._y,s=t._z,r=t._w,o=e._x,a=e._y,l=e._z,u=e._w;return this._x=n*u+r*o+i*l-s*a,this._y=i*u+r*a+s*o-n*l,this._z=s*u+r*l+n*a-i*o,this._w=r*u-n*o-i*a-s*l,this._onChangeCallback(),this}slerp(t,e){let n=t._x,i=t._y,s=t._z,r=t._w,o=this.dot(t);o<0&&(n=-n,i=-i,s=-s,r=-r,o=-o);let a=1-e;if(o<.9995){let l=Math.acos(o),u=Math.sin(l);a=Math.sin(a*l)/u,e=Math.sin(e*l)/u,this._x=this._x*a+n*e,this._y=this._y*a+i*e,this._z=this._z*a+s*e,this._w=this._w*a+r*e,this._onChangeCallback()}else this._x=this._x*a+n*e,this._y=this._y*a+i*e,this._z=this._z*a+s*e,this._w=this._w*a+r*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},M=class c{static{c.prototype.isVector3=!0}constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ys.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ys.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*i,this.y=s[1]*e+s[4]*n+s[7]*i,this.z=s[2]*e+s[5]*n+s[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,s=t.elements,r=1/(s[3]*e+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*e+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*e+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(t){let e=this.x,n=this.y,i=this.z,s=t.x,r=t.y,o=t.z,a=t.w,l=2*(r*i-o*n),u=2*(o*e-s*i),f=2*(s*n-r*e);return this.x=e+a*l+r*f-o*u,this.y=n+a*u+o*l-s*f,this.z=i+a*f+s*u-r*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i,this.y=s[1]*e+s[5]*n+s[9]*i,this.z=s[2]*e+s[6]*n+s[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this.z=U(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this.z=U(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,i=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=i*a-s*o,this.y=s*r-n*a,this.z=n*o-i*r,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Jn.copy(this).projectOnVector(t),this.sub(Jn)}reflect(t){return this.sub(Jn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(U(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Jn=new M,ys=new Lt,N=class c{static{c.prototype.isMatrix3=!0}constructor(t,e,n,i,s,r,o,a,l){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,r,o,a,l)}set(t,e,n,i,s,r,o,a,l){let u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=e,u[4]=s,u[5]=a,u[6]=n,u[7]=r,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,s=this.elements,r=n[0],o=n[3],a=n[6],l=n[1],u=n[4],f=n[7],h=n[2],d=n[5],p=n[8],m=i[0],_=i[3],g=i[6],x=i[1],y=i[4],S=i[7],v=i[2],b=i[5],T=i[8];return s[0]=r*m+o*x+a*v,s[3]=r*_+o*y+a*b,s[6]=r*g+o*S+a*T,s[1]=l*m+u*x+f*v,s[4]=l*_+u*y+f*b,s[7]=l*g+u*S+f*T,s[2]=h*m+d*x+p*v,s[5]=h*_+d*y+p*b,s[8]=h*g+d*S+p*T,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8];return e*r*u-e*o*l-n*s*u+n*o*a+i*s*l-i*r*a}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8],f=u*r-o*l,h=o*a-u*s,d=l*s-r*a,p=e*f+n*h+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return t[0]=f*m,t[1]=(i*l-u*n)*m,t[2]=(o*n-i*r)*m,t[3]=h*m,t[4]=(u*e-i*a)*m,t[5]=(i*s-o*e)*m,t[6]=d*m,t[7]=(n*a-l*e)*m,t[8]=(r*e-n*s)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,s,r,o){let a=Math.cos(s),l=Math.sin(s);return this.set(n*a,n*l,-n*(a*r+l*o)+r+t,-i*l,i*a,-i*(-l*r+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply($n.makeScale(t,e)),this}rotate(t){return this.premultiply($n.makeRotation(-t)),this}translate(t,e){return this.premultiply($n.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},$n=new N,vs=new N().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ms=new N().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function kr(){let c={enabled:!0,workingColorSpace:wi,spaces:{},convert:function(i,s,r){return this.enabled===!1||s===r||!s||!r||(this.spaces[s].transfer===cn&&(i.r=It(i.r),i.g=It(i.g),i.b=It(i.b)),this.spaces[s].primaries!==this.spaces[r].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===cn&&(i.r=he(i.r),i.g=he(i.g),i.b=he(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===qi?Ci:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,r){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Li("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),c.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Li("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),c.colorSpaceToWorking(i,s)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return c.define({[wi]:{primaries:t,whitePoint:n,transfer:Ci,toXYZ:vs,fromXYZ:Ms,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:_t},outputColorSpaceConfig:{drawingBufferColorSpace:_t}},[_t]:{primaries:t,whitePoint:n,transfer:cn,toXYZ:vs,fromXYZ:Ms,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:_t}}}),c}var gt=kr();function It(c){return c<.04045?c*.0773993808:Math.pow(c*.9478672986+.0521327014,2.4)}function he(c){return c<.0031308?c*12.92:1.055*Math.pow(c,.41666)-.055}var jt,hn=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{jt===void 0&&(jt=Ii("canvas")),jt.width=t.width,jt.height=t.height;let i=jt.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),n=jt}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Ii("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let i=n.getImageData(0,0,t.width,t.height),s=i.data;for(let r=0;r<s.length;r++)s[r]=It(s[r]/255)*255;return n.putImageData(i,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(It(e[n]/255)*255):e[n]=It(e[n]);return{data:e,width:t.width,height:t.height}}else return Q("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Gr=0,fn=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Gr++}),this.uuid=Cn(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let r=0,o=i.length;r<o;r++)i[r].isDataTexture?s.push(Kn(i[r].image)):s.push(Kn(i[r]))}else s=Kn(i);n.url=s}return e||(t.images[this.uuid]=n),n}};function Kn(c){return typeof HTMLImageElement<"u"&&c instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&c instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&c instanceof ImageBitmap?hn.getDataURL(c):c.data?{data:Array.from(c.data),width:c.width,height:c.height,type:c.data.constructor.name}:(Q("Texture: Unable to serialize Texture."),{})}var Hr=0,Qn=new M,fe=class c extends Yt{constructor(t=c.DEFAULT_IMAGE,e=c.DEFAULT_MAPPING,n=Ie,i=Ie,s=zs,r=Vs,o=Hs,a=ks,l=c.DEFAULT_ANISOTROPY,u=qi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hr++}),this.uuid=Cn(),this.name="",this.source=new fn(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new H(0,0),this.repeat=new H(1,1),this.center=new H(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new N,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Qn).x}get height(){return this.source.getSize(Qn).y}get depth(){return this.source.getSize(Qn).z}get image(){return this.source.data}set image(t){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){Q(\`Texture.setValues(): parameter '\${e}' has value of undefined.\`);continue}let i=this[e];if(i===void 0){Q(\`Texture.setValues(): property '\${e}' does not exist.\`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Wi)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Mi:t.x=t.x-Math.floor(t.x);break;case Ie:t.x=t.x<0?0:1;break;case Si:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Mi:t.y=t.y-Math.floor(t.y);break;case Ie:t.y=t.y<0?0:1;break;case Si:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};fe.DEFAULT_IMAGE=null;fe.DEFAULT_MAPPING=Wi;fe.DEFAULT_ANISOTROPY=1;var de=class c{static{c.prototype.isVector4=!0}constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,s=this.w,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12]*s,this.y=r[1]*e+r[5]*n+r[9]*i+r[13]*s,this.z=r[2]*e+r[6]*n+r[10]*i+r[14]*s,this.w=r[3]*e+r[7]*n+r[11]*i+r[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,s,a=t.elements,l=a[0],u=a[4],f=a[8],h=a[1],d=a[5],p=a[9],m=a[2],_=a[6],g=a[10];if(Math.abs(u-h)<.01&&Math.abs(f-m)<.01&&Math.abs(p-_)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+m)<.1&&Math.abs(p+_)<.1&&Math.abs(l+d+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let y=(l+1)/2,S=(d+1)/2,v=(g+1)/2,b=(u+h)/4,T=(f+m)/4,A=(p+_)/4;return y>S&&y>v?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=b/n,s=T/n):S>v?S<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(S),n=b/i,s=A/i):v<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(v),n=T/s,i=A/s),this.set(n,i,s,e),this}let x=Math.sqrt((_-p)*(_-p)+(f-m)*(f-m)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(_-p)/x,this.y=(f-m)/x,this.z=(h-u)/x,this.w=Math.acos((l+d+g-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this.z=U(this.z,t.z,e.z),this.w=U(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this.z=U(this.z,t,e),this.w=U(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}};var W=class c{static{c.prototype.isMatrix4=!0}constructor(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_)}set(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_){let g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=o,g[13]=a,g[2]=l,g[6]=u,g[10]=f,g[14]=h,g[3]=d,g[7]=p,g[11]=m,g[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new c().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return this.determinant()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(t.determinant()===0)return this.identity();let e=this.elements,n=t.elements,i=1/te.setFromMatrixColumn(t,0).length(),s=1/te.setFromMatrixColumn(t,1).length(),r=1/te.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*r,e[9]=n[9]*r,e[10]=n[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,i=t.y,s=t.z,r=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),u=Math.cos(s),f=Math.sin(s);if(t.order==="XYZ"){let h=r*u,d=r*f,p=o*u,m=o*f;e[0]=a*u,e[4]=-a*f,e[8]=l,e[1]=d+p*l,e[5]=h-m*l,e[9]=-o*a,e[2]=m-h*l,e[6]=p+d*l,e[10]=r*a}else if(t.order==="YXZ"){let h=a*u,d=a*f,p=l*u,m=l*f;e[0]=h+m*o,e[4]=p*o-d,e[8]=r*l,e[1]=r*f,e[5]=r*u,e[9]=-o,e[2]=d*o-p,e[6]=m+h*o,e[10]=r*a}else if(t.order==="ZXY"){let h=a*u,d=a*f,p=l*u,m=l*f;e[0]=h-m*o,e[4]=-r*f,e[8]=p+d*o,e[1]=d+p*o,e[5]=r*u,e[9]=m-h*o,e[2]=-r*l,e[6]=o,e[10]=r*a}else if(t.order==="ZYX"){let h=r*u,d=r*f,p=o*u,m=o*f;e[0]=a*u,e[4]=p*l-d,e[8]=h*l+m,e[1]=a*f,e[5]=m*l+h,e[9]=d*l-p,e[2]=-l,e[6]=o*a,e[10]=r*a}else if(t.order==="YZX"){let h=r*a,d=r*l,p=o*a,m=o*l;e[0]=a*u,e[4]=m-h*f,e[8]=p*f+d,e[1]=f,e[5]=r*u,e[9]=-o*u,e[2]=-l*u,e[6]=d*f+p,e[10]=h-m*f}else if(t.order==="XZY"){let h=r*a,d=r*l,p=o*a,m=o*l;e[0]=a*u,e[4]=-f,e[8]=l*u,e[1]=h*f+m,e[5]=r*u,e[9]=d*f-p,e[2]=p*f-d,e[6]=o*u,e[10]=m*f+h}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Wr,t,Xr)}lookAt(t,e,n){let i=this.elements;return ft.subVectors(t,e),ft.lengthSq()===0&&(ft.z=1),ft.normalize(),Nt.crossVectors(n,ft),Nt.lengthSq()===0&&(Math.abs(n.z)===1?ft.x+=1e-4:ft.z+=1e-4,ft.normalize(),Nt.crossVectors(n,ft)),Nt.normalize(),Ke.crossVectors(ft,Nt),i[0]=Nt.x,i[4]=Ke.x,i[8]=ft.x,i[1]=Nt.y,i[5]=Ke.y,i[9]=ft.y,i[2]=Nt.z,i[6]=Ke.z,i[10]=ft.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,s=this.elements,r=n[0],o=n[4],a=n[8],l=n[12],u=n[1],f=n[5],h=n[9],d=n[13],p=n[2],m=n[6],_=n[10],g=n[14],x=n[3],y=n[7],S=n[11],v=n[15],b=i[0],T=i[4],A=i[8],E=i[12],C=i[1],R=i[5],w=i[9],P=i[13],L=i[2],D=i[6],O=i[10],it=i[14],Tt=i[3],At=i[7],Je=i[11],$e=i[15];return s[0]=r*b+o*C+a*L+l*Tt,s[4]=r*T+o*R+a*D+l*At,s[8]=r*A+o*w+a*O+l*Je,s[12]=r*E+o*P+a*it+l*$e,s[1]=u*b+f*C+h*L+d*Tt,s[5]=u*T+f*R+h*D+d*At,s[9]=u*A+f*w+h*O+d*Je,s[13]=u*E+f*P+h*it+d*$e,s[2]=p*b+m*C+_*L+g*Tt,s[6]=p*T+m*R+_*D+g*At,s[10]=p*A+m*w+_*O+g*Je,s[14]=p*E+m*P+_*it+g*$e,s[3]=x*b+y*C+S*L+v*Tt,s[7]=x*T+y*R+S*D+v*At,s[11]=x*A+y*w+S*O+v*Je,s[15]=x*E+y*P+S*it+v*$e,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],i=t[8],s=t[12],r=t[1],o=t[5],a=t[9],l=t[13],u=t[2],f=t[6],h=t[10],d=t[14],p=t[3],m=t[7],_=t[11],g=t[15],x=a*d-l*h,y=o*d-l*f,S=o*h-a*f,v=r*d-l*u,b=r*h-a*u,T=r*f-o*u;return e*(m*x-_*y+g*S)-n*(p*x-_*v+g*b)+i*(p*y-m*v+g*T)-s*(p*S-m*b+_*T)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8],f=t[9],h=t[10],d=t[11],p=t[12],m=t[13],_=t[14],g=t[15],x=e*o-n*r,y=e*a-i*r,S=e*l-s*r,v=n*a-i*o,b=n*l-s*o,T=i*l-s*a,A=u*m-f*p,E=u*_-h*p,C=u*g-d*p,R=f*_-h*m,w=f*g-d*m,P=h*g-d*_,L=x*P-y*w+S*R+v*C-b*E+T*A;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/L;return t[0]=(o*P-a*w+l*R)*D,t[1]=(i*w-n*P-s*R)*D,t[2]=(m*T-_*b+g*v)*D,t[3]=(h*b-f*T-d*v)*D,t[4]=(a*C-r*P-l*E)*D,t[5]=(e*P-i*C+s*E)*D,t[6]=(_*S-p*T-g*y)*D,t[7]=(u*T-h*S+d*y)*D,t[8]=(r*w-o*C+l*A)*D,t[9]=(n*C-e*w-s*A)*D,t[10]=(p*b-m*S+g*x)*D,t[11]=(f*S-u*b-d*x)*D,t[12]=(o*E-r*R-a*A)*D,t[13]=(e*R-n*E+i*A)*D,t[14]=(m*y-p*v-_*x)*D,t[15]=(u*v-f*y+h*x)*D,this}scale(t){let e=this.elements,n=t.x,i=t.y,s=t.z;return e[0]*=n,e[4]*=i,e[8]*=s,e[1]*=n,e[5]*=i,e[9]*=s,e[2]*=n,e[6]*=i,e[10]*=s,e[3]*=n,e[7]*=i,e[11]*=s,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),i=Math.sin(e),s=1-n,r=t.x,o=t.y,a=t.z,l=s*r,u=s*o;return this.set(l*r+n,l*o-i*a,l*a+i*o,0,l*o+i*a,u*o+n,u*a-i*r,0,l*a-i*o,u*a+i*r,s*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,s,r){return this.set(1,n,s,0,t,1,r,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){let i=this.elements,s=e._x,r=e._y,o=e._z,a=e._w,l=s+s,u=r+r,f=o+o,h=s*l,d=s*u,p=s*f,m=r*u,_=r*f,g=o*f,x=a*l,y=a*u,S=a*f,v=n.x,b=n.y,T=n.z;return i[0]=(1-(m+g))*v,i[1]=(d+S)*v,i[2]=(p-y)*v,i[3]=0,i[4]=(d-S)*b,i[5]=(1-(h+g))*b,i[6]=(_+x)*b,i[7]=0,i[8]=(p+y)*T,i[9]=(_-x)*T,i[10]=(1-(h+m))*T,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){let i=this.elements;t.x=i[12],t.y=i[13],t.z=i[14];let s=this.determinant();if(s===0)return n.set(1,1,1),e.identity(),this;let r=te.set(i[0],i[1],i[2]).length(),o=te.set(i[4],i[5],i[6]).length(),a=te.set(i[8],i[9],i[10]).length();s<0&&(r=-r),yt.copy(this);let l=1/r,u=1/o,f=1/a;return yt.elements[0]*=l,yt.elements[1]*=l,yt.elements[2]*=l,yt.elements[4]*=u,yt.elements[5]*=u,yt.elements[6]*=u,yt.elements[8]*=f,yt.elements[9]*=f,yt.elements[10]*=f,e.setFromRotationMatrix(yt),n.x=r,n.y=o,n.z=a,this}makePerspective(t,e,n,i,s,r,o=Le,a=!1){let l=this.elements,u=2*s/(e-t),f=2*s/(n-i),h=(e+t)/(e-t),d=(n+i)/(n-i),p,m;if(a)p=s/(r-s),m=r*s/(r-s);else if(o===Le)p=-(r+s)/(r-s),m=-2*r*s/(r-s);else if(o===Pi)p=-r/(r-s),m=-r*s/(r-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=f,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,i,s,r,o=Le,a=!1){let l=this.elements,u=2/(e-t),f=2/(n-i),h=-(e+t)/(e-t),d=-(n+i)/(n-i),p,m;if(a)p=1/(r-s),m=r/(r-s);else if(o===Le)p=-2/(r-s),m=-(r+s)/(r-s);else if(o===Pi)p=-1/(r-s),m=-s/(r-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=f,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},te=new M,yt=new W,Wr=new M(0,0,0),Xr=new M(1,1,1),Nt=new M,Ke=new M,ft=new M,Ss=new W,bs=new Lt,Ne=class c{constructor(t=0,e=0,n=0,i=c.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let i=t.elements,s=i[0],r=i[4],o=i[8],a=i[1],l=i[5],u=i[9],f=i[2],h=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(U(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-U(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(U(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(a,s));break;case"ZYX":this._y=Math.asin(-U(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(a,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(U(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-U(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:Q("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Ss.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ss,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return bs.setFromEuler(this),this.setFromQuaternion(bs,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ne.DEFAULT_ORDER="XYZ";var dn=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},qr=0,Ts=new M,ee=new Lt,wt=new W,Qe=new M,we=new M,Yr=new M,Zr=new Lt,As=new M(1,0,0),Es=new M(0,1,0),ws=new M(0,0,1),Cs={type:"added"},Jr={type:"removed"},ne={type:"childadded",child:null},jn={type:"childremoved",child:null},Zt=class c extends Yt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:qr++}),this.uuid=Cn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=c.DEFAULT_UP.clone();let t=new M,e=new Ne,n=new Lt,i=new M(1,1,1);function s(){n.setFromEuler(e,!1)}function r(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new W},normalMatrix:{value:new N}}),this.matrix=new W,this.matrixWorld=new W,this.matrixAutoUpdate=c.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=c.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new dn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return ee.setFromAxisAngle(t,e),this.quaternion.multiply(ee),this}rotateOnWorldAxis(t,e){return ee.setFromAxisAngle(t,e),this.quaternion.premultiply(ee),this}rotateX(t){return this.rotateOnAxis(As,t)}rotateY(t){return this.rotateOnAxis(Es,t)}rotateZ(t){return this.rotateOnAxis(ws,t)}translateOnAxis(t,e){return Ts.copy(t).applyQuaternion(this.quaternion),this.position.add(Ts.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(As,t)}translateY(t){return this.translateOnAxis(Es,t)}translateZ(t){return this.translateOnAxis(ws,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(wt.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Qe.copy(t):Qe.set(t,e,n);let i=this.parent;this.updateWorldMatrix(!0,!1),we.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?wt.lookAt(we,Qe,this.up):wt.lookAt(Qe,we,this.up),this.quaternion.setFromRotationMatrix(wt),i&&(wt.extractRotation(i.matrixWorld),ee.setFromRotationMatrix(wt),this.quaternion.premultiply(ee.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(G("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Cs),ne.child=t,this.dispatchEvent(ne),ne.child=null):G("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Jr),jn.child=t,this.dispatchEvent(jn),jn.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),wt.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),wt.multiply(t.parent.matrixWorld)),t.applyMatrix4(wt),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Cs),ne.child=t,this.dispatchEvent(ne),ne.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){let r=this.children[n].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,t,Yr),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,Zr,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,n=t.y,i=t.z,s=this.matrix.elements;s[12]+=e-s[0]*e-s[4]*n-s[8]*i,s[13]+=n-s[1]*e-s[5]*n-s[9]*i,s[14]+=i-s[2]*e-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){let n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(t){let e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,a){return o[a.uuid]===void 0&&(o[a.uuid]=a.toJSON(t)),a.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let a=o.shapes;if(Array.isArray(a))for(let l=0,u=a.length;l<u;l++){let f=a[l];s(t.shapes,f)}else s(t.shapes,a)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let a=0,l=this.material.length;a<l;a++)o.push(s(t.materials,this.material[a]));i.material=o}else i.material=s(t.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let a=this.animations[o];i.animations.push(s(t.animations,a))}}if(e){let o=r(t.geometries),a=r(t.materials),l=r(t.textures),u=r(t.images),f=r(t.shapes),h=r(t.skeletons),d=r(t.animations),p=r(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),d.length>0&&(n.animations=d),p.length>0&&(n.nodes=p)}return n.object=i,n;function r(o){let a=[];for(let l in o){let u=o[l];delete u.metadata,a.push(u)}return a}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let i=t.children[n];this.add(i.clone())}return this}};Zt.DEFAULT_UP=new M(0,1,0);Zt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Xs={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},Ut={h:0,s:0,l:0},je={h:0,s:0,l:0};function ti(c,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?c+(t-c)*6*e:e<1/2?t:e<2/3?c+(t-c)*6*(2/3-e):c}var j=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=_t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,gt.colorSpaceToWorking(this,e),this}setRGB(t,e,n,i=gt.workingColorSpace){return this.r=t,this.g=e,this.b=n,gt.colorSpaceToWorking(this,i),this}setHSL(t,e,n,i=gt.workingColorSpace){if(t=Vr(t,1),e=U(e,0,1),n=U(n,0,1),e===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+e):n+e-n*e,r=2*n-s;this.r=ti(r,s,t+1/3),this.g=ti(r,s,t),this.b=ti(r,s,t-1/3)}return gt.colorSpaceToWorking(this,i),this}setStyle(t,e=_t){function n(s){s!==void 0&&parseFloat(s)<1&&Q("Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let s,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(s=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:Q("Color: Unknown color model "+t)}}else if(i=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let s=i[1],r=s.length;if(r===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(r===6)return this.setHex(parseInt(s,16),e);Q("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=_t){let n=Xs[t.toLowerCase()];return n!==void 0?this.setHex(n,e):Q("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=It(t.r),this.g=It(t.g),this.b=It(t.b),this}copyLinearToSRGB(t){return this.r=he(t.r),this.g=he(t.g),this.b=he(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=_t){return gt.workingToColorSpace(rt.copy(this),t),Math.round(U(rt.r*255,0,255))*65536+Math.round(U(rt.g*255,0,255))*256+Math.round(U(rt.b*255,0,255))}getHexString(t=_t){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=gt.workingColorSpace){gt.workingToColorSpace(rt.copy(this),e);let n=rt.r,i=rt.g,s=rt.b,r=Math.max(n,i,s),o=Math.min(n,i,s),a,l,u=(o+r)/2;if(o===r)a=0,l=0;else{let f=r-o;switch(l=u<=.5?f/(r+o):f/(2-r-o),r){case n:a=(i-s)/f+(i<s?6:0);break;case i:a=(s-n)/f+2;break;case s:a=(n-i)/f+4;break}a/=6}return t.h=a,t.s=l,t.l=u,t}getRGB(t,e=gt.workingColorSpace){return gt.workingToColorSpace(rt.copy(this),e),t.r=rt.r,t.g=rt.g,t.b=rt.b,t}getStyle(t=_t){gt.workingToColorSpace(rt.copy(this),t);let e=rt.r,n=rt.g,i=rt.b;return t!==_t?\`color(\${t} \${e.toFixed(3)} \${n.toFixed(3)} \${i.toFixed(3)})\`:\`rgb(\${Math.round(e*255)},\${Math.round(n*255)},\${Math.round(i*255)})\`}offsetHSL(t,e,n){return this.getHSL(Ut),this.setHSL(Ut.h+t,Ut.s+e,Ut.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Ut),t.getHSL(je);let n=Zn(Ut.h,je.h,e),i=Zn(Ut.s,je.s,e),s=Zn(Ut.l,je.l,e);return this.setHSL(n,i,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,i=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*i,this.g=s[1]*e+s[4]*n+s[7]*i,this.b=s[2]*e+s[5]*n+s[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},rt=new j;j.NAMES=Xs;var vt=new M,Ct=new M,ei=new M,Rt=new M,ie=new M,se=new M,Rs=new M,ni=new M,ii=new M,si=new M,ri=new de,oi=new de,ai=new de,St=class c{constructor(t=new M,e=new M,n=new M){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),vt.subVectors(t,e),i.cross(vt);let s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(t,e,n,i,s){vt.subVectors(i,e),Ct.subVectors(n,e),ei.subVectors(t,e);let r=vt.dot(vt),o=vt.dot(Ct),a=vt.dot(ei),l=Ct.dot(Ct),u=Ct.dot(ei),f=r*l-o*o;if(f===0)return s.set(0,0,0),null;let h=1/f,d=(l*a-o*u)*h,p=(r*u-o*a)*h;return s.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Rt)===null?!1:Rt.x>=0&&Rt.y>=0&&Rt.x+Rt.y<=1}static getInterpolation(t,e,n,i,s,r,o,a){return this.getBarycoord(t,e,n,i,Rt)===null?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(s,Rt.x),a.addScaledVector(r,Rt.y),a.addScaledVector(o,Rt.z),a)}static getInterpolatedAttribute(t,e,n,i,s,r){return ri.setScalar(0),oi.setScalar(0),ai.setScalar(0),ri.fromBufferAttribute(t,e),oi.fromBufferAttribute(t,n),ai.fromBufferAttribute(t,i),r.setScalar(0),r.addScaledVector(ri,s.x),r.addScaledVector(oi,s.y),r.addScaledVector(ai,s.z),r}static isFrontFacing(t,e,n,i){return vt.subVectors(n,e),Ct.subVectors(t,e),vt.cross(Ct).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return vt.subVectors(this.c,this.b),Ct.subVectors(this.a,this.b),vt.cross(Ct).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return c.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return c.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,s){return c.getInterpolation(t,this.a,this.b,this.c,e,n,i,s)}containsPoint(t){return c.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return c.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,i=this.b,s=this.c,r,o;ie.subVectors(i,n),se.subVectors(s,n),ni.subVectors(t,n);let a=ie.dot(ni),l=se.dot(ni);if(a<=0&&l<=0)return e.copy(n);ii.subVectors(t,i);let u=ie.dot(ii),f=se.dot(ii);if(u>=0&&f<=u)return e.copy(i);let h=a*f-u*l;if(h<=0&&a>=0&&u<=0)return r=a/(a-u),e.copy(n).addScaledVector(ie,r);si.subVectors(t,s);let d=ie.dot(si),p=se.dot(si);if(p>=0&&d<=p)return e.copy(s);let m=d*l-a*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(se,o);let _=u*p-d*f;if(_<=0&&f-u>=0&&d-p>=0)return Rs.subVectors(s,i),o=(f-u)/(f-u+(d-p)),e.copy(i).addScaledVector(Rs,o);let g=1/(_+m+h);return r=m*g,o=h*g,e.copy(n).addScaledVector(ie,r).addScaledVector(se,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},X=class{constructor(t=new M(1/0,1/0,1/0),e=new M(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Mt.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(Mt.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=Mt.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let r=0,o=s.count;r<o;r++)t.isMesh===!0?t.getVertexPosition(r,Mt):Mt.fromBufferAttribute(s,r),Mt.applyMatrix4(t.matrixWorld),this.expandByPoint(Mt);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),tn.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),tn.copy(n.boundingBox)),tn.applyMatrix4(t.matrixWorld),this.union(tn)}let i=t.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Mt),Mt.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ce),en.subVectors(this.max,Ce),re.subVectors(t.a,Ce),oe.subVectors(t.b,Ce),ae.subVectors(t.c,Ce),Ft.subVectors(oe,re),Bt.subVectors(ae,oe),Xt.subVectors(re,ae);let e=[0,-Ft.z,Ft.y,0,-Bt.z,Bt.y,0,-Xt.z,Xt.y,Ft.z,0,-Ft.x,Bt.z,0,-Bt.x,Xt.z,0,-Xt.x,-Ft.y,Ft.x,0,-Bt.y,Bt.x,0,-Xt.y,Xt.x,0];return!ci(e,re,oe,ae,en)||(e=[1,0,0,0,1,0,0,0,1],!ci(e,re,oe,ae,en))?!1:(nn.crossVectors(Ft,Bt),e=[nn.x,nn.y,nn.z],ci(e,re,oe,ae,en))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Mt).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Mt).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Pt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},Pt=[new M,new M,new M,new M,new M,new M,new M,new M],Mt=new M,tn=new X,re=new M,oe=new M,ae=new M,Ft=new M,Bt=new M,Xt=new M,Ce=new M,en=new M,nn=new M,qt=new M;function ci(c,t,e,n,i){for(let s=0,r=c.length-3;s<=r;s+=3){qt.fromArray(c,s);let o=i.x*Math.abs(qt.x)+i.y*Math.abs(qt.y)+i.z*Math.abs(qt.z),a=t.dot(qt),l=e.dot(qt),u=n.dot(qt);if(Math.max(-Math.max(a,l,u),Math.min(a,l,u))>o)return!1}return!0}var J=new M,sn=new H,$r=0,ot=class extends Yt{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:$r++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Ri,this.updateRanges=[],this.gpuType=Gs,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)sn.fromBufferAttribute(this,e),sn.applyMatrix3(t),this.setXY(e,sn.x,sn.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyMatrix3(t),this.setXYZ(e,J.x,J.y,J.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyMatrix4(t),this.setXYZ(e,J.x,J.y,J.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyNormalMatrix(t),this.setXYZ(e,J.x,J.y,J.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.transformDirection(t),this.setXYZ(e,J.x,J.y,J.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Ee(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ut(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ee(e,this.array)),e}setX(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ee(e,this.array)),e}setY(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ee(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ee(e,this.array)),e}setW(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,s){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array),i=ut(i,this.array),s=ut(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==Ri&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}};var pn=class extends ot{constructor(t,e,n){super(new Uint16Array(t),e,n)}};var mn=class extends ot{constructor(t,e,n){super(new Uint32Array(t),e,n)}};var gn=class extends ot{constructor(t,e,n){super(new Float32Array(t),e,n)}},Kr=new X,Re=new M,li=new M,pe=class{constructor(t=new M,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):Kr.setFromPoints(t).getCenter(n);let i=0;for(let s=0,r=t.length;s<r;s++)i=Math.max(i,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Re.subVectors(t,this.center);let e=Re.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(Re,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(li.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Re.copy(t.center).add(li)),this.expandByPoint(Re.copy(t.center).sub(li))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},Qr=0,mt=new W,ui=new Zt,ce=new M,dt=new X,Pe=new X,K=new M,Ue=class c extends Yt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Qr++}),this.uuid=Cn(),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={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Fr(t)?mn:pn)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new N().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return mt.makeRotationFromQuaternion(t),this.applyMatrix4(mt),this}rotateX(t){return mt.makeRotationX(t),this.applyMatrix4(mt),this}rotateY(t){return mt.makeRotationY(t),this.applyMatrix4(mt),this}rotateZ(t){return mt.makeRotationZ(t),this.applyMatrix4(mt),this}translate(t,e,n){return mt.makeTranslation(t,e,n),this.applyMatrix4(mt),this}scale(t,e,n){return mt.makeScale(t,e,n),this.applyMatrix4(mt),this}lookAt(t){return ui.lookAt(t),ui.updateMatrix(),this.applyMatrix4(ui.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ce).negate(),this.translate(ce.x,ce.y,ce.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let i=0,s=t.length;i<s;i++){let r=t[i];n.push(r.x,r.y,r.z||0)}this.setAttribute("position",new gn(n,3))}else{let n=Math.min(t.length,e.count);for(let i=0;i<n;i++){let s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&Q("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new X);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){G("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){let s=e[n];dt.setFromBufferAttribute(s),this.morphTargetsRelative?(K.addVectors(this.boundingBox.min,dt.min),this.boundingBox.expandByPoint(K),K.addVectors(this.boundingBox.max,dt.max),this.boundingBox.expandByPoint(K)):(this.boundingBox.expandByPoint(dt.min),this.boundingBox.expandByPoint(dt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&G('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new pe);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){G("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new M,1/0);return}if(t){let n=this.boundingSphere.center;if(dt.setFromBufferAttribute(t),e)for(let s=0,r=e.length;s<r;s++){let o=e[s];Pe.setFromBufferAttribute(o),this.morphTargetsRelative?(K.addVectors(dt.min,Pe.min),dt.expandByPoint(K),K.addVectors(dt.max,Pe.max),dt.expandByPoint(K)):(dt.expandByPoint(Pe.min),dt.expandByPoint(Pe.max))}dt.getCenter(n);let i=0;for(let s=0,r=t.count;s<r;s++)K.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(K));if(e)for(let s=0,r=e.length;s<r;s++){let o=e[s],a=this.morphTargetsRelative;for(let l=0,u=o.count;l<u;l++)K.fromBufferAttribute(o,l),a&&(ce.fromBufferAttribute(t,l),K.add(ce)),i=Math.max(i,n.distanceToSquared(K))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&G('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){G("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,i=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ot(new Float32Array(4*n.count),4));let r=this.getAttribute("tangent"),o=[],a=[];for(let A=0;A<n.count;A++)o[A]=new M,a[A]=new M;let l=new M,u=new M,f=new M,h=new H,d=new H,p=new H,m=new M,_=new M;function g(A,E,C){l.fromBufferAttribute(n,A),u.fromBufferAttribute(n,E),f.fromBufferAttribute(n,C),h.fromBufferAttribute(s,A),d.fromBufferAttribute(s,E),p.fromBufferAttribute(s,C),u.sub(l),f.sub(l),d.sub(h),p.sub(h);let R=1/(d.x*p.y-p.x*d.y);isFinite(R)&&(m.copy(u).multiplyScalar(p.y).addScaledVector(f,-d.y).multiplyScalar(R),_.copy(f).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(R),o[A].add(m),o[E].add(m),o[C].add(m),a[A].add(_),a[E].add(_),a[C].add(_))}let x=this.groups;x.length===0&&(x=[{start:0,count:t.count}]);for(let A=0,E=x.length;A<E;++A){let C=x[A],R=C.start,w=C.count;for(let P=R,L=R+w;P<L;P+=3)g(t.getX(P+0),t.getX(P+1),t.getX(P+2))}let y=new M,S=new M,v=new M,b=new M;function T(A){v.fromBufferAttribute(i,A),b.copy(v);let E=o[A];y.copy(E),y.sub(v.multiplyScalar(v.dot(E))).normalize(),S.crossVectors(b,E);let R=S.dot(a[A])<0?-1:1;r.setXYZW(A,y.x,y.y,y.z,R)}for(let A=0,E=x.length;A<E;++A){let C=x[A],R=C.start,w=C.count;for(let P=R,L=R+w;P<L;P+=3)T(t.getX(P+0)),T(t.getX(P+1)),T(t.getX(P+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ot(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let h=0,d=n.count;h<d;h++)n.setXYZ(h,0,0,0);let i=new M,s=new M,r=new M,o=new M,a=new M,l=new M,u=new M,f=new M;if(t)for(let h=0,d=t.count;h<d;h+=3){let p=t.getX(h+0),m=t.getX(h+1),_=t.getX(h+2);i.fromBufferAttribute(e,p),s.fromBufferAttribute(e,m),r.fromBufferAttribute(e,_),u.subVectors(r,s),f.subVectors(i,s),u.cross(f),o.fromBufferAttribute(n,p),a.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),o.add(u),a.add(u),l.add(u),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(_,l.x,l.y,l.z)}else for(let h=0,d=e.count;h<d;h+=3)i.fromBufferAttribute(e,h+0),s.fromBufferAttribute(e,h+1),r.fromBufferAttribute(e,h+2),u.subVectors(r,s),f.subVectors(i,s),u.cross(f),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)K.fromBufferAttribute(t,e),K.normalize(),t.setXYZ(e,K.x,K.y,K.z)}toNonIndexed(){function t(o,a){let l=o.array,u=o.itemSize,f=o.normalized,h=new l.constructor(a.length*u),d=0,p=0;for(let m=0,_=a.length;m<_;m++){o.isInterleavedBufferAttribute?d=a[m]*o.data.stride+o.offset:d=a[m]*u;for(let g=0;g<u;g++)h[p++]=l[d++]}return new ot(h,u,f)}if(this.index===null)return Q("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new c,n=this.index.array,i=this.attributes;for(let o in i){let a=i[o],l=t(a,n);e.setAttribute(o,l)}let s=this.morphAttributes;for(let o in s){let a=[],l=s[o];for(let u=0,f=l.length;u<f;u++){let h=l[u],d=t(h,n);a.push(d)}e.morphAttributes[o]=a}e.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let o=0,a=r.length;o<a;o++){let l=r[o];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let a=this.parameters;for(let l in a)a[l]!==void 0&&(t[l]=a[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let a in n){let l=n[a];t.data.attributes[a]=l.toJSON(t.data)}let i={},s=!1;for(let a in this.morphAttributes){let l=this.morphAttributes[a],u=[];for(let f=0,h=l.length;f<h;f++){let d=l[f];u.push(d.toJSON(t.data))}u.length>0&&(i[a]=u,s=!0)}s&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let i=t.attributes;for(let l in i){let u=i[l];this.setAttribute(l,u.clone(e))}let s=t.morphAttributes;for(let l in s){let u=[],f=s[l];for(let h=0,d=f.length;h<d;h++)u.push(f[h].clone(e));this.morphAttributes[l]=u}this.morphTargetsRelative=t.morphTargetsRelative;let r=t.groups;for(let l=0,u=r.length;l<u;l++){let f=r[l];this.addGroup(f.start,f.count,f.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let a=t.boundingSphere;return a!==null&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var hi=new M,jr=new M,to=new N,Jt=class{constructor(t=new M(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let i=hi.subVectors(n,e).cross(jr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,n=!0){let i=t.delta(hi),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return n===!0&&(r<0||r>1)?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||to.getNormalMatrix(t),i=this.coplanarPoint(hi).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}};function qs(c){let t={};for(let e in c){t[e]={};for(let n in c[e]){let i=c[e][n];if(Ps(i))i.isRenderTargetTexture?(Q("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=i.clone();else if(Array.isArray(i))if(Ps(i[0])){let s=[];for(let r=0,o=i.length;r<o;r++)s[r]=i[r].clone();t[e][n]=s}else t[e][n]=i.slice();else t[e][n]=i}}return t}function ct(c){let t={};for(let e=0;e<c.length;e++){let n=qs(c[e]);for(let i in n)t[i]=n[i]}return t}function Ps(c){return c&&(c.isColor||c.isMatrix3||c.isMatrix4||c.isVector2||c.isVector3||c.isVector4||c.isTexture||c.isQuaternion)}function rn(c,t){return!c||c.constructor===t?c:typeof t.BYTES_PER_ELEMENT=="number"?new t(c):Array.prototype.slice.call(c)}var Ot=class{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,i=e[n],s=e[n-1];n:{t:{let r;e:{i:if(!(t<i)){for(let o=n+2;;){if(i===void 0){if(t<s)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=e[++n],t<i)break t}r=e.length;break e}if(!(t>=s)){let o=e[1];t<o&&(n=2,s=o);for(let a=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=s,s=e[--n-1],t>=s)break t}r=n,n=0;break e}break n}for(;n<r;){let o=n+r>>>1;t<e[o]?r=o:n=o+1}if(i=e[n],s=e[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=t*i;for(let r=0;r!==i;++r)e[r]=n[s+r];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},_n=class extends Ot{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ti,endingEnd:Ti}}intervalChanged_(t,e,n){let i=this.parameterPositions,s=t-2,r=t+1,o=i[s],a=i[r];if(o===void 0)switch(this.getSettings_().endingStart){case Ai:s=t,o=2*e-n;break;case Ei:s=i.length-2,o=e+i[s]-i[s+1];break;default:s=t,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case Ai:r=t,a=2*n-e;break;case Ei:r=1,a=n+i[1]-i[0];break;default:r=t-1,a=e}let l=(n-e)*.5,u=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=s*u,this._offsetNext=r*u}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),m=p*p,_=m*p,g=-h*_+2*h*m-h*p,x=(1+h)*_+(-1.5-2*h)*m+(-.5+h)*p+1,y=(-1-d)*_+(1.5+d)*m+.5*p,S=d*_-d*m;for(let v=0;v!==o;++v)s[v]=g*r[u+v]+x*r[l+v]+y*r[a+v]+S*r[f+v];return s}},xn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=(n-e)/(i-e),f=1-u;for(let h=0;h!==o;++h)s[h]=r[l+h]*f+r[a+h]*u;return s}},yn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}},vn=class extends Ot{interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=this.settings||this.DefaultSettings_,f=u.inTangents,h=u.outTangents;if(!f||!h){let m=(n-e)/(i-e),_=1-m;for(let g=0;g!==o;++g)s[g]=r[l+g]*_+r[a+g]*m;return s}let d=o*2,p=t-1;for(let m=0;m!==o;++m){let _=r[l+m],g=r[a+m],x=p*d+m*2,y=h[x],S=h[x+1],v=t*d+m*2,b=f[v],T=f[v+1],A=(n-e)/(i-e),E,C,R,w,P;for(let L=0;L<8;L++){E=A*A,C=E*A,R=1-A,w=R*R,P=w*R;let O=P*e+3*w*A*y+3*R*E*b+C*i-n;if(Math.abs(O)<1e-10)break;let it=3*w*(y-e)+6*R*A*(b-y)+3*E*(i-b);if(Math.abs(it)<1e-10)break;A=A-O/it,A=Math.max(0,Math.min(1,A))}s[m]=P*_+3*w*A*S+3*R*E*T+C*g}return s}},pt=class{constructor(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=rn(e,this.TimeBufferType),this.values=rn(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:rn(t.times,Array),values:rn(t.values,Array)};let i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new yn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new xn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new _n(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){let e=new vn(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.settings=this.settings),e}setInterpolation(t){let e;switch(t){case De:e=this.InterpolantFactoryMethodDiscrete;break;case ln:e=this.InterpolantFactoryMethodLinear;break;case an:e=this.InterpolantFactoryMethodSmooth;break;case bi:e=this.InterpolantFactoryMethodBezier;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Q("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return De;case this.InterpolantFactoryMethodLinear:return ln;case this.InterpolantFactoryMethodSmooth:return an;case this.InterpolantFactoryMethodBezier:return bi}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){let n=this.times,i=n.length,s=0,r=i-1;for(;s!==i&&n[s]<t;)++s;for(;r!==-1&&n[r]>e;)--r;if(++r,s!==0||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);let o=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*o,r*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(G("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,i=this.values,s=n.length;s===0&&(G("KeyframeTrack: Track is empty.",this),t=!1);let r=null;for(let o=0;o!==s;o++){let a=n[o];if(typeof a=="number"&&isNaN(a)){G("KeyframeTrack: Time is not a valid number.",this,o,a),t=!1;break}if(r!==null&&r>a){G("KeyframeTrack: Out of order keys.",this,o,a,r),t=!1;break}r=a}if(i!==void 0&&Br(i))for(let o=0,a=i.length;o!==a;++o){let l=i[o];if(isNaN(l)){G("KeyframeTrack: Value is not a valid number.",this,o,l),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===an,s=t.length-1,r=1;for(let o=1;o<s;++o){let a=!1,l=t[o],u=t[o+1];if(l!==u&&(o!==1||l!==t[0]))if(i)a=!0;else{let f=o*n,h=f-n,d=f+n;for(let p=0;p!==n;++p){let m=e[f+p];if(m!==e[h+p]||m!==e[d+p]){a=!0;break}}}if(a){if(o!==r){t[r]=t[o];let f=o*n,h=r*n;for(let d=0;d!==n;++d)e[h+d]=e[f+d]}++r}}if(s>0){t[r]=t[s];for(let o=s*n,a=r*n,l=0;l!==n;++l)e[a+l]=e[o+l];++r}return r!==t.length?(this.times=t.slice(0,r),this.values=e.slice(0,r*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}};pt.prototype.ValueTypeName="";pt.prototype.TimeBufferType=Float32Array;pt.prototype.ValueBufferType=Float32Array;pt.prototype.DefaultInterpolation=ln;var zt=class extends pt{constructor(t,e,n){super(t,e,n)}};zt.prototype.ValueTypeName="bool";zt.prototype.ValueBufferType=Array;zt.prototype.DefaultInterpolation=De;zt.prototype.InterpolantFactoryMethodLinear=void 0;zt.prototype.InterpolantFactoryMethodSmooth=void 0;var Mn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Mn.prototype.ValueTypeName="color";var Sn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Sn.prototype.ValueTypeName="number";var bn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e),l=t*o;for(let u=l+o;l!==u;l+=4)Lt.slerpFlat(s,0,r,l-o,r,l,a);return s}},Fe=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new bn(this.times,this.values,this.getValueSize(),t)}};Fe.prototype.ValueTypeName="quaternion";Fe.prototype.InterpolantFactoryMethodSmooth=void 0;var Vt=class extends pt{constructor(t,e,n){super(t,e,n)}};Vt.prototype.ValueTypeName="string";Vt.prototype.ValueBufferType=Array;Vt.prototype.DefaultInterpolation=De;Vt.prototype.InterpolantFactoryMethodLinear=void 0;Vt.prototype.InterpolantFactoryMethodSmooth=void 0;var Tn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Tn.prototype.ValueTypeName="vector";var An=class{constructor(t,e,n){let i=this,s=!1,r=0,o=0,a,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(u){o++,s===!1&&i.onStart!==void 0&&i.onStart(u,r,o),s=!0},this.itemEnd=function(u){r++,i.onProgress!==void 0&&i.onProgress(u,r,o),r===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return a?a(u):u},this.setURLModifier=function(u){return a=u,this},this.addHandler=function(u,f){return l.push(u,f),this},this.removeHandler=function(u){let f=l.indexOf(u);return f!==-1&&l.splice(f,2),this},this.getHandler=function(u){for(let f=0,h=l.length;f<h;f+=2){let d=l[f],p=l[f+1];if(d.global&&(d.lastIndex=0),d.test(u))return p}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Ys=new An,En=class{constructor(t){this.manager=t!==void 0?t:Ys,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(t,e){let n=this;return new Promise(function(i,s){n.load(t,i,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}};En.DEFAULT_MATERIAL_NAME="__DEFAULT";var Yi="\\\\[\\\\]\\\\.:\\\\/",eo=new RegExp("["+Yi+"]","g"),Zi="[^"+Yi+"]",no="[^"+Yi.replace("\\\\.","")+"]",io=/((?:WC+[\\/:])*)/.source.replace("WC",Zi),so=/(WCOD+)?/.source.replace("WCOD",no),ro=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Zi),oo=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Zi),ao=new RegExp("^"+io+so+ro+oo+"$"),co=["material","materials","bones","map"],Di=class{constructor(t,e,n){let i=n||k.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},k=class c{constructor(t,e,n){this.path=e,this.parsedPath=n||c.parseTrackName(e),this.node=c.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new c.Composite(t,e,n):new c(t,e,n)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(eo,"")}static parseTrackName(t){let e=ao.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);co.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(s){for(let r=0;r<s.length;r++){let o=s[r];if(o.name===e||o.uuid===e)return o;let a=n(o.children);if(a)return a}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,s=e.propertyIndex;if(t||(t=c.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){Q("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=e.objectIndex;switch(n){case"materials":if(!t.material){G("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){G("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){G("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let u=0;u<t.length;u++)if(t[u].name===l){l=u;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){G("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){G("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){G("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(l!==void 0){if(t[l]===void 0){G("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[l]}}let r=t[i];if(r===void 0){let l=e.nodeName;G("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){G("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){G("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}a=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else r.fromArray!==void 0&&r.toArray!==void 0?(a=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(a=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};k.Composite=Di;k.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};k.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};k.prototype.GetterByBindingType=[k.prototype._getValue_direct,k.prototype._getValue_array,k.prototype._getValue_arrayElement,k.prototype._getValue_toArray];k.prototype.SetterByBindingTypeAndVersioning=[[k.prototype._setValue_direct,k.prototype._setValue_direct_setNeedsUpdate,k.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[k.prototype._setValue_array,k.prototype._setValue_array_setNeedsUpdate,k.prototype._setValue_array_setMatrixWorldNeedsUpdate],[k.prototype._setValue_arrayElement,k.prototype._setValue_arrayElement_setNeedsUpdate,k.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[k.prototype._setValue_fromArray,k.prototype._setValue_fromArray_setNeedsUpdate,k.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var vl=new Float32Array(1);var Ni=class c{static{c.prototype.isMatrix2=!0}constructor(t,e,n,i){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){let s=this.elements;return s[0]=t,s[2]=e,s[1]=n,s[3]=i,this}};var Is=new M,on=new M,le=new M,ue=new M,fi=new M,lo=new M,uo=new M,at=class{constructor(t=new M,e=new M){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Is.subVectors(t,this.start),on.subVectors(this.end,this.start);let n=on.dot(on);if(n===0)return 0;let s=on.dot(Is)/n;return e&&(s=U(s,0,1)),s}closestPointToPoint(t,e,n){let i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=lo,n=uo){let i=10000000000000001e-32,s,r,o=this.start,a=t.start,l=this.end,u=t.end;le.subVectors(l,o),ue.subVectors(u,a),fi.subVectors(o,a);let f=le.dot(le),h=ue.dot(ue),d=ue.dot(fi);if(f<=i&&h<=i)return e.copy(o),n.copy(a),e.sub(n),e.dot(e);if(f<=i)s=0,r=d/h,r=U(r,0,1);else{let p=le.dot(fi);if(h<=i)r=0,s=U(-p/f,0,1);else{let m=le.dot(ue),_=f*h-m*m;_!==0?s=U((m*d-p*h)/_,0,1):s=0,r=(m*s+d)/h,r<0?(r=0,s=U(-p/f,0,1)):r>1&&(r=1,s=U((m-p)/f,0,1))}}return e.copy(o).addScaledVector(le,s),n.copy(a).addScaledVector(ue,r),e.distanceToSquared(n)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?Q("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");var ho=\`#ifdef USE_ALPHAHASH
|
|
1
|
+
"use strict";"use client";var CT=Object.create;var oc=Object.defineProperty;var TT=Object.getOwnPropertyDescriptor;var PT=Object.getOwnPropertyNames;var AT=Object.getPrototypeOf,ET=Object.prototype.hasOwnProperty;var RT=(e,t,n)=>t in e?oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var kT=(e,t)=>()=>(e&&(t=e(e=0)),t);var lv=(e,t)=>{for(var n in t)oc(e,n,{get:t[n],enumerable:!0})},cv=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of PT(t))!ET.call(e,r)&&r!==n&&oc(e,r,{get:()=>t[r],enumerable:!(i=TT(t,r))||i.enumerable});return e};var Qd=(e,t,n)=>(n=e!=null?CT(AT(e)):{},cv(t||!e||!e.__esModule?oc(n,"default",{value:e,enumerable:!0}):n,e)),LT=e=>cv(oc({},"__esModule",{value:!0}),e);var fh=(e,t,n)=>RT(e,typeof t!="symbol"?t+"":t,n);var gv={};lv(gv,{bvhWorkerCode:()=>NT});var NT,bv=kT(()=>{"use strict";NT=`(()=>{var Ls=1;var Ds=3,wn=0,Ui=1,Fi=2;var di=0,pi=1,mi=2,gi=3,_i=4,xi=5,yi=6,vi=7,Ns=0,Us=1,Fs=2;var Bi=1,Oi=2,zi=3,Vi=4,ki=5,Gi=6,Hi=7;var Wi=300,Bs=301,Xi=302;var Os=306,Mi=1e3,Ie=1001,Si=1002;var zs=1006;var Vs=1008;var ks=1009;var Gs=1015;var Hs=1023;var De=2300,ln=2301,an=2302,bi=2303,Ti=2400,Ai=2401,Ei=2402;var qi="",_t="srgb",wi="srgb-linear",Ci="linear",cn="srgb";var Ri=35044;var Le=2e3,Pi=2001;function Fr(c){for(let t=c.length-1;t>=0;--t)if(c[t]>=65535)return!0;return!1}function Br(c){return ArrayBuffer.isView(c)&&!(c instanceof DataView)}function Ii(c){return document.createElementNS("http://www.w3.org/1999/xhtml",c)}var xs={},un=null;function Ws(c){let t=c[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=c[1];e&&e.isStackTrace?c[0]+=" "+e.getLocation():c[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return c}function Q(...c){c=Ws(c);let t="THREE."+c.shift();if(un)un("warn",t,...c);else{let e=c[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...c)}}function G(...c){c=Ws(c);let t="THREE."+c.shift();if(un)un("error",t,...c);else{let e=c[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...c)}}function Li(...c){let t=c.join(" ");t in xs||(xs[t]=!0,Q(...c))}var Or={[di]:pi,[mi]:yi,[_i]:vi,[gi]:xi,[pi]:di,[yi]:mi,[vi]:_i,[xi]:gi},Yt=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let i=n[t];if(i!==void 0){let s=i.indexOf(e);s!==-1&&i.splice(s,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,t);t.target=null}}},st=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var yl=Math.PI/180,zr=180/Math.PI;function Cn(){let c=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(st[c&255]+st[c>>8&255]+st[c>>16&255]+st[c>>24&255]+"-"+st[t&255]+st[t>>8&255]+"-"+st[t>>16&15|64]+st[t>>24&255]+"-"+st[e&63|128]+st[e>>8&255]+"-"+st[e>>16&255]+st[e>>24&255]+st[n&255]+st[n>>8&255]+st[n>>16&255]+st[n>>24&255]).toLowerCase()}function U(c,t,e){return Math.max(t,Math.min(e,c))}function Vr(c,t){return(c%t+t)%t}function Zn(c,t,e){return(1-e)*c+e*t}function Ee(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return c/4294967295;case Uint16Array:return c/65535;case Uint8Array:return c/255;case Int32Array:return Math.max(c/2147483647,-1);case Int16Array:return Math.max(c/32767,-1);case Int8Array:return Math.max(c/127,-1);default:throw new Error("Invalid component type.")}}function ut(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return Math.round(c*4294967295);case Uint16Array:return Math.round(c*65535);case Uint8Array:return Math.round(c*255);case Int32Array:return Math.round(c*2147483647);case Int16Array:return Math.round(c*32767);case Int8Array:return Math.round(c*127);default:throw new Error("Invalid component type.")}}var H=class c{static{c.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(U(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),i=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*n-r*i+t.x,this.y=s*i+r*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Lt=class{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,s,r,o){let a=n[i+0],l=n[i+1],u=n[i+2],f=n[i+3],h=s[r+0],d=s[r+1],p=s[r+2],m=s[r+3];if(f!==m||a!==h||l!==d||u!==p){let _=a*h+l*d+u*p+f*m;_<0&&(h=-h,d=-d,p=-p,m=-m,_=-_);let g=1-o;if(_<.9995){let x=Math.acos(_),y=Math.sin(x);g=Math.sin(g*x)/y,o=Math.sin(o*x)/y,a=a*g+h*o,l=l*g+d*o,u=u*g+p*o,f=f*g+m*o}else{a=a*g+h*o,l=l*g+d*o,u=u*g+p*o,f=f*g+m*o;let x=1/Math.sqrt(a*a+l*l+u*u+f*f);a*=x,l*=x,u*=x,f*=x}}t[e]=a,t[e+1]=l,t[e+2]=u,t[e+3]=f}static multiplyQuaternionsFlat(t,e,n,i,s,r){let o=n[i],a=n[i+1],l=n[i+2],u=n[i+3],f=s[r],h=s[r+1],d=s[r+2],p=s[r+3];return t[e]=o*p+u*f+a*d-l*h,t[e+1]=a*p+u*h+l*f-o*d,t[e+2]=l*p+u*d+o*h-a*f,t[e+3]=u*p-o*f-a*h-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,i=t._y,s=t._z,r=t._order,o=Math.cos,a=Math.sin,l=o(n/2),u=o(i/2),f=o(s/2),h=a(n/2),d=a(i/2),p=a(s/2);switch(r){case"XYZ":this._x=h*u*f+l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f-h*d*p;break;case"YXZ":this._x=h*u*f+l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f+h*d*p;break;case"ZXY":this._x=h*u*f-l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f-h*d*p;break;case"ZYX":this._x=h*u*f-l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f+h*d*p;break;case"YZX":this._x=h*u*f+l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f-h*d*p;break;case"XZY":this._x=h*u*f-l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f+h*d*p;break;default:Q("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],i=e[4],s=e[8],r=e[1],o=e[5],a=e[9],l=e[2],u=e[6],f=e[10],h=n+o+f;if(h>0){let d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-a)*d,this._y=(s-l)*d,this._z=(r-i)*d}else if(n>o&&n>f){let d=2*Math.sqrt(1+n-o-f);this._w=(u-a)/d,this._x=.25*d,this._y=(i+r)/d,this._z=(s+l)/d}else if(o>f){let d=2*Math.sqrt(1+o-n-f);this._w=(s-l)/d,this._x=(i+r)/d,this._y=.25*d,this._z=(a+u)/d}else{let d=2*Math.sqrt(1+f-n-o);this._w=(r-i)/d,this._x=(s+l)/d,this._y=(a+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(U(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,i=t._y,s=t._z,r=t._w,o=e._x,a=e._y,l=e._z,u=e._w;return this._x=n*u+r*o+i*l-s*a,this._y=i*u+r*a+s*o-n*l,this._z=s*u+r*l+n*a-i*o,this._w=r*u-n*o-i*a-s*l,this._onChangeCallback(),this}slerp(t,e){let n=t._x,i=t._y,s=t._z,r=t._w,o=this.dot(t);o<0&&(n=-n,i=-i,s=-s,r=-r,o=-o);let a=1-e;if(o<.9995){let l=Math.acos(o),u=Math.sin(l);a=Math.sin(a*l)/u,e=Math.sin(e*l)/u,this._x=this._x*a+n*e,this._y=this._y*a+i*e,this._z=this._z*a+s*e,this._w=this._w*a+r*e,this._onChangeCallback()}else this._x=this._x*a+n*e,this._y=this._y*a+i*e,this._z=this._z*a+s*e,this._w=this._w*a+r*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},M=class c{static{c.prototype.isVector3=!0}constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ys.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ys.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*i,this.y=s[1]*e+s[4]*n+s[7]*i,this.z=s[2]*e+s[5]*n+s[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,s=t.elements,r=1/(s[3]*e+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*e+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*e+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(t){let e=this.x,n=this.y,i=this.z,s=t.x,r=t.y,o=t.z,a=t.w,l=2*(r*i-o*n),u=2*(o*e-s*i),f=2*(s*n-r*e);return this.x=e+a*l+r*f-o*u,this.y=n+a*u+o*l-s*f,this.z=i+a*f+s*u-r*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i,this.y=s[1]*e+s[5]*n+s[9]*i,this.z=s[2]*e+s[6]*n+s[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this.z=U(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this.z=U(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,i=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=i*a-s*o,this.y=s*r-n*a,this.z=n*o-i*r,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Jn.copy(this).projectOnVector(t),this.sub(Jn)}reflect(t){return this.sub(Jn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(U(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Jn=new M,ys=new Lt,N=class c{static{c.prototype.isMatrix3=!0}constructor(t,e,n,i,s,r,o,a,l){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,r,o,a,l)}set(t,e,n,i,s,r,o,a,l){let u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=e,u[4]=s,u[5]=a,u[6]=n,u[7]=r,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,s=this.elements,r=n[0],o=n[3],a=n[6],l=n[1],u=n[4],f=n[7],h=n[2],d=n[5],p=n[8],m=i[0],_=i[3],g=i[6],x=i[1],y=i[4],S=i[7],v=i[2],b=i[5],T=i[8];return s[0]=r*m+o*x+a*v,s[3]=r*_+o*y+a*b,s[6]=r*g+o*S+a*T,s[1]=l*m+u*x+f*v,s[4]=l*_+u*y+f*b,s[7]=l*g+u*S+f*T,s[2]=h*m+d*x+p*v,s[5]=h*_+d*y+p*b,s[8]=h*g+d*S+p*T,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8];return e*r*u-e*o*l-n*s*u+n*o*a+i*s*l-i*r*a}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8],f=u*r-o*l,h=o*a-u*s,d=l*s-r*a,p=e*f+n*h+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return t[0]=f*m,t[1]=(i*l-u*n)*m,t[2]=(o*n-i*r)*m,t[3]=h*m,t[4]=(u*e-i*a)*m,t[5]=(i*s-o*e)*m,t[6]=d*m,t[7]=(n*a-l*e)*m,t[8]=(r*e-n*s)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,s,r,o){let a=Math.cos(s),l=Math.sin(s);return this.set(n*a,n*l,-n*(a*r+l*o)+r+t,-i*l,i*a,-i*(-l*r+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply($n.makeScale(t,e)),this}rotate(t){return this.premultiply($n.makeRotation(-t)),this}translate(t,e){return this.premultiply($n.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},$n=new N,vs=new N().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ms=new N().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function kr(){let c={enabled:!0,workingColorSpace:wi,spaces:{},convert:function(i,s,r){return this.enabled===!1||s===r||!s||!r||(this.spaces[s].transfer===cn&&(i.r=It(i.r),i.g=It(i.g),i.b=It(i.b)),this.spaces[s].primaries!==this.spaces[r].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===cn&&(i.r=he(i.r),i.g=he(i.g),i.b=he(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===qi?Ci:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,r){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Li("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),c.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Li("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),c.colorSpaceToWorking(i,s)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return c.define({[wi]:{primaries:t,whitePoint:n,transfer:Ci,toXYZ:vs,fromXYZ:Ms,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:_t},outputColorSpaceConfig:{drawingBufferColorSpace:_t}},[_t]:{primaries:t,whitePoint:n,transfer:cn,toXYZ:vs,fromXYZ:Ms,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:_t}}}),c}var gt=kr();function It(c){return c<.04045?c*.0773993808:Math.pow(c*.9478672986+.0521327014,2.4)}function he(c){return c<.0031308?c*12.92:1.055*Math.pow(c,.41666)-.055}var jt,hn=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{jt===void 0&&(jt=Ii("canvas")),jt.width=t.width,jt.height=t.height;let i=jt.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),n=jt}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Ii("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let i=n.getImageData(0,0,t.width,t.height),s=i.data;for(let r=0;r<s.length;r++)s[r]=It(s[r]/255)*255;return n.putImageData(i,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(It(e[n]/255)*255):e[n]=It(e[n]);return{data:e,width:t.width,height:t.height}}else return Q("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Gr=0,fn=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Gr++}),this.uuid=Cn(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let r=0,o=i.length;r<o;r++)i[r].isDataTexture?s.push(Kn(i[r].image)):s.push(Kn(i[r]))}else s=Kn(i);n.url=s}return e||(t.images[this.uuid]=n),n}};function Kn(c){return typeof HTMLImageElement<"u"&&c instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&c instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&c instanceof ImageBitmap?hn.getDataURL(c):c.data?{data:Array.from(c.data),width:c.width,height:c.height,type:c.data.constructor.name}:(Q("Texture: Unable to serialize Texture."),{})}var Hr=0,Qn=new M,fe=class c extends Yt{constructor(t=c.DEFAULT_IMAGE,e=c.DEFAULT_MAPPING,n=Ie,i=Ie,s=zs,r=Vs,o=Hs,a=ks,l=c.DEFAULT_ANISOTROPY,u=qi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hr++}),this.uuid=Cn(),this.name="",this.source=new fn(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new H(0,0),this.repeat=new H(1,1),this.center=new H(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new N,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Qn).x}get height(){return this.source.getSize(Qn).y}get depth(){return this.source.getSize(Qn).z}get image(){return this.source.data}set image(t){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){Q(\`Texture.setValues(): parameter '\${e}' has value of undefined.\`);continue}let i=this[e];if(i===void 0){Q(\`Texture.setValues(): property '\${e}' does not exist.\`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Wi)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Mi:t.x=t.x-Math.floor(t.x);break;case Ie:t.x=t.x<0?0:1;break;case Si:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Mi:t.y=t.y-Math.floor(t.y);break;case Ie:t.y=t.y<0?0:1;break;case Si:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};fe.DEFAULT_IMAGE=null;fe.DEFAULT_MAPPING=Wi;fe.DEFAULT_ANISOTROPY=1;var de=class c{static{c.prototype.isVector4=!0}constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,s=this.w,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12]*s,this.y=r[1]*e+r[5]*n+r[9]*i+r[13]*s,this.z=r[2]*e+r[6]*n+r[10]*i+r[14]*s,this.w=r[3]*e+r[7]*n+r[11]*i+r[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,s,a=t.elements,l=a[0],u=a[4],f=a[8],h=a[1],d=a[5],p=a[9],m=a[2],_=a[6],g=a[10];if(Math.abs(u-h)<.01&&Math.abs(f-m)<.01&&Math.abs(p-_)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+m)<.1&&Math.abs(p+_)<.1&&Math.abs(l+d+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let y=(l+1)/2,S=(d+1)/2,v=(g+1)/2,b=(u+h)/4,T=(f+m)/4,A=(p+_)/4;return y>S&&y>v?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=b/n,s=T/n):S>v?S<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(S),n=b/i,s=A/i):v<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(v),n=T/s,i=A/s),this.set(n,i,s,e),this}let x=Math.sqrt((_-p)*(_-p)+(f-m)*(f-m)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(_-p)/x,this.y=(f-m)/x,this.z=(h-u)/x,this.w=Math.acos((l+d+g-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this.z=U(this.z,t.z,e.z),this.w=U(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this.z=U(this.z,t,e),this.w=U(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}};var W=class c{static{c.prototype.isMatrix4=!0}constructor(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_)}set(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_){let g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=o,g[13]=a,g[2]=l,g[6]=u,g[10]=f,g[14]=h,g[3]=d,g[7]=p,g[11]=m,g[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new c().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return this.determinant()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(t.determinant()===0)return this.identity();let e=this.elements,n=t.elements,i=1/te.setFromMatrixColumn(t,0).length(),s=1/te.setFromMatrixColumn(t,1).length(),r=1/te.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*r,e[9]=n[9]*r,e[10]=n[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,i=t.y,s=t.z,r=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),u=Math.cos(s),f=Math.sin(s);if(t.order==="XYZ"){let h=r*u,d=r*f,p=o*u,m=o*f;e[0]=a*u,e[4]=-a*f,e[8]=l,e[1]=d+p*l,e[5]=h-m*l,e[9]=-o*a,e[2]=m-h*l,e[6]=p+d*l,e[10]=r*a}else if(t.order==="YXZ"){let h=a*u,d=a*f,p=l*u,m=l*f;e[0]=h+m*o,e[4]=p*o-d,e[8]=r*l,e[1]=r*f,e[5]=r*u,e[9]=-o,e[2]=d*o-p,e[6]=m+h*o,e[10]=r*a}else if(t.order==="ZXY"){let h=a*u,d=a*f,p=l*u,m=l*f;e[0]=h-m*o,e[4]=-r*f,e[8]=p+d*o,e[1]=d+p*o,e[5]=r*u,e[9]=m-h*o,e[2]=-r*l,e[6]=o,e[10]=r*a}else if(t.order==="ZYX"){let h=r*u,d=r*f,p=o*u,m=o*f;e[0]=a*u,e[4]=p*l-d,e[8]=h*l+m,e[1]=a*f,e[5]=m*l+h,e[9]=d*l-p,e[2]=-l,e[6]=o*a,e[10]=r*a}else if(t.order==="YZX"){let h=r*a,d=r*l,p=o*a,m=o*l;e[0]=a*u,e[4]=m-h*f,e[8]=p*f+d,e[1]=f,e[5]=r*u,e[9]=-o*u,e[2]=-l*u,e[6]=d*f+p,e[10]=h-m*f}else if(t.order==="XZY"){let h=r*a,d=r*l,p=o*a,m=o*l;e[0]=a*u,e[4]=-f,e[8]=l*u,e[1]=h*f+m,e[5]=r*u,e[9]=d*f-p,e[2]=p*f-d,e[6]=o*u,e[10]=m*f+h}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Wr,t,Xr)}lookAt(t,e,n){let i=this.elements;return ft.subVectors(t,e),ft.lengthSq()===0&&(ft.z=1),ft.normalize(),Nt.crossVectors(n,ft),Nt.lengthSq()===0&&(Math.abs(n.z)===1?ft.x+=1e-4:ft.z+=1e-4,ft.normalize(),Nt.crossVectors(n,ft)),Nt.normalize(),Ke.crossVectors(ft,Nt),i[0]=Nt.x,i[4]=Ke.x,i[8]=ft.x,i[1]=Nt.y,i[5]=Ke.y,i[9]=ft.y,i[2]=Nt.z,i[6]=Ke.z,i[10]=ft.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,s=this.elements,r=n[0],o=n[4],a=n[8],l=n[12],u=n[1],f=n[5],h=n[9],d=n[13],p=n[2],m=n[6],_=n[10],g=n[14],x=n[3],y=n[7],S=n[11],v=n[15],b=i[0],T=i[4],A=i[8],E=i[12],C=i[1],R=i[5],w=i[9],P=i[13],L=i[2],D=i[6],O=i[10],it=i[14],Tt=i[3],At=i[7],Je=i[11],$e=i[15];return s[0]=r*b+o*C+a*L+l*Tt,s[4]=r*T+o*R+a*D+l*At,s[8]=r*A+o*w+a*O+l*Je,s[12]=r*E+o*P+a*it+l*$e,s[1]=u*b+f*C+h*L+d*Tt,s[5]=u*T+f*R+h*D+d*At,s[9]=u*A+f*w+h*O+d*Je,s[13]=u*E+f*P+h*it+d*$e,s[2]=p*b+m*C+_*L+g*Tt,s[6]=p*T+m*R+_*D+g*At,s[10]=p*A+m*w+_*O+g*Je,s[14]=p*E+m*P+_*it+g*$e,s[3]=x*b+y*C+S*L+v*Tt,s[7]=x*T+y*R+S*D+v*At,s[11]=x*A+y*w+S*O+v*Je,s[15]=x*E+y*P+S*it+v*$e,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],i=t[8],s=t[12],r=t[1],o=t[5],a=t[9],l=t[13],u=t[2],f=t[6],h=t[10],d=t[14],p=t[3],m=t[7],_=t[11],g=t[15],x=a*d-l*h,y=o*d-l*f,S=o*h-a*f,v=r*d-l*u,b=r*h-a*u,T=r*f-o*u;return e*(m*x-_*y+g*S)-n*(p*x-_*v+g*b)+i*(p*y-m*v+g*T)-s*(p*S-m*b+_*T)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8],f=t[9],h=t[10],d=t[11],p=t[12],m=t[13],_=t[14],g=t[15],x=e*o-n*r,y=e*a-i*r,S=e*l-s*r,v=n*a-i*o,b=n*l-s*o,T=i*l-s*a,A=u*m-f*p,E=u*_-h*p,C=u*g-d*p,R=f*_-h*m,w=f*g-d*m,P=h*g-d*_,L=x*P-y*w+S*R+v*C-b*E+T*A;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/L;return t[0]=(o*P-a*w+l*R)*D,t[1]=(i*w-n*P-s*R)*D,t[2]=(m*T-_*b+g*v)*D,t[3]=(h*b-f*T-d*v)*D,t[4]=(a*C-r*P-l*E)*D,t[5]=(e*P-i*C+s*E)*D,t[6]=(_*S-p*T-g*y)*D,t[7]=(u*T-h*S+d*y)*D,t[8]=(r*w-o*C+l*A)*D,t[9]=(n*C-e*w-s*A)*D,t[10]=(p*b-m*S+g*x)*D,t[11]=(f*S-u*b-d*x)*D,t[12]=(o*E-r*R-a*A)*D,t[13]=(e*R-n*E+i*A)*D,t[14]=(m*y-p*v-_*x)*D,t[15]=(u*v-f*y+h*x)*D,this}scale(t){let e=this.elements,n=t.x,i=t.y,s=t.z;return e[0]*=n,e[4]*=i,e[8]*=s,e[1]*=n,e[5]*=i,e[9]*=s,e[2]*=n,e[6]*=i,e[10]*=s,e[3]*=n,e[7]*=i,e[11]*=s,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),i=Math.sin(e),s=1-n,r=t.x,o=t.y,a=t.z,l=s*r,u=s*o;return this.set(l*r+n,l*o-i*a,l*a+i*o,0,l*o+i*a,u*o+n,u*a-i*r,0,l*a-i*o,u*a+i*r,s*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,s,r){return this.set(1,n,s,0,t,1,r,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){let i=this.elements,s=e._x,r=e._y,o=e._z,a=e._w,l=s+s,u=r+r,f=o+o,h=s*l,d=s*u,p=s*f,m=r*u,_=r*f,g=o*f,x=a*l,y=a*u,S=a*f,v=n.x,b=n.y,T=n.z;return i[0]=(1-(m+g))*v,i[1]=(d+S)*v,i[2]=(p-y)*v,i[3]=0,i[4]=(d-S)*b,i[5]=(1-(h+g))*b,i[6]=(_+x)*b,i[7]=0,i[8]=(p+y)*T,i[9]=(_-x)*T,i[10]=(1-(h+m))*T,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){let i=this.elements;t.x=i[12],t.y=i[13],t.z=i[14];let s=this.determinant();if(s===0)return n.set(1,1,1),e.identity(),this;let r=te.set(i[0],i[1],i[2]).length(),o=te.set(i[4],i[5],i[6]).length(),a=te.set(i[8],i[9],i[10]).length();s<0&&(r=-r),yt.copy(this);let l=1/r,u=1/o,f=1/a;return yt.elements[0]*=l,yt.elements[1]*=l,yt.elements[2]*=l,yt.elements[4]*=u,yt.elements[5]*=u,yt.elements[6]*=u,yt.elements[8]*=f,yt.elements[9]*=f,yt.elements[10]*=f,e.setFromRotationMatrix(yt),n.x=r,n.y=o,n.z=a,this}makePerspective(t,e,n,i,s,r,o=Le,a=!1){let l=this.elements,u=2*s/(e-t),f=2*s/(n-i),h=(e+t)/(e-t),d=(n+i)/(n-i),p,m;if(a)p=s/(r-s),m=r*s/(r-s);else if(o===Le)p=-(r+s)/(r-s),m=-2*r*s/(r-s);else if(o===Pi)p=-r/(r-s),m=-r*s/(r-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=f,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,i,s,r,o=Le,a=!1){let l=this.elements,u=2/(e-t),f=2/(n-i),h=-(e+t)/(e-t),d=-(n+i)/(n-i),p,m;if(a)p=1/(r-s),m=r/(r-s);else if(o===Le)p=-2/(r-s),m=-(r+s)/(r-s);else if(o===Pi)p=-1/(r-s),m=-s/(r-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=f,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},te=new M,yt=new W,Wr=new M(0,0,0),Xr=new M(1,1,1),Nt=new M,Ke=new M,ft=new M,Ss=new W,bs=new Lt,Ne=class c{constructor(t=0,e=0,n=0,i=c.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let i=t.elements,s=i[0],r=i[4],o=i[8],a=i[1],l=i[5],u=i[9],f=i[2],h=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(U(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-U(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(U(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(a,s));break;case"ZYX":this._y=Math.asin(-U(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(a,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(U(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-U(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:Q("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Ss.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ss,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return bs.setFromEuler(this),this.setFromQuaternion(bs,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ne.DEFAULT_ORDER="XYZ";var dn=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},qr=0,Ts=new M,ee=new Lt,wt=new W,Qe=new M,we=new M,Yr=new M,Zr=new Lt,As=new M(1,0,0),Es=new M(0,1,0),ws=new M(0,0,1),Cs={type:"added"},Jr={type:"removed"},ne={type:"childadded",child:null},jn={type:"childremoved",child:null},Zt=class c extends Yt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:qr++}),this.uuid=Cn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=c.DEFAULT_UP.clone();let t=new M,e=new Ne,n=new Lt,i=new M(1,1,1);function s(){n.setFromEuler(e,!1)}function r(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new W},normalMatrix:{value:new N}}),this.matrix=new W,this.matrixWorld=new W,this.matrixAutoUpdate=c.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=c.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new dn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return ee.setFromAxisAngle(t,e),this.quaternion.multiply(ee),this}rotateOnWorldAxis(t,e){return ee.setFromAxisAngle(t,e),this.quaternion.premultiply(ee),this}rotateX(t){return this.rotateOnAxis(As,t)}rotateY(t){return this.rotateOnAxis(Es,t)}rotateZ(t){return this.rotateOnAxis(ws,t)}translateOnAxis(t,e){return Ts.copy(t).applyQuaternion(this.quaternion),this.position.add(Ts.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(As,t)}translateY(t){return this.translateOnAxis(Es,t)}translateZ(t){return this.translateOnAxis(ws,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(wt.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Qe.copy(t):Qe.set(t,e,n);let i=this.parent;this.updateWorldMatrix(!0,!1),we.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?wt.lookAt(we,Qe,this.up):wt.lookAt(Qe,we,this.up),this.quaternion.setFromRotationMatrix(wt),i&&(wt.extractRotation(i.matrixWorld),ee.setFromRotationMatrix(wt),this.quaternion.premultiply(ee.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(G("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Cs),ne.child=t,this.dispatchEvent(ne),ne.child=null):G("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Jr),jn.child=t,this.dispatchEvent(jn),jn.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),wt.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),wt.multiply(t.parent.matrixWorld)),t.applyMatrix4(wt),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Cs),ne.child=t,this.dispatchEvent(ne),ne.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){let r=this.children[n].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,t,Yr),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,Zr,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,n=t.y,i=t.z,s=this.matrix.elements;s[12]+=e-s[0]*e-s[4]*n-s[8]*i,s[13]+=n-s[1]*e-s[5]*n-s[9]*i,s[14]+=i-s[2]*e-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){let n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(t){let e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,a){return o[a.uuid]===void 0&&(o[a.uuid]=a.toJSON(t)),a.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let a=o.shapes;if(Array.isArray(a))for(let l=0,u=a.length;l<u;l++){let f=a[l];s(t.shapes,f)}else s(t.shapes,a)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let a=0,l=this.material.length;a<l;a++)o.push(s(t.materials,this.material[a]));i.material=o}else i.material=s(t.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let a=this.animations[o];i.animations.push(s(t.animations,a))}}if(e){let o=r(t.geometries),a=r(t.materials),l=r(t.textures),u=r(t.images),f=r(t.shapes),h=r(t.skeletons),d=r(t.animations),p=r(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),d.length>0&&(n.animations=d),p.length>0&&(n.nodes=p)}return n.object=i,n;function r(o){let a=[];for(let l in o){let u=o[l];delete u.metadata,a.push(u)}return a}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let i=t.children[n];this.add(i.clone())}return this}};Zt.DEFAULT_UP=new M(0,1,0);Zt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Xs={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},Ut={h:0,s:0,l:0},je={h:0,s:0,l:0};function ti(c,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?c+(t-c)*6*e:e<1/2?t:e<2/3?c+(t-c)*6*(2/3-e):c}var j=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=_t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,gt.colorSpaceToWorking(this,e),this}setRGB(t,e,n,i=gt.workingColorSpace){return this.r=t,this.g=e,this.b=n,gt.colorSpaceToWorking(this,i),this}setHSL(t,e,n,i=gt.workingColorSpace){if(t=Vr(t,1),e=U(e,0,1),n=U(n,0,1),e===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+e):n+e-n*e,r=2*n-s;this.r=ti(r,s,t+1/3),this.g=ti(r,s,t),this.b=ti(r,s,t-1/3)}return gt.colorSpaceToWorking(this,i),this}setStyle(t,e=_t){function n(s){s!==void 0&&parseFloat(s)<1&&Q("Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let s,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(s=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:Q("Color: Unknown color model "+t)}}else if(i=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let s=i[1],r=s.length;if(r===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(r===6)return this.setHex(parseInt(s,16),e);Q("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=_t){let n=Xs[t.toLowerCase()];return n!==void 0?this.setHex(n,e):Q("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=It(t.r),this.g=It(t.g),this.b=It(t.b),this}copyLinearToSRGB(t){return this.r=he(t.r),this.g=he(t.g),this.b=he(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=_t){return gt.workingToColorSpace(rt.copy(this),t),Math.round(U(rt.r*255,0,255))*65536+Math.round(U(rt.g*255,0,255))*256+Math.round(U(rt.b*255,0,255))}getHexString(t=_t){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=gt.workingColorSpace){gt.workingToColorSpace(rt.copy(this),e);let n=rt.r,i=rt.g,s=rt.b,r=Math.max(n,i,s),o=Math.min(n,i,s),a,l,u=(o+r)/2;if(o===r)a=0,l=0;else{let f=r-o;switch(l=u<=.5?f/(r+o):f/(2-r-o),r){case n:a=(i-s)/f+(i<s?6:0);break;case i:a=(s-n)/f+2;break;case s:a=(n-i)/f+4;break}a/=6}return t.h=a,t.s=l,t.l=u,t}getRGB(t,e=gt.workingColorSpace){return gt.workingToColorSpace(rt.copy(this),e),t.r=rt.r,t.g=rt.g,t.b=rt.b,t}getStyle(t=_t){gt.workingToColorSpace(rt.copy(this),t);let e=rt.r,n=rt.g,i=rt.b;return t!==_t?\`color(\${t} \${e.toFixed(3)} \${n.toFixed(3)} \${i.toFixed(3)})\`:\`rgb(\${Math.round(e*255)},\${Math.round(n*255)},\${Math.round(i*255)})\`}offsetHSL(t,e,n){return this.getHSL(Ut),this.setHSL(Ut.h+t,Ut.s+e,Ut.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Ut),t.getHSL(je);let n=Zn(Ut.h,je.h,e),i=Zn(Ut.s,je.s,e),s=Zn(Ut.l,je.l,e);return this.setHSL(n,i,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,i=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*i,this.g=s[1]*e+s[4]*n+s[7]*i,this.b=s[2]*e+s[5]*n+s[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},rt=new j;j.NAMES=Xs;var vt=new M,Ct=new M,ei=new M,Rt=new M,ie=new M,se=new M,Rs=new M,ni=new M,ii=new M,si=new M,ri=new de,oi=new de,ai=new de,St=class c{constructor(t=new M,e=new M,n=new M){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),vt.subVectors(t,e),i.cross(vt);let s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(t,e,n,i,s){vt.subVectors(i,e),Ct.subVectors(n,e),ei.subVectors(t,e);let r=vt.dot(vt),o=vt.dot(Ct),a=vt.dot(ei),l=Ct.dot(Ct),u=Ct.dot(ei),f=r*l-o*o;if(f===0)return s.set(0,0,0),null;let h=1/f,d=(l*a-o*u)*h,p=(r*u-o*a)*h;return s.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Rt)===null?!1:Rt.x>=0&&Rt.y>=0&&Rt.x+Rt.y<=1}static getInterpolation(t,e,n,i,s,r,o,a){return this.getBarycoord(t,e,n,i,Rt)===null?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(s,Rt.x),a.addScaledVector(r,Rt.y),a.addScaledVector(o,Rt.z),a)}static getInterpolatedAttribute(t,e,n,i,s,r){return ri.setScalar(0),oi.setScalar(0),ai.setScalar(0),ri.fromBufferAttribute(t,e),oi.fromBufferAttribute(t,n),ai.fromBufferAttribute(t,i),r.setScalar(0),r.addScaledVector(ri,s.x),r.addScaledVector(oi,s.y),r.addScaledVector(ai,s.z),r}static isFrontFacing(t,e,n,i){return vt.subVectors(n,e),Ct.subVectors(t,e),vt.cross(Ct).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return vt.subVectors(this.c,this.b),Ct.subVectors(this.a,this.b),vt.cross(Ct).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return c.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return c.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,s){return c.getInterpolation(t,this.a,this.b,this.c,e,n,i,s)}containsPoint(t){return c.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return c.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,i=this.b,s=this.c,r,o;ie.subVectors(i,n),se.subVectors(s,n),ni.subVectors(t,n);let a=ie.dot(ni),l=se.dot(ni);if(a<=0&&l<=0)return e.copy(n);ii.subVectors(t,i);let u=ie.dot(ii),f=se.dot(ii);if(u>=0&&f<=u)return e.copy(i);let h=a*f-u*l;if(h<=0&&a>=0&&u<=0)return r=a/(a-u),e.copy(n).addScaledVector(ie,r);si.subVectors(t,s);let d=ie.dot(si),p=se.dot(si);if(p>=0&&d<=p)return e.copy(s);let m=d*l-a*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(se,o);let _=u*p-d*f;if(_<=0&&f-u>=0&&d-p>=0)return Rs.subVectors(s,i),o=(f-u)/(f-u+(d-p)),e.copy(i).addScaledVector(Rs,o);let g=1/(_+m+h);return r=m*g,o=h*g,e.copy(n).addScaledVector(ie,r).addScaledVector(se,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},X=class{constructor(t=new M(1/0,1/0,1/0),e=new M(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Mt.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(Mt.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=Mt.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let r=0,o=s.count;r<o;r++)t.isMesh===!0?t.getVertexPosition(r,Mt):Mt.fromBufferAttribute(s,r),Mt.applyMatrix4(t.matrixWorld),this.expandByPoint(Mt);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),tn.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),tn.copy(n.boundingBox)),tn.applyMatrix4(t.matrixWorld),this.union(tn)}let i=t.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Mt),Mt.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ce),en.subVectors(this.max,Ce),re.subVectors(t.a,Ce),oe.subVectors(t.b,Ce),ae.subVectors(t.c,Ce),Ft.subVectors(oe,re),Bt.subVectors(ae,oe),Xt.subVectors(re,ae);let e=[0,-Ft.z,Ft.y,0,-Bt.z,Bt.y,0,-Xt.z,Xt.y,Ft.z,0,-Ft.x,Bt.z,0,-Bt.x,Xt.z,0,-Xt.x,-Ft.y,Ft.x,0,-Bt.y,Bt.x,0,-Xt.y,Xt.x,0];return!ci(e,re,oe,ae,en)||(e=[1,0,0,0,1,0,0,0,1],!ci(e,re,oe,ae,en))?!1:(nn.crossVectors(Ft,Bt),e=[nn.x,nn.y,nn.z],ci(e,re,oe,ae,en))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Mt).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Mt).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Pt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},Pt=[new M,new M,new M,new M,new M,new M,new M,new M],Mt=new M,tn=new X,re=new M,oe=new M,ae=new M,Ft=new M,Bt=new M,Xt=new M,Ce=new M,en=new M,nn=new M,qt=new M;function ci(c,t,e,n,i){for(let s=0,r=c.length-3;s<=r;s+=3){qt.fromArray(c,s);let o=i.x*Math.abs(qt.x)+i.y*Math.abs(qt.y)+i.z*Math.abs(qt.z),a=t.dot(qt),l=e.dot(qt),u=n.dot(qt);if(Math.max(-Math.max(a,l,u),Math.min(a,l,u))>o)return!1}return!0}var J=new M,sn=new H,$r=0,ot=class extends Yt{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:$r++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Ri,this.updateRanges=[],this.gpuType=Gs,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)sn.fromBufferAttribute(this,e),sn.applyMatrix3(t),this.setXY(e,sn.x,sn.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyMatrix3(t),this.setXYZ(e,J.x,J.y,J.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyMatrix4(t),this.setXYZ(e,J.x,J.y,J.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyNormalMatrix(t),this.setXYZ(e,J.x,J.y,J.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.transformDirection(t),this.setXYZ(e,J.x,J.y,J.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Ee(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ut(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ee(e,this.array)),e}setX(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ee(e,this.array)),e}setY(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ee(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ee(e,this.array)),e}setW(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,s){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array),i=ut(i,this.array),s=ut(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==Ri&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}};var pn=class extends ot{constructor(t,e,n){super(new Uint16Array(t),e,n)}};var mn=class extends ot{constructor(t,e,n){super(new Uint32Array(t),e,n)}};var gn=class extends ot{constructor(t,e,n){super(new Float32Array(t),e,n)}},Kr=new X,Re=new M,li=new M,pe=class{constructor(t=new M,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):Kr.setFromPoints(t).getCenter(n);let i=0;for(let s=0,r=t.length;s<r;s++)i=Math.max(i,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Re.subVectors(t,this.center);let e=Re.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(Re,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(li.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Re.copy(t.center).add(li)),this.expandByPoint(Re.copy(t.center).sub(li))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},Qr=0,mt=new W,ui=new Zt,ce=new M,dt=new X,Pe=new X,K=new M,Ue=class c extends Yt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Qr++}),this.uuid=Cn(),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={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Fr(t)?mn:pn)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new N().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return mt.makeRotationFromQuaternion(t),this.applyMatrix4(mt),this}rotateX(t){return mt.makeRotationX(t),this.applyMatrix4(mt),this}rotateY(t){return mt.makeRotationY(t),this.applyMatrix4(mt),this}rotateZ(t){return mt.makeRotationZ(t),this.applyMatrix4(mt),this}translate(t,e,n){return mt.makeTranslation(t,e,n),this.applyMatrix4(mt),this}scale(t,e,n){return mt.makeScale(t,e,n),this.applyMatrix4(mt),this}lookAt(t){return ui.lookAt(t),ui.updateMatrix(),this.applyMatrix4(ui.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ce).negate(),this.translate(ce.x,ce.y,ce.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let i=0,s=t.length;i<s;i++){let r=t[i];n.push(r.x,r.y,r.z||0)}this.setAttribute("position",new gn(n,3))}else{let n=Math.min(t.length,e.count);for(let i=0;i<n;i++){let s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&Q("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new X);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){G("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){let s=e[n];dt.setFromBufferAttribute(s),this.morphTargetsRelative?(K.addVectors(this.boundingBox.min,dt.min),this.boundingBox.expandByPoint(K),K.addVectors(this.boundingBox.max,dt.max),this.boundingBox.expandByPoint(K)):(this.boundingBox.expandByPoint(dt.min),this.boundingBox.expandByPoint(dt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&G('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new pe);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){G("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new M,1/0);return}if(t){let n=this.boundingSphere.center;if(dt.setFromBufferAttribute(t),e)for(let s=0,r=e.length;s<r;s++){let o=e[s];Pe.setFromBufferAttribute(o),this.morphTargetsRelative?(K.addVectors(dt.min,Pe.min),dt.expandByPoint(K),K.addVectors(dt.max,Pe.max),dt.expandByPoint(K)):(dt.expandByPoint(Pe.min),dt.expandByPoint(Pe.max))}dt.getCenter(n);let i=0;for(let s=0,r=t.count;s<r;s++)K.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(K));if(e)for(let s=0,r=e.length;s<r;s++){let o=e[s],a=this.morphTargetsRelative;for(let l=0,u=o.count;l<u;l++)K.fromBufferAttribute(o,l),a&&(ce.fromBufferAttribute(t,l),K.add(ce)),i=Math.max(i,n.distanceToSquared(K))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&G('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){G("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,i=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ot(new Float32Array(4*n.count),4));let r=this.getAttribute("tangent"),o=[],a=[];for(let A=0;A<n.count;A++)o[A]=new M,a[A]=new M;let l=new M,u=new M,f=new M,h=new H,d=new H,p=new H,m=new M,_=new M;function g(A,E,C){l.fromBufferAttribute(n,A),u.fromBufferAttribute(n,E),f.fromBufferAttribute(n,C),h.fromBufferAttribute(s,A),d.fromBufferAttribute(s,E),p.fromBufferAttribute(s,C),u.sub(l),f.sub(l),d.sub(h),p.sub(h);let R=1/(d.x*p.y-p.x*d.y);isFinite(R)&&(m.copy(u).multiplyScalar(p.y).addScaledVector(f,-d.y).multiplyScalar(R),_.copy(f).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(R),o[A].add(m),o[E].add(m),o[C].add(m),a[A].add(_),a[E].add(_),a[C].add(_))}let x=this.groups;x.length===0&&(x=[{start:0,count:t.count}]);for(let A=0,E=x.length;A<E;++A){let C=x[A],R=C.start,w=C.count;for(let P=R,L=R+w;P<L;P+=3)g(t.getX(P+0),t.getX(P+1),t.getX(P+2))}let y=new M,S=new M,v=new M,b=new M;function T(A){v.fromBufferAttribute(i,A),b.copy(v);let E=o[A];y.copy(E),y.sub(v.multiplyScalar(v.dot(E))).normalize(),S.crossVectors(b,E);let R=S.dot(a[A])<0?-1:1;r.setXYZW(A,y.x,y.y,y.z,R)}for(let A=0,E=x.length;A<E;++A){let C=x[A],R=C.start,w=C.count;for(let P=R,L=R+w;P<L;P+=3)T(t.getX(P+0)),T(t.getX(P+1)),T(t.getX(P+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ot(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let h=0,d=n.count;h<d;h++)n.setXYZ(h,0,0,0);let i=new M,s=new M,r=new M,o=new M,a=new M,l=new M,u=new M,f=new M;if(t)for(let h=0,d=t.count;h<d;h+=3){let p=t.getX(h+0),m=t.getX(h+1),_=t.getX(h+2);i.fromBufferAttribute(e,p),s.fromBufferAttribute(e,m),r.fromBufferAttribute(e,_),u.subVectors(r,s),f.subVectors(i,s),u.cross(f),o.fromBufferAttribute(n,p),a.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),o.add(u),a.add(u),l.add(u),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(_,l.x,l.y,l.z)}else for(let h=0,d=e.count;h<d;h+=3)i.fromBufferAttribute(e,h+0),s.fromBufferAttribute(e,h+1),r.fromBufferAttribute(e,h+2),u.subVectors(r,s),f.subVectors(i,s),u.cross(f),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)K.fromBufferAttribute(t,e),K.normalize(),t.setXYZ(e,K.x,K.y,K.z)}toNonIndexed(){function t(o,a){let l=o.array,u=o.itemSize,f=o.normalized,h=new l.constructor(a.length*u),d=0,p=0;for(let m=0,_=a.length;m<_;m++){o.isInterleavedBufferAttribute?d=a[m]*o.data.stride+o.offset:d=a[m]*u;for(let g=0;g<u;g++)h[p++]=l[d++]}return new ot(h,u,f)}if(this.index===null)return Q("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new c,n=this.index.array,i=this.attributes;for(let o in i){let a=i[o],l=t(a,n);e.setAttribute(o,l)}let s=this.morphAttributes;for(let o in s){let a=[],l=s[o];for(let u=0,f=l.length;u<f;u++){let h=l[u],d=t(h,n);a.push(d)}e.morphAttributes[o]=a}e.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let o=0,a=r.length;o<a;o++){let l=r[o];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let a=this.parameters;for(let l in a)a[l]!==void 0&&(t[l]=a[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let a in n){let l=n[a];t.data.attributes[a]=l.toJSON(t.data)}let i={},s=!1;for(let a in this.morphAttributes){let l=this.morphAttributes[a],u=[];for(let f=0,h=l.length;f<h;f++){let d=l[f];u.push(d.toJSON(t.data))}u.length>0&&(i[a]=u,s=!0)}s&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let i=t.attributes;for(let l in i){let u=i[l];this.setAttribute(l,u.clone(e))}let s=t.morphAttributes;for(let l in s){let u=[],f=s[l];for(let h=0,d=f.length;h<d;h++)u.push(f[h].clone(e));this.morphAttributes[l]=u}this.morphTargetsRelative=t.morphTargetsRelative;let r=t.groups;for(let l=0,u=r.length;l<u;l++){let f=r[l];this.addGroup(f.start,f.count,f.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let a=t.boundingSphere;return a!==null&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var hi=new M,jr=new M,to=new N,Jt=class{constructor(t=new M(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let i=hi.subVectors(n,e).cross(jr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,n=!0){let i=t.delta(hi),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return n===!0&&(r<0||r>1)?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||to.getNormalMatrix(t),i=this.coplanarPoint(hi).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}};function qs(c){let t={};for(let e in c){t[e]={};for(let n in c[e]){let i=c[e][n];if(Ps(i))i.isRenderTargetTexture?(Q("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=i.clone();else if(Array.isArray(i))if(Ps(i[0])){let s=[];for(let r=0,o=i.length;r<o;r++)s[r]=i[r].clone();t[e][n]=s}else t[e][n]=i.slice();else t[e][n]=i}}return t}function ct(c){let t={};for(let e=0;e<c.length;e++){let n=qs(c[e]);for(let i in n)t[i]=n[i]}return t}function Ps(c){return c&&(c.isColor||c.isMatrix3||c.isMatrix4||c.isVector2||c.isVector3||c.isVector4||c.isTexture||c.isQuaternion)}function rn(c,t){return!c||c.constructor===t?c:typeof t.BYTES_PER_ELEMENT=="number"?new t(c):Array.prototype.slice.call(c)}var Ot=class{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,i=e[n],s=e[n-1];n:{t:{let r;e:{i:if(!(t<i)){for(let o=n+2;;){if(i===void 0){if(t<s)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=e[++n],t<i)break t}r=e.length;break e}if(!(t>=s)){let o=e[1];t<o&&(n=2,s=o);for(let a=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=s,s=e[--n-1],t>=s)break t}r=n,n=0;break e}break n}for(;n<r;){let o=n+r>>>1;t<e[o]?r=o:n=o+1}if(i=e[n],s=e[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=t*i;for(let r=0;r!==i;++r)e[r]=n[s+r];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},_n=class extends Ot{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ti,endingEnd:Ti}}intervalChanged_(t,e,n){let i=this.parameterPositions,s=t-2,r=t+1,o=i[s],a=i[r];if(o===void 0)switch(this.getSettings_().endingStart){case Ai:s=t,o=2*e-n;break;case Ei:s=i.length-2,o=e+i[s]-i[s+1];break;default:s=t,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case Ai:r=t,a=2*n-e;break;case Ei:r=1,a=n+i[1]-i[0];break;default:r=t-1,a=e}let l=(n-e)*.5,u=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=s*u,this._offsetNext=r*u}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),m=p*p,_=m*p,g=-h*_+2*h*m-h*p,x=(1+h)*_+(-1.5-2*h)*m+(-.5+h)*p+1,y=(-1-d)*_+(1.5+d)*m+.5*p,S=d*_-d*m;for(let v=0;v!==o;++v)s[v]=g*r[u+v]+x*r[l+v]+y*r[a+v]+S*r[f+v];return s}},xn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=(n-e)/(i-e),f=1-u;for(let h=0;h!==o;++h)s[h]=r[l+h]*f+r[a+h]*u;return s}},yn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}},vn=class extends Ot{interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=this.settings||this.DefaultSettings_,f=u.inTangents,h=u.outTangents;if(!f||!h){let m=(n-e)/(i-e),_=1-m;for(let g=0;g!==o;++g)s[g]=r[l+g]*_+r[a+g]*m;return s}let d=o*2,p=t-1;for(let m=0;m!==o;++m){let _=r[l+m],g=r[a+m],x=p*d+m*2,y=h[x],S=h[x+1],v=t*d+m*2,b=f[v],T=f[v+1],A=(n-e)/(i-e),E,C,R,w,P;for(let L=0;L<8;L++){E=A*A,C=E*A,R=1-A,w=R*R,P=w*R;let O=P*e+3*w*A*y+3*R*E*b+C*i-n;if(Math.abs(O)<1e-10)break;let it=3*w*(y-e)+6*R*A*(b-y)+3*E*(i-b);if(Math.abs(it)<1e-10)break;A=A-O/it,A=Math.max(0,Math.min(1,A))}s[m]=P*_+3*w*A*S+3*R*E*T+C*g}return s}},pt=class{constructor(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=rn(e,this.TimeBufferType),this.values=rn(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:rn(t.times,Array),values:rn(t.values,Array)};let i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new yn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new xn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new _n(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){let e=new vn(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.settings=this.settings),e}setInterpolation(t){let e;switch(t){case De:e=this.InterpolantFactoryMethodDiscrete;break;case ln:e=this.InterpolantFactoryMethodLinear;break;case an:e=this.InterpolantFactoryMethodSmooth;break;case bi:e=this.InterpolantFactoryMethodBezier;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Q("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return De;case this.InterpolantFactoryMethodLinear:return ln;case this.InterpolantFactoryMethodSmooth:return an;case this.InterpolantFactoryMethodBezier:return bi}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){let n=this.times,i=n.length,s=0,r=i-1;for(;s!==i&&n[s]<t;)++s;for(;r!==-1&&n[r]>e;)--r;if(++r,s!==0||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);let o=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*o,r*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(G("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,i=this.values,s=n.length;s===0&&(G("KeyframeTrack: Track is empty.",this),t=!1);let r=null;for(let o=0;o!==s;o++){let a=n[o];if(typeof a=="number"&&isNaN(a)){G("KeyframeTrack: Time is not a valid number.",this,o,a),t=!1;break}if(r!==null&&r>a){G("KeyframeTrack: Out of order keys.",this,o,a,r),t=!1;break}r=a}if(i!==void 0&&Br(i))for(let o=0,a=i.length;o!==a;++o){let l=i[o];if(isNaN(l)){G("KeyframeTrack: Value is not a valid number.",this,o,l),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===an,s=t.length-1,r=1;for(let o=1;o<s;++o){let a=!1,l=t[o],u=t[o+1];if(l!==u&&(o!==1||l!==t[0]))if(i)a=!0;else{let f=o*n,h=f-n,d=f+n;for(let p=0;p!==n;++p){let m=e[f+p];if(m!==e[h+p]||m!==e[d+p]){a=!0;break}}}if(a){if(o!==r){t[r]=t[o];let f=o*n,h=r*n;for(let d=0;d!==n;++d)e[h+d]=e[f+d]}++r}}if(s>0){t[r]=t[s];for(let o=s*n,a=r*n,l=0;l!==n;++l)e[a+l]=e[o+l];++r}return r!==t.length?(this.times=t.slice(0,r),this.values=e.slice(0,r*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}};pt.prototype.ValueTypeName="";pt.prototype.TimeBufferType=Float32Array;pt.prototype.ValueBufferType=Float32Array;pt.prototype.DefaultInterpolation=ln;var zt=class extends pt{constructor(t,e,n){super(t,e,n)}};zt.prototype.ValueTypeName="bool";zt.prototype.ValueBufferType=Array;zt.prototype.DefaultInterpolation=De;zt.prototype.InterpolantFactoryMethodLinear=void 0;zt.prototype.InterpolantFactoryMethodSmooth=void 0;var Mn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Mn.prototype.ValueTypeName="color";var Sn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Sn.prototype.ValueTypeName="number";var bn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e),l=t*o;for(let u=l+o;l!==u;l+=4)Lt.slerpFlat(s,0,r,l-o,r,l,a);return s}},Fe=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new bn(this.times,this.values,this.getValueSize(),t)}};Fe.prototype.ValueTypeName="quaternion";Fe.prototype.InterpolantFactoryMethodSmooth=void 0;var Vt=class extends pt{constructor(t,e,n){super(t,e,n)}};Vt.prototype.ValueTypeName="string";Vt.prototype.ValueBufferType=Array;Vt.prototype.DefaultInterpolation=De;Vt.prototype.InterpolantFactoryMethodLinear=void 0;Vt.prototype.InterpolantFactoryMethodSmooth=void 0;var Tn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Tn.prototype.ValueTypeName="vector";var An=class{constructor(t,e,n){let i=this,s=!1,r=0,o=0,a,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(u){o++,s===!1&&i.onStart!==void 0&&i.onStart(u,r,o),s=!0},this.itemEnd=function(u){r++,i.onProgress!==void 0&&i.onProgress(u,r,o),r===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return a?a(u):u},this.setURLModifier=function(u){return a=u,this},this.addHandler=function(u,f){return l.push(u,f),this},this.removeHandler=function(u){let f=l.indexOf(u);return f!==-1&&l.splice(f,2),this},this.getHandler=function(u){for(let f=0,h=l.length;f<h;f+=2){let d=l[f],p=l[f+1];if(d.global&&(d.lastIndex=0),d.test(u))return p}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Ys=new An,En=class{constructor(t){this.manager=t!==void 0?t:Ys,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(t,e){let n=this;return new Promise(function(i,s){n.load(t,i,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}};En.DEFAULT_MATERIAL_NAME="__DEFAULT";var Yi="\\\\[\\\\]\\\\.:\\\\/",eo=new RegExp("["+Yi+"]","g"),Zi="[^"+Yi+"]",no="[^"+Yi.replace("\\\\.","")+"]",io=/((?:WC+[\\/:])*)/.source.replace("WC",Zi),so=/(WCOD+)?/.source.replace("WCOD",no),ro=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Zi),oo=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Zi),ao=new RegExp("^"+io+so+ro+oo+"$"),co=["material","materials","bones","map"],Di=class{constructor(t,e,n){let i=n||k.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},k=class c{constructor(t,e,n){this.path=e,this.parsedPath=n||c.parseTrackName(e),this.node=c.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new c.Composite(t,e,n):new c(t,e,n)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(eo,"")}static parseTrackName(t){let e=ao.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);co.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(s){for(let r=0;r<s.length;r++){let o=s[r];if(o.name===e||o.uuid===e)return o;let a=n(o.children);if(a)return a}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,s=e.propertyIndex;if(t||(t=c.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){Q("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=e.objectIndex;switch(n){case"materials":if(!t.material){G("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){G("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){G("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let u=0;u<t.length;u++)if(t[u].name===l){l=u;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){G("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){G("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){G("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(l!==void 0){if(t[l]===void 0){G("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[l]}}let r=t[i];if(r===void 0){let l=e.nodeName;G("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){G("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){G("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}a=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else r.fromArray!==void 0&&r.toArray!==void 0?(a=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(a=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};k.Composite=Di;k.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};k.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};k.prototype.GetterByBindingType=[k.prototype._getValue_direct,k.prototype._getValue_array,k.prototype._getValue_arrayElement,k.prototype._getValue_toArray];k.prototype.SetterByBindingTypeAndVersioning=[[k.prototype._setValue_direct,k.prototype._setValue_direct_setNeedsUpdate,k.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[k.prototype._setValue_array,k.prototype._setValue_array_setNeedsUpdate,k.prototype._setValue_array_setMatrixWorldNeedsUpdate],[k.prototype._setValue_arrayElement,k.prototype._setValue_arrayElement_setNeedsUpdate,k.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[k.prototype._setValue_fromArray,k.prototype._setValue_fromArray_setNeedsUpdate,k.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var vl=new Float32Array(1);var Ni=class c{static{c.prototype.isMatrix2=!0}constructor(t,e,n,i){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){let s=this.elements;return s[0]=t,s[2]=e,s[1]=n,s[3]=i,this}};var Is=new M,on=new M,le=new M,ue=new M,fi=new M,lo=new M,uo=new M,at=class{constructor(t=new M,e=new M){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Is.subVectors(t,this.start),on.subVectors(this.end,this.start);let n=on.dot(on);if(n===0)return 0;let s=on.dot(Is)/n;return e&&(s=U(s,0,1)),s}closestPointToPoint(t,e,n){let i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=lo,n=uo){let i=10000000000000001e-32,s,r,o=this.start,a=t.start,l=this.end,u=t.end;le.subVectors(l,o),ue.subVectors(u,a),fi.subVectors(o,a);let f=le.dot(le),h=ue.dot(ue),d=ue.dot(fi);if(f<=i&&h<=i)return e.copy(o),n.copy(a),e.sub(n),e.dot(e);if(f<=i)s=0,r=d/h,r=U(r,0,1);else{let p=le.dot(fi);if(h<=i)r=0,s=U(-p/f,0,1);else{let m=le.dot(ue),_=f*h-m*m;_!==0?s=U((m*d-p*h)/_,0,1):s=0,r=(m*s+d)/h,r<0?(r=0,s=U(-p/f,0,1)):r>1&&(r=1,s=U((m-p)/f,0,1))}}return e.copy(o).addScaledVector(le,s),n.copy(a).addScaledVector(ue,r),e.distanceToSquared(n)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?Q("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");var ho=\`#ifdef USE_ALPHAHASH
|
|
2
2
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
3
3
|
#endif\`,fo=\`#ifdef USE_ALPHAHASH
|
|
4
4
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -3661,16 +3661,18 @@ void main() {
|
|
|
3661
3661
|
#include <colorspace_fragment>
|
|
3662
3662
|
#include <fog_fragment>
|
|
3663
3663
|
}\`,F={alphahash_fragment:ho,alphahash_pars_fragment:fo,alphamap_fragment:po,alphamap_pars_fragment:mo,alphatest_fragment:go,alphatest_pars_fragment:_o,aomap_fragment:xo,aomap_pars_fragment:yo,batching_pars_vertex:vo,batching_vertex:Mo,begin_vertex:So,beginnormal_vertex:bo,bsdfs:To,iridescence_fragment:Ao,bumpmap_pars_fragment:Eo,clipping_planes_fragment:wo,clipping_planes_pars_fragment:Co,clipping_planes_pars_vertex:Ro,clipping_planes_vertex:Po,color_fragment:Io,color_pars_fragment:Lo,color_pars_vertex:Do,color_vertex:No,common:Uo,cube_uv_reflection_fragment:Fo,defaultnormal_vertex:Bo,displacementmap_pars_vertex:Oo,displacementmap_vertex:zo,emissivemap_fragment:Vo,emissivemap_pars_fragment:ko,colorspace_fragment:Go,colorspace_pars_fragment:Ho,envmap_fragment:Wo,envmap_common_pars_fragment:Xo,envmap_pars_fragment:qo,envmap_pars_vertex:Yo,envmap_physical_pars_fragment:sa,envmap_vertex:Zo,fog_vertex:Jo,fog_pars_vertex:$o,fog_fragment:Ko,fog_pars_fragment:Qo,gradientmap_pars_fragment:jo,lightmap_pars_fragment:ta,lights_lambert_fragment:ea,lights_lambert_pars_fragment:na,lights_pars_begin:ia,lights_toon_fragment:ra,lights_toon_pars_fragment:oa,lights_phong_fragment:aa,lights_phong_pars_fragment:ca,lights_physical_fragment:la,lights_physical_pars_fragment:ua,lights_fragment_begin:ha,lights_fragment_maps:fa,lights_fragment_end:da,lightprobes_pars_fragment:pa,logdepthbuf_fragment:ma,logdepthbuf_pars_fragment:ga,logdepthbuf_pars_vertex:_a,logdepthbuf_vertex:xa,map_fragment:ya,map_pars_fragment:va,map_particle_fragment:Ma,map_particle_pars_fragment:Sa,metalnessmap_fragment:ba,metalnessmap_pars_fragment:Ta,morphinstance_vertex:Aa,morphcolor_vertex:Ea,morphnormal_vertex:wa,morphtarget_pars_vertex:Ca,morphtarget_vertex:Ra,normal_fragment_begin:Pa,normal_fragment_maps:Ia,normal_pars_fragment:La,normal_pars_vertex:Da,normal_vertex:Na,normalmap_pars_fragment:Ua,clearcoat_normal_fragment_begin:Fa,clearcoat_normal_fragment_maps:Ba,clearcoat_pars_fragment:Oa,iridescence_pars_fragment:za,opaque_fragment:Va,packing:ka,premultiplied_alpha_fragment:Ga,project_vertex:Ha,dithering_fragment:Wa,dithering_pars_fragment:Xa,roughnessmap_fragment:qa,roughnessmap_pars_fragment:Ya,shadowmap_pars_fragment:Za,shadowmap_pars_vertex:Ja,shadowmap_vertex:$a,shadowmask_pars_fragment:Ka,skinbase_vertex:Qa,skinning_pars_vertex:ja,skinning_vertex:tc,skinnormal_vertex:ec,specularmap_fragment:nc,specularmap_pars_fragment:ic,tonemapping_fragment:sc,tonemapping_pars_fragment:rc,transmission_fragment:oc,transmission_pars_fragment:ac,uv_pars_fragment:cc,uv_pars_vertex:lc,uv_vertex:uc,worldpos_vertex:hc,background_vert:fc,background_frag:dc,backgroundCube_vert:pc,backgroundCube_frag:mc,cube_vert:gc,cube_frag:_c,depth_vert:xc,depth_frag:yc,distance_vert:vc,distance_frag:Mc,equirect_vert:Sc,equirect_frag:bc,linedashed_vert:Tc,linedashed_frag:Ac,meshbasic_vert:Ec,meshbasic_frag:wc,meshlambert_vert:Cc,meshlambert_frag:Rc,meshmatcap_vert:Pc,meshmatcap_frag:Ic,meshnormal_vert:Lc,meshnormal_frag:Dc,meshphong_vert:Nc,meshphong_frag:Uc,meshphysical_vert:Fc,meshphysical_frag:Bc,meshtoon_vert:Oc,meshtoon_frag:zc,points_vert:Vc,points_frag:kc,shadow_vert:Gc,shadow_frag:Hc,sprite_vert:Wc,sprite_frag:Xc},I={common:{diffuse:{value:new j(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new N},alphaMap:{value:null},alphaMapTransform:{value:new N},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new N}},envmap:{envMap:{value:null},envMapRotation:{value:new N},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new N}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new N}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new N},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new N},normalScale:{value:new H(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new N},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new N}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new N}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new N}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new j(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 M},probesMax:{value:new M},probesResolution:{value:new M}},points:{diffuse:{value:new j(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new N},alphaTest:{value:0},uvTransform:{value:new N}},sprite:{diffuse:{value:new j(16777215)},opacity:{value:1},center:{value:new H(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new N},alphaMap:{value:null},alphaMapTransform:{value:new N},alphaTest:{value:0}}},Zs={basic:{uniforms:ct([I.common,I.specularmap,I.envmap,I.aomap,I.lightmap,I.fog]),vertexShader:F.meshbasic_vert,fragmentShader:F.meshbasic_frag},lambert:{uniforms:ct([I.common,I.specularmap,I.envmap,I.aomap,I.lightmap,I.emissivemap,I.bumpmap,I.normalmap,I.displacementmap,I.fog,I.lights,{emissive:{value:new j(0)},envMapIntensity:{value:1}}]),vertexShader:F.meshlambert_vert,fragmentShader:F.meshlambert_frag},phong:{uniforms:ct([I.common,I.specularmap,I.envmap,I.aomap,I.lightmap,I.emissivemap,I.bumpmap,I.normalmap,I.displacementmap,I.fog,I.lights,{emissive:{value:new j(0)},specular:{value:new j(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:F.meshphong_vert,fragmentShader:F.meshphong_frag},standard:{uniforms:ct([I.common,I.envmap,I.aomap,I.lightmap,I.emissivemap,I.bumpmap,I.normalmap,I.displacementmap,I.roughnessmap,I.metalnessmap,I.fog,I.lights,{emissive:{value:new j(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:F.meshphysical_vert,fragmentShader:F.meshphysical_frag},toon:{uniforms:ct([I.common,I.aomap,I.lightmap,I.emissivemap,I.bumpmap,I.normalmap,I.displacementmap,I.gradientmap,I.fog,I.lights,{emissive:{value:new j(0)}}]),vertexShader:F.meshtoon_vert,fragmentShader:F.meshtoon_frag},matcap:{uniforms:ct([I.common,I.bumpmap,I.normalmap,I.displacementmap,I.fog,{matcap:{value:null}}]),vertexShader:F.meshmatcap_vert,fragmentShader:F.meshmatcap_frag},points:{uniforms:ct([I.points,I.fog]),vertexShader:F.points_vert,fragmentShader:F.points_frag},dashed:{uniforms:ct([I.common,I.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:F.linedashed_vert,fragmentShader:F.linedashed_frag},depth:{uniforms:ct([I.common,I.displacementmap]),vertexShader:F.depth_vert,fragmentShader:F.depth_frag},normal:{uniforms:ct([I.common,I.bumpmap,I.normalmap,I.displacementmap,{opacity:{value:1}}]),vertexShader:F.meshnormal_vert,fragmentShader:F.meshnormal_frag},sprite:{uniforms:ct([I.sprite,I.fog]),vertexShader:F.sprite_vert,fragmentShader:F.sprite_frag},background:{uniforms:{uvTransform:{value:new N},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:F.background_vert,fragmentShader:F.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new N}},vertexShader:F.backgroundCube_vert,fragmentShader:F.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:F.cube_vert,fragmentShader:F.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:F.equirect_vert,fragmentShader:F.equirect_frag},distance:{uniforms:ct([I.common,I.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:F.distance_vert,fragmentShader:F.distance_frag},shadow:{uniforms:ct([I.lights,I.fog,{color:{value:new j(0)},opacity:{value:1}}]),vertexShader:F.shadow_vert,fragmentShader:F.shadow_frag}};Zs.physical={uniforms:ct([Zs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new N},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new N},clearcoatNormalScale:{value:new H(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new N},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new N},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new N},sheen:{value:0},sheenColor:{value:new j(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new N},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new N},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new N},transmissionSamplerSize:{value:new H},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new N},attenuationDistance:{value:0},attenuationColor:{value:new j(0)},specularColor:{value:new j(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new N},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new N},anisotropyVector:{value:new H},anisotropyMap:{value:null},anisotropyMapTransform:{value:new N}}]),vertexShader:F.meshphysical_vert,fragmentShader:F.meshphysical_frag};var qc=new N;qc.set(-1,0,0,0,1,0,0,0,1);var Vm={[Bi]:"LINEAR_TONE_MAPPING",[Oi]:"REINHARD_TONE_MAPPING",[zi]:"CINEON_TONE_MAPPING",[Vi]:"ACES_FILMIC_TONE_MAPPING",[Gi]:"AGX_TONE_MAPPING",[Hi]:"NEUTRAL_TONE_MAPPING",[ki]:"CUSTOM_TONE_MAPPING"};var km=new Float32Array(16),Gm=new Float32Array(9),Hm=new Float32Array(4);var Wm={[Bi]:"Linear",[Oi]:"Reinhard",[zi]:"Cineon",[Vi]:"ACESFilmic",[Gi]:"AgX",[Hi]:"Neutral",[ki]:"Custom"};var Xm={[Ls]:"SHADOWMAP_TYPE_PCF",[Ds]:"SHADOWMAP_TYPE_VSM"};var qm={[Bs]:"ENVMAP_TYPE_CUBE",[Xi]:"ENVMAP_TYPE_CUBE",[Os]:"ENVMAP_TYPE_CUBE_UV"};var Ym={[Xi]:"ENVMAP_MODE_REFRACTION"};var Zm={[Ns]:"ENVMAP_BLENDING_MULTIPLY",[Us]:"ENVMAP_BLENDING_MIX",[Fs]:"ENVMAP_BLENDING_ADD"};var Yc=new N;Yc.set(-1,0,0,0,1,0,0,0,1);var Jm=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]);var $s=Math.pow(2,-24),Rn=Symbol("SKIP_GENERATION");function Zc(c){return c.index?c.index.count:c.attributes.position.count}function Et(c){return Zc(c)/3}function Jc(c,t=ArrayBuffer){return c>65535?new Uint32Array(new t(4*c)):new Uint16Array(new t(2*c))}function Ks(c,t){if(!c.index){let e=c.attributes.position.count,n=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Jc(e,n);c.setIndex(new ot(i,1));for(let s=0;s<e;s++)i[s]=s}}function Ji(c,t){let e=Et(c),n=t||c.drawRange,i=n.start/3,s=(n.start+n.count)/3,r=Math.max(0,i),o=Math.min(e,s)-r;return[{offset:Math.floor(r),count:Math.floor(o)}]}function $i(c,t){if(!c.groups||!c.groups.length)return Ji(c,t);let e=[],n=new Set,i=t||c.drawRange,s=i.start/3,r=(i.start+i.count)/3;for(let a of c.groups){let l=a.start/3,u=(a.start+a.count)/3;n.add(Math.max(s,l)),n.add(Math.min(r,u))}let o=Array.from(n.values()).sort((a,l)=>a-l);for(let a=0;a<o.length-1;a++){let l=o[a],u=o[a+1];e.push({offset:Math.floor(l),count:Math.floor(u-l)})}return e}function Qs(c,t){let e=Et(c),n=$i(c,t).sort((r,o)=>r.offset-o.offset),i=n[n.length-1];i.count=Math.min(e-i.offset,i.count);let s=0;return n.forEach(({count:r})=>s+=r),e!==s}function Pn(c,t,e,n,i){let s=1/0,r=1/0,o=1/0,a=-1/0,l=-1/0,u=-1/0,f=1/0,h=1/0,d=1/0,p=-1/0,m=-1/0,_=-1/0;for(let g=t*6,x=(t+e)*6;g<x;g+=6){let y=c[g+0],S=c[g+1],v=y-S,b=y+S;v<s&&(s=v),b>a&&(a=b),y<f&&(f=y),y>p&&(p=y);let T=c[g+2],A=c[g+3],E=T-A,C=T+A;E<r&&(r=E),C>l&&(l=C),T<h&&(h=T),T>m&&(m=T);let R=c[g+4],w=c[g+5],P=R-w,L=R+w;P<o&&(o=P),L>u&&(u=L),R<d&&(d=R),R>_&&(_=R)}n[0]=s,n[1]=r,n[2]=o,n[3]=a,n[4]=l,n[5]=u,i[0]=f,i[1]=h,i[2]=d,i[3]=p,i[4]=m,i[5]=_}function js(c,t=null,e=null,n=null){let i=c.attributes.position,s=c.index?c.index.array:null,r=Et(c),o=i.normalized,a;t===null?(a=new Float32Array(r*6),e=0,n=r):(a=t,e=e||0,n=n||r);let l=i.array,u=i.offset||0,f=3;i.isInterleavedBufferAttribute&&(f=i.data.stride);let h=["getX","getY","getZ"];for(let d=e;d<e+n;d++){let p=d*3,m=d*6,_=p+0,g=p+1,x=p+2;s&&(_=s[_],g=s[g],x=s[x]),o||(_=_*f+u,g=g*f+u,x=x*f+u);for(let y=0;y<3;y++){let S,v,b;o?(S=i[h[y]](_),v=i[h[y]](g),b=i[h[y]](x)):(S=l[_+y],v=l[g+y],b=l[x+y]);let T=S;v<T&&(T=v),b<T&&(T=b);let A=S;v>A&&(A=v),b>A&&(A=b);let E=(A-T)/2,C=y*2;a[m+C+0]=T+E,a[m+C+1]=E+(Math.abs(T)+E)*$s}}return a}function z(c,t,e){return e.min.x=t[c],e.min.y=t[c+1],e.min.z=t[c+2],e.max.x=t[c+3],e.max.y=t[c+4],e.max.z=t[c+5],e}function Ki(c){let t=-1,e=-1/0;for(let n=0;n<3;n++){let i=c[n+3]-c[n];i>e&&(e=i,t=n)}return t}function Qi(c,t){t.set(c)}function ji(c,t,e){let n,i;for(let s=0;s<3;s++){let r=s+3;n=c[s],i=t[s],e[s]=n<i?n:i,n=c[r],i=t[r],e[r]=n>i?n:i}}function Be(c,t,e){for(let n=0;n<3;n++){let i=t[c+2*n],s=t[c+2*n+1],r=i-s,o=i+s;r<e[n]&&(e[n]=r),o>e[n+3]&&(e[n+3]=o)}}function me(c){let t=c[3]-c[0],e=c[4]-c[1],n=c[5]-c[2];return 2*(t*e+e*n+n*t)}var Dt=32,Kc=(c,t)=>c.candidate-t.candidate,kt=new Array(Dt).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),In=new Float32Array(6);function nr(c,t,e,n,i,s){let r=-1,o=0;if(s===0)r=Ki(t),r!==-1&&(o=(t[r]+t[r+3])/2);else if(s===1)r=Ki(c),r!==-1&&(o=Qc(e,n,i,r));else if(s===2){let a=me(c),l=1.25*i,u=n*6,f=(n+i)*6;for(let h=0;h<3;h++){let d=t[h],_=(t[h+3]-d)/Dt;if(i<Dt/4){let g=[...kt];g.length=i;let x=0;for(let S=u;S<f;S+=6,x++){let v=g[x];v.candidate=e[S+2*h],v.count=0;let{bounds:b,leftCacheBounds:T,rightCacheBounds:A}=v;for(let E=0;E<3;E++)A[E]=1/0,A[E+3]=-1/0,T[E]=1/0,T[E+3]=-1/0,b[E]=1/0,b[E+3]=-1/0;Be(S,e,b)}g.sort(Kc);let y=i;for(let S=0;S<y;S++){let v=g[S];for(;S+1<y&&g[S+1].candidate===v.candidate;)g.splice(S+1,1),y--}for(let S=u;S<f;S+=6){let v=e[S+2*h];for(let b=0;b<y;b++){let T=g[b];v>=T.candidate?Be(S,e,T.rightCacheBounds):(Be(S,e,T.leftCacheBounds),T.count++)}}for(let S=0;S<y;S++){let v=g[S],b=v.count,T=i-v.count,A=v.leftCacheBounds,E=v.rightCacheBounds,C=0;b!==0&&(C=me(A)/a);let R=0;T!==0&&(R=me(E)/a);let w=1+1.25*(C*b+R*T);w<l&&(r=h,l=w,o=v.candidate)}}else{for(let y=0;y<Dt;y++){let S=kt[y];S.count=0,S.candidate=d+_+y*_;let v=S.bounds;for(let b=0;b<3;b++)v[b]=1/0,v[b+3]=-1/0}for(let y=u;y<f;y+=6){let b=~~((e[y+2*h]-d)/_);b>=Dt&&(b=Dt-1);let T=kt[b];T.count++,Be(y,e,T.bounds)}let g=kt[Dt-1];Qi(g.bounds,g.rightCacheBounds);for(let y=Dt-2;y>=0;y--){let S=kt[y],v=kt[y+1];ji(S.bounds,v.rightCacheBounds,S.rightCacheBounds)}let x=0;for(let y=0;y<Dt-1;y++){let S=kt[y],v=S.count,b=S.bounds,A=kt[y+1].rightCacheBounds;v!==0&&(x===0?Qi(b,In):ji(b,In,In)),x+=v;let E=0,C=0;x!==0&&(E=me(In)/a);let R=i-x;R!==0&&(C=me(A)/a);let w=1+1.25*(E*x+C*R);w<l&&(r=h,l=w,o=S.candidate)}}}}else console.warn(\`MeshBVH: Invalid build strategy value \${s} used.\`);return{axis:r,pos:o}}function Qc(c,t,e,n){let i=0;for(let s=t,r=t+e;s<r;s++)i+=c[s*6+n*2];return i/e}var ge=class{constructor(){this.boundingData=new Float32Array(6)}};function ir(c,t,e,n,i,s){let r=n,o=n+i-1,a=s.pos,l=s.axis*2;for(;;){for(;r<=o&&e[r*6+l]<a;)r++;for(;r<=o&&e[o*6+l]>=a;)o--;if(r<o){for(let u=0;u<3;u++){let f=t[r*3+u];t[r*3+u]=t[o*3+u],t[o*3+u]=f}for(let u=0;u<6;u++){let f=e[r*6+u];e[r*6+u]=e[o*6+u],e[o*6+u]=f}r++,o--}else return r}}function sr(c,t,e,n,i,s){let r=n,o=n+i-1,a=s.pos,l=s.axis*2;for(;;){for(;r<=o&&e[r*6+l]<a;)r++;for(;r<=o&&e[o*6+l]>=a;)o--;if(r<o){let u=c[r];c[r]=c[o],c[o]=u;for(let f=0;f<6;f++){let h=e[r*6+f];e[r*6+f]=e[o*6+f],e[o*6+f]=h}r++,o--}else return r}}function q(c,t){return t[c+15]===65535}function Z(c,t){return t[c+6]}function $(c,t){return t[c+14]}function tt(c){return c+8}function et(c,t){return t[c+6]}function Ln(c,t){return t[c+7]}var rr,Oe,Dn,or,jc=Math.pow(2,32);function Nn(c){return"count"in c?1:1+Nn(c.left)+Nn(c.right)}function ar(c,t,e){return rr=new Float32Array(e),Oe=new Uint32Array(e),Dn=new Uint16Array(e),or=new Uint8Array(e),ts(c,t)}function ts(c,t){let e=c/4,n=c/2,i="count"in t,s=t.boundingData;for(let r=0;r<6;r++)rr[e+r]=s[r];if(i)if(t.buffer){let r=t.buffer;or.set(new Uint8Array(r),c);for(let o=c,a=c+r.byteLength;o<a;o+=32){let l=o/2;q(l,Dn)||(Oe[o/4+6]+=e)}return c+r.byteLength}else{let r=t.offset,o=t.count;return Oe[e+6]=r,Dn[n+14]=o,Dn[n+15]=65535,c+32}else{let r=t.left,o=t.right,a=t.splitAxis,l;if(l=ts(c+32,r),l/4>jc)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Oe[e+6]=l/4,l=ts(l,o),Oe[e+7]=a,l}}function tl(c,t){let e=(c.index?c.index.count:c.attributes.position.count)/3,n=e>2**16,i=n?4:2,s=t?new SharedArrayBuffer(e*i):new ArrayBuffer(e*i),r=n?new Uint32Array(s):new Uint16Array(s);for(let o=0,a=r.length;o<a;o++)r[o]=o;return r}function el(c,t,e,n,i){let{maxDepth:s,verbose:r,maxLeafTris:o,strategy:a,onProgress:l,indirect:u}=i,f=c._indirectBuffer,h=c.geometry,d=h.index?h.index.array:null,p=u?sr:ir,m=Et(h),_=new Float32Array(6),g=!1,x=new ge;return Pn(t,e,n,x.boundingData,_),S(x,e,n,_),x;function y(v){l&&l(v/m)}function S(v,b,T,A=null,E=0){if(!g&&E>=s&&(g=!0,r&&(console.warn(\`MeshBVH: Max depth of \${s} reached when generating BVH. Consider increasing maxDepth.\`),console.warn(h))),T<=o||E>=s)return y(b+T),v.offset=b,v.count=T,v;let C=nr(v.boundingData,A,t,b,T,a);if(C.axis===-1)return y(b+T),v.offset=b,v.count=T,v;let R=p(f,d,t,b,T,C);if(R===b||R===b+T)y(b+T),v.offset=b,v.count=T;else{v.splitAxis=C.axis;let w=new ge,P=b,L=R-b;v.left=w,Pn(t,P,L,w.boundingData,_),S(w,P,L,_,E+1);let D=new ge,O=R,it=T-L;v.right=D,Pn(t,O,it,D.boundingData,_),S(D,O,it,_,E+1)}return v}}function cr(c,t){let e=c.geometry;t.indirect&&(c._indirectBuffer=tl(e,t.useSharedArrayBuffer),Qs(e,t.range)&&!t.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),c._indirectBuffer||Ks(e,t);let n=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=js(e),s=t.indirect?Ji(e,t.range):$i(e,t.range);c._roots=s.map(r=>{let o=el(c,i,r.offset,r.count,t),a=Nn(o),l=new n(32*a);return ar(0,o,l),l})}var ht=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(t,e){let n=1/0,i=-1/0;for(let s=0,r=t.length;s<r;s++){let a=t[s][e];n=a<n?a:n,i=a>i?a:i}this.min=n,this.max=i}setFromPoints(t,e){let n=1/0,i=-1/0;for(let s=0,r=e.length;s<r;s++){let o=e[s],a=t.dot(o);n=a<n?a:n,i=a>i?a:i}this.min=n,this.max=i}isSeparated(t){return this.min>t.max||t.min>this.max}};ht.prototype.setFromBox=(function(){let c=new M;return function(e,n){let i=n.min,s=n.max,r=1/0,o=-1/0;for(let a=0;a<=1;a++)for(let l=0;l<=1;l++)for(let u=0;u<=1;u++){c.x=i.x*a+s.x*(1-a),c.y=i.y*l+s.y*(1-l),c.z=i.z*u+s.z*(1-u);let f=e.dot(c);r=Math.min(f,r),o=Math.max(f,o)}this.min=r,this.max=o}})();var Tg=(function(){let c=new ht;return function(e,n){let i=e.points,s=e.satAxes,r=e.satBounds,o=n.points,a=n.satAxes,l=n.satBounds;for(let u=0;u<3;u++){let f=r[u],h=s[u];if(c.setFromPoints(h,o),f.isSeparated(c))return!1}for(let u=0;u<3;u++){let f=l[u],h=a[u];if(c.setFromPoints(h,i),f.isSeparated(c))return!1}}})();var nl=(function(){let c=new M,t=new M,e=new M;return function(i,s,r){let o=i.start,a=c,l=s.start,u=t;e.subVectors(o,l),c.subVectors(i.end,i.start),t.subVectors(s.end,s.start);let f=e.dot(u),h=u.dot(a),d=u.dot(u),p=e.dot(a),_=a.dot(a)*d-h*h,g,x;_!==0?g=(f*h-p*d)/_:g=0,x=(f+g*h)/d,r.x=g,r.y=x}})(),Ve=(function(){let c=new H,t=new M,e=new M;return function(i,s,r,o){nl(i,s,c);let a=c.x,l=c.y;if(a>=0&&a<=1&&l>=0&&l<=1){i.at(a,r),s.at(l,o);return}else if(a>=0&&a<=1){l<0?s.at(0,o):s.at(1,o),i.closestPointToPoint(o,!0,r);return}else if(l>=0&&l<=1){a<0?i.at(0,r):i.at(1,r),s.closestPointToPoint(r,!0,o);return}else{let u;a<0?u=i.start:u=i.end;let f;l<0?f=s.start:f=s.end;let h=t,d=e;if(i.closestPointToPoint(f,!0,t),s.closestPointToPoint(u,!0,e),h.distanceToSquared(f)<=d.distanceToSquared(u)){r.copy(h),o.copy(f);return}else{r.copy(u),o.copy(d);return}}}})(),lr=(function(){let c=new M,t=new M,e=new Jt,n=new at;return function(s,r){let{radius:o,center:a}=s,{a:l,b:u,c:f}=r;if(n.start=l,n.end=u,n.closestPointToPoint(a,!0,c).distanceTo(a)<=o||(n.start=l,n.end=f,n.closestPointToPoint(a,!0,c).distanceTo(a)<=o)||(n.start=u,n.end=f,n.closestPointToPoint(a,!0,c).distanceTo(a)<=o))return!0;let m=r.getPlane(e);if(Math.abs(m.distanceToPoint(a))<=o){let g=m.projectPoint(a,t);if(r.containsPoint(g))return!0}return!1}})();var il=1e-15;function es(c){return Math.abs(c)<il}var nt=class extends St{constructor(...t){super(...t),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new M),this.satBounds=new Array(4).fill().map(()=>new ht),this.points=[this.a,this.b,this.c],this.sphere=new pe,this.plane=new Jt,this.needsUpdate=!0}intersectsSphere(t){return lr(t,this)}update(){let t=this.a,e=this.b,n=this.c,i=this.points,s=this.satAxes,r=this.satBounds,o=s[0],a=r[0];this.getNormal(o),a.setFromPoints(o,i);let l=s[1],u=r[1];l.subVectors(t,e),u.setFromPoints(l,i);let f=s[2],h=r[2];f.subVectors(e,n),h.setFromPoints(f,i);let d=s[3],p=r[3];d.subVectors(n,t),p.setFromPoints(d,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,t),this.needsUpdate=!1}};nt.prototype.closestPointToSegment=(function(){let c=new M,t=new M,e=new at;return function(i,s=null,r=null){let{start:o,end:a}=i,l=this.points,u,f=1/0;for(let h=0;h<3;h++){let d=(h+1)%3;e.start.copy(l[h]),e.end.copy(l[d]),Ve(e,i,c,t),u=c.distanceToSquared(t),u<f&&(f=u,s&&s.copy(c),r&&r.copy(t))}return this.closestPointToPoint(o,c),u=o.distanceToSquared(c),u<f&&(f=u,s&&s.copy(c),r&&r.copy(o)),this.closestPointToPoint(a,c),u=a.distanceToSquared(c),u<f&&(f=u,s&&s.copy(c),r&&r.copy(a)),Math.sqrt(f)}})();nt.prototype.intersectsTriangle=(function(){let c=new nt,t=new Array(3),e=new Array(3),n=new ht,i=new ht,s=new M,r=new M,o=new M,a=new M,l=new M,u=new at,f=new at,h=new at,d=new M;function p(m,_,g){let x=m.points,y=0,S=-1;for(let v=0;v<3;v++){let{start:b,end:T}=u;b.copy(x[v]),T.copy(x[(v+1)%3]),u.delta(r);let A=es(_.distanceToPoint(b));if(es(_.normal.dot(r))&&A){g.copy(u),y=2;break}let E=_.intersectLine(u,d);if(!E&&A&&d.copy(b),(E||A)&&!es(d.distanceTo(T))){if(y<=1)(y===1?g.start:g.end).copy(d),A&&(S=y);else if(y>=2){(S===1?g.start:g.end).copy(d),y=2;break}if(y++,y===2&&S===-1)break}}return y}return function(_,g=null,x=!1){this.needsUpdate&&this.update(),_.isExtendedTriangle?_.needsUpdate&&_.update():(c.copy(_),c.update(),_=c);let y=this.plane,S=_.plane;if(Math.abs(y.normal.dot(S.normal))>1-1e-10){let v=this.satBounds,b=this.satAxes;e[0]=_.a,e[1]=_.b,e[2]=_.c;for(let E=0;E<4;E++){let C=v[E],R=b[E];if(n.setFromPoints(R,e),C.isSeparated(n))return!1}let T=_.satBounds,A=_.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let E=0;E<4;E++){let C=T[E],R=A[E];if(n.setFromPoints(R,t),C.isSeparated(n))return!1}for(let E=0;E<4;E++){let C=b[E];for(let R=0;R<4;R++){let w=A[R];if(s.crossVectors(C,w),n.setFromPoints(s,t),i.setFromPoints(s,e),n.isSeparated(i))return!1}}return g&&(x||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),g.start.set(0,0,0),g.end.set(0,0,0)),!0}else{let v=p(this,S,f);if(v===1&&_.containsPoint(f.end))return g&&(g.start.copy(f.end),g.end.copy(f.end)),!0;if(v!==2)return!1;let b=p(_,y,h);if(b===1&&this.containsPoint(h.end))return g&&(g.start.copy(h.end),g.end.copy(h.end)),!0;if(b!==2)return!1;if(f.delta(o),h.delta(a),o.dot(a)<0){let P=h.start;h.start=h.end,h.end=P}let T=f.start.dot(o),A=f.end.dot(o),E=h.start.dot(o),C=h.end.dot(o),R=A<E,w=T<C;return T!==C&&E!==A&&R===w?!1:(g&&(l.subVectors(f.start,h.start),l.dot(o)>0?g.start.copy(f.start):g.start.copy(h.start),l.subVectors(f.end,h.end),l.dot(o)<0?g.end.copy(f.end):g.end.copy(h.end)),!0)}}})();nt.prototype.distanceToPoint=(function(){let c=new M;return function(e){return this.closestPointToPoint(e,c),e.distanceTo(c)}})();nt.prototype.distanceToTriangle=(function(){let c=new M,t=new M,e=["a","b","c"],n=new at,i=new at;return function(r,o=null,a=null){let l=o||a?n:null;if(this.intersectsTriangle(r,l))return(o||a)&&(o&&l.getCenter(o),a&&l.getCenter(a)),0;let u=1/0;for(let f=0;f<3;f++){let h,d=e[f],p=r[d];this.closestPointToPoint(p,c),h=p.distanceToSquared(c),h<u&&(u=h,o&&o.copy(c),a&&a.copy(p));let m=this[d];r.closestPointToPoint(m,c),h=m.distanceToSquared(c),h<u&&(u=h,o&&o.copy(m),a&&a.copy(c))}for(let f=0;f<3;f++){let h=e[f],d=e[(f+1)%3];n.set(this[h],this[d]);for(let p=0;p<3;p++){let m=e[p],_=e[(p+1)%3];i.set(r[m],r[_]),Ve(n,i,c,t);let g=c.distanceToSquared(t);g<u&&(u=g,o&&o.copy(c),a&&a.copy(t))}}return Math.sqrt(u)}})();var Y=class{constructor(t,e,n){this.isOrientedBox=!0,this.min=new M,this.max=new M,this.matrix=new W,this.invMatrix=new W,this.points=new Array(8).fill().map(()=>new M),this.satAxes=new Array(3).fill().map(()=>new M),this.satBounds=new Array(3).fill().map(()=>new ht),this.alignedSatBounds=new Array(3).fill().map(()=>new ht),this.needsUpdate=!1,t&&this.min.copy(t),e&&this.max.copy(e),n&&this.matrix.copy(n)}set(t,e,n){this.min.copy(t),this.max.copy(e),this.matrix.copy(n),this.needsUpdate=!0}copy(t){this.min.copy(t.min),this.max.copy(t.max),this.matrix.copy(t.matrix),this.needsUpdate=!0}};Y.prototype.update=(function(){return function(){let t=this.matrix,e=this.min,n=this.max,i=this.points;for(let l=0;l<=1;l++)for(let u=0;u<=1;u++)for(let f=0;f<=1;f++){let h=1*l|2*u|4*f,d=i[h];d.x=l?n.x:e.x,d.y=u?n.y:e.y,d.z=f?n.z:e.z,d.applyMatrix4(t)}let s=this.satBounds,r=this.satAxes,o=i[0];for(let l=0;l<3;l++){let u=r[l],f=s[l],h=1<<l,d=i[h];u.subVectors(o,d),f.setFromPoints(u,i)}let a=this.alignedSatBounds;a[0].setFromPointsField(i,"x"),a[1].setFromPointsField(i,"y"),a[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}})();Y.prototype.intersectsBox=(function(){let c=new ht;return function(e){this.needsUpdate&&this.update();let n=e.min,i=e.max,s=this.satBounds,r=this.satAxes,o=this.alignedSatBounds;if(c.min=n.x,c.max=i.x,o[0].isSeparated(c)||(c.min=n.y,c.max=i.y,o[1].isSeparated(c))||(c.min=n.z,c.max=i.z,o[2].isSeparated(c)))return!1;for(let a=0;a<3;a++){let l=r[a],u=s[a];if(c.setFromBox(l,e),u.isSeparated(c))return!1}return!0}})();Y.prototype.intersectsTriangle=(function(){let c=new nt,t=new Array(3),e=new ht,n=new ht,i=new M;return function(r){this.needsUpdate&&this.update(),r.isExtendedTriangle?r.needsUpdate&&r.update():(c.copy(r),c.update(),r=c);let o=this.satBounds,a=this.satAxes;t[0]=r.a,t[1]=r.b,t[2]=r.c;for(let h=0;h<3;h++){let d=o[h],p=a[h];if(e.setFromPoints(p,t),d.isSeparated(e))return!1}let l=r.satBounds,u=r.satAxes,f=this.points;for(let h=0;h<3;h++){let d=l[h],p=u[h];if(e.setFromPoints(p,f),d.isSeparated(e))return!1}for(let h=0;h<3;h++){let d=a[h];for(let p=0;p<4;p++){let m=u[p];if(i.crossVectors(d,m),e.setFromPoints(i,t),n.setFromPoints(i,f),e.isSeparated(n))return!1}}return!0}})();Y.prototype.closestPointToPoint=(function(){return function(t,e){return this.needsUpdate&&this.update(),e.copy(t).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),e}})();Y.prototype.distanceToPoint=(function(){let c=new M;return function(e){return this.closestPointToPoint(e,c),e.distanceTo(c)}})();Y.prototype.distanceToBox=(function(){let c=["x","y","z"],t=new Array(12).fill().map(()=>new at),e=new Array(12).fill().map(()=>new at),n=new M,i=new M;return function(r,o=0,a=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(a||l)&&(r.getCenter(i),this.closestPointToPoint(i,n),r.closestPointToPoint(n,i),a&&a.copy(n),l&&l.copy(i)),0;let u=o*o,f=r.min,h=r.max,d=this.points,p=1/0;for(let _=0;_<8;_++){let g=d[_];i.copy(g).clamp(f,h);let x=g.distanceToSquared(i);if(x<p&&(p=x,a&&a.copy(g),l&&l.copy(i),x<u))return Math.sqrt(x)}let m=0;for(let _=0;_<3;_++)for(let g=0;g<=1;g++)for(let x=0;x<=1;x++){let y=(_+1)%3,S=(_+2)%3,v=g<<y|x<<S,b=1<<_|g<<y|x<<S,T=d[v],A=d[b];t[m].set(T,A);let C=c[_],R=c[y],w=c[S],P=e[m],L=P.start,D=P.end;L[C]=f[C],L[R]=g?f[R]:h[R],L[w]=x?f[w]:h[R],D[C]=h[C],D[R]=g?f[R]:h[R],D[w]=x?f[w]:h[R],m++}for(let _=0;_<=1;_++)for(let g=0;g<=1;g++)for(let x=0;x<=1;x++){i.x=_?h.x:f.x,i.y=g?h.y:f.y,i.z=x?h.z:f.z,this.closestPointToPoint(i,n);let y=i.distanceToSquared(n);if(y<p&&(p=y,a&&a.copy(n),l&&l.copy(i),y<u))return Math.sqrt(y)}for(let _=0;_<12;_++){let g=t[_];for(let x=0;x<12;x++){let y=e[x];Ve(g,y,n,i);let S=n.distanceToSquared(i);if(S<p&&(p=S,a&&a.copy(n),l&&l.copy(i),S<u))return Math.sqrt(S)}}return Math.sqrt(p)}})();var Gt=class{constructor(t){this._getNewPrimitive=t,this._primitives=[]}getPrimitive(){let t=this._primitives;return t.length===0?this._getNewPrimitive():t.pop()}releasePrimitive(t){this._primitives.push(t)}};var ns=class extends Gt{constructor(){super(()=>new nt)}},lt=new ns;var is=class{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;let t=[],e=null;this.setBuffer=n=>{e&&t.push(e),e=n,this.float32Array=new Float32Array(n),this.uint16Array=new Uint16Array(n),this.uint32Array=new Uint32Array(n)},this.clearBuffer=()=>{e=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,t.length!==0&&this.setBuffer(t.pop())}}},B=new is;var Ht,xe,_e=[],Fn=new Gt(()=>new X);function ur(c,t,e,n,i,s){Ht=Fn.getPrimitive(),xe=Fn.getPrimitive(),_e.push(Ht,xe),B.setBuffer(c._roots[t]);let r=ss(0,c.geometry,e,n,i,s);B.clearBuffer(),Fn.releasePrimitive(Ht),Fn.releasePrimitive(xe),_e.pop(),_e.pop();let o=_e.length;return o>0&&(xe=_e[o-1],Ht=_e[o-2]),r}function ss(c,t,e,n,i=null,s=0,r=0){let{float32Array:o,uint16Array:a,uint32Array:l}=B,u=c*2;if(q(u,a)){let h=Z(c,l),d=$(u,a);return z(c,o,Ht),n(h,d,!1,r,s+c,Ht)}else{let C=function(w){let{uint16Array:P,uint32Array:L}=B,D=w*2;for(;!q(D,P);)w=tt(w),D=w*2;return Z(w,L)},R=function(w){let{uint16Array:P,uint32Array:L}=B,D=w*2;for(;!q(D,P);)w=et(w,L),D=w*2;return Z(w,L)+$(D,P)},h=tt(c),d=et(c,l),p=h,m=d,_,g,x,y;if(i&&(x=Ht,y=xe,z(p,o,x),z(m,o,y),_=i(x),g=i(y),g<_)){p=d,m=h;let w=_;_=g,g=w,x=y}x||(x=Ht,z(p,o,x));let S=q(p*2,a),v=e(x,S,_,r+1,s+p),b;if(v===2){let w=C(p),L=R(p)-w;b=n(w,L,!0,r+1,s+p,x)}else b=v&&ss(p,t,e,n,i,s,r+1);if(b)return!0;y=xe,z(m,o,y);let T=q(m*2,a),A=e(y,T,g,r+1,s+m),E;if(A===2){let w=C(m),L=R(m)-w;E=n(w,L,!0,r+1,s+m,y)}else E=A&&ss(m,t,e,n,i,s,r+1);return!!E}}var ke=new M,os=new M;function hr(c,t,e={},n=0,i=1/0){let s=n*n,r=i*i,o=1/0,a=null;if(c.shapecast({boundsTraverseOrder:u=>(ke.copy(t).clamp(u.min,u.max),ke.distanceToSquared(t)),intersectsBounds:(u,f,h)=>h<o&&h<r,intersectsTriangle:(u,f)=>{u.closestPointToPoint(t,ke);let h=t.distanceToSquared(ke);return h<o&&(os.copy(ke),o=h,a=f),h<s}}),o===1/0)return null;let l=Math.sqrt(o);return e.point?e.point.copy(os):e.point=os.clone(),e.distance=l,e.faceIndex=a,e}var rl=parseInt("184")>=169,$t=new M,Kt=new M,Qt=new M,Bn=new H,On=new H,zn=new H,fr=new M,dr=new M,pr=new M,Ge=new M;function ol(c,t,e,n,i,s,r,o){let a;if(s===Ui?a=c.intersectTriangle(n,e,t,!0,i):a=c.intersectTriangle(t,e,n,s!==Fi,i),a===null)return null;let l=c.origin.distanceTo(i);return l<r||l>o?null:{distance:l,point:i.clone()}}function al(c,t,e,n,i,s,r,o,a,l,u){$t.fromBufferAttribute(t,s),Kt.fromBufferAttribute(t,r),Qt.fromBufferAttribute(t,o);let f=ol(c,$t,Kt,Qt,Ge,a,l,u);if(f){let h=new M;St.getBarycoord(Ge,$t,Kt,Qt,h),n&&(Bn.fromBufferAttribute(n,s),On.fromBufferAttribute(n,r),zn.fromBufferAttribute(n,o),f.uv=St.getInterpolation(Ge,$t,Kt,Qt,Bn,On,zn,new H)),i&&(Bn.fromBufferAttribute(i,s),On.fromBufferAttribute(i,r),zn.fromBufferAttribute(i,o),f.uv1=St.getInterpolation(Ge,$t,Kt,Qt,Bn,On,zn,new H)),e&&(fr.fromBufferAttribute(e,s),dr.fromBufferAttribute(e,r),pr.fromBufferAttribute(e,o),f.normal=St.getInterpolation(Ge,$t,Kt,Qt,fr,dr,pr,new M),f.normal.dot(c.direction)>0&&f.normal.multiplyScalar(-1));let d={a:s,b:r,c:o,normal:new M,materialIndex:0};St.getNormal($t,Kt,Qt,d.normal),f.face=d,f.faceIndex=s,rl&&(f.barycoord=h)}return f}function ye(c,t,e,n,i,s,r){let o=n*3,a=o+0,l=o+1,u=o+2,f=c.index;c.index&&(a=f.getX(a),l=f.getX(l),u=f.getX(u));let{position:h,normal:d,uv:p,uv1:m}=c.attributes,_=al(e,h,d,p,m,a,l,u,t,s,r);return _?(_.faceIndex=n,i&&i.push(_),_):null}function V(c,t,e,n){let i=c.a,s=c.b,r=c.c,o=t,a=t+1,l=t+2;e&&(o=e.getX(o),a=e.getX(a),l=e.getX(l)),i.x=n.getX(o),i.y=n.getY(o),i.z=n.getZ(o),s.x=n.getX(a),s.y=n.getY(a),s.z=n.getZ(a),r.x=n.getX(l),r.y=n.getY(l),r.z=n.getZ(l)}function mr(c,t,e,n,i,s,r,o){let{geometry:a,_indirectBuffer:l}=c;for(let u=n,f=n+i;u<f;u++)ye(a,t,e,u,s,r,o)}function gr(c,t,e,n,i,s,r){let{geometry:o,_indirectBuffer:a}=c,l=1/0,u=null;for(let f=n,h=n+i;f<h;f++){let d;d=ye(o,t,e,f,null,s,r),d&&d.distance<l&&(u=d,l=d.distance)}return u}function _r(c,t,e,n,i,s,r){let{geometry:o}=e,{index:a}=o,l=o.attributes.position;for(let u=c,f=t+c;u<f;u++){let h;if(h=u,V(r,h*3,a,l),r.needsUpdate=!0,n(r,h,i,s))return!0}return!1}function xr(c,t=null){t&&Array.isArray(t)&&(t=new Set(t));let e=c.geometry,n=e.index?e.index.array:null,i=e.attributes.position,s,r,o,a,l=0,u=c._roots;for(let h=0,d=u.length;h<d;h++)s=u[h],r=new Uint32Array(s),o=new Uint16Array(s),a=new Float32Array(s),f(0,l),l+=s.byteLength;function f(h,d,p=!1){let m=h*2;if(o[m+15]===65535){let g=r[h+6],x=o[m+14],y=1/0,S=1/0,v=1/0,b=-1/0,T=-1/0,A=-1/0;for(let E=3*g,C=3*(g+x);E<C;E++){let R=n[E],w=i.getX(R),P=i.getY(R),L=i.getZ(R);w<y&&(y=w),w>b&&(b=w),P<S&&(S=P),P>T&&(T=P),L<v&&(v=L),L>A&&(A=L)}return a[h+0]!==y||a[h+1]!==S||a[h+2]!==v||a[h+3]!==b||a[h+4]!==T||a[h+5]!==A?(a[h+0]=y,a[h+1]=S,a[h+2]=v,a[h+3]=b,a[h+4]=T,a[h+5]=A,!0):!1}else{let g=h+8,x=r[h+6],y=g+d,S=x+d,v=p,b=!1,T=!1;t?v||(b=t.has(y),T=t.has(S),v=!b&&!T):(b=!0,T=!0);let A=v||b,E=v||T,C=!1;A&&(C=f(g,d,v));let R=!1;E&&(R=f(x,d,v));let w=C||R;if(w)for(let P=0;P<3;P++){let L=g+P,D=x+P,O=a[L],it=a[L+3],Tt=a[D],At=a[D+3];a[h+P]=O<Tt?O:Tt,a[h+P+3]=it>At?it:At}return w}}}function xt(c,t,e,n,i){let s,r,o,a,l,u,f=1/e.direction.x,h=1/e.direction.y,d=1/e.direction.z,p=e.origin.x,m=e.origin.y,_=e.origin.z,g=t[c],x=t[c+3],y=t[c+1],S=t[c+3+1],v=t[c+2],b=t[c+3+2];return f>=0?(s=(g-p)*f,r=(x-p)*f):(s=(x-p)*f,r=(g-p)*f),h>=0?(o=(y-m)*h,a=(S-m)*h):(o=(S-m)*h,a=(y-m)*h),s>a||o>r||((o>s||isNaN(s))&&(s=o),(a<r||isNaN(r))&&(r=a),d>=0?(l=(v-_)*d,u=(b-_)*d):(l=(b-_)*d,u=(v-_)*d),s>u||l>r)?!1:((l>s||s!==s)&&(s=l),(u<r||r!==r)&&(r=u),s<=i&&r>=n)}function yr(c,t,e,n,i,s,r,o){let{geometry:a,_indirectBuffer:l}=c;for(let u=n,f=n+i;u<f;u++){let h=l?l[u]:u;ye(a,t,e,h,s,r,o)}}function vr(c,t,e,n,i,s,r){let{geometry:o,_indirectBuffer:a}=c,l=1/0,u=null;for(let f=n,h=n+i;f<h;f++){let d;d=ye(o,t,e,a?a[f]:f,null,s,r),d&&d.distance<l&&(u=d,l=d.distance)}return u}function Mr(c,t,e,n,i,s,r){let{geometry:o}=e,{index:a}=o,l=o.attributes.position;for(let u=c,f=t+c;u<f;u++){let h;if(h=e.resolveTriangleIndex(u),V(r,h*3,a,l),r.needsUpdate=!0,n(r,h,i,s))return!0}return!1}function Sr(c,t,e,n,i,s,r){B.setBuffer(c._roots[t]),as(0,c,e,n,i,s,r),B.clearBuffer()}function as(c,t,e,n,i,s,r){let{float32Array:o,uint16Array:a,uint32Array:l}=B,u=c*2;if(q(u,a)){let h=Z(c,l),d=$(u,a);mr(t,e,n,h,d,i,s,r)}else{let h=tt(c);xt(h,o,n,s,r)&&as(h,t,e,n,i,s,r);let d=et(c,l);xt(d,o,n,s,r)&&as(d,t,e,n,i,s,r)}}var cl=["x","y","z"];function br(c,t,e,n,i,s){B.setBuffer(c._roots[t]);let r=cs(0,c,e,n,i,s);return B.clearBuffer(),r}function cs(c,t,e,n,i,s){let{float32Array:r,uint16Array:o,uint32Array:a}=B,l=c*2;if(q(l,o)){let f=Z(c,a),h=$(l,o);return gr(t,e,n,f,h,i,s)}else{let f=Ln(c,a),h=cl[f],p=n.direction[h]>=0,m,_;p?(m=tt(c),_=et(c,a)):(m=et(c,a),_=tt(c));let x=xt(m,r,n,i,s)?cs(m,t,e,n,i,s):null;if(x){let v=x.point[h];if(p?v<=r[_+f]:v>=r[_+f+3])return x}let S=xt(_,r,n,i,s)?cs(_,t,e,n,i,s):null;return x&&S?x.distance<=S.distance?x:S:x||S||null}}var Vn=new X,ve=new nt,Me=new nt,He=new W,Tr=new Y,kn=new Y;function Ar(c,t,e,n){B.setBuffer(c._roots[t]);let i=ls(0,c,e,n);return B.clearBuffer(),i}function ls(c,t,e,n,i=null){let{float32Array:s,uint16Array:r,uint32Array:o}=B,a=c*2;if(i===null&&(e.boundingBox||e.computeBoundingBox(),Tr.set(e.boundingBox.min,e.boundingBox.max,n),i=Tr),q(a,r)){let u=t.geometry,f=u.index,h=u.attributes.position,d=e.index,p=e.attributes.position,m=Z(c,o),_=$(a,r);if(He.copy(n).invert(),e.boundsTree)return z(c,s,kn),kn.matrix.copy(He),kn.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:x=>kn.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(n),x.b.applyMatrix4(n),x.c.applyMatrix4(n),x.needsUpdate=!0;for(let y=m*3,S=(_+m)*3;y<S;y+=3)if(V(Me,y,f,h),Me.needsUpdate=!0,x.intersectsTriangle(Me))return!0;return!1}});for(let g=m*3,x=(_+m)*3;g<x;g+=3){V(ve,g,f,h),ve.a.applyMatrix4(He),ve.b.applyMatrix4(He),ve.c.applyMatrix4(He),ve.needsUpdate=!0;for(let y=0,S=d.count;y<S;y+=3)if(V(Me,y,d,p),Me.needsUpdate=!0,ve.intersectsTriangle(Me))return!0}}else{let u=c+8,f=o[c+6];return z(u,s,Vn),!!(i.intersectsBox(Vn)&&ls(u,t,e,n,i)||(z(f,s,Vn),i.intersectsBox(Vn)&&ls(f,t,e,n,i)))}}var Gn=new W,us=new Y,We=new Y,ll=new M,ul=new M,hl=new M,fl=new M;function Er(c,t,e,n={},i={},s=0,r=1/0){t.boundingBox||t.computeBoundingBox(),us.set(t.boundingBox.min,t.boundingBox.max,e),us.needsUpdate=!0;let o=c.geometry,a=o.attributes.position,l=o.index,u=t.attributes.position,f=t.index,h=lt.getPrimitive(),d=lt.getPrimitive(),p=ll,m=ul,_=null,g=null;i&&(_=hl,g=fl);let x=1/0,y=null,S=null;return Gn.copy(e).invert(),We.matrix.copy(Gn),c.shapecast({boundsTraverseOrder:v=>us.distanceToBox(v),intersectsBounds:(v,b,T)=>T<x&&T<r?(b&&(We.min.copy(v.min),We.max.copy(v.max),We.needsUpdate=!0),!0):!1,intersectsRange:(v,b)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:A=>We.distanceToBox(A),intersectsBounds:(A,E,C)=>C<x&&C<r,intersectsRange:(A,E)=>{for(let C=A,R=A+E;C<R;C++){V(d,3*C,f,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let w=v,P=v+b;w<P;w++){V(h,3*w,l,a),h.needsUpdate=!0;let L=h.distanceToTriangle(d,p,_);if(L<x&&(m.copy(p),g&&g.copy(_),x=L,y=w,S=C),L<s)return!0}}}});{let T=Et(t);for(let A=0,E=T;A<E;A++){V(d,3*A,f,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let C=v,R=v+b;C<R;C++){V(h,3*C,l,a),h.needsUpdate=!0;let w=h.distanceToTriangle(d,p,_);if(w<x&&(m.copy(p),g&&g.copy(_),x=w,y=C,S=A),w<s)return!0}}}}}),lt.releasePrimitive(h),lt.releasePrimitive(d),x===1/0?null:(n.point?n.point.copy(m):n.point=m.clone(),n.distance=x,n.faceIndex=y,i&&(i.point?i.point.copy(g):i.point=g.clone(),i.point.applyMatrix4(Gn),m.applyMatrix4(Gn),i.distance=m.sub(i.point).length(),i.faceIndex=S),n)}function wr(c,t=null){t&&Array.isArray(t)&&(t=new Set(t));let e=c.geometry,n=e.index?e.index.array:null,i=e.attributes.position,s,r,o,a,l=0,u=c._roots;for(let h=0,d=u.length;h<d;h++)s=u[h],r=new Uint32Array(s),o=new Uint16Array(s),a=new Float32Array(s),f(0,l),l+=s.byteLength;function f(h,d,p=!1){let m=h*2;if(o[m+15]===65535){let g=r[h+6],x=o[m+14],y=1/0,S=1/0,v=1/0,b=-1/0,T=-1/0,A=-1/0;for(let E=g,C=g+x;E<C;E++){let R=3*c.resolveTriangleIndex(E);for(let w=0;w<3;w++){let P=R+w;P=n?n[P]:P;let L=i.getX(P),D=i.getY(P),O=i.getZ(P);L<y&&(y=L),L>b&&(b=L),D<S&&(S=D),D>T&&(T=D),O<v&&(v=O),O>A&&(A=O)}}return a[h+0]!==y||a[h+1]!==S||a[h+2]!==v||a[h+3]!==b||a[h+4]!==T||a[h+5]!==A?(a[h+0]=y,a[h+1]=S,a[h+2]=v,a[h+3]=b,a[h+4]=T,a[h+5]=A,!0):!1}else{let g=h+8,x=r[h+6],y=g+d,S=x+d,v=p,b=!1,T=!1;t?v||(b=t.has(y),T=t.has(S),v=!b&&!T):(b=!0,T=!0);let A=v||b,E=v||T,C=!1;A&&(C=f(g,d,v));let R=!1;E&&(R=f(x,d,v));let w=C||R;if(w)for(let P=0;P<3;P++){let L=g+P,D=x+P,O=a[L],it=a[L+3],Tt=a[D],At=a[D+3];a[h+P]=O<Tt?O:Tt,a[h+P+3]=it>At?it:At}return w}}}function Cr(c,t,e,n,i,s,r){B.setBuffer(c._roots[t]),hs(0,c,e,n,i,s,r),B.clearBuffer()}function hs(c,t,e,n,i,s,r){let{float32Array:o,uint16Array:a,uint32Array:l}=B,u=c*2;if(q(u,a)){let h=Z(c,l),d=$(u,a);yr(t,e,n,h,d,i,s,r)}else{let h=tt(c);xt(h,o,n,s,r)&&hs(h,t,e,n,i,s,r);let d=et(c,l);xt(d,o,n,s,r)&&hs(d,t,e,n,i,s,r)}}var dl=["x","y","z"];function Rr(c,t,e,n,i,s){B.setBuffer(c._roots[t]);let r=fs(0,c,e,n,i,s);return B.clearBuffer(),r}function fs(c,t,e,n,i,s){let{float32Array:r,uint16Array:o,uint32Array:a}=B,l=c*2;if(q(l,o)){let f=Z(c,a),h=$(l,o);return vr(t,e,n,f,h,i,s)}else{let f=Ln(c,a),h=dl[f],p=n.direction[h]>=0,m,_;p?(m=tt(c),_=et(c,a)):(m=et(c,a),_=tt(c));let x=xt(m,r,n,i,s)?fs(m,t,e,n,i,s):null;if(x){let v=x.point[h];if(p?v<=r[_+f]:v>=r[_+f+3])return x}let S=xt(_,r,n,i,s)?fs(_,t,e,n,i,s):null;return x&&S?x.distance<=S.distance?x:S:x||S||null}}var Hn=new X,Se=new nt,be=new nt,Xe=new W,Pr=new Y,Wn=new Y;function Ir(c,t,e,n){B.setBuffer(c._roots[t]);let i=ds(0,c,e,n);return B.clearBuffer(),i}function ds(c,t,e,n,i=null){let{float32Array:s,uint16Array:r,uint32Array:o}=B,a=c*2;if(i===null&&(e.boundingBox||e.computeBoundingBox(),Pr.set(e.boundingBox.min,e.boundingBox.max,n),i=Pr),q(a,r)){let u=t.geometry,f=u.index,h=u.attributes.position,d=e.index,p=e.attributes.position,m=Z(c,o),_=$(a,r);if(Xe.copy(n).invert(),e.boundsTree)return z(c,s,Wn),Wn.matrix.copy(Xe),Wn.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:x=>Wn.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(n),x.b.applyMatrix4(n),x.c.applyMatrix4(n),x.needsUpdate=!0;for(let y=m,S=_+m;y<S;y++)if(V(be,3*t.resolveTriangleIndex(y),f,h),be.needsUpdate=!0,x.intersectsTriangle(be))return!0;return!1}});for(let g=m,x=_+m;g<x;g++){let y=t.resolveTriangleIndex(g);V(Se,3*y,f,h),Se.a.applyMatrix4(Xe),Se.b.applyMatrix4(Xe),Se.c.applyMatrix4(Xe),Se.needsUpdate=!0;for(let S=0,v=d.count;S<v;S+=3)if(V(be,S,d,p),be.needsUpdate=!0,Se.intersectsTriangle(be))return!0}}else{let u=c+8,f=o[c+6];return z(u,s,Hn),!!(i.intersectsBox(Hn)&&ds(u,t,e,n,i)||(z(f,s,Hn),i.intersectsBox(Hn)&&ds(f,t,e,n,i)))}}var Xn=new W,ps=new Y,qe=new Y,pl=new M,ml=new M,gl=new M,_l=new M;function Lr(c,t,e,n={},i={},s=0,r=1/0){t.boundingBox||t.computeBoundingBox(),ps.set(t.boundingBox.min,t.boundingBox.max,e),ps.needsUpdate=!0;let o=c.geometry,a=o.attributes.position,l=o.index,u=t.attributes.position,f=t.index,h=lt.getPrimitive(),d=lt.getPrimitive(),p=pl,m=ml,_=null,g=null;i&&(_=gl,g=_l);let x=1/0,y=null,S=null;return Xn.copy(e).invert(),qe.matrix.copy(Xn),c.shapecast({boundsTraverseOrder:v=>ps.distanceToBox(v),intersectsBounds:(v,b,T)=>T<x&&T<r?(b&&(qe.min.copy(v.min),qe.max.copy(v.max),qe.needsUpdate=!0),!0):!1,intersectsRange:(v,b)=>{if(t.boundsTree){let T=t.boundsTree;return T.shapecast({boundsTraverseOrder:A=>qe.distanceToBox(A),intersectsBounds:(A,E,C)=>C<x&&C<r,intersectsRange:(A,E)=>{for(let C=A,R=A+E;C<R;C++){let w=T.resolveTriangleIndex(C);V(d,3*w,f,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let P=v,L=v+b;P<L;P++){let D=c.resolveTriangleIndex(P);V(h,3*D,l,a),h.needsUpdate=!0;let O=h.distanceToTriangle(d,p,_);if(O<x&&(m.copy(p),g&&g.copy(_),x=O,y=P,S=C),O<s)return!0}}}})}else{let T=Et(t);for(let A=0,E=T;A<E;A++){V(d,3*A,f,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let C=v,R=v+b;C<R;C++){let w=c.resolveTriangleIndex(C);V(h,3*w,l,a),h.needsUpdate=!0;let P=h.distanceToTriangle(d,p,_);if(P<x&&(m.copy(p),g&&g.copy(_),x=P,y=C,S=A),P<s)return!0}}}}}),lt.releasePrimitive(h),lt.releasePrimitive(d),x===1/0?null:(n.point?n.point.copy(m):n.point=m.clone(),n.distance=x,n.faceIndex=y,i&&(i.point?i.point.copy(g):i.point=g.clone(),i.point.applyMatrix4(Xn),m.applyMatrix4(Xn),i.distance=m.sub(i.point).length(),i.faceIndex=S),n)}function Dr(){return typeof SharedArrayBuffer<"u"}var Ye=new B.constructor,qn=new B.constructor,Wt=new Gt(()=>new X),Te=new X,Ae=new X,ms=new X,gs=new X,_s=!1;function Nr(c,t,e,n){if(_s)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");_s=!0;let i=c._roots,s=t._roots,r,o=0,a=0,l=new W().copy(e).invert();for(let u=0,f=i.length;u<f;u++){Ye.setBuffer(i[u]),a=0;let h=Wt.getPrimitive();z(0,Ye.float32Array,h),h.applyMatrix4(l);for(let d=0,p=s.length;d<p&&(qn.setBuffer(s[d]),r=bt(0,0,e,l,n,o,a,0,0,h),qn.clearBuffer(),a+=s[d].length,!r);d++);if(Wt.releasePrimitive(h),Ye.clearBuffer(),o+=i[u].length,r)break}return _s=!1,r}function bt(c,t,e,n,i,s=0,r=0,o=0,a=0,l=null,u=!1){let f,h;u?(f=qn,h=Ye):(f=Ye,h=qn);let d=f.float32Array,p=f.uint32Array,m=f.uint16Array,_=h.float32Array,g=h.uint32Array,x=h.uint16Array,y=c*2,S=t*2,v=q(y,m),b=q(S,x),T=!1;if(b&&v)u?T=i(Z(t,g),$(t*2,x),Z(c,p),$(c*2,m),a,r+t,o,s+c):T=i(Z(c,p),$(c*2,m),Z(t,g),$(t*2,x),o,s+c,a,r+t);else if(b){let A=Wt.getPrimitive();z(t,_,A),A.applyMatrix4(e);let E=tt(c),C=et(c,p);z(E,d,Te),z(C,d,Ae);let R=A.intersectsBox(Te),w=A.intersectsBox(Ae);T=R&&bt(t,E,n,e,i,r,s,a,o+1,A,!u)||w&&bt(t,C,n,e,i,r,s,a,o+1,A,!u),Wt.releasePrimitive(A)}else{let A=tt(t),E=et(t,g);z(A,_,ms),z(E,_,gs);let C=l.intersectsBox(ms),R=l.intersectsBox(gs);if(C&&R)T=bt(c,A,e,n,i,s,r,o,a+1,l,u)||bt(c,E,e,n,i,s,r,o,a+1,l,u);else if(C)if(v)T=bt(c,A,e,n,i,s,r,o,a+1,l,u);else{let w=Wt.getPrimitive();w.copy(ms).applyMatrix4(e);let P=tt(c),L=et(c,p);z(P,d,Te),z(L,d,Ae);let D=w.intersectsBox(Te),O=w.intersectsBox(Ae);T=D&&bt(A,P,n,e,i,r,s,a,o+1,w,!u)||O&&bt(A,L,n,e,i,r,s,a,o+1,w,!u),Wt.releasePrimitive(w)}else if(R)if(v)T=bt(c,E,e,n,i,s,r,o,a+1,l,u);else{let w=Wt.getPrimitive();w.copy(gs).applyMatrix4(e);let P=tt(c),L=et(c,p);z(P,d,Te),z(L,d,Ae);let D=w.intersectsBox(Te),O=w.intersectsBox(Ae);T=D&&bt(E,P,n,e,i,r,s,a,o+1,w,!u)||O&&bt(E,L,n,e,i,r,s,a,o+1,w,!u),Wt.releasePrimitive(w)}}return T}var Yn=new Y,Ur=new X,xl={strategy:0,maxDepth:40,maxLeafTris:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0,range:null},Ze=class c{static serialize(t,e={}){e={cloneBuffers:!0,...e};let n=t.geometry,i=t._roots,s=t._indirectBuffer,r=n.getIndex(),o;return e.cloneBuffers?o={roots:i.map(a=>a.slice()),index:r?r.array.slice():null,indirectBuffer:s?s.slice():null}:o={roots:i,index:r?r.array:null,indirectBuffer:s},o}static deserialize(t,e,n={}){n={setIndex:!0,indirect:!!t.indirectBuffer,...n};let{index:i,roots:s,indirectBuffer:r}=t,o=new c(e,{...n,[Rn]:!0});if(o._roots=s,o._indirectBuffer=r||null,n.setIndex){let a=e.getIndex();if(a===null){let l=new ot(t.index,1,!1);e.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(t,e={}){if(t.isBufferGeometry){if(t.index&&t.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e=Object.assign({...xl,[Rn]:!1},e),e.useSharedArrayBuffer&&!Dr())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=t,this._roots=null,this._indirectBuffer=null,e[Rn]||(cr(this,e),!t.boundingBox&&e.setBoundingBox&&(t.boundingBox=this.getBoundingBox(new X))),this.resolveTriangleIndex=e.indirect?n=>this._indirectBuffer[n]:n=>n}refit(t=null){return(this.indirect?wr:xr)(this,t)}traverse(t,e=0){let n=this._roots[e],i=new Uint32Array(n),s=new Uint16Array(n);r(0);function r(o,a=0){let l=o*2,u=s[l+15]===65535;if(u){let f=i[o+6],h=s[l+14];t(a,u,new Float32Array(n,o*4,6),f,h)}else{let f=o+32/4,h=i[o+6],d=i[o+7];t(a,u,new Float32Array(n,o*4,6),d)||(r(f,a+1),r(h,a+1))}}}raycast(t,e=wn,n=0,i=1/0){let s=this._roots,r=this.geometry,o=[],a=e.isMaterial,l=Array.isArray(e),u=r.groups,f=a?e.side:e,h=this.indirect?Cr:Sr;for(let d=0,p=s.length;d<p;d++){let m=l?e[u[d].materialIndex].side:f,_=o.length;if(h(this,d,m,t,o,n,i),l){let g=u[d].materialIndex;for(let x=_,y=o.length;x<y;x++)o[x].face.materialIndex=g}}return o}raycastFirst(t,e=wn,n=0,i=1/0){let s=this._roots,r=this.geometry,o=e.isMaterial,a=Array.isArray(e),l=null,u=r.groups,f=o?e.side:e,h=this.indirect?Rr:br;for(let d=0,p=s.length;d<p;d++){let m=a?e[u[d].materialIndex].side:f,_=h(this,d,m,t,n,i);_!=null&&(l==null||_.distance<l.distance)&&(l=_,a&&(_.face.materialIndex=u[d].materialIndex))}return l}intersectsGeometry(t,e){let n=!1,i=this._roots,s=this.indirect?Ir:Ar;for(let r=0,o=i.length;r<o&&(n=s(this,r,t,e),!n);r++);return n}shapecast(t){let e=lt.getPrimitive(),n=this.indirect?Mr:_r,{boundsTraverseOrder:i,intersectsBounds:s,intersectsRange:r,intersectsTriangle:o}=t;if(r&&o){let f=r;r=(h,d,p,m,_)=>f(h,d,p,m,_)?!0:n(h,d,this,o,p,m,e)}else r||(o?r=(f,h,d,p)=>n(f,h,this,o,d,p,e):r=(f,h,d)=>d);let a=!1,l=0,u=this._roots;for(let f=0,h=u.length;f<h;f++){let d=u[f];if(a=ur(this,f,s,r,i,l),a)break;l+=d.byteLength}return lt.releasePrimitive(e),a}bvhcast(t,e,n){let{intersectsRanges:i,intersectsTriangles:s}=n,r=lt.getPrimitive(),o=this.geometry.index,a=this.geometry.attributes.position,l=this.indirect?p=>{let m=this.resolveTriangleIndex(p);V(r,m*3,o,a)}:p=>{V(r,p*3,o,a)},u=lt.getPrimitive(),f=t.geometry.index,h=t.geometry.attributes.position,d=t.indirect?p=>{let m=t.resolveTriangleIndex(p);V(u,m*3,f,h)}:p=>{V(u,p*3,f,h)};if(s){let p=(m,_,g,x,y,S,v,b)=>{for(let T=g,A=g+x;T<A;T++){d(T),u.a.applyMatrix4(e),u.b.applyMatrix4(e),u.c.applyMatrix4(e),u.needsUpdate=!0;for(let E=m,C=m+_;E<C;E++)if(l(E),r.needsUpdate=!0,s(r,u,E,T,y,S,v,b))return!0}return!1};if(i){let m=i;i=function(_,g,x,y,S,v,b,T){return m(_,g,x,y,S,v,b,T)?!0:p(_,g,x,y,S,v,b,T)}}else i=p}return Nr(this,t,e,i)}intersectsBox(t,e){return Yn.set(t.min,t.max,e),Yn.needsUpdate=!0,this.shapecast({intersectsBounds:n=>Yn.intersectsBox(n),intersectsTriangle:n=>Yn.intersectsTriangle(n)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,n={},i={},s=0,r=1/0){return(this.indirect?Lr:Er)(this,t,e,n,i,s,r)}closestPointToPoint(t,e={},n=0,i=1/0){return hr(this,t,e,n,i)}getBoundingBox(t){return t.makeEmpty(),this._roots.forEach(n=>{z(0,new Float32Array(n),Ur),t.union(Ur)}),t}};onmessage=({data:c})=>{let t=performance.now();function e(r){r=Math.min(r,1);let o=performance.now();o-t>=10&&r!==1&&(postMessage({error:null,serialized:null,position:null,progress:r}),t=o)}let{index:n,position:i,options:s}=c;try{let r=new Ue;if(r.setAttribute("position",new ot(i,3,!1)),n&&r.setIndex(new ot(n,1,!1)),s.includedProgressCallback&&(s.onProgress=e),s.groups){let u=s.groups;for(let f in u){let h=u[f];r.addGroup(h.start,h.count,h.materialIndex)}}let o=new Ze(r,s),a=Ze.serialize(o,{copyIndexBuffer:!1}),l=[i.buffer,...a.roots];a.index&&l.push(a.index.buffer),l=l.filter(u=>typeof SharedArrayBuffer>"u"||!(u instanceof SharedArrayBuffer)),o._indirectBuffer&&l.push(a.indirectBuffer.buffer),postMessage({error:null,serialized:a,position:i,progress:1},l)}catch(r){postMessage({error:r,serialized:null,position:null,progress:1})}};})();
|
|
3664
|
-
`});var yP={};Zg(yP,{ProjectBindingBuilder:()=>Uf,ProjectModelViewer:()=>Ff});module.exports=f_(yP);var K=require("react"),Fw=require("three"),Cn=require("lucide-react");var E=require("react");var _s=require("three"),No=require("three-mesh-bvh"),nb=!1,Ss=new WeakMap,Ll=new WeakMap;function b_(){nb||(_s.Mesh.prototype.raycast=No.acceleratedRaycast,nb=!0)}function v_(e){let t=new Set;return e.traverse(n=>{let i=n.geometry;!i||!i.attributes?.position||t.add(i)}),[...t]}function rb(e){let t=0;for(let n of e){let i=n.index?n.index.count:n.attributes.position.count;t+=i/3}return t}var Dl=12e6;function ib(e){return dh(e)>Dl}function dh(e){let t=new Set;return e.traverse(n=>{let i=n.geometry;i?.attributes?.position&&t.add(i)}),rb([...t])}function x_(e,t){return new Promise((n,i)=>{let r=c=>{let p=c.data;if(!p||!p.error&&!p.serialized)return;if(e.removeEventListener("message",r),e.removeEventListener("error",o),p.error){i(new Error(String(p.error)));return}let{serialized:u}=p,d=No.MeshBVH.deserialize(u,t,{setIndex:!1});u.index&&(t.index?t.index.array=u.index:t.setIndex(new _s.BufferAttribute(u.index,1,!1))),t.boundingBox=d.getBoundingBox(new _s.Box3),n(d)},o=c=>{e.removeEventListener("message",r),e.removeEventListener("error",o),i(new Error(c.message||"BVH worker error"))};e.addEventListener("message",r),e.addEventListener("error",o);let a=t.index?t.index.array.slice():null,s=t.attributes.position.array.slice(),l=[s,...a?[a]:[]].map(c=>c.buffer);e.postMessage({index:a,position:s,options:{groups:[...t.groups]}},l)})}async function y_(){if(typeof window>"u"||typeof Worker>"u")return null;try{let{bvhWorkerCode:e}=await Promise.resolve().then(()=>(tb(),eb)),t=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(t),i=new Worker(n);return{worker:i,dispose:()=>{i.terminate(),URL.revokeObjectURL(n)}}}catch{return null}}async function w_(e,t){if(t)try{return await x_(t,e)}catch{}let n=No.computeBoundsTree.call(e);return e.boundsTree=void 0,await new Promise(i=>setTimeout(i,0)),n}async function S_(e,t,n){if(e.boundsTree)return;if(t.buildPromise)return t.buildPromise;let i=(async()=>{let r=await n();t.references>0&&!e.boundsTree&&(e.boundsTree=r,t.ownedTree=r)})();return t.buildPromise=i.finally(()=>{t.buildPromise=void 0,t.references===0&&Ss.delete(e)}),t.buildPromise}async function bd(e,t){if(t?.aborted)return;let n=Ll.get(e);if(!n){if(n=v_(e),rb(n)>Dl){Ll.set(e,[]);return}Ll.set(e,n);for(let r of n){let o=Ss.get(r)??{references:0};o.references+=1,Ss.set(r,o)}}if(n.length===0)return;b_();let i=await y_();if(t?.aborted){i?.dispose();return}try{for(let r of n){if(t?.aborted)return;let o=Ss.get(r);o&&await S_(r,o,()=>w_(r,i?.worker))}}finally{i?.dispose()}}function Nl(e){let t=Ll.get(e);if(t){Ll.delete(e);for(let n of t){let i=Ss.get(n);i&&(i.references=Math.max(0,i.references-1),!(i.references>0)&&(i.ownedTree&&n.boundsTree===i.ownedTree&&(No.disposeBoundsTree.call(n),n.boundsTree=void 0),i.ownedTree=void 0,i.buildPromise||Ss.delete(n)))}}}var ap=require("@react-three/drei"),Qs=require("@react-three/fiber"),d1=require("qrcode.react"),Tt=require("three");var ob=require("lucide-react");var Bo=require("react/jsx-runtime");function ya({title:e,message:t,tone:n="default"}){return(0,Bo.jsxs)("div",{className:`ri-license-overlay${n==="error"?" ri-license-overlay--error":""}`,children:[(0,Bo.jsxs)("div",{className:"ri-license-overlay__header",children:[n==="error"?(0,Bo.jsx)(ob.AlertTriangle,{size:16,className:"ri-license-overlay__icon","aria-hidden":"true"}):(0,Bo.jsx)("span",{className:"ri-license-overlay__statusDot","aria-hidden":"true"}),(0,Bo.jsx)("span",{className:"ri-license-overlay__title",children:e})]}),(0,Bo.jsx)("p",{className:"ri-license-overlay__message",children:t})]})}var ab=require("react"),vd=class extends ab.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,i){this.props.onLoadError?.(n)}render(){return this.state.hasError?null:this.props.children}};var Ms=require("three");var sb="riEditorGizmo";function xd(e){return e.userData[sb]=!0,e}function yd(e){let t=[];return e.traverse(n=>{n.visible&&n.userData[sb]&&(n.visible=!1,t.push(n))}),()=>{for(let n of t)n.visible=!0}}function wd(e,t={}){if(!e)return Promise.reject(new Error("Viewer not ready"));let{gl:n,scene:i,camera:r,invalidate:o}=e;if(!n.getContextAttributes().preserveDrawingBuffer)return Promise.reject(new Error("Screenshot capture is disabled. Set preserveDrawingBuffer on ModelViewer to enable it."));let{transparent:a=!1}=t,s=n.getSize(new Ms.Vector2),l=n.getPixelRatio(),c=r instanceof Ms.PerspectiveCamera?r.aspect:null,p=i.background,u=t.width??s.x,d=t.height??s.y,m=u!==s.x||d!==s.y,g=yd(i);return a&&(i.background=null),m&&(n.setPixelRatio(1),n.setSize(u,d,!1),r instanceof Ms.PerspectiveCamera&&(r.aspect=u/d,r.updateProjectionMatrix())),o(),new Promise((v,M)=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{let w,x;try{w=n.domElement.toDataURL("image/png")}catch(S){x=S}g(),a&&(i.background=p),m&&(n.setPixelRatio(l),n.setSize(s.x,s.y,!1),r instanceof Ms.PerspectiveCamera&&c!==null&&(r.aspect=c,r.updateProjectionMatrix())),o(),x?M(x):v(w)})})})}var uh={webm:["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"],mp4:["video/mp4;codecs=avc1.42E01E","video/mp4"]};function wa(e="auto"){return typeof MediaRecorder>"u"?null:(e==="auto"?[...uh.webm,...uh.mp4]:uh[e]).find(n=>MediaRecorder.isTypeSupported(n))??null}function lb(e,t={}){let{fps:n=30,videoBitsPerSecond:i=8e6,signal:r}=t;if(!Number.isFinite(n)||n<1||n>60)throw new Error("Video frame rate must be between 1 and 60.");if(!Number.isFinite(i)||i<=0)throw new Error("Video bitrate must be a positive number.");if(r?.aborted)throw new DOMException("Video export cancelled.","AbortError");let o=wa(t.format);if(!o||typeof e.captureStream!="function"){let _=t.format&&t.format!=="auto"?` as ${t.format.toUpperCase()}`:"";throw new Error(`Video recording${_} is not supported in this browser.`)}let a,s,l=!1,c=!1,p,u,d,m=[],g,v,M=new Promise((_,y)=>{g=_,v=y}),w=()=>{clearTimeout(p),u!==void 0&&cancelAnimationFrame(u),d!==void 0&&cancelAnimationFrame(d),r?.removeEventListener("abort",S),e.removeEventListener("webglcontextlost",k),s&&(s.ondataavailable=null,s.onstop=null,s.onerror=null),a?.getTracks().forEach(_=>_.stop())},x=(_=new DOMException("Video export cancelled.","AbortError"))=>{if(!l){if(l=!0,w(),s&&s.state!=="inactive")try{s.stop()}catch{}v(_)}},S=()=>x(),k=()=>x(new Error("Video export stopped because the WebGL context was lost.")),b=()=>x(new Error("Video export timed out. Keep the viewer tab visible while recording."));return r?.addEventListener("abort",S,{once:!0}),e.addEventListener("webglcontextlost",k),p=setTimeout(b,3e4),{result:M,cancel:x,start(_){l||u!==void 0||(u=requestAnimationFrame(()=>{if(!l)try{a=e.captureStream(n);let y=new MediaRecorder(a,{mimeType:o,videoBitsPerSecond:i});s=y,y.ondataavailable=({data:h})=>{h.size>0&&m.push(h)},y.onerror=()=>x(new Error("The browser could not encode the video.")),y.onstop=()=>{if(l)return;l=!0,w();let h=new Blob(m,{type:y.mimeType||o});h.size===0?v(new Error("The browser produced an empty video.")):g(h)},y.start(1e3),clearTimeout(p),p=setTimeout(b,(_+30)*1e3)}catch(y){x(y)}}))},finish(){l||c||(c=!0,d=requestAnimationFrame(()=>{if(!l)try{if(!s)throw new Error("Video recording did not start.");s.stop()}catch(_){x(_)}}))}}}var zr=require("react"),hh=require("three");var Zt=require("react"),Sd=require("@react-three/fiber"),zn=require("three");function ph(e){if(e.duration!==void 0)return e.duration;let t=e.waypoints??[];if(t.length<2)return 24;let n=e.loop===!1?t.slice(0,-1):t;return Math.max(n.reduce((i,r)=>i+(r.segmentDuration??3.5),0),4)}var __=1.2;function _d({controlsRef:e,sceneRef:t,config:n,playing:i,resetOnPlay:r=!1,onFinished:o,onUserInteract:a,onStop:s,playOnce:l=!1,startAtPath:c=!1,onStarted:p,onProgress:u}){let d=(0,Sd.useThree)(O=>O.invalidate),m=(0,Zt.useMemo)(()=>n.waypoints??[],[n.waypoints]),g=m.length>=2,v=n.loop??!0,M=ph(n),w=(0,Zt.useMemo)(()=>m.map(O=>[...O.position,...O.target,O.azimuthAngle??"",O.polarAngle??"",O.segmentDuration??""].join(",")).join(";"),[m]),x=(0,Zt.useMemo)(()=>{let O=[];if(m.length<2)return O;let $=0;for(let le=0;le<m.length-1;le++)$+=m[le].segmentDuration??3.5,O.push($);return v&&m.length>1&&($+=m[m.length-1].segmentDuration??3.5,O.push($)),O},[m,v]),S=(0,Zt.useMemo)(()=>O=>{if(m.length<2||x.length===0)return O/M;let $=x[x.length-1],le=v?O%M:Math.min(O,M),tt=M>0?le/M*$:0;for(let xe=0;xe<x.length;xe++)if(tt<=x[xe]){let nt=xe===0?0:x[xe-1],ce=x[xe]-nt,Le=ce>0?(tt-nt)/ce:0,he=v?m.length:m.length-1,pt=xe/he,Bt=1/he;return pt+Le*Bt}return 1},[m.length,x,M,v]),k=(0,Zt.useMemo)(()=>g?{position:new zn.CatmullRomCurve3(m.map(O=>new zn.Vector3(...O.position)),v,"catmullrom",.5),target:new zn.CatmullRomCurve3(m.map(O=>new zn.Vector3(...O.target)),v,"catmullrom",.5)}:null,[w,g,v]),b=(0,Zt.useMemo)(()=>{if(!g||!m.every($=>Number.isFinite($.azimuthAngle)&&Number.isFinite($.polarAngle)))return null;let O=m.map($=>({azimuth:$.azimuthAngle,polar:$.polarAngle,distance:new zn.Vector3(...$.position).distanceTo(new zn.Vector3(...$.target))}));for(let $=1;$<O.length;$+=1){let le=O[$-1].azimuth,tt=O[$].azimuth;O[$].azimuth=tt+Math.round((le-tt)/(Math.PI*2))*Math.PI*2}return O},[w,g]),_=(0,Zt.useRef)(0),y=(0,Zt.useRef)(0),h=(0,Zt.useRef)(new zn.Vector3),P=(0,Zt.useRef)(new zn.Vector3),A=(0,Zt.useRef)(!1),C=(0,Zt.useRef)(!0),D=(0,Zt.useRef)(0),B=(0,Zt.useRef)(!1),j=(0,Zt.useRef)(null),W=(0,Zt.useMemo)(()=>new zn.Vector3,[]),U=(0,Zt.useMemo)(()=>new zn.Vector3,[]),te=(0,Zt.useMemo)(()=>new zn.Spherical,[]);return(0,Zt.useEffect)(()=>{_.current=0,D.current=0,y.current=0,B.current=!1},[w,v,M]),(0,Zt.useEffect)(()=>{r&&(D.current=0,_.current=0,B.current=!1)},[r]),(0,Zt.useEffect)(()=>{if(!i){A.current=!1,_.current>0&&!r?D.current=_.current:r&&(D.current=0),(_.current>0||B.current)&&s?.();return}_.current>=M&&!v&&(_.current=0,D.current=0,B.current=!1);let O=e.current;if(O&&(O.getPosition(h.current),O.getTarget(P.current)),r||B.current||D.current===0?(_.current=0,D.current=0,B.current=!1):D.current>0&&D.current<M?_.current=D.current:(_.current=0,D.current=0),y.current=0,!g){let $=t.current;if($){let le=new zn.Box3().setFromObject($).getBoundingSphere(new zn.Sphere);j.current={center:le.center.clone(),radius:le.radius>0?le.radius:1}}}A.current=!0,C.current=!0,d()},[i,g,e,t,d,M,v,w,r,s]),(0,Zt.useEffect)(()=>{if(!i||!a)return;let O=e.current;if(!O)return;let $=()=>{B.current||a()};return O.addEventListener("controlstart",$),()=>O.removeEventListener("controlstart",$)},[i,e,a]),(0,Sd.useFrame)((O,$)=>{if(!i||!A.current)return;let le=e.current;if(!le)return;let tt=C.current;C.current=!1,(!tt||!c)&&(_.current+=$,y.current+=$);let xe=(!v||l)&&_.current>=M,nt=xe&&v?0:S(_.current);if(nt=v?nt%1:Math.min(nt,1),k)if(k.target.getPoint(nt,U),b){let Le=v?b.length:b.length-1,he=Math.min(nt,1)*Le,pt=Math.min(Math.floor(he),Le-1),Bt=(pt+1)%b.length,un=nt>=1?1:he-pt,Ie=un*un*(3-2*un),bt=b[pt],Ot=b[Bt],dr=Ot.azimuth+Math.round((bt.azimuth-Ot.azimuth)/(Math.PI*2))*Math.PI*2,de=bt.azimuth+(dr-bt.azimuth)*Ie,Cr=bt.polar+(Ot.polar-bt.polar)*Ie,Xt=bt.distance+(Ot.distance-bt.distance)*Ie;te.set(Math.max(Xt,1e-6),Math.min(Math.max(Cr,1e-6),Math.PI-1e-6),de),W.setFromSpherical(te).add(U)}else k.position.getPoint(nt,W);else{let Le=j.current;if(!Le)return;let he=nt*Math.PI*2,pt=Le.radius*2.2;W.set(Le.center.x+Math.cos(he)*pt,Le.center.y+Le.radius*.6,Le.center.z+Math.sin(he)*pt),U.copy(Le.center)}let ce=c?1:Math.min(y.current/__,1);if(ce<1){let Le=ce*ce*(3-2*ce);W.lerpVectors(h.current,W,Le),U.lerpVectors(P.current,U,Le)}if(le.setLookAt(W.x,W.y,W.z,U.x,U.y,U.z,!1),tt&&p?.(),u?.(Math.min(_.current/M,1)),xe){A.current=!1,B.current=!0,_.current=0,D.current=0,o?.();return}d()}),null}function cb(e){let t=(0,zr.useRef)(e);t.current=e;let n=(0,zr.useRef)(null),[i,r]=(0,zr.useState)(null),[o,a]=(0,zr.useState)(0),s=(0,zr.useCallback)(()=>n.current?.cancel(),[]),l=(0,zr.useCallback)(()=>n.current!==null,[]);(0,zr.useEffect)(()=>s,[e.modelUrl,s]);let c=(0,zr.useCallback)(async(u={})=>{let{rendererCaptureRef:d,controlsRef:m,cinematicConfig:g,ready:v,onCaptureStart:M}=t.current,w=d.current,x=m.current;if(!v||!w||!x)throw new Error("Viewer not ready for video export.");if(w.gl.xr.isPresenting)throw new Error("Exit the XR session before recording a video.");if(n.current)throw new Error("A video export is already in progress.");let S=u.mode??(g?"cinematic":"turntable");if(S==="cinematic"&&!g)throw new Error("Enable a cinematic camera path before recording it.");let k=S==="cinematic"?g:{loop:!0},b=u.duration??ph(k);if(!Number.isFinite(b)||b<=0||b>300)throw new Error("Video duration must be greater than 0 and at most 300 seconds.");let _=lb(w.gl.domElement,u);n.current=_;let y=x.getPosition(new hh.Vector3),h=x.getTarget(new hh.Vector3),P=x.enabled,A=yd(w.scene);x.stop(),x.enabled=!1,a(0),M(),r({config:{...k,duration:b,autoPlay:!1},onStarted:()=>_.start(b),onFinished:_.finish});try{return await _.result}finally{A(),x.enabled=P,x.setLookAt(y.x,y.y,y.z,h.x,h.y,h.z,!1),w.invalidate(),n.current=null,r(null)}},[]),p=(0,zr.useCallback)(u=>{let d=Math.floor(u*100);a(m=>m===d?m:d)},[]);return{captureVideo:c,cancelVideo:s,isRecording:l,recording:i,progress:o,onProgress:p}}var ei=require("react");function db(e){let[t,n]=(0,ei.useState)(null),[i,r]=(0,ei.useState)(!1),[o,a]=(0,ei.useState)(!1),[s,l]=(0,ei.useState)(!1),[c,p]=(0,ei.useState)(null),u=(0,ei.useRef)(!1);(0,ei.useEffect)(()=>{if(!t||!e){r(!1),a(!1),p(null);return}let m=t.ownerDocument;r(m.fullscreenEnabled===!0&&typeof t.requestFullscreen=="function"&&typeof m.exitFullscreen=="function");let g=()=>{a(m.fullscreenElement===t),p(null)};return g(),m.addEventListener("fullscreenchange",g),()=>m.removeEventListener("fullscreenchange",g)},[t,e]);let d=(0,ei.useCallback)(async()=>{if(!t||!e||!i||u.current)return;let m=t.ownerDocument,g=m.fullscreenElement===t;u.current=!0,l(!0),p(null);try{g?await m.exitFullscreen():await t.requestFullscreen(),a(m.fullscreenElement===t)}catch{p(g?"Could not exit fullscreen. Press Escape to exit.":"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.")}finally{u.current=!1,l(!1)}},[t,e,i]);return{rootRef:n,supported:i,active:o,pending:s,error:c,toggle:d}}var Jn=require("react");function ub(e,{onLost:t,onRestored:n,initiallyLost:i=!1}){let r=i,o=s=>{s.preventDefault(),!r&&(r=!0,t())},a=()=>{r&&(r=!1,n())};return e.addEventListener("webglcontextlost",o),e.addEventListener("webglcontextrestored",a),i&&t(),()=>{e.removeEventListener("webglcontextlost",o),e.removeEventListener("webglcontextrestored",a)}}function pb(){let[e,t]=(0,Jn.useState)(null),[n,i]=(0,Jn.useState)(0),[r,o]=(0,Jn.useState)("ready"),a=(0,Jn.useRef)(null),s=(0,Jn.useRef)(!1),l=(0,Jn.useRef)(null),c=(0,Jn.useRef)(null),p=(0,Jn.useCallback)(m=>{c.current?.dispose(),c.current=null,l.current=m,t(m)},[]),u=(0,Jn.useCallback)(()=>{s.current||(s.current=!0,a.current?.(),a.current=null,l.current&&(c.current=l.current),l.current=null,t(null),o("rebuilding"),i(m=>m+1))},[]),d=(0,Jn.useCallback)(()=>{s.current=!1,o("lost")},[]);return(0,Jn.useEffect)(()=>()=>{c.current?.dispose(),c.current=null},[]),(0,Jn.useEffect)(()=>{if(!e)return;s.current=!1,o("ready");let m=ub(e.domElement,{initiallyLost:e.getContext().isContextLost(),onLost:d,onRestored:u});return a.current=m,()=>{m(),a.current===m&&(a.current=null)}},[e,d,u]),{generation:n,status:r,reload:u,fail:d,onRendererCreated:p}}var hb=require("react"),Cs=class extends hb.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,i){this.props.onError?.(n)}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};var Ts=require("react");function mb({modelUrl:e,tilesetUrl:t=null,getOptions:n,now:i=()=>performance.now(),timestamp:r=()=>new Date().toISOString(),sessionId:o=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`viewer-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,log:a=l=>console.info("[react-immersive engagement]",l),warn:s=l=>console.warn("[react-immersive] onEngagement callback failed:",l)}){let l=i(),c=()=>{let C=n();return!!(C.onEngagement||C.debugEngagement)},p=C=>Math.max(0,Math.round(i()-C)),u=C=>{let{onEngagement:D,debugEngagement:B}=n();if(!D&&!B)return;let j={...C,sessionId:o,timestamp:r(),elapsedMs:p(l),modelUrl:e,tilesetUrl:t};B&&a(j);try{Promise.resolve(D?.(j)).catch(s)}catch(W){s(W)}},d=null,m=null,g=null,v=null,M=null,w=C=>{d=C},x=C=>{!c()||d===C.objectKey||(d=C.objectKey,u({type:"part-viewed",...C}))},S=(C,D)=>{let B=JSON.stringify([D,C]);!c()||C===D||B===m||(m=B,u({type:"variant-chosen",variant:C,previousVariant:D}))},k=C=>{C!==g&&(g=C,m=null)},b=()=>{!c()||v!==null||(v=i(),u({type:"ar-started"}))},_=(C="session-ended")=>{if(v===null)return;let D=p(v);v=null,u({type:"ar-ended",durationMs:D,reason:C})},y=(C="stopped")=>{if(!M)return;let{startedAt:D,annotationCount:B}=M;M=null,u({type:"tour-stopped",annotationCount:B,durationMs:p(D),reason:C})};return{setSelectedPart:w,viewPart:x,setMaterialVariant:k,chooseVariant:S,startAR:b,endAR:_,startTour:C=>{!c()||C<=0||(y("restarted"),M={startedAt:i(),annotationCount:C},u({type:"tour-started",annotationCount:C}))},stopTour:y,completeTour:()=>{if(!M)return;let{startedAt:C,annotationCount:D}=M;M=null,u({type:"tour-completed",annotationCount:D,durationMs:p(C)})},interrupt:()=>{_("interrupted"),y("interrupted")},requestARLaunch:C=>u({type:"ar-launch-requested",channel:C})}}function fb(e){let t=(0,Ts.useRef)(e);t.current=e;let n=!!(e.onEngagement||e.debugEngagement),i=(0,Ts.useMemo)(()=>mb({modelUrl:e.modelUrl,tilesetUrl:e.tilesetUrl,getOptions:()=>t.current}),[e.modelUrl,e.tilesetUrl,n]);return(0,Ts.useEffect)(()=>()=>i.interrupt(),[i]),i}var Ps=require("fflate");var gb;function bb(e){gb=e}function Bl(e){gb?.(e)}var M_=[".glb",".gltf",".obj",".fbx",".usdz",".zip"],C_=["model/gltf-binary","model/gltf+json","model/vnd.usdz+zip","application/vnd.usdz+zip","application/zip","application/x-zip-compressed"],Ol=1024*1024,vb=128*Ol,xb=1024,yb=128*Ol,wb=256*Ol,Sb=200,T_=Ol,so=new Map,Tb=".glb,.gltf,.obj,.fbx,.usdz,.zip,model/gltf-binary,model/gltf+json,model/vnd.usdz+zip,application/vnd.usdz+zip,application/zip";function Il(e){let t=e.split(/[?#]/,1)[0].toLowerCase();return t.endsWith(".obj")?"obj":t.endsWith(".fbx")?"fbx":t.endsWith(".usdz")?"usdz":t.endsWith(".gltf")?"gltf":"glb"}function Pb(e){return so.get(e)??{format:Il(e)}}function P_(e){let t=e.name.toLowerCase();return M_.some(n=>t.endsWith(n))||C_.includes(e.type)}async function fh(e){if(!P_(e))throw new Error("Unsupported model file. Please upload a .glb, .gltf, .obj, .fbx, .usdz, or .zip asset.");let t=e.name.toLowerCase();if(t.endsWith(".usdz")||e.type==="model/vnd.usdz+zip"||e.type==="application/vnd.usdz+zip")return _b(e,"usdz");if(t.endsWith(".zip")||A_(e.type))return E_(e);if(t.endsWith(".gltf")||e.type==="model/gltf+json")return Mb(e);let n=Il(e.name);return n==="gltf"?Mb(e):_b(e,n)}function _b(e,t){let n=URL.createObjectURL(e);return so.set(n,{format:t,entryPath:e.name}),{url:n,name:e.name,format:t,cleanup:()=>{Bl(n),so.delete(n),URL.revokeObjectURL(n)}}}function A_(e){return e==="application/zip"||e==="application/x-zip-compressed"}async function Mb(e){let t=await e.text(),n=Ab(t,e.name);for(let r of Eb(n))if(!gh(r))throw new Error(`${e.name} references external assets. Upload a .zip containing the .gltf file and its dependencies.`);let i=URL.createObjectURL(e);return so.set(i,{format:"gltf",entryPath:e.name}),{url:i,name:e.name,format:"gltf",cleanup:()=>{Bl(i),so.delete(i),URL.revokeObjectURL(i)}}}async function E_(e){if(e.size>vb)throw new Error(`Model zip is too large. The compressed archive must be ${mh(vb)} or smaller.`);let t=await R_(new Uint8Array(await e.arrayBuffer())),n=new Map;for(let[a,s]of Object.entries(t)){let l=bh(a);!l||Rb(l)||n.set(l,s)}let i=[...n.keys()].filter(a=>/\.(gltf|obj|fbx)$/i.test(a));if(i.length===0)throw new Error("Invalid model zip: no .gltf, .obj, or .fbx file found.");if(i.length>1)throw new Error("Invalid model zip: multiple model entry files found.");let r=i[0],o=Il(r);if(o==="gltf")return L_(e,r,n);if(o==="obj"||o==="fbx")return k_(e,r,o,n);throw new Error(`Unsupported model entry ${r}.`)}function R_(e){return new Promise((t,n)=>{let i=0,r=0,o=null,a=l=>(o??(o=new Error(`Invalid model zip: ${l}`)),!1);(0,Ps.unzip)(e,{filter:l=>{if(o)return!1;if(i+=1,i>xb)return a(`archive contains more than ${xb.toLocaleString()} entries.`);if(l.originalSize>yb)return a(`${l.name} expands beyond the ${mh(yb)} per-file limit.`);if(r+=l.originalSize,r>wb)return a(`expanded contents exceed ${mh(wb)}.`);if(l.originalSize>=T_&&(l.size===0||l.originalSize/l.size>Sb))return a(`${l.name} exceeds the ${Sb}:1 compression-ratio limit.`);let c=bh(l.name);return!!c&&!Rb(c)}},(l,c)=>{o?n(o):l?n(new Error(`Invalid model zip: ${l.message}`)):t(c)})})}function mh(e){return`${e/Ol} MiB`}function k_(e,t,n,i){let r=[],o={};for(let[s,l]of i){let c=URL.createObjectURL(new Blob([l],{type:kb(s)}));r.push(c),o[s]=c}let a=o[t];if(!a)throw r.forEach(s=>URL.revokeObjectURL(s)),new Error(`Invalid model zip: could not read ${t}.`);return so.set(a,{format:n,entryPath:t,resourceUrls:o}),{url:a,name:e.name,format:n,cleanup:()=>{Bl(a),so.delete(a),r.forEach(s=>URL.revokeObjectURL(s))}}}function L_(e,t,n){let i=n.get(t);if(!i)throw new Error("Invalid GLTF zip: no .gltf found.");let r=Ab((0,Ps.strFromU8)(i),t);D_(r,t);let o=N_(t),a=[];try{Cb(r.buffers,o,n,a),Cb(r.images,o,n,a);let s=new Blob([(0,Ps.strToU8)(JSON.stringify(r))],{type:"model/gltf+json"}),l=URL.createObjectURL(s);return a.push(l),so.set(l,{format:"gltf",entryPath:t}),{url:l,name:e.name,format:"gltf",cleanup:()=>{Bl(l),so.delete(l),a.forEach(c=>URL.revokeObjectURL(c))}}}catch(s){throw a.forEach(l=>URL.revokeObjectURL(l)),s}}function Cb(e,t,n,i){for(let r of e??[]){if(typeof r.uri!="string"||gh(r.uri))continue;let o=B_(t,r.uri),a=n.get(o);if(!a)throw new Error(`Invalid GLTF zip: missing referenced asset ${r.uri}.`);let s=URL.createObjectURL(new Blob([a],{type:kb(o)}));i.push(s),r.uri=s}}function Ab(e,t){try{return JSON.parse(e)}catch{throw new Error(`${t} is not a valid .gltf JSON file.`)}}function Eb(e){return[...e.buffers??[],...e.images??[]].map(t=>t.uri).filter(t=>typeof t=="string"&&t.length>0)}function D_(e,t){for(let n of Eb(e)){if(gh(n))continue;let i=/^[a-z][a-z0-9+.-]*:/i.test(n),r=n.startsWith("/")||n.startsWith("\\");if(i||r)throw new Error(`${t} references external assets. Include every dependency inside the uploaded .zip.`)}}function gh(e){return e.startsWith("data:")}function bh(e){let t=[];for(let n of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(i=>i&&i!==".")){if(n===".."){t.pop();continue}t.push(n)}return t.join("/")}function Rb(e){let t=e.split("/");return e.endsWith("/")||t.includes("__MACOSX")||t.some(n=>n===".DS_Store"||n.startsWith("._"))}function N_(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function B_(e,t){let n=t.split(/[?#]/)[0],i=O_(n);return bh(e?`${e}/${i}`:i)}function O_(e){try{return decodeURI(e)}catch{return e}}function kb(e){let t=e.toLowerCase();return t.endsWith(".obj")||t.endsWith(".mtl")?"text/plain":t.endsWith(".fbx")?"application/octet-stream":t.endsWith(".usdz")?"model/vnd.usdz+zip":t.endsWith(".bin")?"application/octet-stream":t.endsWith(".png")?"image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?"image/jpeg":t.endsWith(".webp")?"image/webp":t.endsWith(".avif")?"image/avif":t.endsWith(".ktx2")?"image/ktx2":"application/octet-stream"}var I_={glb:"GLB",gltf:"glTF",obj:"OBJ",fbx:"FBX",usdz:"USDZ"},z_=/\.(glb|gltf|obj|fbx|usdz|zip)$/i;function U_(e,t){let n=e?.response?.status;if(typeof n=="number")return n;let i=/responded with (\d{3})/.exec(t);return i?Number(i[1]):null}function Lb(e,t,n){let i=e instanceof Error?e.message:e==null?"":String(e),r="This model couldn't be loaded",o=i||null,a=U_(e,i);if(a===404||a===410)return{title:r,detail:`Nothing was found at this address (${a}). Check that modelUrl points to the file.`,technical:o};if(a===401||a===403)return{title:r,detail:`The server refused access to the file (${a}). Check that the file is public, or that a signed URL hasn't expired.`,technical:o};if(a!==null)return{title:r,detail:`The server responded with ${a} when the file was requested.`,technical:o};if(/failed to fetch|networkerror|load failed|network error/i.test(i))return{title:r,detail:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",technical:o};if(/<!doctype|<html/i.test(i))return{title:r,detail:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",technical:o};let s=t.split(/[?#]/,1)[0],l=I_[n??Il(t)],c=z_.test(s);return{title:r,detail:c||n?`The file couldn't be read as ${l}. Check that it's a valid ${l} file${n?" and that modelFormat matches it":""}.`:`The file couldn't be read as ${l}. The URL has no file extension, so set modelFormat to the file's format.`,technical:o}}var Db={showObjectBindingDataPanel:!1,showSceneObjectsPanel:!1,showDownloadButton:!1,showResetButton:!1,showAnnotationNavigation:!1,showMaterialVariants:!1},F_=Object.freeze({minimal:Object.freeze({...Db}),showcase:Object.freeze({...Db,autoRotate:!0}),configurator:Object.freeze({showObjectBindingDataPanel:!0,showSceneObjectsPanel:!1,showDownloadButton:!1,showResetButton:!0,showMaterialVariants:!0}),inspector:Object.freeze({showObjectBindingDataPanel:!0,showSceneObjectsPanel:!0,showDownloadButton:!0,showResetButton:!0,showViewGizmo:!0,showMeasureTools:!0,showUvCheckerButton:!0,showExplodeControls:!0,showSectionTools:!0,showIsolateControls:!0,enableKeyboardNavigation:!0})}),V_=["preset","ui","tools","controls","perf","tiles","xr","decoders"];function Nb(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function j_({ui:e,tools:t,controls:n,perf:i,tiles:r,xr:o,decoders:a}){let s=e?.download,l=e?.mouseController,c=t?.measure,p=n?.autoRotate;return{showObjectBindingDataPanel:e?.objectPanel,showSceneObjectsPanel:e?.sceneObjects,showDownloadButton:s===void 0?void 0:s!==!1,downloadFilename:typeof s=="string"?s:void 0,showResetButton:e?.reset,showFullscreenButton:e?.fullscreen,showLoadingOverlay:e?.loadingOverlay,showViewGizmo:e?.viewGizmo,showMouseController:l===void 0?void 0:l!==!1,mouseControllerPosition:typeof l=="object"?l.position:void 0,mouseControllerOpacity:typeof l=="object"?l.opacity:void 0,showAnnotationNavigation:e?.annotationNavigation,showAnnotationOnHover:e?.annotationOnHover,highlightOnHover:e?.highlightOnHover,showMaterialVariants:e?.materialVariants,showMeasureTools:c===void 0?void 0:c!==!1,measurementUnit:typeof c=="object"?c.unit:void 0,showUvCheckerButton:t?.uvChecker,showExplodeControls:t?.explode,showSectionTools:t?.section,showIsolateControls:t?.isolate,texturePositioning:t?.texturePositioning,enableCameraControls:n?.enabled,enableKeyboardNavigation:n?.keyboard,disableZoom:n?.zoom===void 0?void 0:!n.zoom,zoomOnSelected:n?.zoomOnSelect,autoRotate:p===void 0?void 0:p!==!1,autoRotateSpeed:typeof p=="number"?p:void 0,refitOnResize:n?.refitOnResize,cameraLimits:n?.limits,moveSensitivity:n?.moveSensitivity,zoomSensitivity:n?.zoomSensitivity,renderMode:i?.renderMode,maxDpr:i?.maxDpr,performanceProfile:i?.profile,preserveDrawingBuffer:i?.preserveDrawingBuffer,tilesetUrl:r?.url,tilesErrorTarget:r?.errorTarget,tilesCacheSize:r?.cacheSize,enableXR:o?.enabled,usdzUrl:o?.usdzUrl,arScaleMode:o?.scaleMode,mobileHandoffUrl:o?.mobileHandoffUrl,dracoDecoderPath:a?.draco,ktx2TranscoderPath:a?.ktx2,meshopt:a?.meshopt}}function Bb(e){let t={...e};for(let n of V_)delete t[n];return{...e.preset?F_[e.preset]:void 0,...Nb(t),...Nb(j_(e))}}var Sa=Object.freeze([{id:"change-color",label:"Change Color",handling:"viewer",description:"Opens a color picker docked under the action and commits the result to style.material.baseColor."},{id:"change-material",label:"Change Material",handling:"viewer",description:"Opens the material picker so the viewer can swap the object's texture."},{id:"add-text",label:"Add Text",handling:"viewer",description:"Opens a text box docked under the action; the viewer's user types, clicks the object to place it, and can resize, turn, move, or remove it. Saved to the binding's decals."},{id:"add-image",label:"Add Image",handling:"viewer",description:"Lets the viewer's user choose an image, click the object to place it, and resize, turn, move, or remove it. Saved to the binding's decals."},{id:"toggle-visibility",label:"Toggle Visibility",handling:"viewer",description:"Flips the binding's visible flag."},{id:"toggle-light",label:"Toggle Light",handling:"viewer",description:"Turns the scene lights attached to this object on or off, or the object's own glow when none is attached."},{id:"change-light-color",label:"Change Light Color",handling:"viewer",description:"Opens a color picker docked under the action for the scene lights attached to this object, or the object's own glow."},{id:"set-brightness",label:"Set Brightness",handling:"viewer",description:"Opens a brightness slider docked under the action for the scene lights attached to this object, or the object's own glow."}]),Md="__custom__";function zl(e){return Sa.find(t=>t.id===e)}var Ul=Sa.filter(e=>e.handling==="viewer").map(e=>e.id),H_=new Set(["","New Action",...Sa.map(e=>e.label)]);function vh(e){return H_.has(e.trim())}function Ob(e,t){let n=Array.from({length:t.length+1},(i,r)=>r);for(let i=1;i<=e.length;i+=1){let r=[i];for(let o=1;o<=t.length;o+=1){let a=n[o-1]+(e[i-1]===t[o-1]?0:1);r[o]=Math.min(r[o-1]+1,n[o]+1,a)}n=r}return n[t.length]}function Ib(e){if(zl(e))return null;let t=e.trim().toLowerCase();if(!t)return null;let n=t.replace(/[^a-z0-9]/g,""),i=null;for(let r of Sa){let o=Math.min(Ob(t,r.id),Ob(n,r.id.replace(/[^a-z0-9]/g,"")));(!i||o<i.distance)&&(i={id:r.id,distance:o})}return i&&i.distance<=2?i.id:null}var zb=require("three");function Oo(e,t){if(e[t])return t;let n=Object.entries(e).find(([,r])=>r.id===t)?.[0];return n||(Object.entries(e).find(([,r])=>r.modelObjectId===t)?.[0]??null)}function Ub(e,t,n){let i=t[n]?.modelObjectId;return e.lighting.lights.filter(r=>{let o=r.attachment?.objectId;return o?Oo(t,o)===n||o===i:!1})}function xh(e,t){return e.lighting.lights.some(n=>t[n.id])?{...e,lighting:{...e.lighting,lights:e.lighting.lights.map(n=>t[n.id]?{...n,...t[n.id]}:n)}}:e}function Fb(e){let t=null;if(e?.traverse(r=>{if(t)return;let o=r.material;for(let a of Array.isArray(o)?o:o?[o]:[])if(a.emissive instanceof zb.Color){t=a;return}}),!t)return{color:"#000000",intensity:0,on:!1};let n=`#${t.emissive.getHexString()}`,i=t.emissiveIntensity??1;return{color:n,intensity:i,on:n!=="#000000"&&i>0}}var Vb=require("react-colorful"),Un=require("react/jsx-runtime");function jb({kind:e,color:t,brightness:n,onColorChange:i,onBrightnessChange:r,onClose:o}){return(0,Un.jsx)("div",{className:"ri-popover ri-popover--inline",style:{padding:12},onPointerDown:a=>a.stopPropagation(),children:e==="change-light-color"?(0,Un.jsxs)(Un.Fragment,{children:[(0,Un.jsx)("p",{className:"ri-popoverLabel",children:"Light color"}),(0,Un.jsx)(Vb.HexColorPicker,{color:t,onChange:i}),(0,Un.jsxs)("div",{className:"ri-inlineRow",children:[(0,Un.jsx)("span",{className:"ri-colorCode",children:t}),(0,Un.jsx)("button",{className:"ri-secondaryButton",onClick:o,children:"Done"})]})]}):(0,Un.jsxs)(Un.Fragment,{children:[(0,Un.jsx)("p",{className:"ri-popoverLabel",children:"Brightness"}),(0,Un.jsx)("input",{type:"range",min:0,max:200,step:1,value:n,"aria-label":"Brightness",style:{width:"100%"},onChange:a=>r(Number(a.target.value))}),(0,Un.jsxs)("div",{className:"ri-inlineRow",children:[(0,Un.jsxs)("span",{className:"ri-colorCode",children:[n,"%"]}),(0,Un.jsx)("button",{className:"ri-secondaryButton",onClick:o,children:"Done"})]})]})})}var Fl=require("react");var Io=require("lucide-react"),As=require("react");function Hb(e){let t=!1,n,i=()=>{t||(e(),t||(n=setTimeout(i,70)))};return e(),n=setTimeout(i,300),()=>{t=!0,clearTimeout(n)}}var lo=require("react/jsx-runtime");function Cd({onNudge:e}){let t=(0,As.useRef)(e);t.current=e;let n=(0,As.useRef)(null),i=(0,As.useRef)(null),r=()=>{n.current?.(),n.current=null,i.current=null};return(0,As.useEffect)(()=>{let o=s=>{s.pointerId===i.current&&r()},a=s=>{s.key==="Escape"&&r()};return window.addEventListener("pointerup",o,!0),window.addEventListener("pointercancel",o,!0),window.addEventListener("blur",r),window.addEventListener("keydown",a),()=>{r(),window.removeEventListener("pointerup",o,!0),window.removeEventListener("pointercancel",o,!0),window.removeEventListener("blur",r),window.removeEventListener("keydown",a)}},[]),(0,lo.jsxs)("div",{className:"ri-decalPosition",children:[(0,lo.jsxs)("div",{children:[(0,lo.jsx)("div",{className:"ri-decalPosition__label",children:"Position"}),(0,lo.jsx)("div",{className:"ri-decalPosition__hint",children:"Click to fine-tune \xB7 Hold to move"})]}),(0,lo.jsx)("div",{className:"ri-decalPosition__pad",role:"group","aria-label":"Move decal in small steps",children:[["up",Io.ArrowUp],["left",Io.ArrowLeft],["right",Io.ArrowRight],["down",Io.ArrowDown]].map(([o,a])=>(0,lo.jsx)("button",{type:"button",className:`ri-decalPosition__button ri-decalPosition__button--${o}`,"aria-label":`Move decal ${o}`,title:`Move ${o} on the visible surface`,onPointerDown:s=>{s.button===0&&(s.preventDefault(),s.currentTarget.focus({preventScroll:!0}),r(),i.current=s.pointerId,n.current=Hb(()=>t.current(o)))},onClick:s=>{s.detail===0&&t.current(o)},children:(0,lo.jsx)(a,{size:16})},o))})]})}var mt=require("react/jsx-runtime"),G_=e=>Math.round(e*180/Math.PI);function Gb({kind:e,decals:t,activeId:n,error:i,moving:r,defaultSize:o,onSelect:a,onAddText:s,onAddImage:l,onChange:c,onMove:p,onNudge:u,onRemove:d,onClose:m}){let[g,v]=(0,Fl.useState)(""),[M,w]=(0,Fl.useState)("#ffffff"),x=(0,Fl.useRef)(null),S=t.find(b=>b.id===n)??null;return(0,mt.jsxs)("div",{className:"ri-popover ri-popover--inline ri-decalControl",onPointerDown:b=>b.stopPropagation(),children:[e==="add-text"?(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsx)("p",{className:"ri-popoverLabel",children:"Text"}),(0,mt.jsxs)("div",{className:"ri-decalControl__row",children:[(0,mt.jsx)("input",{className:"ri-decalControl__input",value:g,placeholder:"Your text","aria-label":"Text to add",onChange:b=>v(b.target.value)}),(0,mt.jsx)("input",{type:"color",className:"ri-decalControl__color",value:M,"aria-label":"Text colour",onChange:b=>w(b.target.value)})]}),(0,mt.jsx)("button",{type:"button",className:"ri-uploadButton",disabled:!g.trim(),onClick:()=>{s(g.trim(),M)&&v("")},children:"Add text"})]}):(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsx)("p",{className:"ri-popoverLabel",children:"Image"}),(0,mt.jsx)("button",{type:"button",className:"ri-uploadButton",onClick:()=>x.current?.click(),children:"Choose image"}),(0,mt.jsx)("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/svg+xml",className:"ri-hiddenInput","aria-label":"Image to add",onChange:b=>{let _=b.target.files?.[0];b.target.value="",_&&l(_)}})]}),i?(0,mt.jsx)("div",{className:"ri-decalControl__hint",role:"alert",children:i}):null,t.length>0?(0,mt.jsx)("div",{className:"ri-decalControl__list",role:"group","aria-label":"Added",children:t.map((b,_)=>(0,mt.jsx)("button",{type:"button",className:`ri-decalControl__chip ${b.id===n?"ri-decalControl__chip--active":""}`,"aria-pressed":b.id===n,onClick:()=>a(b.id),children:b.image?`Image ${_+1}`:b.text||`Text ${_+1}`},b.id))}):null,S?(0,mt.jsxs)("div",{className:"ri-decalControl__editor",children:[(0,mt.jsx)(Cd,{onNudge:b=>u(S.id,b)}),S.image?null:(0,mt.jsxs)("div",{className:"ri-decalControl__row",children:[(0,mt.jsx)("input",{className:"ri-decalControl__input",value:S.text??"","aria-label":"Text",onChange:b=>c(S.id,{text:b.target.value})}),(0,mt.jsx)("input",{type:"color",className:"ri-decalControl__color",value:S.color??"#ffffff","aria-label":"Colour",onChange:b=>c(S.id,{color:b.target.value})})]}),(0,mt.jsxs)("label",{className:"ri-decalControl__slider",children:[(0,mt.jsx)("span",{children:"Size"}),(0,mt.jsx)("input",{type:"range",min:o/10,max:o*4,step:o/50,value:S.size,"aria-label":"Size",onChange:b=>c(S.id,{size:Number(b.target.value)})})]}),(0,mt.jsxs)("label",{className:"ri-decalControl__slider",children:[(0,mt.jsx)("span",{children:"Turn"}),(0,mt.jsx)("input",{type:"range",min:-180,max:180,step:1,value:G_(S.rotation??0),"aria-label":"Rotation",onChange:b=>c(S.id,{rotation:Number(b.target.value)*Math.PI/180})})]}),(0,mt.jsxs)("div",{className:"ri-inlineRow",children:[(0,mt.jsx)("button",{type:"button",className:"ri-secondaryButton","aria-pressed":r,title:"Drag the decal across the object's surface",onClick:()=>p(S.id),children:"Move"}),(0,mt.jsx)("button",{type:"button",className:"ri-removeButton",onClick:()=>d(S.id),children:"Remove"})]})]}):null,(0,mt.jsxs)("div",{className:"ri-inlineRow",children:[(0,mt.jsx)("span",{className:"ri-colorCode",children:t.length===0?"None added yet":`${t.length} added`}),(0,mt.jsx)("button",{type:"button",className:"ri-secondaryButton",onClick:m,children:"Done"})]})]})}var Id=require("react"),gv=require("@react-three/fiber"),Pi=require("three");var Ht=require("three"),W_=.5,Vl=4;function X_(e,t=0){let n=new Ht.Vector3(...e);n.lengthSq()<1e-12&&n.set(0,0,1),n.normalize();let i=new Ht.Object3D;return Math.abs(n.y)>.999&&i.up.set(0,0,-Math.sign(n.y)),i.lookAt(n),i.rotateZ(t),i.rotation.clone()}function q_(e,t,n){let i=null;if(e.bones&&t.bones){i=new Map;for(let[r,o]of e.bones)i.set(r,o*(1-n));for(let[r,o]of t.bones)i.set(r,(i.get(r)??0)+o*n)}return{position:e.position.clone().lerp(t.position,n),normal:e.normal.clone().lerp(t.normal,n),bones:i}}function Wb(e,t,n,i){let r=a=>i?a.position[t]<=n:a.position[t]>=n,o=[];for(let a=0;a<e.length;a++){let s=e[a],l=e[(a+1)%e.length],c=r(s);if(c&&o.push(s),c!==r(l)){let p=l.position[t]-s.position[t];o.push(q_(s,l,(n-s.position[t])/p))}}return o}function Td(e,t,n){let i=e.geometry,r=i.getAttribute("position");if(!r)return null;let o=i.getAttribute("normal"),a=i.getAttribute("skinIndex"),s=i.getAttribute("skinWeight"),l=!!(a&&s),c=i.getIndex(),p=Math.max(t.size,1e-6),u=p/(n>0&&Number.isFinite(n)?n:1),d=Math.max(p,u)*W_,m={x:p/2,y:u/2,z:d/2},g=new Ht.Matrix4().makeRotationFromEuler(X_(t.normal,t.rotation)).setPosition(...t.position),v=g.clone().invert(),M=(W,U)=>{let te=null;if(l){te=new Map;for(let O=0;O<Vl;O++){let $=s.getComponent(W,O);if($<=0)continue;let le=a.getComponent(W,O);te.set(le,(te.get(le)??0)+$)}}return{position:U.clone(),normal:o?new Ht.Vector3().fromBufferAttribute(o,W):new Ht.Vector3,bones:te}},w=[],x=[],S=[],k=[],b=[],_=new Ht.Vector3,y=new Ht.Vector3,h=new Ht.Vector3,P=W=>{if(S.push(.5+W.position.x/p,.5-W.position.y/u),_.copy(W.position).applyMatrix4(g),w.push(_.x,_.y,_.z),x.push(W.normal.x,W.normal.y,W.normal.z),!W.bones)return;let U=[...W.bones].sort((O,$)=>$[1]-O[1]).slice(0,Vl),te=U.reduce((O,[,$])=>O+$,0)||1;for(let O=0;O<Vl;O++)k.push(U[O]?.[0]??0),b.push((U[O]?.[1]??0)/te)},A=["x","y","z"],C=[new Ht.Vector3,new Ht.Vector3,new Ht.Vector3],D=[0,0,0],B=(c?c.count:r.count)/3;for(let W=0;W<B;W++){for(let O=0;O<3;O++){let $=W*3+O;D[O]=c?c.getX($):$,C[O].fromBufferAttribute(r,D[O]).applyMatrix4(v)}if(A.some(O=>C[0][O]>m[O]&&C[1][O]>m[O]&&C[2][O]>m[O]||C[0][O]<-m[O]&&C[1][O]<-m[O]&&C[2][O]<-m[O]))continue;let U=C.map((O,$)=>M(D[$],O));if(!o){y.copy(U[1].position).sub(U[0].position),h.copy(U[2].position).sub(U[0].position);let O=y.cross(h).transformDirection(g);for(let $ of U)$.normal.copy(O)}let te=U;for(let O of A)if(te=Wb(te,O,m[O],!0),te=Wb(te,O,-m[O],!1),te.length<3)break;for(let O=1;O+1<te.length;O++)P(te[0]),P(te[O]),P(te[O+1])}if(w.length===0)return null;let j=new Ht.BufferGeometry;return j.setAttribute("position",new Ht.Float32BufferAttribute(w,3)),j.setAttribute("normal",new Ht.Float32BufferAttribute(x,3)),j.setAttribute("uv",new Ht.Float32BufferAttribute(S,2)),l&&(j.setAttribute("skinIndex",new Ht.Uint16BufferAttribute(k,Vl)),j.setAttribute("skinWeight",new Ht.Float32BufferAttribute(b,Vl))),j}function qb(e){return JSON.stringify([e.image??null,e.image?null:[e.text??"",e.color,e.fontFamily,e.fontWeight],e.position,e.normal,e.size,e.rotation??0])}var Xb=256,yh=24;function $b(e){let t=`${e.fontWeight??"bold"} ${Xb-yh*2}px ${e.fontFamily||"sans-serif"}`,n=document.createElement("canvas"),i=n.getContext("2d");i.font=t;let r=e.text||" ";n.width=Math.min(Math.max(Math.ceil(i.measureText(r).width)+yh*2,8),4096),n.height=Xb,i.font=t,i.textAlign="center",i.textBaseline="middle",i.fillStyle=e.color??"#ffffff",i.fillText(r,n.width/2,n.height/2,n.width-yh);let o=new Ht.CanvasTexture(n);return o.flipY=!1,o.colorSpace=Ht.SRGBColorSpace,{texture:o,aspect:n.width/n.height}}var Wl=require("react"),Ur=require("three");var Gn=require("three");function Yb(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function Kb(e){return!!(e&&typeof e=="object"&&"isMeshPhysicalMaterial"in e&&e.isMeshPhysicalMaterial)}function Wn(e){return!!(e&&"isMesh"in e&&e.isMesh)}var Wi=["texture","metalnessMap","roughnessMap","emissiveMap","alphaMap","normalMap","bumpMap","aoMap","displacementMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","anisotropyMap","transmissionMap","thicknessMap","sheenColorMap","sheenRoughnessMap","specularIntensityMap","specularColorMap"],Pd={texture:"map",metalnessMap:"metalnessMap",roughnessMap:"roughnessMap",emissiveMap:"emissiveMap",alphaMap:"alphaMap",normalMap:"normalMap",bumpMap:"bumpMap",aoMap:"aoMap",displacementMap:"displacementMap",clearcoatMap:"clearcoatMap",clearcoatRoughnessMap:"clearcoatRoughnessMap",clearcoatNormalMap:"clearcoatNormalMap",anisotropyMap:"anisotropyMap",transmissionMap:"transmissionMap",thicknessMap:"thicknessMap",sheenColorMap:"sheenColorMap",sheenRoughnessMap:"sheenRoughnessMap",specularIntensityMap:"specularIntensityMap",specularColorMap:"specularColorMap"},$_=new Set(["texture","emissiveMap","sheenColorMap","specularColorMap"]);function Mi(e){return $_.has(e)?Gn.SRGBColorSpace:Gn.NoColorSpace}function rn(e,t){return e?.[t]?.path}function Zb(e,t){let n=e?.[t]?.offset;if(!n)return;let[i,r]=n;if(!(!Number.isFinite(i)||!Number.isFinite(r)))return i===0&&r===0?void 0:[i,r]}function Jb(e,t){let n=e?.[t]?.scale;if(!(!Number.isFinite(n)||!n))return n===1?void 0:n}function Qb(e,t){let n=e?.[t]?.rotation;if(!(!Number.isFinite(n)||!n))return n}function ev(e){return e==="back"?Gn.BackSide:e==="double"?Gn.DoubleSide:Gn.FrontSide}function tv(e){return e==="additive"?Gn.AdditiveBlending:Gn.NormalBlending}function co(e,t=1,n=t){if(e&&typeof e=="object"){let i=e;if(typeof i.x=="number"&&Number.isFinite(i.x)&&typeof i.y=="number"&&Number.isFinite(i.y))return new Gn.Vector2(i.x,i.y)}return new Gn.Vector2(t,n)}function Ad(e){return Number.isFinite(e)&&e>0?e:1}function nv(e,t){return e?.animations.clips.find(n=>n.sourceName===t)}function rv(e){return e?.loopMode??"repeat"}var iv=require("three");function Ci(e){return e.isSkinnedMesh===!0}function Rs(e){let t=[];return e.traverse(n=>{Ci(n)&&t.push(n)}),t}var Es="reactImmersiveSkinFreeze";function ov(e){return!!e.userData[Es]}function Ed(e,t){let n=e.userData,i=new iv.Matrix4().copy(t).invert(),r=n[Es];if(r){r.frozenInverse.copy(i),e.bindMatrixInverse.copy(i);return}let o={frozenInverse:i,previousOnBeforeRender:e.onBeforeRender};e.bindMatrixInverse.copy(i),e.onBeforeRender=function(a,s,l,c,p,u){o.previousOnBeforeRender.call(this,a,s,l,c,p,u),e.bindMatrixInverse.copy(o.frozenInverse)},n[Es]=o}function av(e){return e.userData[Es]?.frozenInverse??null}function ks(e){let t=e.userData,n=t[Es];n&&(e.onBeforeRender=n.previousOnBeforeRender,delete t[Es],e.updateMatrixWorld(!0))}var on=require("three"),Ls=new Map,uo={color:"#93c5fd",intensity:.07},_a=new on.Color(uo.color).multiplyScalar(uo.intensity),sv=new on.Color(uo.color),lv=.28,Ds=new Map,_h=new Map;function Y_(e){return`${e.name}|${e.size}|${e.lastModified}`}function Rd(e){let t=Y_(e),n=e.name.lastIndexOf("."),i=n>0?e.name.slice(0,n):e.name,r=n>0?e.name.slice(n):"",o=`materials/${e.name}`,a=2;for(;;){let s=_h.get(o);if(s===void 0||s===t)return _h.set(o,t),o;o=`materials/${i}-${a}${r}`,a+=1}}function kd(e){return Ds.get(e)}function cv(e,t){let n=++e.loadGeneration;e.loaded=!1;let i=()=>{if(e.loadGeneration!==n)return;e.loaded=!0;let r=e.pending;e.pending=[];for(let o of r)o()};new on.ImageLoader().load(t,r=>{e.loadGeneration===n&&(e.texture.image=r,e.texture.needsUpdate=!0,i())},void 0,()=>{e.loadGeneration===n&&(console.warn(`Failed to load texture: ${t}`),i())})}function dv(e,t){for(let n of[on.SRGBColorSpace,on.NoColorSpace]){let i=Ls.get(jl(e,n));i&&cv(i,t)}}function Ma(e,t){let n=Ds.get(e);n&&n!==t&&n.startsWith("blob:")&&URL.revokeObjectURL(n),Ds.set(e,t),dv(e,t)}function Hl(e){let t=Ds.get(e);t&&(t.startsWith("blob:")&&URL.revokeObjectURL(t),Ds.delete(e),_h.delete(e),dv(e,e))}function jl(e,t){return`${t}|${e}`}function Gl(e,t=on.NoColorSpace,n){let i=jl(e,t),r=Ls.get(i);if(r)return n&&!r.loaded&&r.pending.push(n),r.texture;let o=Ds.get(e)??e,a={texture:new on.Texture,refCount:0,loaded:!1,pending:n?[n]:[],loadGeneration:0};return a.texture.flipY=!1,a.texture.colorSpace=t,Ls.set(i,a),cv(a,o),a.texture}function Ns(e,t=on.NoColorSpace,n){let i=Gl(e,t,n);return Ls.get(jl(e,t)).refCount+=1,i}function po(e,t=on.NoColorSpace){let n=Ls.get(jl(e,t));n&&(n.refCount-=1,n.refCount<=0&&(n.loadGeneration+=1,n.pending=[],n.texture.dispose(),Ls.delete(jl(e,t))))}function Ld(e,t,n,i,r,o=1,a=0){let s=e.offsetTextures??(e.offsetTextures={}),l=s[t],c=l;if(!c||c.sourcePath!==i||c.base!==n){l?.texture.dispose();let u=n.clone();u.wrapS=on.RepeatWrapping,u.wrapT=on.RepeatWrapping,u.center.set(.5,.5),u.needsUpdate=!0,c={texture:u,sourcePath:i,base:n},s[t]=c}let p=o>0?o:1;return c.texture.offset.set(r[0],r[1]),c.texture.repeat.set(1/p,1/p),c.texture.rotation=a,c.texture}function Dd(e,t){let n=e.offsetTextures,i=n?.[t];i&&(i.texture.dispose(),delete n[t])}function uv(e){let t=e.offsetTextures;if(t){for(let n of Object.values(t))n.texture.dispose();delete e.offsetTextures}}var wh=null;function Nd(){if(wh)return wh;let e=256,t=document.createElement("canvas");t.width=e,t.height=e;let n=t.getContext("2d"),i=n.createRadialGradient(e*.35,e*.35,e*.02,e*.5,e*.5,e*.55);i.addColorStop(0,"#ffffff"),i.addColorStop(.4,"#b5b5b5"),i.addColorStop(1,"#3a3a3a"),n.fillStyle=i,n.fillRect(0,0,e,e);let r=new on.CanvasTexture(t);return r.colorSpace=on.SRGBColorSpace,wh=r,r}var Sh=null;function pv(){if(Sh)return Sh;let e=1024,t=8,n=e/t,i=["#ef4444","#f59e0b","#22c55e","#6366f1"],r=document.createElement("canvas");r.width=e,r.height=e;let o=r.getContext("2d");o.textAlign="center",o.textBaseline="middle";for(let s=0;s<t;s+=1)for(let l=0;l<t;l+=1){let c=l*n,p=s*n,u=(Math.floor(l/2)+Math.floor(s/2))%4;o.fillStyle=i[u],o.fillRect(c,p,n,n),o.strokeStyle="rgba(0, 0, 0, 0.28)",o.lineWidth=2;for(let x=1;x<4;x+=1){let S=x*n/4;o.beginPath(),o.moveTo(c+S,p),o.lineTo(c+S,p+n),o.moveTo(c,p+S),o.lineTo(c+n,p+S),o.stroke()}o.strokeStyle="#09090b",o.lineWidth=7,o.strokeRect(c,p,n,n);let d=c+n*.23,m=p+n*.72,g=c+n*.72,v=p+n*.23;o.lineCap="round",o.lineJoin="round",o.beginPath(),o.moveTo(d,m),o.lineTo(g,v),o.lineTo(g-n*.2,v),o.moveTo(g,v),o.lineTo(g,v+n*.2),o.stroke();let M=s*t+l+1;o.font=`700 ${Math.round(n*.2)}px ui-monospace, SFMono-Regular, Menlo, monospace`,o.fillStyle="#ffffff",o.strokeStyle="rgba(0, 0, 0, 0.85)",o.lineWidth=6;let w=String(M).padStart(2,"0");o.strokeText(w,c+n/2,p+n*.82),o.fillText(w,c+n/2,p+n*.82)}let a=new on.CanvasTexture(r);return a.colorSpace=on.SRGBColorSpace,a.wrapS=on.RepeatWrapping,a.wrapT=on.RepeatWrapping,a.flipY=!1,a.anisotropy=8,a.needsUpdate=!0,Sh=a,a}var Ca="riDecal",Th="riDecalId";function Mh(){return new Ur.BufferGeometry().setAttribute("position",new Ur.Float32BufferAttribute([],3))}function hv(e){let t=e.image;return t?.width&&t.height?t.width/t.height:1}function Ch(e){e.disposed=!0,e.node.remove(e.mesh),e.mesh.geometry.dispose(),e.mesh.material.dispose(),e.imagePath&&po(e.imagePath,Ur.SRGBColorSpace),e.ownTexture?.dispose()}function K_(e,t,n,i){let r=new Ur.MeshStandardMaterial({transparent:!0,polygonOffset:!0,polygonOffsetFactor:-4,depthWrite:!1,metalness:0,roughness:.7}),o=Ci(e)&&e.skeleton?e:null,a=o?new Ur.SkinnedMesh(Mh(),r):new Ur.Mesh(Mh(),r);if(o){let c=a;c.bind(o.skeleton,o.bindMatrix),c.frustumCulled=!1,c.onBeforeRender=()=>{let p=av(o);p&&c.bindMatrixInverse.copy(p)}}a.userData[Ca]=!0,a.userData[Th]=t.id,a.raycast=()=>{},a.castShadow=!1,a.receiveShadow=!0,a.renderOrder=1;let s={node:e,mesh:a,signature:n,disposed:!1},l=c=>{let p=Td(e,t,c);a.geometry.dispose(),a.geometry=p??Mh(),a.visible=p!==null};if(t.image){s.imagePath=t.image;let c=Ns(t.image,Ur.SRGBColorSpace,()=>{s.disposed||(l(hv(c)),r.needsUpdate=!0,i())});r.map=c,l(hv(c))}else{let{texture:c,aspect:p}=$b(t);s.ownTexture=c,r.map=c,l(p)}return e.add(a),s}function mv({objectBindings:e,nodeMap:t,invalidate:n}){let i=(0,Wl.useRef)(new Map);(0,Wl.useEffect)(()=>{let r=i.current,o=new Set;for(let[a,s]of Object.entries(e)){if(!s.decals?.length)continue;let l=t[s.modelObjectId??a];if(Wn(l))for(let c of s.decals){if(!c.image&&!c.text)continue;let p=`${a}
|
|
3665
|
-
${c.id}`,u=qb(c),d=r.get(p);d&&(d.node!==l||d.signature!==u)&&(Ch(d),d=void 0),d||(d=K_(l,c,u,n),r.set(p,d)),d.mesh.material.opacity=(c.opacity??1)*(s.style?.material?.opacity??1),o.add(p)}}for(let[a,s]of r)o.has(a)||(Ch(s),r.delete(a));n()},[e,t,n]),(0,Wl.useEffect)(()=>{let r=i.current;return()=>{for(let o of r.values())Ch(o);r.clear()}},[])}var ti=require("react"),Ti=require("three"),Z_=500,J_=10,Q_=5;function Bd(e,t,n){let i=(0,ti.useRef)({resolve:e,onContextMenu:t,anchorOf:n});i.current={resolve:e,onContextMenu:t,anchorOf:n};let r=(0,ti.useRef)(null),o=(0,ti.useRef)(!1),a=(0,ti.useRef)(null),s=(0,ti.useCallback)(()=>{let u=r.current;u?.timer&&clearTimeout(u.timer),r.current=null,a.current?.(),a.current=null},[]),l=(0,ti.useCallback)(()=>{let u=r.current;u&&(s(),u.kind==="touch"&&(o.current=!0,setTimeout(()=>o.current=!1,800)),i.current.onContextMenu?.(u.target,u.pointer))},[s]),c=(0,ti.useCallback)(u=>{let d=u.nativeEvent,m=d.pointerType!=="touch"&&d.button===2,g=d.pointerType==="touch"&&d.button===0;if(!i.current.onContextMenu||!m&&!g)return;let v=i.current.resolve(u.object);if(v===null)return;s();let M={target:v,kind:m?"right":"touch",pointerId:d.pointerId,pointer:Bs(u,i.current.anchorOf?.(u.object)),timer:g?setTimeout(l,Z_):null};r.current=M;let w=m?Q_:J_,x=_=>Math.hypot(_.clientX-M.pointer.clientX,_.clientY-M.pointer.clientY)>w,S=_=>{_.pointerId===M.pointerId&&x(_)&&s()},k=_=>{_.pointerId===M.pointerId&&(M.kind==="right"&&!x(_)?l():s())},b=_=>{_.pointerId!==M.pointerId&&s()};window.addEventListener("pointermove",S),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",s),window.addEventListener("pointerdown",b),a.current=()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",s),window.removeEventListener("pointerdown",b)}},[s,l]);(0,ti.useEffect)(()=>s,[s]);let p=(0,ti.useCallback)(()=>o.current?(o.current=!1,!0):!1,[]);return{onPointerDown:c,consumeClick:p}}function eM(e,t){let n=e.face,i=t.geometry.getAttribute("position");if(!n||!i)return null;let r=e.barycoord??null;if(!r){let[u,d,m]=[n.a,n.b,n.c].map(g=>t.getVertexPosition(g,new Ti.Vector3));if(r=Ti.Triangle.getBarycoord(t.worldToLocal(e.point.clone()),u,d,m,new Ti.Vector3),!r)return null}let[o,a,s]=[n.a,n.b,n.c].map(u=>new Ti.Vector3().fromBufferAttribute(i,u)),l=new Ti.Vector3().addScaledVector(o,r.x).addScaledVector(a,r.y).addScaledVector(s,r.z),c=new Ti.Triangle(o,a,s).getNormal(new Ti.Vector3);return n.normal.clone().transformDirection(t.matrixWorld).dot(e.ray.direction)>0&&c.negate(),{position:[l.x,l.y,l.z],normal:[c.x,c.y,c.z]}}function Ta(e,t){if(t.updateWorldMatrix(!0,!1),e.object===t&&t.isSkinnedMesh===!0){let r=eM(e,t);if(r)return r}let n=t.worldToLocal(e.point.clone()),i=e.face?e.face.normal.clone().transformDirection(e.object.matrixWorld):e.ray.direction.clone().negate();return i.dot(e.ray.direction)>0&&i.negate(),i.transformDirection(new Ti.Matrix4().copy(t.matrixWorld).invert()),{position:[n.x,n.y,n.z],normal:[i.x,i.y,i.z]}}function Bs(e,t){let n=e.nativeEvent;return{clientX:n.clientX,clientY:n.clientY,pointerType:"pointerType"in n?n.pointerType:"mouse",...t?{surface:Ta(e,t)}:{}}}var Od=require("three");function fv(e,t){let n=[];if(Ci(e)){let i=e;i.computeBoundingSphere(),i.computeBoundingBox(),Od.SkinnedMesh.prototype.raycast.call(i,t,n)}else Od.Mesh.prototype.raycast.call(e,t,n);return n.sort((i,r)=>i.distance-r.distance)[0]}function bv({target:e,nodes:t,controls:n}){let{camera:i,gl:r,invalidate:o}=(0,gv.useThree)(),a=(0,Id.useRef)(e);return a.current=e,(0,Id.useEffect)(()=>{let s=r.domElement,l=new Pi.Raycaster,c=new Pi.Vector2,p=s.style.cursor,u=s.style.touchAction;s.style.cursor="grab",s.style.touchAction="none";let d=0,m=null,g=null,v=(y,h=new Pi.Vector2)=>{let P=s.getBoundingClientRect();c.set((y.clientX-P.left-h.x)/P.width*2-1,-((y.clientY-P.top-h.y)/P.height)*2+1),l.setFromCamera(c,i)},M=y=>{if(!g)return;v(y,g.offset),g.node.updateWorldMatrix(!0,!1);let h=l.intersectObject(g.node,!1)[0];if(!h)return;let P=Ta({...h,ray:l.ray},g.node),A=Td(g.node,{...g.decal,...P},g.aspect);A&&(g.mesh.geometry!==g.geometry&&g.mesh.geometry.dispose(),g.mesh.geometry=A,g.surface=P,o())},w=y=>{if(!g)return;cancelAnimationFrame(d),d=0,m=null;let h=g;g=null,h.mesh.geometry!==h.geometry&&(y&&h.surface?h.geometry.dispose():(h.mesh.geometry.dispose(),h.mesh.geometry=h.geometry)),h.controller&&(h.controller.enabled=h.controlsEnabled),s.hasPointerCapture(h.pointerId)&&s.releasePointerCapture(h.pointerId),s.style.cursor="grab",o();let P=()=>{window.removeEventListener("click",A,!0),window.removeEventListener("pointerdown",P,!0),clearTimeout(C)},A=D=>{D.target===s&&(D.preventDefault(),D.stopImmediatePropagation()),P()},C=setTimeout(P,300);window.addEventListener("click",A,!0),window.addEventListener("pointerdown",P,!0),y&&h.surface&&a.current.onCommit(h.surface)},x=y=>{if(y.button!==0||g)return;let h=a.current,P=t.current[h.objectId];if(!(P instanceof Pi.Mesh)||!P.visible)return;let A=P.children.find(O=>O.userData[Ca]&&O.userData[Th]===h.decal.id);if(!A?.visible)return;P.updateWorldMatrix(!0,!0),v(y);let C=fv(A,l),D=l.intersectObject(P,!1)[0];if(!C||!D||C.distance>D.distance+1e-4)return;let B=new Pi.Vector3;if(Ci(A)){let O=new Pi.Vector3,$=A.geometry.getAttribute("position").count;if(!$)return;for(let le=0;le<$;le++)B.add(A.getVertexPosition(le,O));B.divideScalar($).applyMatrix4(A.matrixWorld)}else B.fromArray(h.decal.position).applyMatrix4(P.matrixWorld);B.project(i);let j=s.getBoundingClientRect(),W=new Pi.Vector2(y.clientX-(j.left+(B.x+1)/2*j.width),y.clientY-(j.top+(1-B.y)/2*j.height)),U=A.material.map?.image,te=n.current;g={pointerId:y.pointerId,node:P,mesh:A,geometry:A.geometry,decal:h.decal,surface:null,offset:W,aspect:U?.width&&U.height?U.width/U.height:1,controller:te,controlsEnabled:te?.enabled??!1},te&&(te.enabled=!1),y.preventDefault(),y.stopImmediatePropagation(),s.setPointerCapture(y.pointerId),s.style.cursor="grabbing"},S=y=>{!g||y.pointerId!==g.pointerId||(y.preventDefault(),y.stopImmediatePropagation(),m=y,d||(d=requestAnimationFrame(()=>{d=0,m&&M(m)})))},k=y=>{!g||y.pointerId!==g.pointerId||(y.preventDefault(),y.stopImmediatePropagation(),m&&M(m),w(!0))},b=()=>w(!1),_=y=>{y.key==="Escape"&&(w(!1),a.current.onCancel())};return s.addEventListener("pointerdown",x,!0),window.addEventListener("pointermove",S,{capture:!0,passive:!1}),window.addEventListener("pointerup",k,!0),window.addEventListener("pointercancel",b),window.addEventListener("blur",b),window.addEventListener("keydown",_),s.addEventListener("lostpointercapture",b),()=>{w(!1),s.style.cursor=p,s.style.touchAction=u,s.removeEventListener("pointerdown",x,!0),window.removeEventListener("pointermove",S,!0),window.removeEventListener("pointerup",k,!0),window.removeEventListener("pointercancel",b),window.removeEventListener("blur",b),window.removeEventListener("keydown",_),s.removeEventListener("lostpointercapture",b)}},[i,r,o,t,n,e.objectId,e.decal]),null}var Rn=require("three");function zd(e,t){if(!(e instanceof Rn.Mesh)||!t)return null;let n=e.geometry.getAttribute("position");if(!n?.count)return null;e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);let i=new Rn.Box3,r=new Rn.Vector3;if(Ci(e)){let _=e;_.computeBoundingBox(),_.computeBoundingSphere();for(let y=0;y<n.count;y++)i.expandByPoint(e.getVertexPosition(y,r))}else e.geometry.boundingBox||e.geometry.computeBoundingBox(),i.copy(e.geometry.boundingBox);if(i.applyMatrix4(e.matrixWorld),i.isEmpty())return null;let o=i.getCenter(new Rn.Vector3),a=t.getWorldPosition(new Rn.Vector3),s=t.getWorldDirection(new Rn.Vector3),l=t.isOrthographicCamera,c=new Rn.Raycaster,p=_=>{if(l){let h=a.distanceTo(o)+i.getSize(r).length()+1;c.set(_.clone().addScaledVector(s,-h),s)}else c.set(a,_.clone().sub(a).normalize());let y=c.intersectObject(e,!1)[0];return y?Ta({...y,ray:c.ray},e):null},u=p(o);if(u)return u;let d=e.geometry.index,m=d?.count??n.count,g=new Rn.Vector3,v=new Rn.Vector3,M=new Rn.Vector3,w=new Rn.Vector3,x=new Rn.Vector3,S=new Rn.Vector3,k=null,b=1/0;for(let _=0;_+2<m;_+=3){if(e.getVertexPosition(d?d.getX(_):_,g).applyMatrix4(e.matrixWorld),e.getVertexPosition(d?d.getX(_+1):_+1,v).applyMatrix4(e.matrixWorld),e.getVertexPosition(d?d.getX(_+2):_+2,M).applyMatrix4(e.matrixWorld),w.copy(g).add(v).add(M).multiplyScalar(1/3),Rn.Triangle.getNormal(g,v,M,x),l?S.copy(s).negate():S.copy(a).sub(w),x.dot(S)<=0)continue;let y=w.distanceToSquared(o);y<b&&(b=y,k=w.clone())}return k?p(k):null}var kn=require("three");function Ud(e,t,n,i){if(!(e instanceof kn.Mesh)||!t)return null;e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);let r=new kn.Vector3().fromArray(n.position);if(Ci(e)){let c=e;c.computeBoundingBox(),c.computeBoundingSphere();let p=c.geometry.getAttribute("position");if(!p)return null;let u=c.geometry.index,d=u?.count??p.count,m=new kn.Triangle,g=new kn.Vector3,v=new kn.Vector3,M=1/0,w=null;for(let x=0;x+2<d;x+=3){let S=[0,1,2].map(b=>u?u.getX(x+b):x+b);m.a.fromBufferAttribute(p,S[0]),m.b.fromBufferAttribute(p,S[1]),m.c.fromBufferAttribute(p,S[2]),m.closestPointToPoint(r,g);let k=g.distanceToSquared(r);if(!(k>=M||!m.getBarycoord(g,v))&&(M=k,w=new kn.Vector3().addScaledVector(c.getVertexPosition(S[0],new kn.Vector3),v.x).addScaledVector(c.getVertexPosition(S[1],new kn.Vector3),v.y).addScaledVector(c.getVertexPosition(S[2],new kn.Vector3),v.z),M<1e-12))break}if(!w)return null;r.copy(w)}if(r.applyMatrix4(e.matrixWorld).project(t),!Number.isFinite(r.x)||r.z<-1||r.z>1)return null;let o=new kn.Vector2(i==="left"?-.0035:i==="right"?.0035:0,i==="down"?-.0035:i==="up"?.0035:0),a=new kn.Raycaster,s=n.size*.01,l=new kn.Vector3().fromArray(n.position);for(let c=1;c>=1/1024;c/=2){a.setFromCamera(new kn.Vector2(r.x,r.y).addScaledVector(o,c),t);let p=a.intersectObject(e,!1)[0];if(p){let u=Ta({...p,ray:a.ray},e);if(new kn.Vector3().fromArray(u.position).distanceTo(l)<=s)return u}}return null}var br=require("react");var vv=require("three-stdlib");function ho(e,t){let n=URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.download=t,i.style.display="none";try{document.body.appendChild(i),i.click()}finally{i.remove(),window.setTimeout(()=>{URL.revokeObjectURL(n)},1e3)}}function xv({scene:e,objectBindings:t,matRefs:n,downloadFilename:i,onComplete:r}){import("three").then(({Group:o,Mesh:a})=>{let s=new o,l=new Map;for(let[u,d]of Object.entries(t))l.set(d.modelObjectId??u,u);let c=u=>{let d=u;for(;d;){let m=d.name||d.uuid,g=l.get(m)??m,v=t[g];if(v?v.visible===!1:d.visible===!1)return!1;d=d.parent}return!0};e.traverse(u=>{let d=u;if(!d.isMesh||!d.geometry||!c(d))return;let m=d.name||d.uuid,g=l.get(m)??m,v=n[g]??d.material;if(!v)return;let M=new a(d.geometry,v);M.name=m,M.applyMatrix4(d.matrixWorld),s.add(M)}),new vv.GLTFExporter().parse(s,u=>{let d=u instanceof ArrayBuffer?new Blob([u],{type:"model/gltf-binary"}):new Blob([JSON.stringify(u)],{type:"model/gltf+json"}),m=u instanceof ArrayBuffer?".glb":".gltf";ho(d,`${i}${m}`),r()},u=>{console.error("GLTFExporter error:",u),r()},{binary:!0})})}var Mv=require("fflate");var yv=require("fflate");function Fd(e,t=6){return new Promise((n,i)=>{(0,yv.zip)(e,{level:t},(r,o)=>{r?i(r):n(o)})})}var Xl=2048,wv=["#00e5ff","#ff4fd8","#ffe45e","#7cff6b","#ff784f","#a78bfa","#38bdf8","#fb7185"];function Sv(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}function Eh(e,t){return e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||t}function Cv(e){return Eh(e,"model")}function Ph(e,t){return e.index?Math.round(e.index.getX(t)):t}function tM(e,t,n){let i=Ph(e,n),r=Ph(e,n+1),o=Ph(e,n+2);if(i>=t.count||r>=t.count||o>=t.count)return null;let a=[{index:i,u:t.getX(i),v:t.getY(i)},{index:r,u:t.getX(r),v:t.getY(r)},{index:o,u:t.getX(o),v:t.getY(o)}];return a.every(s=>Number.isFinite(s.u)&&Number.isFinite(s.v))?a:null}function _v(e){return`${e.u.toFixed(6)},${e.v.toFixed(6)}`}function Ah(e,t,n,i){let r,o;i?(r=t.index,o=n.index):(r=_v(t),o=_v(n));let a=r<o?`${r}|${o}`:`${o}|${r}`,s=e.get(a);s?s.count+=1:e.set(a,{count:1,start:t,end:n})}function nM(e,t,n){Ah(e,t[0],t[1],n),Ah(e,t[1],t[2],n),Ah(e,t[2],t[0],n)}function rM(e,t){return Array.isArray(e)?e[t]??null:e}function iM(e){let t=new Map,n=0,i=0,r=0;return e.traverse(o=>{let a=o;if(!a.isMesh||!a.geometry||!a.material)return;let s=a.geometry,l=s.getAttribute("uv");if(!l||l.itemSize<2||l.count<3)return;n+=1;let c=a.name||`Mesh ${n}`,p=s.index?.count??l.count,u=s.groups.length>0?s.groups:[{start:0,count:p,materialIndex:0}];for(let d of u){let m=d.materialIndex??0,g=rM(a.material,m);if(!g)continue;let v=t.get(g.uuid);v||(i+=1,v={name:g.name||`Material ${i}`,layers:new Map},t.set(g.uuid,v));let M=v.layers.get(a.uuid);M||(M={name:c,color:wv[r%wv.length],edges:new Map},r+=1,v.layers.set(a.uuid,M));let w=Math.max(0,d.start),x=Math.min(p,w+d.count);for(let S=w;S+2<x;S+=3){let k=tM(s,l,S);k&&nM(M.edges,k,!!s.index)}}}),[...t.values()].filter(o=>[...o.layers.values()].some(a=>a.edges.size>0))}function Vd(e){return(e*Xl).toFixed(2)}function oM(e){return`M${Vd(e.start.u)} ${Vd(1-e.start.v)}L${Vd(e.end.u)} ${Vd(1-e.end.v)}`}function aM(e){let t=Sv(e.name),n=[...e.layers.values()].filter(i=>i.edges.size>0).map((i,r)=>{let o=Sv(i.name),a=`${Eh(i.name,"mesh")}-${r+1}`,s=[...i.edges.values()],l=s.filter(u=>u.count===1),p=(l.length>0?l:s).map(oM).join("");return[` <g id="${a}" data-mesh="${o}" fill="none" stroke="${i.color}"`,' stroke-width="1" stroke-linejoin="round" vector-effect="non-scaling-stroke">',` <title>${o}</title>`,` <path d="${p}"/>`," </g>"].join(`
|
|
3664
|
+
`});var JR={};lv(JR,{ProjectBindingBuilder:()=>eb,ProjectModelViewer:()=>tb});module.exports=LT(JR);var G=require("react"),XM=require("three"),Wi=require("lucide-react");var Oi=require("react"),Fs=require("lucide-react"),Pn=require("react/jsx-runtime");function gh({label:e,icon:t,title:n,align:i="left",children:r}){let[o,a]=(0,Oi.useState)(!1),s=(0,Oi.useRef)(null),l=(0,Oi.useRef)(null),c=(0,Oi.useId)();return(0,Oi.useEffect)(()=>{if(!o)return;let h=u=>{s.current?.contains(u.target)||a(!1)},p=u=>{u.key==="Escape"&&(a(!1),l.current?.focus())};return window.addEventListener("pointerdown",h),window.addEventListener("keydown",p),()=>{window.removeEventListener("pointerdown",h),window.removeEventListener("keydown",p)}},[o]),(0,Pn.jsxs)("div",{className:"bb-headerMenuWrapper",ref:s,children:[(0,Pn.jsxs)("button",{ref:l,type:"button",className:`bb-headerButton ${e?"":"bb-headerButton--icon"} ${o?"bb-headerButton--open":""}`,onClick:()=>a(h=>!h),title:n,"aria-label":e?void 0:n,"aria-expanded":o,"aria-controls":o?c:void 0,children:[t,e?(0,Pn.jsxs)(Pn.Fragment,{children:[e,(0,Pn.jsx)(Fs.ChevronDown,{size:12,"aria-hidden":"true"})]}):null]}),o?(0,Pn.jsx)("div",{id:c,className:`bb-headerMenu bb-headerMenu--${i}`,role:"group","aria-label":n,children:r(()=>a(!1))}):null]})}function dv({onRestore:e,onRemove:t,restoreDisabled:n,close:i}){let[r,o]=(0,Oi.useState)(!1);return r&&t?(0,Pn.jsxs)("div",{className:"bb-headerMenuConfirm",role:"alertdialog","aria-label":"Remove model",children:[(0,Pn.jsx)("p",{children:"Remove the model and its bindings from the editor? Your edits are saved first, so Restore last session can bring them back."}),(0,Pn.jsxs)("div",{className:"bb-headerMenuConfirmActions",children:[(0,Pn.jsx)("button",{type:"button",className:"bb-headerMenuItem",onClick:()=>o(!1),children:"Cancel"}),(0,Pn.jsx)("button",{type:"button",className:"bb-headerMenuItem bb-headerMenuItem--danger",onClick:()=>{i(),t()},autoFocus:!0,children:"Remove"})]})]}):(0,Pn.jsxs)(Pn.Fragment,{children:[e?(0,Pn.jsxs)("button",{type:"button",className:"bb-headerMenuItem",disabled:n,onClick:()=>{i(),e()},title:"Restore your last session: the model, its object bindings, and scene settings saved in this browser",children:[(0,Pn.jsx)(Fs.History,{size:14,"aria-hidden":"true"}),"Restore last session"]}):null,t?(0,Pn.jsxs)("button",{type:"button",className:"bb-headerMenuItem bb-headerMenuItem--danger",onClick:()=>o(!0),children:[(0,Pn.jsx)(Fs.Trash2,{size:14,"aria-hidden":"true"}),"Remove model\u2026"]}):null]})}var js=require("react");var uv={verifyingLicense:"Verifying License",checkingYourLicenseKey:"Checking your license key...",invalidLicense:"Invalid License",licenseHasBeenRevokedOrHasExpired:"License has been revoked or has expired",failedToLoadPleaseContactTheSiteAdministrator:"Failed to load. Please contact the site administrator.",contextRestoringTitle:"Reloading viewer\u2026",contextLostTitle:"3D view interrupted",contextRestoringMessage:"Rebuilding the 3D view. Please wait\u2026",contextLostMessage:"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now.",reloadViewer:"Reload viewer",texturePositioningHint:"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish",texturePositioningStartHint:"Double-click to move or zoom",dismiss:"Dismiss",missingUVsAreShownInMagenta:"Missing UVs are shown in magenta.",viewThisModelInARWithAppleQuickLook:"View this model in AR with Apple Quick Look",viewInAR:"View in AR",openThisExperienceOnAPhoneForAR:"Open this experience on a phone for AR",openOnPhone:"Open on phone",viewThisModelInYourSpace:"View this model in your space",viewThisModelInVR:"View this model in VR",closePhoneHandoff:"Close phone handoff",arScanCode:"Scan the code and choose AR.",qrCodeToOpenThisModelOnAPhone:"QR code to open this model on a phone",disableUVChecker:"Disable UV checker",enableUVChecker:"Enable UV checker",explodedView:"Exploded view",explodeAmount:"Explode amount",removeSectionCut:"Remove section cut",sectionCut:"Section cut",sectionAxis:"Section axis",sectionPosition:"Section position",keepTheOtherSide:"Keep the other side",pauseCinematic:"Pause cinematic",playCinematic:"Play cinematic",stopCinematicAndResetCamera:"Stop cinematic and reset camera",cancel:"Cancel",annotationCategories:"Annotation categories",annotations:"Annotations",all:"All",uncategorized:"Uncategorized",decalDragHint:"Drag the decal on the object. Release to save; Escape to cancel.",showAll:"Show all",materialVariants:"Material variants",startGuidedTour:"Start guided tour",guidedTour:"Guided Tour",previousAnnotation:"Previous annotation",previous:"Prev",stopGuidedTour:"Stop guided tour",nextAnnotation:"Next annotation",next:"Next",exitFullscreen:"Exit fullscreen",enterFullscreen:"Enter fullscreen",resetCameraView:"Reset camera view",orbitControl:"Orbit Control",pointLock:"Point Lock",cameraController:"Camera controller",cameraControllerSettings:"Camera controller settings",downloadGLB:"Download GLB",downloadPNG:"Download PNG",downloadUVLayout:"Download UV Layout",videoFormat:"Video format",auto:"Auto",recordTurntableVideo:"Record turntable video",recordCinematicVideo:"Record cinematic video",videoUnsupported:"Video recording is not supported in this browser.",downloadOptions:"Download options",exporting:"Exporting\u2026",download:"Download",annotationTitlePlaceholder:"Title *",description:"Description",ok:"OK",arRelocate:"Relocate",tapToPlace:"Tap to place",closeAnnotation:"Close annotation",learnMore:"Learn more",stopMeasuring:"Stop measuring",startMeasuring:"Start measuring",toggleBoundingDimensions:"Toggle bounding dimensions",measurementTool:"Measurement tool",distance:"Distance",angle:"Angle",area:"Area",pointToPlane:"Point to plane",measurementSnapping:"Measurement snapping",noSnapping:"No snapping",snapAuto:"Snap: auto",snapVertex:"Snap: vertex",snapEdge:"Snap: edge",undoMeasurementPoint:"Undo measurement point",clearMeasurements:"Clear measurements",finishArea:"Finish area",openSceneObjectsPanel:"Open scene objects panel",sceneObjects:"SCENE OBJECTS",searchNodesLabels:"Search nodes, labels",closeSceneObjectsPanel:"Close scene objects panel",objectNavigator:"Objects in the 3D view",compareBefore:"Before",compareAfter:"After",compareDivider:"Comparison divider",viewIn3D:"View in 3D",objectNavigatorHint:"Arrow keys browse \xB7 Enter selects \xB7 Esc clears",selectionCleared:"Selection cleared",cameraKeyboardHelp:"3D view. Arrow keys orbit, Shift with Up or Down zooms, and W, A, S, D, Space and C move the camera.",isolate:"Isolate",hide:"Hide",show:"Show",closePanel:"Close panel",actions:"Actions",openPanel:"Open panel",close:"Close",position:"Position",decalNudgeHint:"Click to fine-tune \xB7 Hold to move",decalNudgeControls:"Move decal in small steps",text:"Text",yourText:"Your text",textToAdd:"Text to add",textColour:"Text colour",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Colour",size:"Size",turn:"Turn",rotation:"Rotation",dragTheDecalAcrossTheObjectsSurface:"Drag the decal across the object's surface",move:"Move",remove:"Remove",noneAddedYet:"None added yet",done:"Done",moveForward:"Move forward",moveLeft:"Move left",moveRight:"Move right",moveBackward:"Move backward",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",environment:"Environment",autoRotate:"Auto Rotate",lighting:"Lighting",exposure:"Exposure",ambientLightIntensity:"Ambient Light Intensity",ambientLightColor:"Ambient Light Color",directLightIntensity:"Direct Light Intensity",directLightColor:"Direct Light Color",searchObjects:"Search objects",uploadedModel:"Uploaded model",clear:"Clear",chooseModel:"Choose model",loadingModel:"Loading model...",releaseToLoadYourModel:"Release to load your model",arFindSurface:"Move your device over a flat surface",arReleaseToPlace:"Release to place",arGestureHint:"Pinch to resize \xB7 Twist to rotate",angleFirstArmHint:"Pick the first arm",angleVertexHint:"Pick the angle's vertex",angleSecondArmHint:"Pick the second arm",angleNewHint:"Pick a point to start a new angle",areaNewHint:"Pick a point to start a new area",areaCornersHint:"Pick polygon corners in order, then Finish area",pointToPlaneFaceHint:"Pick the reference face",pointToPlanePointHint:"Pick a point to measure its perpendicular distance",pointToPlaneNewHint:"Pick a face to start a new measurement",distanceHint:"Pick points on the model to measure distances",visibleEntries:"{count} visible entries",objectCount:"{count} objects",annotationMarker:"Annotation {id}: {title}",recordingVideo:"Recording video \xB7 {progress}%",isolatedObjects:"Isolated: {count} objects",largeModelWarning:"Very large model ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts.",preparingLargeModel:"Preparing large model ({millions}M triangles) \u2014 the first display can take a while on this device...",enterAR:"Enter AR",enterVR:"Enter VR",decalImage:"Image {index}",decalText:"Text {index}",decalAdded:"{count} added",up:"up",down:"down",left:"left",right:"right",moveDecal:"Move decal {direction}",moveDecalOnSurface:"Move {direction} on the visible surface",showAllObject:"Show all {name}",isolateObject:"Isolate {name}",isolatedObject:"Isolated: {name}",hideObject:"Hide {name}",showObject:"Show {name}",objectSelected:"{name} selected",objectNavigatorPosition:"{position} of {count}",compareDividerValue:"{before} {percent}%, {after} {rest}%",bindingMismatchOne:"1 object binding doesn't match this model",bindingMismatchMany:"{count} object bindings don't match this model",simpleLargeModelWarning:"Very large model detected ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the scene objects panel to select parts.",dropModelHint:"Drag and drop {formats} here",loadErrorTitle:"This model couldn't be loaded",loadErrorNotFound:"Nothing was found at this address ({status}). Check that modelUrl points to the file.",loadErrorDenied:"The server refused access to the file ({status}). Check that the file is public, or that a signed URL hasn't expired.",loadErrorStatus:"The server responded with {status} when the file was requested.",loadErrorNetwork:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",loadErrorHtml:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",loadErrorInvalidFile:"The file couldn't be read as {format}. Check that it's a valid {format} file.",loadErrorInvalidExplicitFormat:"The file couldn't be read as {format}. Check that it's a valid {format} file and that modelFormat matches it.",loadErrorMissingFormat:"The file couldn't be read as {format}. The URL has no file extension, so set modelFormat to the file's format.",loadErrorPointCloud:"This PLY file is a point cloud: it has points but no faces, and the viewer shows meshes. Turn it into a mesh first, for example with MeshLab or Blender.",measurementReferenceFaceRequired:"Pick a triangle face to define the reference plane.",measurementTooManyPoints:"Finish or clear this measurement before adding more points.",measurementAngleDistinct:"Pick a point away from the angle's vertex.",areaMinimumPoints:"Pick at least three points to finish the area.",areaDistinctPoints:"Area points must be distinct.",areaStraightLine:"Area points must not lie on one straight line.",areaNotPlanar:"Area points must lie on one plane.",areaEdgesCross:"Area edges must not cross or touch each other.",areaZero:"The polygon has no measurable area.",decalSurfaceMissing:"Could not find a surface on this object for the decal.",decalDirectionMissing:"No visible surface in that direction. Try another arrow or rotate the view.",fullscreenExitFailed:"Could not exit fullscreen. Press Escape to exit.",fullscreenEnterFailed:"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.",uvCoordinatesMissing:"This model does not contain UV coordinates.",uvExportFailed:"Could not create the UV layout archive.",videoExportFailed:"Could not export the video.",videoNotReady:"Viewer not ready for video export.",videoExitXR:"Exit the XR session before recording a video.",videoAlreadyRecording:"A video export is already in progress.",videoPathRequired:"Enable a cinematic camera path before recording it.",videoDurationInvalid:"Video duration must be greater than 0 and at most 300 seconds.",videoFrameRateInvalid:"Video frame rate must be between 1 and 60.",videoBitrateInvalid:"Video bitrate must be a positive number.",videoContextLost:"Video export stopped because the WebGL context was lost.",videoTimedOut:"Video export timed out. Keep the viewer tab visible while recording.",videoEncodingFailed:"The browser could not encode the video.",videoEmpty:"The browser produced an empty video.",videoDidNotStart:"Video recording did not start.",videoWebMUnsupported:"Video recording as WEBM is not supported in this browser.",videoMP4Unsupported:"Video recording as MP4 is not supported in this browser.",videoGIFUnsupported:"Video recording as GIF is not supported in this browser.",videoGifWidthInvalid:"GIF width must be a whole number of pixels from 16 to 4096.",environmentApartment:"apartment",environmentCity:"city",environmentDawn:"dawn",environmentForest:"forest",environmentLobby:"lobby",environmentNight:"night",environmentPark:"park",environmentStudio:"studio",environmentSunset:"sunset",environmentWarehouse:"warehouse",color:"Color",material:"Material",texturePreview:"texture preview",noTextureApplied:"No texture applied",noTextureCoordinates:"This part has no texture coordinates, so an image can't be placed on it.",replaceImage:"Replace image",uploadImage:"Upload image",removeTexture:"Remove texture",texturePosition:"Texture position",offsetX:"Offset X",offsetY:"Offset Y",confirmTexturePosition:"Confirm this texture position and exit positioning mode",donePositioning:"Done positioning",textureOffsetHint:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically.",actionToggleLight:"Toggle Light",actionChangeLightColor:"Change Light Color",actionSetBrightness:"Set Brightness",actionChangeColor:"Change Color",actionChangeMaterial:"Change Material",actionToggleVisibility:"Toggle Visibility"};function ac(e,t,n={}){return(e?.[t]??uv[t]).replace(/\{(\w+)\}/g,(r,o)=>Object.prototype.hasOwnProperty.call(n,o)?String(n[o]):r)}var DT=new Map(Object.entries(uv).map(([e,t])=>[t,e]));function pv(e,t){let n=DT.get(t);return n?ac(e,n):t}var fv=require("react/jsx-runtime"),mv=(0,js.createContext)(void 0);function hv({labels:e,children:t}){return(0,fv.jsx)(mv.Provider,{value:e,children:t})}function Me(){let e=(0,js.useContext)(mv);return(0,js.useMemo)(()=>Object.assign((t,n)=>ac(e,t,n),{message:t=>pv(e,t)}),[e])}var N=require("react");var Hs=require("three"),zo=require("three-mesh-bvh"),vv=!1,Gs=new WeakMap,sc=new WeakMap;function OT(){vv||(Hs.Mesh.prototype.raycast=zo.acceleratedRaycast,vv=!0)}function BT(e){let t=new Set;return e.traverse(n=>{let i=n.geometry;!i||!i.attributes?.position||t.add(i)}),[...t]}function xv(e){let t=0;for(let n of e){let i=n.index?n.index.count:n.attributes.position.count;t+=i/3}return t}var lc=12e6;function yv(e){return bh(e)>lc}function bh(e){let t=new Set;return e.traverse(n=>{let i=n.geometry;i?.attributes?.position&&t.add(i)}),xv([...t])}function IT(e,t){return new Promise((n,i)=>{let r=c=>{let h=c.data;if(!h||!h.error&&!h.serialized)return;if(e.removeEventListener("message",r),e.removeEventListener("error",o),h.error){i(new Error(String(h.error)));return}let{serialized:p}=h,u=zo.MeshBVH.deserialize(p,t,{setIndex:!1});p.index&&(t.index?t.index.array=p.index:t.setIndex(new Hs.BufferAttribute(p.index,1,!1))),t.boundingBox=u.getBoundingBox(new Hs.Box3),n(u)},o=c=>{e.removeEventListener("message",r),e.removeEventListener("error",o),i(new Error(c.message||"BVH worker error"))};e.addEventListener("message",r),e.addEventListener("error",o);let a=t.index?t.index.array.slice():null,s=t.attributes.position.array.slice(),l=[s,...a?[a]:[]].map(c=>c.buffer);e.postMessage({index:a,position:s,options:{groups:[...t.groups]}},l)})}async function zT(){if(typeof window>"u"||typeof Worker>"u")return null;try{let{bvhWorkerCode:e}=await Promise.resolve().then(()=>(bv(),gv)),t=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(t),i=new Worker(n);return{worker:i,dispose:()=>{i.terminate(),URL.revokeObjectURL(n)}}}catch{return null}}async function UT(e,t){if(t)try{return await IT(t,e)}catch{}let n=zo.computeBoundsTree.call(e);return e.boundsTree=void 0,await new Promise(i=>setTimeout(i,0)),n}async function VT(e,t,n){if(e.boundsTree)return;if(t.buildPromise)return t.buildPromise;let i=(async()=>{let r=await n();t.references>0&&!e.boundsTree&&(e.boundsTree=r,t.ownedTree=r)})();return t.buildPromise=i.finally(()=>{t.buildPromise=void 0,t.references===0&&Gs.delete(e)}),t.buildPromise}async function eu(e,t){if(t?.aborted)return;let n=sc.get(e);if(!n){if(n=BT(e),xv(n)>lc){sc.set(e,[]);return}sc.set(e,n);for(let r of n){let o=Gs.get(r)??{references:0};o.references+=1,Gs.set(r,o)}}if(n.length===0)return;OT();let i=await zT();if(t?.aborted){i?.dispose();return}try{for(let r of n){if(t?.aborted)return;let o=Gs.get(r);o&&await VT(r,o,()=>UT(r,i?.worker))}}finally{i?.dispose()}}function cc(e){let t=sc.get(e);if(t){sc.delete(e);for(let n of t){let i=Gs.get(n);i&&(i.references=Math.max(0,i.references-1),!(i.references>0)&&(i.ownedTree&&n.boundsTree===i.ownedTree&&(zo.disposeBoundsTree.call(n),n.boundsTree=void 0),i.ownedTree=void 0,i.buildPromise||Gs.delete(n)))}}}var sm=require("@react-three/drei"),xo=require("three");var wv=require("lucide-react");var Uo=require("react/jsx-runtime");function Na({title:e,message:t,tone:n="default"}){return(0,Uo.jsxs)("div",{className:`ri-license-overlay${n==="error"?" ri-license-overlay--error":""}`,children:[(0,Uo.jsxs)("div",{className:"ri-license-overlay__header",children:[n==="error"?(0,Uo.jsx)(wv.AlertTriangle,{size:16,className:"ri-license-overlay__icon","aria-hidden":"true"}):(0,Uo.jsx)("span",{className:"ri-license-overlay__statusDot","aria-hidden":"true"}),(0,Uo.jsx)("span",{className:"ri-license-overlay__title",children:e})]}),(0,Uo.jsx)("p",{className:"ri-license-overlay__message",children:t})]})}var Sv=require("react"),tu=class extends Sv.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,i){this.props.onLoadError?.(n)}render(){return this.state.hasError?null:this.props.children}};var Ws=require("three");var _v="riEditorGizmo";function nu(e){return e.userData[_v]=!0,e}function ru(e){let t=[];return e.traverse(n=>{n.visible&&n.userData[_v]&&(n.visible=!1,t.push(n))}),()=>{for(let n of t)n.visible=!0}}var iu=require("react");function Bi(e){return!!e?.isWebGPURenderer}var Mv;function FT(){return Mv??(Mv=(async()=>{let e=typeof navigator>"u"?void 0:navigator.gpu;if(!e)return!1;try{return!!await e.requestAdapter()}catch{return!1}})()),Mv}var Cv=!1;function Tv(e){let[t,n]=(0,iu.useState)(null);return(0,iu.useEffect)(()=>{if(!e)return;let i=!1;return FT().then(r=>{i||(!r&&!Cv&&(Cv=!0,console.info("[react-immersive] WebGPU isn't available in this browser; using WebGL.")),n(r))}),()=>{i=!0}},[e]),e?t===null?null:t?"webgpu":"webgl":"webgl"}async function Pv(e){let{WebGPURenderer:t}=await import("three/webgpu"),n=new t({canvas:e.canvas,antialias:e.antialias??!0,alpha:e.alpha??!0});return await n.init(),n}function ou(e,t={}){if(!e)return Promise.reject(new Error("Viewer not ready"));let{gl:n,scene:i,camera:r,invalidate:o}=e,a=Bi(n);if(!a&&!n.getContextAttributes().preserveDrawingBuffer)return Promise.reject(new Error("Screenshot capture is disabled. Set preserveDrawingBuffer on ModelViewer to enable it."));let{transparent:s=!1}=t,l=n.getSize(new Ws.Vector2),c=n.getPixelRatio(),h=r instanceof Ws.PerspectiveCamera?r.aspect:null,p=i.background,u=t.width??l.x,m=t.height??l.y,f=u!==l.x||m!==l.y,g=ru(i);s&&(i.background=null),f&&(n.setPixelRatio(1),n.setSize(u,m,!1),r instanceof Ws.PerspectiveCamera&&(r.aspect=u/m,r.updateProjectionMatrix()));let b=()=>{g(),s&&(i.background=p),f&&(n.setPixelRatio(c),n.setSize(l.x,l.y,!1),r instanceof Ws.PerspectiveCamera&&h!==null&&(r.aspect=h,r.updateProjectionMatrix())),o()};if(a)try{return n.render(i,r),Promise.resolve(n.domElement.toDataURL("image/png"))}catch(x){return Promise.reject(x)}finally{b()}return o(),new Promise((x,v)=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{let w,M;try{w=n.domElement.toDataURL("image/png")}catch(_){M=_}b(),M?v(M):x(w)})})})}var Ir=require("react"),yh=require("three");var Qt=require("react"),au=require("@react-three/fiber"),Hn=require("three");function vh(e){if(e.duration!==void 0)return e.duration;let t=e.waypoints??[];if(t.length<2)return 24;let n=e.loop===!1?t.slice(0,-1):t;return Math.max(n.reduce((i,r)=>i+(r.segmentDuration??3.5),0),4)}var jT=1.2;function su({controlsRef:e,sceneRef:t,config:n,playing:i,resetOnPlay:r=!1,onFinished:o,onUserInteract:a,onStop:s,playOnce:l=!1,startAtPath:c=!1,onStarted:h,onProgress:p}){let u=(0,au.useThree)(O=>O.invalidate),m=(0,Qt.useMemo)(()=>n.waypoints??[],[n.waypoints]),f=m.length>=2,g=n.loop??!0,b=vh(n),x=(0,Qt.useMemo)(()=>m.map(O=>[...O.position,...O.target,O.azimuthAngle??"",O.polarAngle??"",O.segmentDuration??""].join(",")).join(";"),[m]),v=(0,Qt.useMemo)(()=>{let O=[];if(m.length<2)return O;let B=0;for(let re=0;re<m.length-1;re++)B+=m[re].segmentDuration??3.5,O.push(B);return g&&m.length>1&&(B+=m[m.length-1].segmentDuration??3.5,O.push(B)),O},[m,g]),w=(0,Qt.useMemo)(()=>O=>{if(m.length<2||v.length===0)return O/b;let B=v[v.length-1],re=g?O%b:Math.min(O,b),ke=b>0?re/b*B:0;for(let te=0;te<v.length;te++)if(ke<=v[te]){let We=te===0?0:v[te-1],wt=v[te]-We,be=wt>0?(ke-We)/wt:0,ue=g?m.length:m.length-1,Ne=te/ue,Te=1/ue;return Ne+be*Te}return 1},[m.length,v,b,g]),M=(0,Qt.useMemo)(()=>f?{position:new Hn.CatmullRomCurve3(m.map(O=>new Hn.Vector3(...O.position)),g,"catmullrom",.5),target:new Hn.CatmullRomCurve3(m.map(O=>new Hn.Vector3(...O.target)),g,"catmullrom",.5)}:null,[x,f,g]),_=(0,Qt.useMemo)(()=>{if(!f||!m.every(B=>Number.isFinite(B.azimuthAngle)&&Number.isFinite(B.polarAngle)))return null;let O=m.map(B=>({azimuth:B.azimuthAngle,polar:B.polarAngle,distance:new Hn.Vector3(...B.position).distanceTo(new Hn.Vector3(...B.target))}));for(let B=1;B<O.length;B+=1){let re=O[B-1].azimuth,ke=O[B].azimuth;O[B].azimuth=ke+Math.round((re-ke)/(Math.PI*2))*Math.PI*2}return O},[x,f]),y=(0,Qt.useRef)(0),P=(0,Qt.useRef)(0),d=(0,Qt.useRef)(new Hn.Vector3),S=(0,Qt.useRef)(new Hn.Vector3),C=(0,Qt.useRef)(!1),T=(0,Qt.useRef)(!0),E=(0,Qt.useRef)(0),k=(0,Qt.useRef)(!1),D=(0,Qt.useRef)(null),I=(0,Qt.useMemo)(()=>new Hn.Vector3,[]),L=(0,Qt.useMemo)(()=>new Hn.Vector3,[]),X=(0,Qt.useMemo)(()=>new Hn.Spherical,[]);return(0,Qt.useEffect)(()=>{y.current=0,E.current=0,P.current=0,k.current=!1},[x,g,b]),(0,Qt.useEffect)(()=>{r&&(E.current=0,y.current=0,k.current=!1)},[r]),(0,Qt.useEffect)(()=>{if(!i){C.current=!1,y.current>0&&!r?E.current=y.current:r&&(E.current=0),(y.current>0||k.current)&&s?.();return}y.current>=b&&!g&&(y.current=0,E.current=0,k.current=!1);let O=e.current;if(O&&(O.getPosition(d.current),O.getTarget(S.current)),r||k.current||E.current===0?(y.current=0,E.current=0,k.current=!1):E.current>0&&E.current<b?y.current=E.current:(y.current=0,E.current=0),P.current=0,!f){let B=t.current;if(B){let re=new Hn.Box3().setFromObject(B).getBoundingSphere(new Hn.Sphere);D.current={center:re.center.clone(),radius:re.radius>0?re.radius:1}}}C.current=!0,T.current=!0,u()},[i,f,e,t,u,b,g,x,r,s]),(0,Qt.useEffect)(()=>{if(!i||!a)return;let O=e.current;if(!O)return;let B=()=>{k.current||a()};return O.addEventListener("controlstart",B),()=>O.removeEventListener("controlstart",B)},[i,e,a]),(0,au.useFrame)((O,B)=>{if(!i||!C.current)return;let re=e.current;if(!re)return;let ke=T.current;T.current=!1,(!ke||!c)&&(y.current+=B,P.current+=B);let te=(!g||l)&&y.current>=b,We=te&&g?0:w(y.current);if(We=g?We%1:Math.min(We,1),M)if(M.target.getPoint(We,L),_){let be=g?_.length:_.length-1,ue=Math.min(We,1)*be,Ne=Math.min(Math.floor(ue),be-1),Te=(Ne+1)%_.length,bn=We>=1?1:ue-Ne,Oe=bn*bn*(3-2*bn),ot=_[Ne],mt=_[Te],vn=mt.azimuth+Math.round((ot.azimuth-mt.azimuth)/(Math.PI*2))*Math.PI*2,de=ot.azimuth+(vn-ot.azimuth)*Oe,ur=ot.polar+(mt.polar-ot.polar)*Oe,jt=ot.distance+(mt.distance-ot.distance)*Oe;X.set(Math.max(jt,1e-6),Math.min(Math.max(ur,1e-6),Math.PI-1e-6),de),I.setFromSpherical(X).add(L)}else M.position.getPoint(We,I);else{let be=D.current;if(!be)return;let ue=We*Math.PI*2,Ne=be.radius*2.2;I.set(be.center.x+Math.cos(ue)*Ne,be.center.y+be.radius*.6,be.center.z+Math.sin(ue)*Ne),L.copy(be.center)}let wt=c?1:Math.min(P.current/jT,1);if(wt<1){let be=wt*wt*(3-2*wt);I.lerpVectors(d.current,I,be),L.lerpVectors(S.current,L,be)}if(re.setLookAt(I.x,I.y,I.z,L.x,L.y,L.z,!1),ke&&h?.(),p?.(Math.min(y.current/b,1)),te){C.current=!1,k.current=!0,y.current=0,E.current=0,o?.();return}u()}),null}function Av(){return typeof document<"u"&&typeof HTMLCanvasElement<"u"&&typeof HTMLCanvasElement.prototype.captureStream=="function"}function Ev(e,t={}){let{fps:n=15,gifWidth:i=480,signal:r}=t;if(!Number.isFinite(n)||n<1||n>60)throw new Error("Video frame rate must be between 1 and 60.");if(!Number.isInteger(i)||i<16||i>4096)throw new Error("GIF width must be a whole number of pixels from 16 to 4096.");if(r?.aborted)throw new DOMException("Video export cancelled.","AbortError");if(typeof e.captureStream!="function"||typeof document>"u")throw new Error("Video recording as GIF is not supported in this browser.");let o=1e3/n,a,s,l,c=null,h,p=0,u=0,m=0,f=null,g=0,b=0,x=0,v=!1,w=!1,M,_,y,P,d,S,C=new Promise((B,re)=>{d=B,S=re}),T=()=>{clearTimeout(M),clearInterval(_),y!==void 0&&cancelAnimationFrame(y),P!==void 0&&cancelAnimationFrame(P),r?.removeEventListener("abort",k),e.removeEventListener("webglcontextlost",D),l&&(l.pause(),l.srcObject=null),s?.getTracks().forEach(B=>B.stop())},E=(B=new DOMException("Video export cancelled.","AbortError"))=>{v||(v=!0,T(),S(B))},k=()=>E(),D=()=>E(new Error("Video export stopped because the WebGL context was lost.")),I=()=>E(new Error("Video export timed out. Keep the viewer tab visible while recording."));r?.addEventListener("abort",k,{once:!0}),e.addEventListener("webglcontextlost",D),M=setTimeout(I,3e4);let L=(async()=>{if(a=await import("gifenc"),!v&&(s=e.captureStream(n),l=document.createElement("video"),l.muted=!0,l.playsInline=!0,l.srcObject=s,await l.play(),!v)){if(c=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),!c)throw new Error("Video recording as GIF is not supported in this browser.");h=a.GIFEncoder()}})().catch(B=>E(B)),X=B=>{if(!f||!h)return;let re=Math.max(2,Math.round((B-g)/10)-x);x+=re,h.writeFrame(f.index,p,u,{palette:f.palette,delay:re*10}),f=null},O=()=>{if(v||!a||!l||!c||!h||l.readyState<2||!l.videoWidth)return;let B=performance.now();if(!(m>0&&B-b<o/2)){p||(p=Math.min(i,l.videoWidth),u=Math.max(1,Math.round(p*l.videoHeight/l.videoWidth)),c.canvas.width=p,c.canvas.height=u);try{c.drawImage(l,0,0,p,u);let{data:re}=c.getImageData(0,0,p,u),ke=a.quantize(re,256),te=a.applyPalette(re,ke);m===0&&(g=B),X(B),f={index:te,palette:ke},b=B,m+=1}catch(re){E(re)}}};return{result:C,cancel:E,start(B){v||y!==void 0||(y=requestAnimationFrame(()=>{L.then(()=>{v||(O(),_=setInterval(O,o),clearTimeout(M),M=setTimeout(I,(B+30)*1e3))})}))},finish(){v||w||(w=!0,P=requestAnimationFrame(()=>{L.then(()=>{if(v||(O(),v))return;if(!h||m===0){E(new Error("The browser produced an empty video."));return}X(b+o),h.finish();let B=new Blob([h.bytes()],{type:"image/gif"});v=!0,T(),d(B)})}))}}}var xh={webm:["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"],mp4:["video/mp4;codecs=avc1.42E01E","video/mp4"]};function Qi(e="auto"){return e==="gif"?Av()?"image/gif":null:typeof MediaRecorder>"u"?null:(e==="auto"?[...xh.webm,...xh.mp4]:xh[e]).find(n=>MediaRecorder.isTypeSupported(n))??null}function Rv(e,t={}){if(t.format==="gif")return Ev(e,t);let{fps:n=30,videoBitsPerSecond:i=8e6,signal:r}=t;if(!Number.isFinite(n)||n<1||n>60)throw new Error("Video frame rate must be between 1 and 60.");if(!Number.isFinite(i)||i<=0)throw new Error("Video bitrate must be a positive number.");if(r?.aborted)throw new DOMException("Video export cancelled.","AbortError");let o=Qi(t.format);if(!o||typeof e.captureStream!="function"){let y=t.format&&t.format!=="auto"?` as ${t.format.toUpperCase()}`:"";throw new Error(`Video recording${y} is not supported in this browser.`)}let a,s,l=!1,c=!1,h,p,u,m=[],f,g,b=new Promise((y,P)=>{f=y,g=P}),x=()=>{clearTimeout(h),p!==void 0&&cancelAnimationFrame(p),u!==void 0&&cancelAnimationFrame(u),r?.removeEventListener("abort",w),e.removeEventListener("webglcontextlost",M),s&&(s.ondataavailable=null,s.onstop=null,s.onerror=null),a?.getTracks().forEach(y=>y.stop())},v=(y=new DOMException("Video export cancelled.","AbortError"))=>{if(!l){if(l=!0,x(),s&&s.state!=="inactive")try{s.stop()}catch{}g(y)}},w=()=>v(),M=()=>v(new Error("Video export stopped because the WebGL context was lost.")),_=()=>v(new Error("Video export timed out. Keep the viewer tab visible while recording."));return r?.addEventListener("abort",w,{once:!0}),e.addEventListener("webglcontextlost",M),h=setTimeout(_,3e4),{result:b,cancel:v,start(y){l||p!==void 0||(p=requestAnimationFrame(()=>{if(!l)try{a=e.captureStream(n);let P=new MediaRecorder(a,{mimeType:o,videoBitsPerSecond:i});s=P,P.ondataavailable=({data:d})=>{d.size>0&&m.push(d)},P.onerror=()=>v(new Error("The browser could not encode the video.")),P.onstop=()=>{if(l)return;l=!0,x();let d=new Blob(m,{type:P.mimeType||o});d.size===0?g(new Error("The browser produced an empty video.")):f(d)},P.start(1e3),clearTimeout(h),h=setTimeout(_,(y+30)*1e3)}catch(P){v(P)}}))},finish(){l||c||(c=!0,u=requestAnimationFrame(()=>{if(!l)try{if(!s)throw new Error("Video recording did not start.");s.stop()}catch(y){v(y)}}))}}}function kv(e){let t=(0,Ir.useRef)(e);t.current=e;let n=(0,Ir.useRef)(null),[i,r]=(0,Ir.useState)(null),[o,a]=(0,Ir.useState)(0),s=(0,Ir.useCallback)(()=>n.current?.cancel(),[]),l=(0,Ir.useCallback)(()=>n.current!==null,[]);(0,Ir.useEffect)(()=>s,[e.modelUrl,s]);let c=(0,Ir.useCallback)(async(p={})=>{let{rendererCaptureRef:u,controlsRef:m,cinematicConfig:f,ready:g,onCaptureStart:b}=t.current,x=u.current,v=m.current;if(!g||!x||!v)throw new Error("Viewer not ready for video export.");if(x.gl.xr.isPresenting)throw new Error("Exit the XR session before recording a video.");if(n.current)throw new Error("A video export is already in progress.");let w=p.mode??(f?"cinematic":"turntable");if(w==="cinematic"&&!f)throw new Error("Enable a cinematic camera path before recording it.");let M=w==="cinematic"?f:{loop:!0},_=p.duration??(w==="turntable"&&p.format==="gif"?8:vh(M));if(!Number.isFinite(_)||_<=0||_>300)throw new Error("Video duration must be greater than 0 and at most 300 seconds.");let y=Rv(x.gl.domElement,p);n.current=y;let P=v.getPosition(new yh.Vector3),d=v.getTarget(new yh.Vector3),S=v.enabled,C=ru(x.scene);v.stop(),v.enabled=!1,a(0),b(),r({config:{...M,duration:_,autoPlay:!1},onStarted:()=>y.start(_),onFinished:y.finish});try{return await y.result}finally{C(),v.enabled=S,v.setLookAt(P.x,P.y,P.z,d.x,d.y,d.z,!1),x.invalidate(),n.current=null,r(null)}},[]),h=(0,Ir.useCallback)(p=>{let u=Math.floor(p*100);a(m=>m===u?m:u)},[]);return{captureVideo:c,cancelVideo:s,isRecording:l,recording:i,progress:o,onProgress:h}}var $r=require("react");function Lv(e){let[t,n]=(0,$r.useState)(null),[i,r]=(0,$r.useState)(!1),[o,a]=(0,$r.useState)(!1),[s,l]=(0,$r.useState)(!1),[c,h]=(0,$r.useState)(null),p=(0,$r.useRef)(!1);(0,$r.useEffect)(()=>{if(!t||!e){r(!1),a(!1),h(null);return}let m=t.ownerDocument;r(m.fullscreenEnabled===!0&&typeof t.requestFullscreen=="function"&&typeof m.exitFullscreen=="function");let f=()=>{a(m.fullscreenElement===t),h(null)};return f(),m.addEventListener("fullscreenchange",f),()=>m.removeEventListener("fullscreenchange",f)},[t,e]);let u=(0,$r.useCallback)(async()=>{if(!t||!e||!i||p.current)return;let m=t.ownerDocument,f=m.fullscreenElement===t;p.current=!0,l(!0),h(null);try{f?await m.exitFullscreen():await t.requestFullscreen(),a(m.fullscreenElement===t)}catch{h(f?"Could not exit fullscreen. Press Escape to exit.":"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.")}finally{p.current=!1,l(!1)}},[t,e,i]);return{rootRef:n,supported:i,active:o,pending:s,error:c,toggle:u}}var Wn=require("react");function Dv(e,{onLost:t,onRestored:n,initiallyLost:i=!1}){let r=i,o=s=>{s.preventDefault(),!r&&(r=!0,t())},a=()=>{r&&(r=!1,n())};return e.addEventListener("webglcontextlost",o),e.addEventListener("webglcontextrestored",a),i&&t(),()=>{e.removeEventListener("webglcontextlost",o),e.removeEventListener("webglcontextrestored",a)}}var lu=require("@react-three/fiber"),wh=require("react");function Nv({captureRef:e}){let{gl:t,scene:n,camera:i,invalidate:r,get:o}=(0,lu.useThree)();return(0,wh.useEffect)(()=>{if(!e)return;let a=()=>{let s=o();s.advance(s.frameloop==="never"?s.clock.elapsedTime:performance.now())};return e.current={gl:t,scene:n,camera:i,invalidate:r,drawNow:a},()=>{e.current=null}},[e,t,n,i,r,o]),null}function Ov(){let e=(0,lu.useThree)(n=>n.frameloop),t=(0,lu.useThree)(n=>n.invalidate);return(0,wh.useEffect)(()=>{e!=="never"&&t()},[e,t]),null}function Bv(e){e.dispose(),"forceContextLoss"in e&&!Bi(e)&&(e.forceContextLoss(),e.forceContextLoss=()=>{})}function Iv(e){if(!e)return Promise.resolve(null);try{e.drawNow();let t=e.gl.domElement;return new Promise(n=>{t.toBlob(i=>n(i?URL.createObjectURL(i):null),"image/webp",.85)})}catch{return Promise.resolve(null)}}function zv(e){let t=(0,Wn.useRef)(e);t.current=e;let[n,i]=(0,Wn.useState)(null),[r,o]=(0,Wn.useState)(0),[a,s]=(0,Wn.useState)("ready"),l=(0,Wn.useRef)(null),c=(0,Wn.useRef)(!1),h=(0,Wn.useRef)(null),p=(0,Wn.useRef)(null),u=(0,Wn.useCallback)(b=>{p.current?.dispose(),p.current=null,h.current=b,i(b)},[]),m=(0,Wn.useCallback)(()=>{c.current||(c.current=!0,t.current?.(),l.current?.(),l.current=null,h.current&&(p.current=h.current),h.current=null,i(null),s("rebuilding"),o(b=>b+1))},[]),f=(0,Wn.useCallback)(()=>{l.current?.(),l.current=null;let b=h.current;h.current=null,i(null),b&&Bv(b)},[]),g=(0,Wn.useCallback)(()=>{c.current=!1,s("lost")},[]);return(0,Wn.useEffect)(()=>()=>{p.current?.dispose(),p.current=null},[]),(0,Wn.useEffect)(()=>{if(!n)return;if(c.current=!1,s("ready"),Bi(n)){let x=n,v=x.onDeviceLost;return x.onDeviceLost=w=>{console.warn("[react-immersive] The WebGPU device was lost.",w),g()},()=>{x.onDeviceLost=v}}let b=Dv(n.domElement,{initiallyLost:n.getContext().isContextLost(),onLost:g,onRestored:m});return l.current=b,()=>{b(),l.current===b&&(l.current=null)}},[n,g,m]),{generation:r,status:a,reload:m,fail:g,release:f,onRendererCreated:u}}var du=require("react");var dc=require("react"),GT="200px",Uv=new Map;function Vv(e,t,n){let i=Uv.get(t);if(!i){let a=new Map;i={observer:new IntersectionObserver(l=>{for(let c of l)a.get(c.target)?.(c.isIntersecting)},{rootMargin:t}),watchers:a},Uv.set(t,i)}let{observer:r,watchers:o}=i;return o.set(e,n),r.observe(e),()=>{o.delete(e),r.unobserve(e)}}function Fv(e){let t=typeof IntersectionObserver<"u",[n,i]=(0,dc.useState)(!t),[r,o]=(0,dc.useState)(!t);return(0,dc.useEffect)(()=>{let a=e.current;if(!a||!t)return;let s=Vv(a,GT,i),l=Vv(a,"0px",o);return()=>{s(),l()}},[e,t]),{near:n,visible:r}}var Vo=require("react");function Sh(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function _h(){if(typeof navigator>"u")return!1;let e=navigator.userAgent;return/iPhone|iPad|iPod/i.test(e)?!0:navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints=="number"&&navigator.maxTouchPoints>1}function jv(){return Sh()||_h()}function HT(){if(typeof window>"u"||typeof navigator>"u")return!1;let e=a=>typeof window.matchMedia=="function"&&window.matchMedia(a).matches,t=e("(pointer: coarse)")||e("(any-pointer: coarse)"),n=e("(hover: none)")||e("(any-hover: none)"),i=navigator.maxTouchPoints>0,r=typeof window.screen<"u"&&Math.min(window.screen.width,window.screen.height)<=1024,o=Sh();return t||o||i&&n||i&&r}function uc(){if(!HT())return!1;if(Sh())return!0;let e=navigator.deviceMemory;return!(typeof e=="number"&&e>=8)}function Gv(e="auto"){switch(e){case"high":return!1;case"low":return!0;default:return uc()}}function WT(e,t){let n=new Set,i=r=>{for(let o of r){if(n.size>=t)return;n.add(o.id)}};return i(e.filter(r=>r.wanted).sort((r,o)=>Number(o.visible)-Number(r.visible)||Number(o.live)-Number(r.live)||r.since-o.since)),i(e.filter(r=>!r.wanted&&r.live).sort((r,o)=>o.since-r.since)),n}var XT=12,qT=6,cu=new Map,$T=1,Mh=!1,Hv;function Wv(){Mh||(Mh=!0,queueMicrotask(()=>{Mh=!1,Hv??(Hv=uc()?qT:XT);let e=WT([...cu.values()],Hv);for(let t of cu.values()){let n=e.has(t.id);n!==t.live&&(t.live=n,t.onLiveChange(n))}}))}function Xv({managed:e,wanted:t,visible:n,onPark:i}){let[r,o]=(0,Vo.useState)(!1),a=(0,Vo.useRef)(i);a.current=i;let s=(0,Vo.useRef)(null);return(0,Vo.useEffect)(()=>{if(!e)return;let l={id:$T++,wanted:!1,visible:!1,live:!1,since:performance.now(),onLiveChange:c=>{c||a.current?.(),o(c)}};return cu.set(l.id,l),s.current=l,()=>{cu.delete(l.id),s.current=null,o(!1),Wv()}},[e]),(0,Vo.useEffect)(()=>{let l=s.current;!l||l.wanted===t&&l.visible===n||(l.wanted!==t&&(l.since=performance.now()),l.wanted=t,l.visible=n,Wv())},[e,t,n]),e?r:t}function qv({loading:e="lazy",reveal:t="auto",rootRef:n,onPark:i}){let{near:r,visible:o}=Fv(n),[a,s]=(0,du.useState)(t==="auto");return(0,du.useEffect)(()=>{t==="auto"&&s(!0)},[t]),{live:Xv({managed:e==="lazy",wanted:a&&(e==="eager"||r),visible:o,onPark:i}),visible:o,awaitingReveal:!a,reveal:()=>s(!0)}}var $v=require("lucide-react");var Oa=require("react/jsx-runtime");function uu({src:e,hidden:t=!1}){return e?(0,Oa.jsx)("img",{className:`ri-poster${t?" ri-poster--hidden":""}`,src:e,alt:"","aria-hidden":"true",draggable:!1,decoding:"async"}):null}function Yv({className:e,background:t,poster:n,onReveal:i}){let r=Me();return(0,Oa.jsxs)("div",{className:`${e} ri-viewerPlaceholder`,style:{background:t},children:[(0,Oa.jsx)(uu,{src:n}),i?(0,Oa.jsxs)("button",{type:"button",className:"ri-revealButton",onClick:i,children:[(0,Oa.jsx)($v.Box,{size:16,"aria-hidden":"true"}),r("viewIn3D")]}):null]})}var pu=require("react");function Fo(e,t){let n=(0,pu.useRef)(t);(0,pu.useEffect)(()=>{let i=n.current;n.current=t,t.some((r,o)=>!Object.is(r,i[o]))&&e()},t)}function Ch(e,t){if(e)return e;let n=t?.background;return n?.enabled&&n.type==="color"?n.color:"#1c1c1d"}function mu(e,t){return t||e}async function Kv(e,t){await e.setLookAt(...t.position,...t.target,!1);let n=e.camera;t.fov!=null&&Number.isFinite(t.fov)&&t.fov>0&&t.fov<180&&"fov"in n&&(n.fov=t.fov,n.updateProjectionMatrix()),t.zoom!=null&&Number.isFinite(t.zoom)&&t.zoom>0&&await e.zoomTo(t.zoom,!1)}var Zv=require("react"),Xs=class extends Zv.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,i){this.props.onError?.(n)}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};var qs=require("react");function Jv({modelUrl:e,tilesetUrl:t=null,getOptions:n,now:i=()=>performance.now(),timestamp:r=()=>new Date().toISOString(),sessionId:o=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`viewer-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,log:a=l=>console.info("[react-immersive engagement]",l),warn:s=l=>console.warn("[react-immersive] onEngagement callback failed:",l)}){let l=i(),c=()=>{let T=n();return!!(T.onEngagement||T.debugEngagement)},h=T=>Math.max(0,Math.round(i()-T)),p=T=>{let{onEngagement:E,debugEngagement:k}=n();if(!E&&!k)return;let D={...T,sessionId:o,timestamp:r(),elapsedMs:h(l),modelUrl:e,tilesetUrl:t};k&&a(D);try{Promise.resolve(E?.(D)).catch(s)}catch(I){s(I)}},u=null,m=null,f="[]",g=null,b=null,x=T=>{u=T},v=T=>{!c()||u===T.objectKey||(u=T.objectKey,p({type:"part-viewed",...T}))},w=(T,E,k=null)=>{let D=JSON.stringify([k,E,T]);!c()||T===E||D===m||(m=D,p({type:"variant-chosen",variant:T,previousVariant:E,group:k}))},M=T=>{let E=JSON.stringify(T);E!==f&&(f=E,m=null)},_=()=>{!c()||g!==null||(g=i(),p({type:"ar-started"}))},y=(T="session-ended")=>{if(g===null)return;let E=h(g);g=null,p({type:"ar-ended",durationMs:E,reason:T})},P=(T="stopped")=>{if(!b)return;let{startedAt:E,annotationCount:k}=b;b=null,p({type:"tour-stopped",annotationCount:k,durationMs:h(E),reason:T})};return{setSelectedPart:x,viewPart:v,setActiveVariants:M,chooseVariant:w,startAR:_,endAR:y,startTour:T=>{!c()||T<=0||(P("restarted"),b={startedAt:i(),annotationCount:T},p({type:"tour-started",annotationCount:T}))},stopTour:P,completeTour:()=>{if(!b)return;let{startedAt:T,annotationCount:E}=b;b=null,p({type:"tour-completed",annotationCount:E,durationMs:h(T)})},interrupt:()=>{y("interrupted"),P("interrupted")},requestARLaunch:T=>p({type:"ar-launch-requested",channel:T})}}function Qv(e){let t=(0,qs.useRef)(e);t.current=e;let n=!!(e.onEngagement||e.debugEngagement),i=(0,qs.useMemo)(()=>Jv({modelUrl:e.modelUrl,tilesetUrl:e.tilesetUrl,getOptions:()=>t.current}),[e.modelUrl,e.tilesetUrl,n]);return(0,qs.useEffect)(()=>()=>i.interrupt(),[i]),i}var $s=require("fflate");var ex;function tx(e){ex=e}function pc(e){ex?.(e)}var YT=[".glb",".gltf",".obj",".fbx",".usdz",".stl",".ply",".zip"],KT=["model/gltf-binary","model/gltf+json","model/vnd.usdz+zip","application/vnd.usdz+zip","application/zip","application/x-zip-compressed"],mc=1024*1024,nx=128*mc,rx=1024,ix=128*mc,ox=256*mc,ax=200,ZT=mc,eo=new Map,dx=".glb,.gltf,.obj,.fbx,.usdz,.stl,.ply,.zip,model/gltf-binary,model/gltf+json,model/vnd.usdz+zip,application/vnd.usdz+zip,application/zip";function hc(e){let t=e.split(/[?#]/,1)[0].toLowerCase();return t.endsWith(".obj")?"obj":t.endsWith(".fbx")?"fbx":t.endsWith(".usdz")?"usdz":t.endsWith(".stl")?"stl":t.endsWith(".ply")?"ply":t.endsWith(".gltf")?"gltf":"glb"}function ux(e){return eo.get(e)??{format:hc(e)}}function JT(e){let t=e.name.toLowerCase();return YT.some(n=>t.endsWith(n))||KT.includes(e.type)}async function Ph(e){if(!JT(e))throw new Error("Unsupported model file. Please upload a .glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, or .zip asset.");let t=e.name.toLowerCase();if(t.endsWith(".usdz")||e.type==="model/vnd.usdz+zip"||e.type==="application/vnd.usdz+zip")return sx(e,"usdz");if(t.endsWith(".zip")||QT(e.type))return e2(e);if(t.endsWith(".gltf")||e.type==="model/gltf+json")return lx(e);let n=hc(e.name);return n==="gltf"?lx(e):sx(e,n)}function sx(e,t){let n=URL.createObjectURL(e);return eo.set(n,{format:t,entryPath:e.name}),{url:n,name:e.name,format:t,cleanup:()=>{pc(n),eo.delete(n),URL.revokeObjectURL(n)}}}function QT(e){return e==="application/zip"||e==="application/x-zip-compressed"}async function lx(e){let t=await e.text(),n=px(t,e.name);for(let r of mx(n))if(!Ah(r))throw new Error(`${e.name} references external assets. Upload a .zip containing the .gltf file and its dependencies.`);let i=URL.createObjectURL(e);return eo.set(i,{format:"gltf",entryPath:e.name}),{url:i,name:e.name,format:"gltf",cleanup:()=>{pc(i),eo.delete(i),URL.revokeObjectURL(i)}}}async function e2(e){if(e.size>nx)throw new Error(`Model zip is too large. The compressed archive must be ${Th(nx)} or smaller.`);let t=await t2(new Uint8Array(await e.arrayBuffer())),n=new Map;for(let[a,s]of Object.entries(t)){let l=Eh(a);!l||hx(l)||n.set(l,s)}let i=[...n.keys()].filter(a=>/\.(gltf|obj|fbx|stl|ply)$/i.test(a));if(i.length===0)throw new Error("Invalid model zip: no .gltf, .obj, .fbx, .stl, or .ply file found.");if(i.length>1)throw new Error("Invalid model zip: multiple model entry files found.");let r=i[0],o=hc(r);if(o==="gltf")return r2(e,r,n);if(o==="obj"||o==="fbx"||o==="stl"||o==="ply")return n2(e,r,o,n);throw new Error(`Unsupported model entry ${r}.`)}function t2(e){return new Promise((t,n)=>{let i=0,r=0,o=null,a=l=>(o??(o=new Error(`Invalid model zip: ${l}`)),!1);(0,$s.unzip)(e,{filter:l=>{if(o)return!1;if(i+=1,i>rx)return a(`archive contains more than ${rx.toLocaleString()} entries.`);if(l.originalSize>ix)return a(`${l.name} expands beyond the ${Th(ix)} per-file limit.`);if(r+=l.originalSize,r>ox)return a(`expanded contents exceed ${Th(ox)}.`);if(l.originalSize>=ZT&&(l.size===0||l.originalSize/l.size>ax))return a(`${l.name} exceeds the ${ax}:1 compression-ratio limit.`);let c=Eh(l.name);return!!c&&!hx(c)}},(l,c)=>{o?n(o):l?n(new Error(`Invalid model zip: ${l.message}`)):t(c)})})}function Th(e){return`${e/mc} MiB`}function n2(e,t,n,i){let r=[],o={};for(let[s,l]of i){let c=URL.createObjectURL(new Blob([l],{type:fx(s)}));r.push(c),o[s]=c}let a=o[t];if(!a)throw r.forEach(s=>URL.revokeObjectURL(s)),new Error(`Invalid model zip: could not read ${t}.`);return eo.set(a,{format:n,entryPath:t,resourceUrls:o}),{url:a,name:e.name,format:n,cleanup:()=>{pc(a),eo.delete(a),r.forEach(s=>URL.revokeObjectURL(s))}}}function r2(e,t,n){let i=n.get(t);if(!i)throw new Error("Invalid GLTF zip: no .gltf found.");let r=px((0,$s.strFromU8)(i),t);i2(r,t);let o=o2(t),a=[];try{cx(r.buffers,o,n,a),cx(r.images,o,n,a);let s=new Blob([(0,$s.strToU8)(JSON.stringify(r))],{type:"model/gltf+json"}),l=URL.createObjectURL(s);return a.push(l),eo.set(l,{format:"gltf",entryPath:t}),{url:l,name:e.name,format:"gltf",cleanup:()=>{pc(l),eo.delete(l),a.forEach(c=>URL.revokeObjectURL(c))}}}catch(s){throw a.forEach(l=>URL.revokeObjectURL(l)),s}}function cx(e,t,n,i){for(let r of e??[]){if(typeof r.uri!="string"||Ah(r.uri))continue;let o=a2(t,r.uri),a=n.get(o);if(!a)throw new Error(`Invalid GLTF zip: missing referenced asset ${r.uri}.`);let s=URL.createObjectURL(new Blob([a],{type:fx(o)}));i.push(s),r.uri=s}}function px(e,t){try{return JSON.parse(e)}catch{throw new Error(`${t} is not a valid .gltf JSON file.`)}}function mx(e){return[...e.buffers??[],...e.images??[]].map(t=>t.uri).filter(t=>typeof t=="string"&&t.length>0)}function i2(e,t){for(let n of mx(e)){if(Ah(n))continue;let i=/^[a-z][a-z0-9+.-]*:/i.test(n),r=n.startsWith("/")||n.startsWith("\\");if(i||r)throw new Error(`${t} references external assets. Include every dependency inside the uploaded .zip.`)}}function Ah(e){return e.startsWith("data:")}function Eh(e){let t=[];for(let n of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(i=>i&&i!==".")){if(n===".."){t.pop();continue}t.push(n)}return t.join("/")}function hx(e){let t=e.split("/");return e.endsWith("/")||t.includes("__MACOSX")||t.some(n=>n===".DS_Store"||n.startsWith("._"))}function o2(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function a2(e,t){let n=t.split(/[?#]/)[0],i=s2(n);return Eh(e?`${e}/${i}`:i)}function s2(e){try{return decodeURI(e)}catch{return e}}function fx(e){let t=e.toLowerCase();return t.endsWith(".obj")||t.endsWith(".mtl")?"text/plain":t.endsWith(".fbx")?"application/octet-stream":t.endsWith(".usdz")?"model/vnd.usdz+zip":t.endsWith(".bin")?"application/octet-stream":t.endsWith(".png")?"image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?"image/jpeg":t.endsWith(".webp")?"image/webp":t.endsWith(".avif")?"image/avif":t.endsWith(".ktx2")?"image/ktx2":"application/octet-stream"}var zr=require("three"),bx=require("three/examples/jsm/loaders/STLLoader.js"),vx=require("three/examples/jsm/loaders/PLYLoader.js"),l2=12106948,xx="This PLY file is a point cloud: it has vertices but no faces.",hu=class extends Error{constructor(){super(xx),this.name="PointCloudError"}};function fu(e){return e instanceof hu||e instanceof Error&&e.message.includes(xx)}function yx(e,t){let n=e.split(/[?#]/,1)[0],i=n.slice(n.lastIndexOf("/")+1);try{i=decodeURIComponent(i)}catch{}return i.replace(/\.[^.]*$/,"").trim()||t}function Rh(e){return new zr.MeshStandardMaterial({color:e?16777215:l2,vertexColors:e,metalness:0,roughness:.6})}function gx(e,t,n){let i=e.itemSize;return new zr.Float32BufferAttribute(e.array.slice(t*i,(t+n)*i),i)}function wx(e,t){let n=new bx.STLLoader().parse(e),i=!!n.hasColors,r=new zr.Group;if(n.groups.length>1){let s=n.userData.groupNames??[],l=n.getAttribute("position"),c=n.getAttribute("normal");return n.groups.forEach((h,p)=>{let u=new zr.BufferGeometry;u.setAttribute("position",gx(l,h.start,h.count)),c&&u.setAttribute("normal",gx(c,h.start,h.count));let m=new zr.Mesh(u,Rh(!1));m.name=s[p]?.trim()||`${t} ${p+1}`,r.add(m)}),n.dispose(),r}n.clearGroups();let o=Rh(i);i&&n.alpha!==void 0&&n.alpha<1&&(o.opacity=n.alpha,o.transparent=!0);let a=new zr.Mesh(n,o);return a.name=t,r.add(a),r}function c2(e){let n=new TextDecoder().decode(new Uint8Array(e,0,Math.min(e.byteLength,65536))).split("end_header",1)[0],i=/^\s*element\s+face\s+(\d+)/m.exec(n);return!!(i&&Number(i[1])>0)}function Sx(e,t){if(!c2(e))throw new hu;let n=new vx.PLYLoader().parse(e);n.getAttribute("normal")||n.computeVertexNormals();let i=new zr.Mesh(n,Rh(!!n.getAttribute("color")));i.name=t;let r=new zr.Group;return r.add(i),r}var d2={glb:"GLB",gltf:"glTF",obj:"OBJ",fbx:"FBX",usdz:"USDZ",stl:"STL",ply:"PLY"},u2=/\.(glb|gltf|obj|fbx|usdz|stl|ply|zip)$/i;function p2(e,t){let n=e?.response?.status;if(typeof n=="number")return n;let i=/responded with (\d{3})/.exec(t);return i?Number(i[1]):null}function _x(e,t,n,i){let r=e instanceof Error?e.message:e==null?"":String(e),o=(u,m)=>ac(i,u,m),a=o("loadErrorTitle"),s=r||null;if(fu(e))return{title:a,detail:o("loadErrorPointCloud"),technical:s};let l=p2(e,r);if(l===404||l===410)return{title:a,detail:o("loadErrorNotFound",{status:l}),technical:s};if(l===401||l===403)return{title:a,detail:o("loadErrorDenied",{status:l}),technical:s};if(l!==null)return{title:a,detail:o("loadErrorStatus",{status:l}),technical:s};if(/failed to fetch|networkerror|load failed|network error/i.test(r))return{title:a,detail:o("loadErrorNetwork"),technical:s};if(/<!doctype|<html/i.test(r))return{title:a,detail:o("loadErrorHtml"),technical:s};let c=t.split(/[?#]/,1)[0],h=d2[n??hc(t)],p=u2.test(c);return{title:a,detail:p||n?o(n?"loadErrorInvalidExplicitFormat":"loadErrorInvalidFile",{format:h}):o("loadErrorMissingFormat",{format:h}),technical:s}}var Mx={showObjectBindingDataPanel:!1,showSceneObjectsPanel:!1,showDownloadButton:!1,showResetButton:!1,showAnnotationNavigation:!1,showMaterialVariants:!1},m2=Object.freeze({minimal:Object.freeze({...Mx}),showcase:Object.freeze({...Mx,autoRotate:!0}),configurator:Object.freeze({showObjectBindingDataPanel:!0,showSceneObjectsPanel:!1,showDownloadButton:!1,showResetButton:!0,showMaterialVariants:!0}),inspector:Object.freeze({showObjectBindingDataPanel:!0,showSceneObjectsPanel:!0,showDownloadButton:!0,showResetButton:!0,showViewGizmo:!0,showMeasureTools:!0,showUvCheckerButton:!0,showExplodeControls:!0,showSectionTools:!0,showIsolateControls:!0,enableKeyboardNavigation:!0})}),h2=["preset","ui","tools","controls","perf","tiles","xr","decoders"];function Cx(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function f2({ui:e,tools:t,controls:n,perf:i,tiles:r,xr:o,decoders:a}){let s=e?.download,l=e?.mouseController,c=t?.measure,h=n?.autoRotate;return{showObjectBindingDataPanel:e?.objectPanel,showSceneObjectsPanel:e?.sceneObjects,showDownloadButton:s===void 0?void 0:s!==!1,downloadFilename:typeof s=="string"?s:void 0,showResetButton:e?.reset,showFullscreenButton:e?.fullscreen,showLoadingOverlay:e?.loadingOverlay,showViewGizmo:e?.viewGizmo,showMouseController:l===void 0?void 0:l!==!1,mouseControllerPosition:typeof l=="object"?l.position:void 0,mouseControllerOpacity:typeof l=="object"?l.opacity:void 0,showAnnotationNavigation:e?.annotationNavigation,showAnnotationOnHover:e?.annotationOnHover,showAnnotationFilters:e?.annotationFilters,highlightOnHover:e?.highlightOnHover,showMaterialVariants:e?.materialVariants,showObjectNavigator:e?.objectNavigator,showMeasureTools:c===void 0?void 0:c!==!1,measurementUnit:typeof c=="object"?c.unit:void 0,showUvCheckerButton:t?.uvChecker,showExplodeControls:t?.explode,showSectionTools:t?.section,showIsolateControls:t?.isolate,texturePositioning:t?.texturePositioning,enableCameraControls:n?.enabled,enableKeyboardNavigation:n?.keyboard,reducedMotion:n?.reducedMotion,disableZoom:n?.zoom===void 0?void 0:!n.zoom,zoomOnSelected:n?.zoomOnSelect,autoRotate:h===void 0?void 0:h!==!1,autoRotateSpeed:typeof h=="number"?h:void 0,refitOnResize:n?.refitOnResize,cameraLimits:n?.limits,moveSensitivity:n?.moveSensitivity,zoomSensitivity:n?.zoomSensitivity,renderMode:i?.renderMode,maxDpr:i?.maxDpr,performanceProfile:i?.profile,preserveDrawingBuffer:i?.preserveDrawingBuffer,webgpu:i?.webgpu,tilesetUrl:r?.url,tilesErrorTarget:r?.errorTarget,tilesCacheSize:r?.cacheSize,enableXR:o?.enabled,usdzUrl:o?.usdzUrl,arScaleMode:o?.scaleMode,mobileHandoffUrl:o?.mobileHandoffUrl,dracoDecoderPath:a?.draco,ktx2TranscoderPath:a?.ktx2,meshopt:a?.meshopt}}function Tx(e){let t={...e};for(let n of h2)delete t[n];return{...e.preset?m2[e.preset]:void 0,...Cx(t),...Cx(f2(e))}}var Ba=Object.freeze([{id:"change-color",label:"Change Color",handling:"viewer",description:"Opens a color picker docked under the action and commits the result to style.material.baseColor."},{id:"change-material",label:"Change Material",handling:"viewer",description:"Opens the material picker so the viewer can swap the object's texture."},{id:"add-text",label:"Add Text",handling:"viewer",description:"Opens a text box docked under the action; the viewer's user types, clicks the object to place it, and can resize, turn, move, or remove it. Saved to the binding's decals."},{id:"add-image",label:"Add Image",handling:"viewer",description:"Lets the viewer's user choose an image, click the object to place it, and resize, turn, move, or remove it. Saved to the binding's decals."},{id:"toggle-visibility",label:"Toggle Visibility",handling:"viewer",description:"Flips the binding's visible flag."},{id:"toggle-light",label:"Toggle Light",handling:"viewer",description:"Turns the scene lights attached to this object on or off, or the object's own glow when none is attached."},{id:"change-light-color",label:"Change Light Color",handling:"viewer",description:"Opens a color picker docked under the action for the scene lights attached to this object, or the object's own glow."},{id:"set-brightness",label:"Set Brightness",handling:"viewer",description:"Opens a brightness slider docked under the action for the scene lights attached to this object, or the object's own glow."}]),gu="__custom__";function fc(e){return Ba.find(t=>t.id===e)}var gc=Ba.filter(e=>e.handling==="viewer").map(e=>e.id),g2=new Set(["","New Action",...Ba.map(e=>e.label)]);function kh(e){return g2.has(e.trim())}function Px(e,t){let n=Array.from({length:t.length+1},(i,r)=>r);for(let i=1;i<=e.length;i+=1){let r=[i];for(let o=1;o<=t.length;o+=1){let a=n[o-1]+(e[i-1]===t[o-1]?0:1);r[o]=Math.min(r[o-1]+1,n[o]+1,a)}n=r}return n[t.length]}function Ax(e){if(fc(e))return null;let t=e.trim().toLowerCase();if(!t)return null;let n=t.replace(/[^a-z0-9]/g,""),i=null;for(let r of Ba){let o=Math.min(Px(t,r.id),Px(n,r.id.replace(/[^a-z0-9]/g,"")));(!i||o<i.distance)&&(i={id:r.id,distance:o})}return i&&i.distance<=2?i.id:null}var Ex=require("three");function jo(e,t){if(e[t])return t;let n=Object.entries(e).find(([,r])=>r.id===t)?.[0];return n||(Object.entries(e).find(([,r])=>r.modelObjectId===t)?.[0]??null)}function Rx(e,t,n){let i=t[n]?.modelObjectId;return e.lighting.lights.filter(r=>{let o=r.attachment?.objectId;return o?jo(t,o)===n||o===i:!1})}function Lh(e,t){return e.lighting.lights.some(n=>t[n.id])?{...e,lighting:{...e.lighting,lights:e.lighting.lights.map(n=>t[n.id]?{...n,...t[n.id]}:n)}}:e}function kx(e){let t=null;if(e?.traverse(r=>{if(t)return;let o=r.material;for(let a of Array.isArray(o)?o:o?[o]:[])if(a.emissive instanceof Ex.Color){t=a;return}}),!t)return{color:"#000000",intensity:0,on:!1};let n=`#${t.emissive.getHexString()}`,i=t.emissiveIntensity??1;return{color:n,intensity:i,on:n!=="#000000"&&i>0}}var Lx=require("react-colorful"),Xn=require("react/jsx-runtime");function Dx({kind:e,color:t,brightness:n,onColorChange:i,onBrightnessChange:r,onClose:o}){return(0,Xn.jsx)("div",{className:"ri-popover ri-popover--inline",style:{padding:12},onPointerDown:a=>a.stopPropagation(),children:e==="change-light-color"?(0,Xn.jsxs)(Xn.Fragment,{children:[(0,Xn.jsx)("p",{className:"ri-popoverLabel",children:"Light color"}),(0,Xn.jsx)(Lx.HexColorPicker,{color:t,onChange:i}),(0,Xn.jsxs)("div",{className:"ri-inlineRow",children:[(0,Xn.jsx)("span",{className:"ri-colorCode",children:t}),(0,Xn.jsx)("button",{className:"ri-secondaryButton",onClick:o,children:"Done"})]})]}):(0,Xn.jsxs)(Xn.Fragment,{children:[(0,Xn.jsx)("p",{className:"ri-popoverLabel",children:"Brightness"}),(0,Xn.jsx)("input",{type:"range",min:0,max:200,step:1,value:n,"aria-label":"Brightness",style:{width:"100%"},onChange:a=>r(Number(a.target.value))}),(0,Xn.jsxs)("div",{className:"ri-inlineRow",children:[(0,Xn.jsxs)("span",{className:"ri-colorCode",children:[n,"%"]}),(0,Xn.jsx)("button",{className:"ri-secondaryButton",onClick:o,children:"Done"})]})]})})}var bc=require("react");var Go=require("lucide-react"),Ys=require("react");function Nx(e){let t=!1,n,i=()=>{t||(e(),t||(n=setTimeout(i,70)))};return e(),n=setTimeout(i,300),()=>{t=!0,clearTimeout(n)}}var to=require("react/jsx-runtime");function bu({onNudge:e}){let t=Me(),n=(0,Ys.useRef)(e);n.current=e;let i=(0,Ys.useRef)(null),r=(0,Ys.useRef)(null),o=()=>{i.current?.(),i.current=null,r.current=null};return(0,Ys.useEffect)(()=>{let a=l=>{l.pointerId===r.current&&o()},s=l=>{l.key==="Escape"&&o()};return window.addEventListener("pointerup",a,!0),window.addEventListener("pointercancel",a,!0),window.addEventListener("blur",o),window.addEventListener("keydown",s),()=>{o(),window.removeEventListener("pointerup",a,!0),window.removeEventListener("pointercancel",a,!0),window.removeEventListener("blur",o),window.removeEventListener("keydown",s)}},[]),(0,to.jsxs)("div",{className:"ri-decalPosition",children:[(0,to.jsxs)("div",{children:[(0,to.jsx)("div",{className:"ri-decalPosition__label",children:t("position")}),(0,to.jsx)("div",{className:"ri-decalPosition__hint",children:t("decalNudgeHint")})]}),(0,to.jsx)("div",{className:"ri-decalPosition__pad",role:"group","aria-label":t("decalNudgeControls"),children:[["up",Go.ArrowUp],["left",Go.ArrowLeft],["right",Go.ArrowRight],["down",Go.ArrowDown]].map(([a,s])=>(0,to.jsx)("button",{type:"button",className:`ri-decalPosition__button ri-decalPosition__button--${a}`,"aria-label":t("moveDecal",{direction:t(a)}),title:t("moveDecalOnSurface",{direction:t(a)}),onPointerDown:l=>{l.button===0&&(l.preventDefault(),l.currentTarget.focus({preventScroll:!0}),o(),r.current=l.pointerId,i.current=Nx(()=>n.current(a)))},onClick:l=>{l.detail===0&&n.current(a)},children:(0,to.jsx)(s,{size:16})},a))})]})}var dt=require("react/jsx-runtime"),b2=e=>Math.round(e*180/Math.PI);function Ox({kind:e,decals:t,activeId:n,error:i,moving:r,defaultSize:o,onSelect:a,onAddText:s,onAddImage:l,onChange:c,onMove:h,onNudge:p,onRemove:u,onClose:m}){let f=Me(),[g,b]=(0,bc.useState)(""),[x,v]=(0,bc.useState)("#ffffff"),w=(0,bc.useRef)(null),M=t.find(y=>y.id===n)??null;return(0,dt.jsxs)("div",{className:"ri-popover ri-popover--inline ri-decalControl",onPointerDown:y=>y.stopPropagation(),children:[e==="add-text"?(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.jsx)("p",{className:"ri-popoverLabel",children:f("text")}),(0,dt.jsxs)("div",{className:"ri-decalControl__row",children:[(0,dt.jsx)("input",{className:"ri-decalControl__input",value:g,placeholder:f("yourText"),"aria-label":f("textToAdd"),onChange:y=>b(y.target.value)}),(0,dt.jsx)("input",{type:"color",className:"ri-decalControl__color",value:x,"aria-label":f("textColour"),onChange:y=>v(y.target.value)})]}),(0,dt.jsx)("button",{type:"button",className:"ri-uploadButton",disabled:!g.trim(),onClick:()=>{s(g.trim(),x)&&b("")},children:f("addText")})]}):(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.jsx)("p",{className:"ri-popoverLabel",children:f("image")}),(0,dt.jsx)("button",{type:"button",className:"ri-uploadButton",onClick:()=>w.current?.click(),children:f("chooseImage")}),(0,dt.jsx)("input",{ref:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/svg+xml",className:"ri-hiddenInput","aria-label":f("imageToAdd"),onChange:y=>{let P=y.target.files?.[0];y.target.value="",P&&l(P)}})]}),i?(0,dt.jsx)("div",{className:"ri-decalControl__hint",role:"alert",children:i}):null,t.length>0?(0,dt.jsx)("div",{className:"ri-decalControl__list",role:"group","aria-label":f("added"),children:t.map((y,P)=>(0,dt.jsx)("button",{type:"button",className:`ri-decalControl__chip ${y.id===n?"ri-decalControl__chip--active":""}`,"aria-pressed":y.id===n,onClick:()=>a(y.id),children:y.image?f("decalImage",{index:P+1}):y.text||f("decalText",{index:P+1})},y.id))}):null,M?(0,dt.jsxs)("div",{className:"ri-decalControl__editor",children:[(0,dt.jsx)(bu,{onNudge:y=>p(M.id,y)}),M.image?null:(0,dt.jsxs)("div",{className:"ri-decalControl__row",children:[(0,dt.jsx)("input",{className:"ri-decalControl__input",value:M.text??"","aria-label":f("text"),onChange:y=>c(M.id,{text:y.target.value})}),(0,dt.jsx)("input",{type:"color",className:"ri-decalControl__color",value:M.color??"#ffffff","aria-label":f("colour"),onChange:y=>c(M.id,{color:y.target.value})})]}),(0,dt.jsxs)("label",{className:"ri-decalControl__slider",children:[(0,dt.jsx)("span",{children:f("size")}),(0,dt.jsx)("input",{type:"range",min:o/10,max:o*4,step:o/50,value:M.size,"aria-label":f("size"),onChange:y=>c(M.id,{size:Number(y.target.value)})})]}),(0,dt.jsxs)("label",{className:"ri-decalControl__slider",children:[(0,dt.jsx)("span",{children:f("turn")}),(0,dt.jsx)("input",{type:"range",min:-180,max:180,step:1,value:b2(M.rotation??0),"aria-label":f("rotation"),onChange:y=>c(M.id,{rotation:Number(y.target.value)*Math.PI/180})})]}),(0,dt.jsxs)("div",{className:"ri-inlineRow",children:[(0,dt.jsx)("button",{type:"button",className:"ri-secondaryButton","aria-pressed":r,title:f("dragTheDecalAcrossTheObjectsSurface"),onClick:()=>h(M.id),children:f("move")}),(0,dt.jsx)("button",{type:"button",className:"ri-removeButton",onClick:()=>u(M.id),children:f("remove")})]})]}):null,(0,dt.jsxs)("div",{className:"ri-inlineRow",children:[(0,dt.jsx)("span",{className:"ri-colorCode",children:t.length===0?f("noneAddedYet"):f("decalAdded",{count:t.length})}),(0,dt.jsx)("button",{type:"button",className:"ri-secondaryButton",onClick:m,children:f("done")})]})]})}var Ru=require("react"),sy=require("@react-three/fiber"),gi=require("three");var $t=require("three"),v2=.5,vc=4;function x2(e,t=0){let n=new $t.Vector3(...e);n.lengthSq()<1e-12&&n.set(0,0,1),n.normalize();let i=new $t.Object3D;return Math.abs(n.y)>.999&&i.up.set(0,0,-Math.sign(n.y)),i.lookAt(n),i.rotateZ(t),i.rotation.clone()}function y2(e,t,n){let i=null;if(e.bones&&t.bones){i=new Map;for(let[r,o]of e.bones)i.set(r,o*(1-n));for(let[r,o]of t.bones)i.set(r,(i.get(r)??0)+o*n)}return{position:e.position.clone().lerp(t.position,n),normal:e.normal.clone().lerp(t.normal,n),bones:i}}function Bx(e,t,n,i){let r=a=>i?a.position[t]<=n:a.position[t]>=n,o=[];for(let a=0;a<e.length;a++){let s=e[a],l=e[(a+1)%e.length],c=r(s);if(c&&o.push(s),c!==r(l)){let h=l.position[t]-s.position[t];o.push(y2(s,l,(n-s.position[t])/h))}}return o}function vu(e,t,n){let i=e.geometry,r=i.getAttribute("position");if(!r)return null;let o=i.getAttribute("normal"),a=i.getAttribute("skinIndex"),s=i.getAttribute("skinWeight"),l=!!(a&&s),c=i.getIndex(),h=Math.max(t.size,1e-6),p=h/(n>0&&Number.isFinite(n)?n:1),u=Math.max(h,p)*v2,m={x:h/2,y:p/2,z:u/2},f=new $t.Matrix4().makeRotationFromEuler(x2(t.normal,t.rotation)).setPosition(...t.position),g=f.clone().invert(),b=(I,L)=>{let X=null;if(l){X=new Map;for(let O=0;O<vc;O++){let B=s.getComponent(I,O);if(B<=0)continue;let re=a.getComponent(I,O);X.set(re,(X.get(re)??0)+B)}}return{position:L.clone(),normal:o?new $t.Vector3().fromBufferAttribute(o,I):new $t.Vector3,bones:X}},x=[],v=[],w=[],M=[],_=[],y=new $t.Vector3,P=new $t.Vector3,d=new $t.Vector3,S=I=>{if(w.push(.5+I.position.x/h,.5-I.position.y/p),y.copy(I.position).applyMatrix4(f),x.push(y.x,y.y,y.z),v.push(I.normal.x,I.normal.y,I.normal.z),!I.bones)return;let L=[...I.bones].sort((O,B)=>B[1]-O[1]).slice(0,vc),X=L.reduce((O,[,B])=>O+B,0)||1;for(let O=0;O<vc;O++)M.push(L[O]?.[0]??0),_.push((L[O]?.[1]??0)/X)},C=["x","y","z"],T=[new $t.Vector3,new $t.Vector3,new $t.Vector3],E=[0,0,0],k=(c?c.count:r.count)/3;for(let I=0;I<k;I++){for(let O=0;O<3;O++){let B=I*3+O;E[O]=c?c.getX(B):B,T[O].fromBufferAttribute(r,E[O]).applyMatrix4(g)}if(C.some(O=>T[0][O]>m[O]&&T[1][O]>m[O]&&T[2][O]>m[O]||T[0][O]<-m[O]&&T[1][O]<-m[O]&&T[2][O]<-m[O]))continue;let L=T.map((O,B)=>b(E[B],O));if(!o){P.copy(L[1].position).sub(L[0].position),d.copy(L[2].position).sub(L[0].position);let O=P.cross(d).transformDirection(f);for(let B of L)B.normal.copy(O)}let X=L;for(let O of C)if(X=Bx(X,O,m[O],!0),X=Bx(X,O,-m[O],!1),X.length<3)break;for(let O=1;O+1<X.length;O++)S(X[0]),S(X[O]),S(X[O+1])}if(x.length===0)return null;let D=new $t.BufferGeometry;return D.setAttribute("position",new $t.Float32BufferAttribute(x,3)),D.setAttribute("normal",new $t.Float32BufferAttribute(v,3)),D.setAttribute("uv",new $t.Float32BufferAttribute(w,2)),l&&(D.setAttribute("skinIndex",new $t.Uint16BufferAttribute(M,vc)),D.setAttribute("skinWeight",new $t.Float32BufferAttribute(_,vc))),D}function zx(e){return JSON.stringify([e.image??null,e.image?null:[e.text??"",e.color,e.fontFamily,e.fontWeight],e.position,e.normal,e.size,e.rotation??0])}var Ix=256,Dh=24;function Ux(e){let t=`${e.fontWeight??"bold"} ${Ix-Dh*2}px ${e.fontFamily||"sans-serif"}`,n=document.createElement("canvas"),i=n.getContext("2d");i.font=t;let r=e.text||" ";n.width=Math.min(Math.max(Math.ceil(i.measureText(r).width)+Dh*2,8),4096),n.height=Ix,i.font=t,i.textAlign="center",i.textBaseline="middle",i.fillStyle=e.color??"#ffffff",i.fillText(r,n.width/2,n.height/2,n.width-Dh);let o=new $t.CanvasTexture(n);return o.flipY=!1,o.colorSpace=$t.SRGBColorSpace,{texture:o,aspect:n.width/n.height}}var Sc=require("react"),Ur=require("three");var er=require("three");function xu(e){let t=!0;return e?.traverse(n=>{let i=n.isMesh?n.geometry:null;i&&!i.getAttribute("uv")&&(t=!1)}),t}function Vx(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function Fx(e){return!!(e&&typeof e=="object"&&"isMeshPhysicalMaterial"in e&&e.isMeshPhysicalMaterial)}function tr(e){return!!(e&&"isMesh"in e&&e.isMesh)}var Ii=["texture","metalnessMap","roughnessMap","emissiveMap","alphaMap","normalMap","bumpMap","aoMap","displacementMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","anisotropyMap","transmissionMap","thicknessMap","sheenColorMap","sheenRoughnessMap","specularIntensityMap","specularColorMap"],yu={texture:"map",metalnessMap:"metalnessMap",roughnessMap:"roughnessMap",emissiveMap:"emissiveMap",alphaMap:"alphaMap",normalMap:"normalMap",bumpMap:"bumpMap",aoMap:"aoMap",displacementMap:"displacementMap",clearcoatMap:"clearcoatMap",clearcoatRoughnessMap:"clearcoatRoughnessMap",clearcoatNormalMap:"clearcoatNormalMap",anisotropyMap:"anisotropyMap",transmissionMap:"transmissionMap",thicknessMap:"thicknessMap",sheenColorMap:"sheenColorMap",sheenRoughnessMap:"sheenRoughnessMap",specularIntensityMap:"specularIntensityMap",specularColorMap:"specularColorMap"},w2=new Set(["texture","emissiveMap","sheenColorMap","specularColorMap"]);function mi(e){return w2.has(e)?er.SRGBColorSpace:er.NoColorSpace}function on(e,t){return e?.[t]?.path}function jx(e,t){let n=e?.[t]?.offset;if(!n)return;let[i,r]=n;if(!(!Number.isFinite(i)||!Number.isFinite(r)))return i===0&&r===0?void 0:[i,r]}function Gx(e,t){let n=e?.[t]?.scale;if(!(!Number.isFinite(n)||!n))return n===1?void 0:n}function Hx(e,t){let n=e?.[t]?.rotation;if(!(!Number.isFinite(n)||!n))return n}function Wx(e){return e==="back"?er.BackSide:e==="double"?er.DoubleSide:er.FrontSide}function Xx(e){return e==="additive"?er.AdditiveBlending:er.NormalBlending}function no(e,t=1,n=t){if(e&&typeof e=="object"){let i=e;if(typeof i.x=="number"&&Number.isFinite(i.x)&&typeof i.y=="number"&&Number.isFinite(i.y))return new er.Vector2(i.x,i.y)}return new er.Vector2(t,n)}function wu(e){return Number.isFinite(e)&&e>0?e:1}function qx(e,t){return e?.animations.clips.find(n=>n.sourceName===t)}function $x(e){return e?.loopMode??"repeat"}var Yx=require("three");function hi(e){return e.isSkinnedMesh===!0}function Zs(e){let t=[];return e.traverse(n=>{hi(n)&&t.push(n)}),t}var Ks="reactImmersiveSkinFreeze";function Kx(e){return!!e.userData[Ks]}function Su(e,t){let n=e.userData,i=new Yx.Matrix4().copy(t).invert(),r=n[Ks];if(r){r.frozenInverse.copy(i),e.bindMatrixInverse.copy(i);return}let o={frozenInverse:i,previousOnBeforeRender:e.onBeforeRender};e.bindMatrixInverse.copy(i),e.onBeforeRender=function(a,s,l,c,h,p){o.previousOnBeforeRender.call(this,a,s,l,c,h,p),e.bindMatrixInverse.copy(o.frozenInverse)},n[Ks]=o}function Zx(e){return e.userData[Ks]?.frozenInverse??null}function Js(e){let t=e.userData,n=t[Ks];n&&(e.onBeforeRender=n.previousOnBeforeRender,delete t[Ks],e.updateMatrixWorld(!0))}var an=require("three"),Qs=new Map,ro={color:"#93c5fd",intensity:.07},Ia=new an.Color(ro.color).multiplyScalar(ro.intensity),Jx=new an.Color(ro.color),Qx=.28,el=new Map,Bh=new Map;function S2(e){return`${e.name}|${e.size}|${e.lastModified}`}function _u(e){let t=S2(e),n=e.name.lastIndexOf("."),i=n>0?e.name.slice(0,n):e.name,r=n>0?e.name.slice(n):"",o=`materials/${e.name}`,a=2;for(;;){let s=Bh.get(o);if(s===void 0||s===t)return Bh.set(o,t),o;o=`materials/${i}-${a}${r}`,a+=1}}function Mu(e){return el.get(e)}function ey(e,t){let n=++e.loadGeneration;e.loaded=!1;let i=()=>{if(e.loadGeneration!==n)return;e.loaded=!0;let r=e.pending;e.pending=[];for(let o of r)o()};new an.ImageLoader().load(t,r=>{e.loadGeneration===n&&(e.texture.image=r,e.texture.needsUpdate=!0,i())},void 0,()=>{e.loadGeneration===n&&(console.warn(`Failed to load texture: ${t}`),i())})}function ty(e,t){for(let n of[an.SRGBColorSpace,an.NoColorSpace]){let i=Qs.get(xc(e,n));i&&ey(i,t)}}function za(e,t){let n=el.get(e);n&&n!==t&&n.startsWith("blob:")&&URL.revokeObjectURL(n),el.set(e,t),ty(e,t)}function yc(e){let t=el.get(e);t&&(t.startsWith("blob:")&&URL.revokeObjectURL(t),el.delete(e),Bh.delete(e),ty(e,e))}function xc(e,t){return`${t}|${e}`}function wc(e,t=an.NoColorSpace,n){let i=xc(e,t),r=Qs.get(i);if(r)return n&&!r.loaded&&r.pending.push(n),r.texture;let o=el.get(e)??e,a={texture:new an.Texture,refCount:0,loaded:!1,pending:n?[n]:[],loadGeneration:0};return a.texture.flipY=!1,a.texture.colorSpace=t,Qs.set(i,a),ey(a,o),a.texture}function tl(e,t=an.NoColorSpace,n){let i=wc(e,t,n);return Qs.get(xc(e,t)).refCount+=1,i}function io(e,t=an.NoColorSpace){let n=Qs.get(xc(e,t));n&&(n.refCount-=1,n.refCount<=0&&(n.loadGeneration+=1,n.pending=[],n.texture.dispose(),Qs.delete(xc(e,t))))}function Cu(e,t,n,i,r,o=1,a=0){let s=e.offsetTextures??(e.offsetTextures={}),l=s[t],c=l;if(!c||c.sourcePath!==i||c.base!==n){l?.texture.dispose();let p=n.clone();p.wrapS=an.RepeatWrapping,p.wrapT=an.RepeatWrapping,p.center.set(.5,.5),p.needsUpdate=!0,c={texture:p,sourcePath:i,base:n},s[t]=c}let h=o>0?o:1;return c.texture.offset.set(r[0],r[1]),c.texture.repeat.set(1/h,1/h),c.texture.rotation=a,c.texture}function Tu(e,t){let n=e.offsetTextures,i=n?.[t];i&&(i.texture.dispose(),delete n[t])}function ny(e){let t=e.offsetTextures;if(t){for(let n of Object.values(t))n.texture.dispose();delete e.offsetTextures}}var Nh=null;function Pu(){if(Nh)return Nh;let e=256,t=document.createElement("canvas");t.width=e,t.height=e;let n=t.getContext("2d"),i=n.createRadialGradient(e*.35,e*.35,e*.02,e*.5,e*.5,e*.55);i.addColorStop(0,"#ffffff"),i.addColorStop(.4,"#b5b5b5"),i.addColorStop(1,"#3a3a3a"),n.fillStyle=i,n.fillRect(0,0,e,e);let r=new an.CanvasTexture(t);return r.colorSpace=an.SRGBColorSpace,Nh=r,r}var Oh=null;function ry(){if(Oh)return Oh;let e=1024,t=8,n=e/t,i=["#ef4444","#f59e0b","#22c55e","#6366f1"],r=document.createElement("canvas");r.width=e,r.height=e;let o=r.getContext("2d");o.textAlign="center",o.textBaseline="middle";for(let s=0;s<t;s+=1)for(let l=0;l<t;l+=1){let c=l*n,h=s*n,p=(Math.floor(l/2)+Math.floor(s/2))%4;o.fillStyle=i[p],o.fillRect(c,h,n,n),o.strokeStyle="rgba(0, 0, 0, 0.28)",o.lineWidth=2;for(let v=1;v<4;v+=1){let w=v*n/4;o.beginPath(),o.moveTo(c+w,h),o.lineTo(c+w,h+n),o.moveTo(c,h+w),o.lineTo(c+n,h+w),o.stroke()}o.strokeStyle="#09090b",o.lineWidth=7,o.strokeRect(c,h,n,n);let u=c+n*.23,m=h+n*.72,f=c+n*.72,g=h+n*.23;o.lineCap="round",o.lineJoin="round",o.beginPath(),o.moveTo(u,m),o.lineTo(f,g),o.lineTo(f-n*.2,g),o.moveTo(f,g),o.lineTo(f,g+n*.2),o.stroke();let b=s*t+l+1;o.font=`700 ${Math.round(n*.2)}px ui-monospace, SFMono-Regular, Menlo, monospace`,o.fillStyle="#ffffff",o.strokeStyle="rgba(0, 0, 0, 0.85)",o.lineWidth=6;let x=String(b).padStart(2,"0");o.strokeText(x,c+n/2,h+n*.82),o.fillText(x,c+n/2,h+n*.82)}let a=new an.CanvasTexture(r);return a.colorSpace=an.SRGBColorSpace,a.wrapS=an.RepeatWrapping,a.wrapT=an.RepeatWrapping,a.flipY=!1,a.anisotropy=8,a.needsUpdate=!0,Oh=a,a}var Ua="riDecal",Uh="riDecalId";function Ih(){return new Ur.BufferGeometry().setAttribute("position",new Ur.Float32BufferAttribute([],3))}function iy(e){let t=e.image;return t?.width&&t.height?t.width/t.height:1}function zh(e){e.disposed=!0,e.node.remove(e.mesh),e.mesh.geometry.dispose(),e.mesh.material.dispose(),e.imagePath&&io(e.imagePath,Ur.SRGBColorSpace),e.ownTexture?.dispose()}function _2(e,t,n,i){let r=new Ur.MeshStandardMaterial({transparent:!0,polygonOffset:!0,polygonOffsetFactor:-4,depthWrite:!1,metalness:0,roughness:.7}),o=hi(e)&&e.skeleton?e:null,a=o?new Ur.SkinnedMesh(Ih(),r):new Ur.Mesh(Ih(),r);if(o){let c=a;c.bind(o.skeleton,o.bindMatrix),c.frustumCulled=!1,c.onBeforeRender=()=>{let h=Zx(o);h&&c.bindMatrixInverse.copy(h)}}a.userData[Ua]=!0,a.userData[Uh]=t.id,a.raycast=()=>{},a.castShadow=!1,a.receiveShadow=!0,a.renderOrder=1;let s={node:e,mesh:a,signature:n,disposed:!1},l=c=>{let h=vu(e,t,c);a.geometry.dispose(),a.geometry=h??Ih(),a.visible=h!==null};if(t.image){s.imagePath=t.image;let c=tl(t.image,Ur.SRGBColorSpace,()=>{s.disposed||(l(iy(c)),r.needsUpdate=!0,i())});r.map=c,l(iy(c))}else{let{texture:c,aspect:h}=Ux(t);s.ownTexture=c,r.map=c,l(h)}return e.add(a),s}function oy({objectBindings:e,nodeMap:t,invalidate:n}){let i=(0,Sc.useRef)(new Map);(0,Sc.useEffect)(()=>{let r=i.current,o=new Set;for(let[a,s]of Object.entries(e)){if(!s.decals?.length)continue;let l=t[s.modelObjectId??a];if(tr(l))for(let c of s.decals){if(!c.image&&!c.text)continue;let h=`${a}
|
|
3665
|
+
${c.id}`,p=zx(c),u=r.get(h);u&&(u.node!==l||u.signature!==p)&&(zh(u),u=void 0),u||(u=_2(l,c,p,n),r.set(h,u)),u.mesh.material.opacity=(c.opacity??1)*(s.style?.material?.opacity??1),o.add(h)}}for(let[a,s]of r)o.has(a)||(zh(s),r.delete(a));n()},[e,t,n]),(0,Sc.useEffect)(()=>{let r=i.current;return()=>{for(let o of r.values())zh(o);r.clear()}},[])}var Yr=require("react"),fi=require("three"),M2=500,C2=10,T2=5;function Au(e,t,n){let i=(0,Yr.useRef)({resolve:e,onContextMenu:t,anchorOf:n});i.current={resolve:e,onContextMenu:t,anchorOf:n};let r=(0,Yr.useRef)(null),o=(0,Yr.useRef)(!1),a=(0,Yr.useRef)(null),s=(0,Yr.useCallback)(()=>{let p=r.current;p?.timer&&clearTimeout(p.timer),r.current=null,a.current?.(),a.current=null},[]),l=(0,Yr.useCallback)(()=>{let p=r.current;p&&(s(),p.kind==="touch"&&(o.current=!0,setTimeout(()=>o.current=!1,800)),i.current.onContextMenu?.(p.target,p.pointer))},[s]),c=(0,Yr.useCallback)(p=>{let u=p.nativeEvent,m=u.pointerType!=="touch"&&u.button===2,f=u.pointerType==="touch"&&u.button===0;if(!i.current.onContextMenu||!m&&!f)return;let g=i.current.resolve(p.object);if(g===null)return;s();let b={target:g,kind:m?"right":"touch",pointerId:u.pointerId,pointer:nl(p,i.current.anchorOf?.(p.object)),timer:f?setTimeout(l,M2):null};r.current=b;let x=m?T2:C2,v=y=>Math.hypot(y.clientX-b.pointer.clientX,y.clientY-b.pointer.clientY)>x,w=y=>{y.pointerId===b.pointerId&&v(y)&&s()},M=y=>{y.pointerId===b.pointerId&&(b.kind==="right"&&!v(y)?l():s())},_=y=>{y.pointerId!==b.pointerId&&s()};window.addEventListener("pointermove",w),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",s),window.addEventListener("pointerdown",_),a.current=()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",s),window.removeEventListener("pointerdown",_)}},[s,l]);(0,Yr.useEffect)(()=>s,[s]);let h=(0,Yr.useCallback)(()=>o.current?(o.current=!1,!0):!1,[]);return{onPointerDown:c,consumeClick:h}}function P2(e,t){let n=e.face,i=t.geometry.getAttribute("position");if(!n||!i)return null;let r=e.barycoord??null;if(!r){let[p,u,m]=[n.a,n.b,n.c].map(f=>t.getVertexPosition(f,new fi.Vector3));if(r=fi.Triangle.getBarycoord(t.worldToLocal(e.point.clone()),p,u,m,new fi.Vector3),!r)return null}let[o,a,s]=[n.a,n.b,n.c].map(p=>new fi.Vector3().fromBufferAttribute(i,p)),l=new fi.Vector3().addScaledVector(o,r.x).addScaledVector(a,r.y).addScaledVector(s,r.z),c=new fi.Triangle(o,a,s).getNormal(new fi.Vector3);return n.normal.clone().transformDirection(t.matrixWorld).dot(e.ray.direction)>0&&c.negate(),{position:[l.x,l.y,l.z],normal:[c.x,c.y,c.z]}}function Va(e,t){if(t.updateWorldMatrix(!0,!1),e.object===t&&t.isSkinnedMesh===!0){let r=P2(e,t);if(r)return r}let n=t.worldToLocal(e.point.clone()),i=e.face?e.face.normal.clone().transformDirection(e.object.matrixWorld):e.ray.direction.clone().negate();return i.dot(e.ray.direction)>0&&i.negate(),i.transformDirection(new fi.Matrix4().copy(t.matrixWorld).invert()),{position:[n.x,n.y,n.z],normal:[i.x,i.y,i.z]}}function nl(e,t){let n=e.nativeEvent;return{clientX:n.clientX,clientY:n.clientY,pointerType:"pointerType"in n?n.pointerType:"mouse",...t?{surface:Va(e,t)}:{}}}var Eu=require("three");function ay(e,t){let n=[];if(hi(e)){let i=e;i.computeBoundingSphere(),i.computeBoundingBox(),Eu.SkinnedMesh.prototype.raycast.call(i,t,n)}else Eu.Mesh.prototype.raycast.call(e,t,n);return n.sort((i,r)=>i.distance-r.distance)[0]}function ly({target:e,nodes:t,controls:n}){let{camera:i,gl:r,invalidate:o}=(0,sy.useThree)(),a=(0,Ru.useRef)(e);return a.current=e,(0,Ru.useEffect)(()=>{let s=r.domElement,l=new gi.Raycaster,c=new gi.Vector2,h=s.style.cursor,p=s.style.touchAction;s.style.cursor="grab",s.style.touchAction="none";let u=0,m=null,f=null,g=(P,d=new gi.Vector2)=>{let S=s.getBoundingClientRect();c.set((P.clientX-S.left-d.x)/S.width*2-1,-((P.clientY-S.top-d.y)/S.height)*2+1),l.setFromCamera(c,i)},b=P=>{if(!f)return;g(P,f.offset),f.node.updateWorldMatrix(!0,!1);let d=l.intersectObject(f.node,!1)[0];if(!d)return;let S=Va({...d,ray:l.ray},f.node),C=vu(f.node,{...f.decal,...S},f.aspect);C&&(f.mesh.geometry!==f.geometry&&f.mesh.geometry.dispose(),f.mesh.geometry=C,f.surface=S,o())},x=P=>{if(!f)return;cancelAnimationFrame(u),u=0,m=null;let d=f;f=null,d.mesh.geometry!==d.geometry&&(P&&d.surface?d.geometry.dispose():(d.mesh.geometry.dispose(),d.mesh.geometry=d.geometry)),d.controller&&(d.controller.enabled=d.controlsEnabled),s.hasPointerCapture(d.pointerId)&&s.releasePointerCapture(d.pointerId),s.style.cursor="grab",o();let S=()=>{window.removeEventListener("click",C,!0),window.removeEventListener("pointerdown",S,!0),clearTimeout(T)},C=E=>{E.target===s&&(E.preventDefault(),E.stopImmediatePropagation()),S()},T=setTimeout(S,300);window.addEventListener("click",C,!0),window.addEventListener("pointerdown",S,!0),P&&d.surface&&a.current.onCommit(d.surface)},v=P=>{if(P.button!==0||f)return;let d=a.current,S=t.current[d.objectId];if(!(S instanceof gi.Mesh)||!S.visible)return;let C=S.children.find(O=>O.userData[Ua]&&O.userData[Uh]===d.decal.id);if(!C?.visible)return;S.updateWorldMatrix(!0,!0),g(P);let T=ay(C,l),E=l.intersectObject(S,!1)[0];if(!T||!E||T.distance>E.distance+1e-4)return;let k=new gi.Vector3;if(hi(C)){let O=new gi.Vector3,B=C.geometry.getAttribute("position").count;if(!B)return;for(let re=0;re<B;re++)k.add(C.getVertexPosition(re,O));k.divideScalar(B).applyMatrix4(C.matrixWorld)}else k.fromArray(d.decal.position).applyMatrix4(S.matrixWorld);k.project(i);let D=s.getBoundingClientRect(),I=new gi.Vector2(P.clientX-(D.left+(k.x+1)/2*D.width),P.clientY-(D.top+(1-k.y)/2*D.height)),L=C.material.map?.image,X=n.current;f={pointerId:P.pointerId,node:S,mesh:C,geometry:C.geometry,decal:d.decal,surface:null,offset:I,aspect:L?.width&&L.height?L.width/L.height:1,controller:X,controlsEnabled:X?.enabled??!1},X&&(X.enabled=!1),P.preventDefault(),P.stopImmediatePropagation(),s.setPointerCapture(P.pointerId),s.style.cursor="grabbing"},w=P=>{!f||P.pointerId!==f.pointerId||(P.preventDefault(),P.stopImmediatePropagation(),m=P,u||(u=requestAnimationFrame(()=>{u=0,m&&b(m)})))},M=P=>{!f||P.pointerId!==f.pointerId||(P.preventDefault(),P.stopImmediatePropagation(),m&&b(m),x(!0))},_=()=>x(!1),y=P=>{P.key==="Escape"&&(x(!1),a.current.onCancel())};return s.addEventListener("pointerdown",v,!0),window.addEventListener("pointermove",w,{capture:!0,passive:!1}),window.addEventListener("pointerup",M,!0),window.addEventListener("pointercancel",_),window.addEventListener("blur",_),window.addEventListener("keydown",y),s.addEventListener("lostpointercapture",_),()=>{x(!1),s.style.cursor=h,s.style.touchAction=p,s.removeEventListener("pointerdown",v,!0),window.removeEventListener("pointermove",w,!0),window.removeEventListener("pointerup",M,!0),window.removeEventListener("pointercancel",_),window.removeEventListener("blur",_),window.removeEventListener("keydown",y),s.removeEventListener("lostpointercapture",_)}},[i,r,o,t,n,e.objectId,e.decal]),null}var Mr=require("react");var cy=require("three-stdlib");function oo(e,t){let n=URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.download=t,i.style.display="none";try{document.body.appendChild(i),i.click()}finally{i.remove(),window.setTimeout(()=>{URL.revokeObjectURL(n)},1e3)}}function dy({scene:e,objectBindings:t,matRefs:n,downloadFilename:i,onComplete:r}){import("three").then(({Group:o,Mesh:a})=>{let s=new o,l=new Map;for(let[p,u]of Object.entries(t))l.set(u.modelObjectId??p,p);let c=p=>{let u=p;for(;u;){let m=u.name||u.uuid,f=l.get(m)??m,g=t[f];if(g?g.visible===!1:u.visible===!1)return!1;u=u.parent}return!0};e.traverse(p=>{let u=p;if(!u.isMesh||!u.geometry||!c(u))return;let m=u.name||u.uuid,f=l.get(m)??m,g=n[f]??u.material;if(!g)return;let b=new a(u.geometry,g);b.name=m,b.applyMatrix4(u.matrixWorld),s.add(b)}),new cy.GLTFExporter().parse(s,p=>{let u=p instanceof ArrayBuffer?new Blob([p],{type:"model/gltf-binary"}):new Blob([JSON.stringify(p)],{type:"model/gltf+json"}),m=p instanceof ArrayBuffer?".glb":".gltf";oo(u,`${i}${m}`),r()},p=>{console.error("GLTFExporter error:",p),r()},{binary:!0})})}var fy=require("fflate");var uy=require("fflate");function ku(e,t=6){return new Promise((n,i)=>{(0,uy.zip)(e,{level:t},(r,o)=>{r?i(r):n(o)})})}var _c=2048,py=["#00e5ff","#ff4fd8","#ffe45e","#7cff6b","#ff784f","#a78bfa","#38bdf8","#fb7185"];function my(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}function jh(e,t){return e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||t}function gy(e){return jh(e,"model")}function Vh(e,t){return e.index?Math.round(e.index.getX(t)):t}function A2(e,t,n){let i=Vh(e,n),r=Vh(e,n+1),o=Vh(e,n+2);if(i>=t.count||r>=t.count||o>=t.count)return null;let a=[{index:i,u:t.getX(i),v:t.getY(i)},{index:r,u:t.getX(r),v:t.getY(r)},{index:o,u:t.getX(o),v:t.getY(o)}];return a.every(s=>Number.isFinite(s.u)&&Number.isFinite(s.v))?a:null}function hy(e){return`${e.u.toFixed(6)},${e.v.toFixed(6)}`}function Fh(e,t,n,i){let r,o;i?(r=t.index,o=n.index):(r=hy(t),o=hy(n));let a=r<o?`${r}|${o}`:`${o}|${r}`,s=e.get(a);s?s.count+=1:e.set(a,{count:1,start:t,end:n})}function E2(e,t,n){Fh(e,t[0],t[1],n),Fh(e,t[1],t[2],n),Fh(e,t[2],t[0],n)}function R2(e,t){return Array.isArray(e)?e[t]??null:e}function k2(e){let t=new Map,n=0,i=0,r=0;return e.traverse(o=>{let a=o;if(!a.isMesh||!a.geometry||!a.material)return;let s=a.geometry,l=s.getAttribute("uv");if(!l||l.itemSize<2||l.count<3)return;n+=1;let c=a.name||`Mesh ${n}`,h=s.index?.count??l.count,p=s.groups.length>0?s.groups:[{start:0,count:h,materialIndex:0}];for(let u of p){let m=u.materialIndex??0,f=R2(a.material,m);if(!f)continue;let g=t.get(f.uuid);g||(i+=1,g={name:f.name||`Material ${i}`,layers:new Map},t.set(f.uuid,g));let b=g.layers.get(a.uuid);b||(b={name:c,color:py[r%py.length],edges:new Map},r+=1,g.layers.set(a.uuid,b));let x=Math.max(0,u.start),v=Math.min(h,x+u.count);for(let w=x;w+2<v;w+=3){let M=A2(s,l,w);M&&E2(b.edges,M,!!s.index)}}}),[...t.values()].filter(o=>[...o.layers.values()].some(a=>a.edges.size>0))}function Lu(e){return(e*_c).toFixed(2)}function L2(e){return`M${Lu(e.start.u)} ${Lu(1-e.start.v)}L${Lu(e.end.u)} ${Lu(1-e.end.v)}`}function D2(e){let t=my(e.name),n=[...e.layers.values()].filter(i=>i.edges.size>0).map((i,r)=>{let o=my(i.name),a=`${jh(i.name,"mesh")}-${r+1}`,s=[...i.edges.values()],l=s.filter(p=>p.count===1),h=(l.length>0?l:s).map(L2).join("");return[` <g id="${a}" data-mesh="${o}" fill="none" stroke="${i.color}"`,' stroke-width="1" stroke-linejoin="round" vector-effect="non-scaling-stroke">',` <title>${o}</title>`,` <path d="${h}"/>`," </g>"].join(`
|
|
3666
3666
|
`)}).join(`
|
|
3667
|
-
`);return['<?xml version="1.0" encoding="UTF-8"?>',`<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
3668
|
-
`)}function sM(e,t="model"){let n=iM(e),i=Cv(t);return n.map((r,o)=>{let a=Eh(r.name,`material-${o+1}`);return{filename:n.length===1?`${i}-uv-layout.svg`:`${i}-uv-${a}-${o+1}.svg`,materialName:r.name,meshCount:[...r.layers.values()].filter(l=>l.edges.size>0).length,svg:aM(r)}})}async function Tv(e,t="model"){let n=sM(e,t);if(n.length===0)return n;if(n.length===1)return ho(new Blob([n[0].svg],{type:"image/svg+xml;charset=utf-8"}),n[0].filename),n;let i=Object.fromEntries(n.map(o=>[o.filename,(0,Mv.strToU8)(o.svg)])),r=await Fd(i);return ho(new Blob([r],{type:"application/zip"}),`${Cv(t)}-uv-layouts.zip`),n}function Pv({sceneRef:e,materialRefs:t,rendererCaptureRef:n,objectBindings:i,downloadFilename:r,captureVideo:o}){let[a,s]=(0,br.useState)(!1),[l,c]=(0,br.useState)(!1),[p,u]=(0,br.useState)(null),[d,m]=(0,br.useState)(null),[g,v]=(0,br.useState)("auto");(0,br.useEffect)(()=>{if(!l)return;let b=()=>c(!1);return window.addEventListener("pointerdown",b),()=>window.removeEventListener("pointerdown",b)},[l]);let M=(0,br.useCallback)(()=>{u(null),m(null),c(b=>!b)},[]),w=(0,br.useCallback)(()=>{let b=e.current;b&&(c(!1),s(!0),xv({scene:b,objectBindings:i,matRefs:t.current,downloadFilename:r,onComplete:()=>s(!1)}))},[r,t,i,e]),x=(0,br.useCallback)(()=>{c(!1),wd(n.current).then(b=>{let _=document.createElement("a");_.href=b,_.download=`${r}.png`,document.body.appendChild(_),_.click(),document.body.removeChild(_)}).catch(b=>{console.error("Screenshot failed:",b)})},[r,n]),S=(0,br.useCallback)(async()=>{let b=e.current;if(b)try{if((await Tv(b,r)).length===0){u("This model does not contain UV coordinates.");return}u(null),c(!1)}catch(_){console.error("UV layout export failed:",_),u("Could not create the UV layout archive.")}},[r,e]),k=(0,br.useCallback)(async b=>{c(!1),m(null);try{let _=await o({mode:b,format:g}),y=_.type.startsWith("video/mp4")?"mp4":"webm",h=URL.createObjectURL(_),P=document.createElement("a");P.href=h,P.download=`${r}-${b}.${y}`,document.body.appendChild(P);try{P.click()}finally{P.remove(),setTimeout(()=>URL.revokeObjectURL(h),1e3)}}catch(_){if(_ instanceof DOMException&&_.name==="AbortError")return;m(_ instanceof Error?_.message:"Could not export the video."),c(!0)}},[o,r,g]);return{isDownloading:a,downloadMenuOpen:l,uvExportError:p,toggleDownloadMenu:M,handleDownloadMesh:w,handleDownloadScreenshot:x,handleDownloadUvLayout:S,handleDownloadVideo:k,videoFormat:g,setVideoFormat:v,videoExportError:d}}var _t=require("react"),ni=require("three");var an=require("three");function jd(e){if(e.length!==3)return null;let t=new an.Vector3(...e[0]).sub(new an.Vector3(...e[1])),n=new an.Vector3(...e[2]).sub(new an.Vector3(...e[1]));return t.lengthSq()===0||n.lengthSq()===0?null:Math.acos(Math.max(-1,Math.min(1,t.normalize().dot(n.normalize()))))*180/Math.PI}function Av(e,t){if(!e.normal)return null;let n=new an.Vector3(...e.normal);if(n.lengthSq()===0)return null;n.normalize();let i=new an.Vector3(...t),r=i.clone().sub(new an.Vector3(...e.position)).dot(n);return{distance:Math.abs(r),projection:i.addScaledVector(n,-r).toArray()}}function Hd(e){if(e.length<3)return{error:"Pick at least three points to finish the area."};let t=new an.Vector3(...e[0]),n=e.map(M=>new an.Vector3(...M).sub(t)),i=Math.max(...n.map(M=>M.length()));if(i===0)return{error:"Area points must be distinct."};let r=new an.Vector3;for(let M=1;M<n.length-1;M+=1){let w=n[M].clone().cross(n[M+1]);w.lengthSq()>r.lengthSq()&&r.copy(w)}if(r.length()<=i*i*1e-10)return{error:"Area points must not lie on one straight line."};r.normalize();let o=Math.max(i*1e-5,Number.EPSILON*Math.max(...e.flat().map(Math.abs))*32);if(n.some(M=>Math.abs(M.dot(r))>o))return{error:"Area points must lie on one plane."};let a=n.find(M=>M.length()>i*1e-10).clone().normalize(),s=r.clone().cross(a).normalize(),l=n.map(M=>new an.Vector2(M.dot(a),M.dot(s))),c=(M,w,x)=>(w.x-M.x)*(x.y-M.y)-(w.y-M.y)*(x.x-M.x),p=i*i*1e-10,u=(M,w,x)=>Math.abs(c(M,w,x))<=p&&x.x>=Math.min(M.x,w.x)-i*1e-10&&x.x<=Math.max(M.x,w.x)+i*1e-10&&x.y>=Math.min(M.y,w.y)-i*1e-10&&x.y<=Math.max(M.y,w.y)+i*1e-10;for(let M=0;M<l.length;M+=1){let w=l[M],x=l[(M+1)%l.length];if(w.distanceTo(x)<=i*1e-10)return{error:"Area points must be distinct."};for(let S=M+1;S<l.length;S+=1){if(S===M+1||M===0&&S===l.length-1)continue;let k=l[S],b=l[(S+1)%l.length],_=c(w,x,k),y=c(w,x,b),h=c(k,b,w),P=c(k,b,x);if(_*y<0&&h*P<0||u(w,x,k)||u(w,x,b)||u(k,b,w)||u(k,b,x))return{error:"Area edges must not cross or touch each other."}}}let d=0,m=0,g=0;for(let M=0;M<l.length;M+=1){let w=l[M],x=l[(M+1)%l.length],S=w.x*x.y-x.x*w.y;d+=S,m+=(w.x+x.x)*S,g+=(w.y+x.y)*S}if(Math.abs(d)<=p)return{error:"The polygon has no measurable area."};let v=t.clone().addScaledVector(a,m/(3*d)).addScaledVector(s,g/(3*d));return{area:Math.abs(d)/2,center:v.toArray(),triangles:an.ShapeUtils.triangulateShape(l,[])}}function lM(e){if(!(e.object instanceof an.Mesh)||!e.face)return null;let t=e.object,n=t.matrixWorld.clone();if(e.instanceId!==void 0&&"getMatrixAt"in t){let i=new an.Matrix4;t.getMatrixAt(e.instanceId,i),n.multiply(i)}return[e.face.a,e.face.b,e.face.c].map(i=>t.getVertexPosition(i,new an.Vector3).applyMatrix4(n))}function Ev(e){if(!(e.object instanceof an.Mesh))return!1;for(let n=e.object;n;n=n.parent)if(!n.visible||n.userData.riEditorGizmo||n.userData.riDecal)return!1;return(Array.isArray(e.object.material)?e.object.material:[e.object.material])[e.face?.materialIndex??0]?.visible!==!1}function Rv(e,t,n,i,r,o=12){let a=lM(e),s=a?a[1].clone().sub(a[0]).cross(a[2].clone().sub(a[0])).normalize():null,l={position:e.point.toArray(),...s&&s.lengthSq()>0?{normal:s.toArray()}:{},...a?{faceVertices:a.map(d=>d.toArray())}:{}};if(!a||r==="none")return l;let c=d=>{let m=new an.Vector4(d.x,d.y,d.z,1).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);return m.w<=0||m.z/m.w<-1||m.z/m.w>1?null:{screen:new an.Vector2((m.x/m.w+1)*i.width/2,(1-m.y/m.w)*i.height/2),w:m.w}},p=a.map(c),u=o;if((r==="vertex"||r==="auto")&&(p.forEach((d,m)=>{let g=d?.screen.distanceTo(n)??1/0;g<=u&&(u=g,l.position=a[m].toArray(),l.snapped="vertex")}),l.snapped))return l;if(r==="edge"||r==="auto")for(let d=0;d<3;d+=1){let m=(d+1)%3,g=p[d],v=p[m];if(!g||!v)continue;let M=v.screen.clone().sub(g.screen);if(M.lengthSq()===0)continue;let w=Math.max(0,Math.min(1,n.clone().sub(g.screen).dot(M)/M.lengthSq())),x=g.screen.clone().addScaledVector(M,w).distanceTo(n);if(x<=u){u=x;let S=w*g.w/((1-w)*v.w+w*g.w);l.position=a[d].clone().lerp(a[m],S).toArray(),l.snapped="edge"}}return l}var Gd={tool:"distance",points:[],areaClosed:!1,error:null};function kv(e,t){if(t.type==="tool")return{...Gd,tool:t.tool};if(t.type==="clear")return{...Gd,tool:e.tool};if(t.type==="undo")return{...e,points:e.points.slice(0,-1),areaClosed:!1,error:null};if(t.type==="finishArea"){if(e.tool!=="area")return e;let o=Hd(e.points.map(a=>a.position));return"error"in o?{...e,error:o.error}:{...e,areaClosed:!0,error:null}}if(t.type!=="place")return e;let i=e.areaClosed||e.tool==="angle"&&e.points.length===3||e.tool==="pointToPlane"&&e.points.length===2?[]:e.points;if(e.tool==="pointToPlane"&&i.length===0&&!t.point.normal)return{...e,error:"Pick a triangle face to define the reference plane."};if(i.length>=256)return{...e,error:"Finish or clear this measurement before adding more points."};let r=[...i,t.point];return e.tool==="angle"&&r.length===3&&jd(r.map(o=>o.position))===null?{...e,error:"Pick a point away from the angle's vertex."}:{...e,points:r,areaClosed:!1,error:null}}function cM(e){let t=new ni.Box3().setFromObject(e),n=new ni.Vector3;return t.getSize(n),{min:[t.min.x,t.min.y,t.min.z],max:[t.max.x,t.max.y,t.max.z],size:[n.x,n.y,n.z]}}function dM(e){let t=new ni.Box3().setFromObject(e);if(t.isEmpty())return null;let n=t.getCenter(new ni.Vector3),i=t.getSize(new ni.Vector3).length()/2;return!Number.isFinite(i)||i<=0?null:{center:[n.x,n.y,n.z],radius:i}}function Lv({canvasAreaRef:e,controlsRef:t,sceneRef:n,modelUrl:i,modelRotation:r,bindingTransformSignature:o,modelLoaded:a,enabled:s}){let[l,c]=(0,_t.useState)(!1),[p,u]=(0,_t.useReducer)(kv,Gd),[d,m]=(0,_t.useState)("none"),[g,v]=(0,_t.useState)(null),[M,w]=(0,_t.useState)(!1),[x,S]=(0,_t.useState)(null),[k,b]=(0,_t.useState)(null),_=(0,_t.useRef)(!1),y=(0,_t.useRef)(0),h=(0,_t.useRef)(null),P=(0,_t.useRef)(null);_.current=l&&s;let A=(0,_t.useCallback)(xe=>{xe.updateMatrixWorld(!0),S(cM(xe)),b(dM(xe))},[]),C=(0,_t.useCallback)(()=>{u({type:"clear"}),v(null)},[]),D=(0,_t.useCallback)(xe=>{u({type:"tool",tool:xe}),v(null)},[]),B=(0,_t.useCallback)(()=>u({type:"undo"}),[]),j=(0,_t.useCallback)(()=>u({type:"finishArea"}),[]),W=(0,_t.useCallback)(()=>c(xe=>!xe),[]),U=(0,_t.useCallback)(()=>w(xe=>!xe),[]),te=(0,_t.useCallback)(xe=>{!_.current||xe.button!==0||(h.current={x:xe.clientX,y:xe.clientY})},[]),O=(0,_t.useCallback)((xe,nt)=>{let ce=e.current,Le=t.current?.camera,he=n.current;if(!ce||!Le||!he)return null;let pt=ce.getBoundingClientRect();if(!pt.width||!pt.height)return null;he.updateMatrixWorld(!0),Le.updateMatrixWorld(!0);let Bt=new ni.Vector2(xe-pt.left,nt-pt.top),un=new ni.Raycaster;un.setFromCamera(new ni.Vector2(Bt.x/pt.width*2-1,1-Bt.y/pt.height*2),Le);let Ie=un.intersectObject(he,!0).find(Ev);return Ie?Rv(Ie,Le,Bt,pt,d):null},[e,t,n,d]),$=(0,_t.useCallback)(()=>{P.current!==null&&cancelAnimationFrame(P.current),P.current=null,v(null)},[]),le=(0,_t.useCallback)(xe=>{if(!_.current||d==="none"||xe.buttons!==0||xe.target.closest("button, input, select, label, textarea, .ri-measureTools")){$();return}P.current!==null&&cancelAnimationFrame(P.current);let{clientX:nt,clientY:ce}=xe;P.current=requestAnimationFrame(()=>{P.current=null;let Le=O(nt,ce);v(Le?.snapped?Le:null)})},[$,O,d]),tt=(0,_t.useCallback)(xe=>{if(!_.current)return;let nt=h.current;if(h.current=null,nt&&Math.hypot(xe.clientX-nt.x,xe.clientY-nt.y)>6||xe.target.closest("button, input, select, label, textarea, .ri-measureTools"))return;let Le=O(xe.clientX,xe.clientY);Le&&(y.current+=1,u({type:"place",point:{...Le,id:y.current}}))},[O]);return(0,_t.useEffect)(()=>{C(),S(null),b(null)},[i,C]),(0,_t.useEffect)(()=>{C()},[r,o,C]),(0,_t.useEffect)(()=>($(),$),[$,l,d]),(0,_t.useEffect)(()=>{s||(c(!1),$())},[s,$]),(0,_t.useEffect)(()=>{let xe=n.current;!a||!xe||A(xe)},[o,a,A,n]),{measureMode:l,measureModeRef:_,measurePoints:p.points,measurementTool:p.tool,areaClosed:p.areaClosed,measurementError:p.error,selectMeasurementTool:D,undoMeasurementPoint:B,finishMeasureArea:j,snapMode:d,setSnapMode:m,snapPreview:g,handleMeasurePointerMove:le,clearSnapPreview:$,showDimensions:M,measureBox:x,modelBounds:k,refreshBounds:A,clearMeasurements:C,toggleMeasureMode:W,toggleDimensions:U,handleMeasurePointerDown:te,handleMeasureClick:tt}}var Iv=require("react-dom"),zv=require("@react-three/xr"),Uv=require("lucide-react"),Dt=require("react");function Dv(e,t){let n=null,i=o=>{let a=o.mode==="immersive-ar"?o.session??null:null;a!==n&&(n&&t.endAR(),n=a,n&&t.startAR())},r=e.subscribe(i);return i(e.getState()),()=>{r(),n&&t.endAR("interrupted"),n=null}}function Rh(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function kh(){if(typeof navigator>"u")return!1;let e=navigator.userAgent;return/iPhone|iPad|iPod/i.test(e)?!0:navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints=="number"&&navigator.maxTouchPoints>1}function Nv(){return Rh()||kh()}function uM(){if(typeof window>"u"||typeof navigator>"u")return!1;let e=a=>typeof window.matchMedia=="function"&&window.matchMedia(a).matches,t=e("(pointer: coarse)")||e("(any-pointer: coarse)"),n=e("(hover: none)")||e("(any-hover: none)"),i=navigator.maxTouchPoints>0,r=typeof window.screen<"u"&&Math.min(window.screen.width,window.screen.height)<=1024,o=Rh();return t||o||i&&n||i&&r}function Lh(){if(!uM())return!1;if(Rh())return!0;let e=navigator.deviceMemory;return!(typeof e=="number"&&e>=8)}function Bv(e="auto"){switch(e){case"high":return!1;case"low":return!0;default:return Lh()}}var Fr=require("react/jsx-runtime"),Ov={canPlace:!1,isPlacementMode:!0,isModelPlaced:!1};function Fv({enableXR:e,usdzUrl:t,mobileHandoffUrl:n,engagement:i}){let r=(0,Dt.useRef)(null),o=(0,Dt.useMemo)(()=>{if(!e||typeof navigator>"u")return null;let O=navigator.xr;if(!O||typeof O.isSessionSupported!="function"||typeof O.addEventListener!="function")return null;try{return(0,zv.createXRStore)({emulate:!1})}catch{return null}},[e]),[a,s]=(0,Dt.useState)(!1),[l,c]=(0,Dt.useState)(!1),[p,u]=(0,Dt.useState)(!0),[d,m]=(0,Dt.useState)(null),[g,v]=(0,Dt.useState)(!1),[M,w]=(0,Dt.useState)(!1),[x,S]=(0,Dt.useState)(Ov),[k,b]=(0,Dt.useState)(!1),_=(0,Dt.useMemo)(()=>e&&!!t?.trim()&&kh(),[e,t]);(0,Dt.useEffect)(()=>{u(Nv())},[]);let y=(0,Dt.useCallback)(()=>{if(typeof window>"u")return null;try{let O=new URL(n?.trim()||window.location.href,window.location.href);return O.protocol==="http:"||O.protocol==="https:"?O.toString():null}catch{return null}},[n]);(0,Dt.useEffect)(()=>{if(!e||p){m(null),v(!1);return}m(y())},[e,p,y]),(0,Dt.useEffect)(()=>{if(o)return o.subscribe(O=>w(O.session!=null&&O.mode==="immersive-ar"))},[o]),(0,Dt.useEffect)(()=>{if(o)return Dv(o,i)},[o,i]),(0,Dt.useEffect)(()=>{b(!1),S(Ov)},[M]),(0,Dt.useEffect)(()=>{if(!e||typeof navigator>"u")return;let O=navigator.xr;if(!O?.isSessionSupported)return;let $=!1;return O.isSessionSupported("immersive-ar").then(le=>!$&&s(le)).catch(()=>{}),O.isSessionSupported("immersive-vr").then(le=>!$&&c(le)).catch(()=>{}),()=>{$=!0}},[e]);let h=(0,Dt.useCallback)(()=>{let O=y();O&&(i.requestARLaunch("mobile-handoff"),m(O),v(!0))},[y,i]),P=(0,Dt.useCallback)(()=>v(!1),[]),A=(0,Dt.useCallback)(()=>{let O=t?.trim();if(!O)return;i.requestARLaunch("quick-look");let $=document.createElement("a");$.setAttribute("rel","ar"),$.href=O,$.style.display="none";let le=document.createElement("img");le.alt="",le.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",$.appendChild(le),document.body.appendChild($),$.click(),$.remove()},[t,i]),C=(0,Dt.useCallback)(O=>{S(O),O.isPlacementMode||b(!1)},[]),D=(0,Dt.useCallback)(O=>{b(!1),O?r.current?.finishPlacementMode():r.current?.cancelPlacementMode()},[]),B=(0,Dt.useCallback)(O=>{O.preventDefault(),b(!0),r.current?.startPlacementMode()},[]);(0,Dt.useEffect)(()=>{if(!k)return;let O=()=>D(!0),$=()=>D(!1);return window.addEventListener("pointerup",O),window.addEventListener("pointercancel",$),()=>{window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",$)}},[D,k]);let j=x.isModelPlaced?x.isPlacementMode?x.canPlace?"Release to place":"Move your device over a flat surface":null:x.canPlace?null:"Move your device over a flat surface",W=x.isModelPlaced&&!x.isPlacementMode?"Pinch to resize \xB7 Twist to rotate":null,U=o?.getState().domOverlayRoot??null,te=M&&U?(0,Iv.createPortal)((0,Fr.jsxs)(Fr.Fragment,{children:[W&&(0,Fr.jsx)("div",{className:"ri-arHintOverlay",children:(0,Fr.jsx)("div",{className:"ri-arHint",children:W})}),(0,Fr.jsx)("div",{className:"ri-arOverlay",children:(0,Fr.jsxs)("div",{className:"ri-arControls",children:[j&&(0,Fr.jsx)("div",{className:"ri-arStatus",children:j}),x.isModelPlaced&&(0,Fr.jsxs)("button",{type:"button",className:`ri-arActionButton ${k?"ri-arActionButton--active":""}`,onPointerDown:O=>B(O.nativeEvent),"aria-pressed":k,children:[(0,Fr.jsx)(Uv.MapPin,{size:14}),"Relocate"]}),!x.isModelPlaced&&x.canPlace&&(0,Fr.jsx)("button",{type:"button",className:"ri-arActionButton ri-arActionButton--primary",onClick:()=>r.current?.placeCurrent(),children:"Tap to place"})]})})]}),U):null;return{xrStore:o,presenterRef:r,arSupported:a,vrSupported:l,quickLookSupported:_,resolvedMobileHandoffUrl:d,isMobileHandoffOpen:g,arOverlay:te,openMobileHandoff:h,closeMobileHandoff:P,openQuickLook:A,handleARStateChange:C}}var Zd=require("@react-three/fiber"),Jd=require("@react-three/drei"),dx=require("@react-three/xr"),ux=require("three"),Ei=require("react");function Wd(e){let t=e.trim();return t?/\.(hdr|exr|jpg|jpeg|png|webp)(?:[?#].*)?$/i.test(t):!1}var Vv=["none","directional","point","spot","hemisphere"],jv=["pbr","matcap","uv-checker"],Hv=["apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"];var Gv=["sporadic","constantMild","constantWild"],Wv=["linear","radial","mirroredLinear"],ql=["verySmall","small","medium","large","veryLarge","huge"],Xd=["x","y","z"],Pa={enabled:!1,axis:"y",position:.5,flip:!1},pM={clips:[],autoplayClip:null},hM={autofocus:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6,target:[0,0,0],mouse:!0,debug:0,manual:!1,smoothTime:.25},toneMapping:{enabled:!1,mode:"aces",exposure:1,resolution:256,whitePoint:4,middleGrey:.6,minLuminance:.01,averageLuminance:1,adaptationRate:1},brightnessContrast:{enabled:!1,brightness:0,contrast:0},hueSaturation:{enabled:!1,hue:0,saturation:0},colorAverage:{enabled:!1},dotScreen:{enabled:!1,angle:Math.PI/2,scale:1},glitch:{enabled:!1,mode:"sporadic",delay:[1.5,3.5],duration:[.6,1],strength:[.3,1],chromaticAberrationOffset:[0,0],columns:.05,ratio:.85},ssao:{enabled:!1,samples:30,rings:4,intensity:8,radius:.25,bias:.025,luminanceInfluence:.6,fade:.01,minRadiusScale:.33,worldDistanceThreshold:20,worldDistanceFalloff:5,worldProximityThreshold:6,worldProximityFalloff:3},bloom:{enabled:!1,intensity:.3,luminanceThreshold:.9,luminanceSmoothing:.2,mipmapBlur:!0,radius:0,levels:8},godRays:{enabled:!1,sunPosition:[5,10,5],samples:60,density:.96,decay:.9,weight:.4,exposure:.6,clampMax:1,blur:!0,kernelSize:"small"},grid:{enabled:!1,scale:1,lineWidth:0},noise:{enabled:!1,opacity:1,premultiply:!1},depthOfField:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6},chromaticAberration:{enabled:!1,offsetX:.002,offsetY:.002,radialModulation:!1,modulationOffset:.15},lensflare:{enabled:!1,lensPosition:[-25,6,-60],smoothTime:.07,glareSize:.2,flareSize:.01,flareSpeed:.01,flareShape:.01,animated:!0,anamorphic:!1,colorGain:"#141414",haloScale:.5,secondaryGhosts:!0,aditionalStreaks:!0,ghostScale:0,opacity:1,starBurst:!1},vignette:{enabled:!1,offset:.3,darkness:.3,eskil:!1},smaa:{enabled:!1},sepia:{enabled:!1,intensity:0},scanline:{enabled:!1,density:1.25},pixelation:{enabled:!1,granularity:5},outline:{enabled:!1,selectionLayer:10,edgeStrength:2.5,pulseSpeed:0,visibleEdgeColor:"#ffffff",hiddenEdgeColor:"#22090a",kernelSize:"large",blur:!1,xRay:!0},selectiveBloom:{enabled:!1,selectionLayer:10,intensity:1,luminanceThreshold:.9,luminanceSmoothing:.025,kernelSize:"large",mipmapBlur:!0,inverted:!1,ignoreBackground:!1},ramp:{enabled:!1,rampType:"linear",rampStart:[.5,.5],rampEnd:[1,1],startColor:"#000000",endColor:"#ffffff",opacity:.5,rampBias:.5,rampGain:.5,rampMask:!1,rampInvert:!1}},Aa={model:{rotation:[0,0,0],showAdvancedRotation:!1,renderer:"pbr",shading:"lit",autoRotate:!1,autoRotateSpeed:1,materialVariant:null},camera:{fieldOfView:50,showAdvancedSettings:!1},lighting:{ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},shadows:{enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3},environment:{source:"preset",preset:"apartment",customEnvironmentUrl:"",intensity:.25,rotation:0,shadowLight:{enabled:!1,intensity:2.5,bias:-5e-4}},wireframe:{enabled:!1,color:"#000000",opacity:1},background:{enabled:!1,type:"color",color:"#1c1c1d",imageUrl:""},groundShadows:{enabled:!1,mode:"shadowCatcher",intensity:.7,borderFade:1,height:0,size:10},postProcessing:hM,animations:pM,annotations:[]};var ri=require("@react-three/fiber"),Dh=require("@react-three/xr"),qd=require("three"),Vr=require("react");function Xv({renderMode:e,suspended:t=!1}){let{scene:n}=(0,ri.useThree)(),i=(0,ri.useThree)(s=>s.setFrameloop),r=(0,Dh.useXR)(s=>s.session!=null),o=(0,Dh.useXR)(s=>s.mode==="immersive-ar"),a=(0,Vr.useRef)(void 0);return(0,Vr.useEffect)(()=>{i(t?"never":r?"always":e)},[r,e,t,i]),(0,Vr.useEffect)(()=>{o?(a.current=n.background,n.background=null):a.current!==void 0&&(n.background=a.current,a.current=void 0)},[o,n]),(0,ri.useFrame)(()=>{o&&n.background!==null&&(n.background=null)}),null}function qv({onPresentingChange:e}){let t=(0,ri.useThree)(r=>r.gl),n=(0,Vr.useRef)(null);(0,Vr.useEffect)(()=>{let r=t.xr;if(!r)return;let o=l=>{l?(n.current=t.shadowMap.enabled,t.shadowMap.enabled=!1):n.current!==null&&(t.shadowMap.enabled=n.current,n.current=null),e(l)},a=()=>o(!0),s=()=>o(!1);return r.addEventListener("sessionstart",a),r.addEventListener("sessionend",s),o(r.isPresenting),()=>{r.removeEventListener("sessionstart",a),r.removeEventListener("sessionend",s)}},[t,e]);let i=(0,Vr.useRef)(0);return(0,ri.useFrame)(()=>{if(!t.xr.isPresenting)return;let r=performance.now();if(r-i.current<1e3)return;i.current=r;let o=t.xr}),null}function $v({active:e}){let t=(0,ri.useThree)(n=>n.invalidate);return(0,Vr.useEffect)(()=>{e&&t()},[e,t]),(0,ri.useFrame)(()=>{e&&t()}),null}function Yv({color:e}){let{scene:t}=(0,ri.useThree)();return(0,Vr.useEffect)(()=>{let n=t.background;return t.background=e?new qd.Color(e):null,()=>{t.background=n}},[t,e]),null}function Kv({rotation:e}){let{scene:t}=(0,ri.useThree)();return(0,Vr.useLayoutEffect)(()=>{let n=e*Math.PI/180;t.environmentRotation.set(0,n,0),t.backgroundRotation.set(0,n,0)}),null}function Zv({cameraConfig:e}){let{camera:t}=(0,ri.useThree)();return(0,Vr.useEffect)(()=>{if(!(t instanceof qd.PerspectiveCamera))return;let n=e?.fov;typeof n=="number"&&t.fov!==n&&(t.fov=n,t.updateProjectionMatrix())},[t,e]),null}var $l=require("@react-three/fiber"),Ue=require("@react-three/postprocessing"),zo=require("postprocessing"),Ai=require("three"),Ln=require("react");var Os=require("react"),$d=require("postprocessing"),Jv=require("three"),ex=require("react/jsx-runtime"),mM=`
|
|
3667
|
+
`);return['<?xml version="1.0" encoding="UTF-8"?>',`<svg xmlns="http://www.w3.org/2000/svg" width="${_c}" height="${_c}" viewBox="0 0 ${_c} ${_c}">`,` <title>${t} UV layout</title>`," <desc>UV0 island-outline template exported by React Immersive. The SVG canvas maps to the complete 0\u20131 texture area.</desc>",' <rect width="2048" height="2048" fill="none" stroke="#94a3b8" stroke-width="2"/>',n,"</svg>"].join(`
|
|
3668
|
+
`)}function N2(e,t="model"){let n=k2(e),i=gy(t);return n.map((r,o)=>{let a=jh(r.name,`material-${o+1}`);return{filename:n.length===1?`${i}-uv-layout.svg`:`${i}-uv-${a}-${o+1}.svg`,materialName:r.name,meshCount:[...r.layers.values()].filter(l=>l.edges.size>0).length,svg:D2(r)}})}async function by(e,t="model"){let n=N2(e,t);if(n.length===0)return n;if(n.length===1)return oo(new Blob([n[0].svg],{type:"image/svg+xml;charset=utf-8"}),n[0].filename),n;let i=Object.fromEntries(n.map(o=>[o.filename,(0,fy.strToU8)(o.svg)])),r=await ku(i);return oo(new Blob([r],{type:"application/zip"}),`${gy(t)}-uv-layouts.zip`),n}function vy({sceneRef:e,materialRefs:t,rendererCaptureRef:n,objectBindings:i,downloadFilename:r,captureVideo:o}){let[a,s]=(0,Mr.useState)(!1),[l,c]=(0,Mr.useState)(!1),[h,p]=(0,Mr.useState)(null),[u,m]=(0,Mr.useState)(null),[f,g]=(0,Mr.useState)("auto");(0,Mr.useEffect)(()=>{if(!l)return;let _=()=>c(!1);return window.addEventListener("pointerdown",_),()=>window.removeEventListener("pointerdown",_)},[l]);let b=(0,Mr.useCallback)(()=>{p(null),m(null),c(_=>!_)},[]),x=(0,Mr.useCallback)(()=>{let _=e.current;_&&(c(!1),s(!0),dy({scene:_,objectBindings:i,matRefs:t.current,downloadFilename:r,onComplete:()=>s(!1)}))},[r,t,i,e]),v=(0,Mr.useCallback)(()=>{c(!1),ou(n.current).then(_=>{let y=document.createElement("a");y.href=_,y.download=`${r}.png`,document.body.appendChild(y),y.click(),document.body.removeChild(y)}).catch(_=>{console.error("Screenshot failed:",_)})},[r,n]),w=(0,Mr.useCallback)(async()=>{let _=e.current;if(_)try{if((await by(_,r)).length===0){p("This model does not contain UV coordinates.");return}p(null),c(!1)}catch(y){console.error("UV layout export failed:",y),p("Could not create the UV layout archive.")}},[r,e]),M=(0,Mr.useCallback)(async _=>{c(!1),m(null);try{let y=await o({mode:_,format:f}),P=y.type==="image/gif"?"gif":y.type.startsWith("video/mp4")?"mp4":"webm",d=URL.createObjectURL(y),S=document.createElement("a");S.href=d,S.download=`${r}-${_}.${P}`,document.body.appendChild(S);try{S.click()}finally{S.remove(),setTimeout(()=>URL.revokeObjectURL(d),1e3)}}catch(y){if(y instanceof DOMException&&y.name==="AbortError")return;m(y instanceof Error?y.message:"Could not export the video."),c(!0)}},[o,r,f]);return{isDownloading:a,downloadMenuOpen:l,uvExportError:h,toggleDownloadMenu:b,handleDownloadMesh:x,handleDownloadScreenshot:v,handleDownloadUvLayout:w,handleDownloadVideo:M,videoFormat:f,setVideoFormat:g,videoExportError:u}}var vt=require("react"),Kr=require("three");var sn=require("three");function Du(e){if(e.length!==3)return null;let t=new sn.Vector3(...e[0]).sub(new sn.Vector3(...e[1])),n=new sn.Vector3(...e[2]).sub(new sn.Vector3(...e[1]));return t.lengthSq()===0||n.lengthSq()===0?null:Math.acos(Math.max(-1,Math.min(1,t.normalize().dot(n.normalize()))))*180/Math.PI}function xy(e,t){if(!e.normal)return null;let n=new sn.Vector3(...e.normal);if(n.lengthSq()===0)return null;n.normalize();let i=new sn.Vector3(...t),r=i.clone().sub(new sn.Vector3(...e.position)).dot(n);return{distance:Math.abs(r),projection:i.addScaledVector(n,-r).toArray()}}function Nu(e){if(e.length<3)return{error:"Pick at least three points to finish the area."};let t=new sn.Vector3(...e[0]),n=e.map(b=>new sn.Vector3(...b).sub(t)),i=Math.max(...n.map(b=>b.length()));if(i===0)return{error:"Area points must be distinct."};let r=new sn.Vector3;for(let b=1;b<n.length-1;b+=1){let x=n[b].clone().cross(n[b+1]);x.lengthSq()>r.lengthSq()&&r.copy(x)}if(r.length()<=i*i*1e-10)return{error:"Area points must not lie on one straight line."};r.normalize();let o=Math.max(i*1e-5,Number.EPSILON*Math.max(...e.flat().map(Math.abs))*32);if(n.some(b=>Math.abs(b.dot(r))>o))return{error:"Area points must lie on one plane."};let a=n.find(b=>b.length()>i*1e-10).clone().normalize(),s=r.clone().cross(a).normalize(),l=n.map(b=>new sn.Vector2(b.dot(a),b.dot(s))),c=(b,x,v)=>(x.x-b.x)*(v.y-b.y)-(x.y-b.y)*(v.x-b.x),h=i*i*1e-10,p=(b,x,v)=>Math.abs(c(b,x,v))<=h&&v.x>=Math.min(b.x,x.x)-i*1e-10&&v.x<=Math.max(b.x,x.x)+i*1e-10&&v.y>=Math.min(b.y,x.y)-i*1e-10&&v.y<=Math.max(b.y,x.y)+i*1e-10;for(let b=0;b<l.length;b+=1){let x=l[b],v=l[(b+1)%l.length];if(x.distanceTo(v)<=i*1e-10)return{error:"Area points must be distinct."};for(let w=b+1;w<l.length;w+=1){if(w===b+1||b===0&&w===l.length-1)continue;let M=l[w],_=l[(w+1)%l.length],y=c(x,v,M),P=c(x,v,_),d=c(M,_,x),S=c(M,_,v);if(y*P<0&&d*S<0||p(x,v,M)||p(x,v,_)||p(M,_,x)||p(M,_,v))return{error:"Area edges must not cross or touch each other."}}}let u=0,m=0,f=0;for(let b=0;b<l.length;b+=1){let x=l[b],v=l[(b+1)%l.length],w=x.x*v.y-v.x*x.y;u+=w,m+=(x.x+v.x)*w,f+=(x.y+v.y)*w}if(Math.abs(u)<=h)return{error:"The polygon has no measurable area."};let g=t.clone().addScaledVector(a,m/(3*u)).addScaledVector(s,f/(3*u));return{area:Math.abs(u)/2,center:g.toArray(),triangles:sn.ShapeUtils.triangulateShape(l,[])}}function O2(e){if(!(e.object instanceof sn.Mesh)||!e.face)return null;let t=e.object,n=t.matrixWorld.clone();if(e.instanceId!==void 0&&"getMatrixAt"in t){let i=new sn.Matrix4;t.getMatrixAt(e.instanceId,i),n.multiply(i)}return[e.face.a,e.face.b,e.face.c].map(i=>t.getVertexPosition(i,new sn.Vector3).applyMatrix4(n))}function yy(e){if(!(e.object instanceof sn.Mesh))return!1;for(let n=e.object;n;n=n.parent)if(!n.visible||n.userData.riEditorGizmo||n.userData.riDecal)return!1;return(Array.isArray(e.object.material)?e.object.material:[e.object.material])[e.face?.materialIndex??0]?.visible!==!1}function wy(e,t,n,i,r,o=12){let a=O2(e),s=a?a[1].clone().sub(a[0]).cross(a[2].clone().sub(a[0])).normalize():null,l={position:e.point.toArray(),...s&&s.lengthSq()>0?{normal:s.toArray()}:{},...a?{faceVertices:a.map(u=>u.toArray())}:{}};if(!a||r==="none")return l;let c=u=>{let m=new sn.Vector4(u.x,u.y,u.z,1).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);return m.w<=0||m.z/m.w<-1||m.z/m.w>1?null:{screen:new sn.Vector2((m.x/m.w+1)*i.width/2,(1-m.y/m.w)*i.height/2),w:m.w}},h=a.map(c),p=o;if((r==="vertex"||r==="auto")&&(h.forEach((u,m)=>{let f=u?.screen.distanceTo(n)??1/0;f<=p&&(p=f,l.position=a[m].toArray(),l.snapped="vertex")}),l.snapped))return l;if(r==="edge"||r==="auto")for(let u=0;u<3;u+=1){let m=(u+1)%3,f=h[u],g=h[m];if(!f||!g)continue;let b=g.screen.clone().sub(f.screen);if(b.lengthSq()===0)continue;let x=Math.max(0,Math.min(1,n.clone().sub(f.screen).dot(b)/b.lengthSq())),v=f.screen.clone().addScaledVector(b,x).distanceTo(n);if(v<=p){p=v;let w=x*f.w/((1-x)*g.w+x*f.w);l.position=a[u].clone().lerp(a[m],w).toArray(),l.snapped="edge"}}return l}var Ou={tool:"distance",points:[],areaClosed:!1,error:null};function Sy(e,t){if(t.type==="tool")return{...Ou,tool:t.tool};if(t.type==="clear")return{...Ou,tool:e.tool};if(t.type==="undo")return{...e,points:e.points.slice(0,-1),areaClosed:!1,error:null};if(t.type==="finishArea"){if(e.tool!=="area")return e;let o=Nu(e.points.map(a=>a.position));return"error"in o?{...e,error:o.error}:{...e,areaClosed:!0,error:null}}if(t.type!=="place")return e;let i=e.areaClosed||e.tool==="angle"&&e.points.length===3||e.tool==="pointToPlane"&&e.points.length===2?[]:e.points;if(e.tool==="pointToPlane"&&i.length===0&&!t.point.normal)return{...e,error:"Pick a triangle face to define the reference plane."};if(i.length>=256)return{...e,error:"Finish or clear this measurement before adding more points."};let r=[...i,t.point];return e.tool==="angle"&&r.length===3&&Du(r.map(o=>o.position))===null?{...e,error:"Pick a point away from the angle's vertex."}:{...e,points:r,areaClosed:!1,error:null}}function B2(e){let t=new Kr.Box3().setFromObject(e),n=new Kr.Vector3;return t.getSize(n),{min:[t.min.x,t.min.y,t.min.z],max:[t.max.x,t.max.y,t.max.z],size:[n.x,n.y,n.z]}}function I2(e){let t=new Kr.Box3().setFromObject(e);if(t.isEmpty())return null;let n=t.getCenter(new Kr.Vector3),i=t.getSize(new Kr.Vector3).length()/2;return!Number.isFinite(i)||i<=0?null:{center:[n.x,n.y,n.z],radius:i}}function _y({canvasAreaRef:e,controlsRef:t,sceneRef:n,modelUrl:i,modelRotation:r,bindingTransformSignature:o,modelLoaded:a,enabled:s}){let[l,c]=(0,vt.useState)(!1),[h,p]=(0,vt.useReducer)(Sy,Ou),[u,m]=(0,vt.useState)("none"),[f,g]=(0,vt.useState)(null),[b,x]=(0,vt.useState)(!1),[v,w]=(0,vt.useState)(null),[M,_]=(0,vt.useState)(null),y=(0,vt.useRef)(!1),P=(0,vt.useRef)(0),d=(0,vt.useRef)(null),S=(0,vt.useRef)(null);y.current=l&&s;let C=(0,vt.useCallback)(te=>{te.updateMatrixWorld(!0),w(B2(te)),_(I2(te))},[]),T=(0,vt.useCallback)(()=>{p({type:"clear"}),g(null)},[]),E=(0,vt.useCallback)(te=>{p({type:"tool",tool:te}),g(null)},[]),k=(0,vt.useCallback)(()=>p({type:"undo"}),[]),D=(0,vt.useCallback)(()=>p({type:"finishArea"}),[]),I=(0,vt.useCallback)(()=>c(te=>!te),[]),L=(0,vt.useCallback)(()=>x(te=>!te),[]),X=(0,vt.useCallback)(te=>{!y.current||te.button!==0||(d.current={x:te.clientX,y:te.clientY})},[]),O=(0,vt.useCallback)((te,We)=>{let wt=e.current,be=t.current?.camera,ue=n.current;if(!wt||!be||!ue)return null;let Ne=wt.getBoundingClientRect();if(!Ne.width||!Ne.height)return null;ue.updateMatrixWorld(!0),be.updateMatrixWorld(!0);let Te=new Kr.Vector2(te-Ne.left,We-Ne.top),bn=new Kr.Raycaster;bn.setFromCamera(new Kr.Vector2(Te.x/Ne.width*2-1,1-Te.y/Ne.height*2),be);let Oe=bn.intersectObject(ue,!0).find(yy);return Oe?wy(Oe,be,Te,Ne,u):null},[e,t,n,u]),B=(0,vt.useCallback)(()=>{S.current!==null&&cancelAnimationFrame(S.current),S.current=null,g(null)},[]),re=(0,vt.useCallback)(te=>{if(!y.current||u==="none"||te.buttons!==0||te.target.closest("button, input, select, label, textarea, .ri-measureTools")){B();return}S.current!==null&&cancelAnimationFrame(S.current);let{clientX:We,clientY:wt}=te;S.current=requestAnimationFrame(()=>{S.current=null;let be=O(We,wt);g(be?.snapped?be:null)})},[B,O,u]),ke=(0,vt.useCallback)(te=>{if(!y.current)return;let We=d.current;if(d.current=null,We&&Math.hypot(te.clientX-We.x,te.clientY-We.y)>6||te.target.closest("button, input, select, label, textarea, .ri-measureTools"))return;let be=O(te.clientX,te.clientY);be&&(P.current+=1,p({type:"place",point:{...be,id:P.current}}))},[O]);return(0,vt.useEffect)(()=>{T(),w(null),_(null)},[i,T]),(0,vt.useEffect)(()=>{T()},[r,o,T]),(0,vt.useEffect)(()=>(B(),B),[B,l,u]),(0,vt.useEffect)(()=>{s||(c(!1),B())},[s,B]),(0,vt.useEffect)(()=>{let te=n.current;!a||!te||C(te)},[o,a,C,n]),{measureMode:l,measureModeRef:y,measurePoints:h.points,measurementTool:h.tool,areaClosed:h.areaClosed,measurementError:h.error,selectMeasurementTool:E,undoMeasurementPoint:k,finishMeasureArea:D,snapMode:u,setSnapMode:m,snapPreview:f,handleMeasurePointerMove:re,clearSnapPreview:B,showDimensions:b,measureBox:v,modelBounds:M,refreshBounds:C,clearMeasurements:T,toggleMeasureMode:I,toggleDimensions:L,handleMeasurePointerDown:X,handleMeasureClick:ke}}var Ty=require("react-dom"),Py=require("@react-three/xr"),Ay=require("lucide-react"),kt=require("react");function My(e,t){let n=null,i=o=>{let a=o.mode==="immersive-ar"?o.session??null:null;a!==n&&(n&&t.endAR(),n=a,n&&t.startAR())},r=e.subscribe(i);return i(e.getState()),()=>{r(),n&&t.endAR("interrupted"),n=null}}var Vr=require("react/jsx-runtime"),Cy={canPlace:!1,isPlacementMode:!0,isModelPlaced:!1};function Ey({enableXR:e,usdzUrl:t,mobileHandoffUrl:n,engagement:i}){let r=Me(),o=(0,kt.useRef)(null),a=(0,kt.useMemo)(()=>{if(!e||typeof navigator>"u")return null;let B=navigator.xr;if(!B||typeof B.isSessionSupported!="function"||typeof B.addEventListener!="function")return null;try{return(0,Py.createXRStore)({emulate:!1})}catch{return null}},[e]),[s,l]=(0,kt.useState)(!1),[c,h]=(0,kt.useState)(!1),[p,u]=(0,kt.useState)(!0),[m,f]=(0,kt.useState)(null),[g,b]=(0,kt.useState)(!1),[x,v]=(0,kt.useState)(!1),[w,M]=(0,kt.useState)(Cy),[_,y]=(0,kt.useState)(!1),P=(0,kt.useMemo)(()=>e&&!!t?.trim()&&_h(),[e,t]);(0,kt.useEffect)(()=>{u(jv())},[]);let d=(0,kt.useCallback)(()=>{if(typeof window>"u")return null;try{let B=new URL(n?.trim()||window.location.href,window.location.href);return B.protocol==="http:"||B.protocol==="https:"?B.toString():null}catch{return null}},[n]);(0,kt.useEffect)(()=>{if(!e||p){f(null),b(!1);return}f(d())},[e,p,d]),(0,kt.useEffect)(()=>{if(a)return a.subscribe(B=>v(B.session!=null&&B.mode==="immersive-ar"))},[a]),(0,kt.useEffect)(()=>{if(a)return My(a,i)},[a,i]),(0,kt.useEffect)(()=>{y(!1),M(Cy)},[x]),(0,kt.useEffect)(()=>{if(!e||typeof navigator>"u")return;let B=navigator.xr;if(!B?.isSessionSupported)return;let re=!1;return B.isSessionSupported("immersive-ar").then(ke=>!re&&l(ke)).catch(()=>{}),B.isSessionSupported("immersive-vr").then(ke=>!re&&h(ke)).catch(()=>{}),()=>{re=!0}},[e]);let S=(0,kt.useCallback)(()=>{let B=d();B&&(i.requestARLaunch("mobile-handoff"),f(B),b(!0))},[d,i]),C=(0,kt.useCallback)(()=>b(!1),[]),T=(0,kt.useCallback)(()=>{let B=t?.trim();if(!B)return;i.requestARLaunch("quick-look");let re=document.createElement("a");re.setAttribute("rel","ar"),re.href=B,re.style.display="none";let ke=document.createElement("img");ke.alt="",ke.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",re.appendChild(ke),document.body.appendChild(re),re.click(),re.remove()},[t,i]),E=(0,kt.useCallback)(B=>{M(B),B.isPlacementMode||y(!1)},[]),k=(0,kt.useCallback)(B=>{y(!1),B?o.current?.finishPlacementMode():o.current?.cancelPlacementMode()},[]),D=(0,kt.useCallback)(B=>{B.preventDefault(),y(!0),o.current?.startPlacementMode()},[]);(0,kt.useEffect)(()=>{if(!_)return;let B=()=>k(!0),re=()=>k(!1);return window.addEventListener("pointerup",B),window.addEventListener("pointercancel",re),()=>{window.removeEventListener("pointerup",B),window.removeEventListener("pointercancel",re)}},[k,_]);let I=w.isModelPlaced?w.isPlacementMode?w.canPlace?r("arReleaseToPlace"):r("arFindSurface"):null:w.canPlace?null:r("arFindSurface"),L=w.isModelPlaced&&!w.isPlacementMode?r("arGestureHint"):null,X=a?.getState().domOverlayRoot??null,O=x&&X?(0,Ty.createPortal)((0,Vr.jsxs)(Vr.Fragment,{children:[L&&(0,Vr.jsx)("div",{className:"ri-arHintOverlay",children:(0,Vr.jsx)("div",{className:"ri-arHint",children:L})}),(0,Vr.jsx)("div",{className:"ri-arOverlay",children:(0,Vr.jsxs)("div",{className:"ri-arControls",children:[I&&(0,Vr.jsx)("div",{className:"ri-arStatus",children:I}),w.isModelPlaced&&(0,Vr.jsxs)("button",{type:"button",className:`ri-arActionButton ${_?"ri-arActionButton--active":""}`,onPointerDown:B=>D(B.nativeEvent),"aria-pressed":_,children:[(0,Vr.jsx)(Ay.MapPin,{size:14}),r("arRelocate")]}),!w.isModelPlaced&&w.canPlace&&(0,Vr.jsx)("button",{type:"button",className:"ri-arActionButton ri-arActionButton--primary",onClick:()=>o.current?.placeCurrent(),children:r("tapToPlace")})]})})]}),X):null;return{xrStore:a,presenterRef:o,arSupported:s,vrSupported:c,quickLookSupported:P,resolvedMobileHandoffUrl:m,isMobileHandoffOpen:g,arOverlay:O,openMobileHandoff:S,closeMobileHandoff:C,openQuickLook:T,handleARStateChange:E}}var Tc=require("@react-three/fiber"),t0=require("@react-three/drei"),n0=require("@react-three/xr"),ao=require("three"),vi=require("react");function Bu(e){let t=e.trim();return t?/\.(hdr|exr|jpg|jpeg|png|webp)(?:[?#].*)?$/i.test(t):!1}var Ry=["none","directional","point","spot","hemisphere"],ky=["pbr","matcap","uv-checker"],Ly=["apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"];var Dy=["sporadic","constantMild","constantWild"],Ny=["linear","radial","mirroredLinear"],Mc=["verySmall","small","medium","large","veryLarge","huge"],Iu=["x","y","z"],Fa={enabled:!1,axis:"y",position:.5,flip:!1},z2={clips:[],autoplayClip:null},U2={autofocus:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6,target:[0,0,0],mouse:!0,debug:0,manual:!1,smoothTime:.25},toneMapping:{enabled:!1,mode:"aces",exposure:1,resolution:256,whitePoint:4,middleGrey:.6,minLuminance:.01,averageLuminance:1,adaptationRate:1},brightnessContrast:{enabled:!1,brightness:0,contrast:0},hueSaturation:{enabled:!1,hue:0,saturation:0},colorAverage:{enabled:!1},dotScreen:{enabled:!1,angle:Math.PI/2,scale:1},glitch:{enabled:!1,mode:"sporadic",delay:[1.5,3.5],duration:[.6,1],strength:[.3,1],chromaticAberrationOffset:[0,0],columns:.05,ratio:.85},ssao:{enabled:!1,samples:30,rings:4,intensity:8,radius:.25,bias:.025,luminanceInfluence:.6,fade:.01,minRadiusScale:.33,worldDistanceThreshold:20,worldDistanceFalloff:5,worldProximityThreshold:6,worldProximityFalloff:3},bloom:{enabled:!1,intensity:.3,luminanceThreshold:.9,luminanceSmoothing:.2,mipmapBlur:!0,radius:0,levels:8},godRays:{enabled:!1,sunPosition:[5,10,5],samples:60,density:.96,decay:.9,weight:.4,exposure:.6,clampMax:1,blur:!0,kernelSize:"small"},grid:{enabled:!1,scale:1,lineWidth:0},noise:{enabled:!1,opacity:1,premultiply:!1},depthOfField:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6},chromaticAberration:{enabled:!1,offsetX:.002,offsetY:.002,radialModulation:!1,modulationOffset:.15},lensflare:{enabled:!1,lensPosition:[-25,6,-60],smoothTime:.07,glareSize:.2,flareSize:.01,flareSpeed:.01,flareShape:.01,animated:!0,anamorphic:!1,colorGain:"#141414",haloScale:.5,secondaryGhosts:!0,aditionalStreaks:!0,ghostScale:0,opacity:1,starBurst:!1},vignette:{enabled:!1,offset:.3,darkness:.3,eskil:!1},smaa:{enabled:!1},sepia:{enabled:!1,intensity:0},scanline:{enabled:!1,density:1.25},pixelation:{enabled:!1,granularity:5},outline:{enabled:!1,selectionLayer:10,edgeStrength:2.5,pulseSpeed:0,visibleEdgeColor:"#ffffff",hiddenEdgeColor:"#22090a",kernelSize:"large",blur:!1,xRay:!0},selectiveBloom:{enabled:!1,selectionLayer:10,intensity:1,luminanceThreshold:.9,luminanceSmoothing:.025,kernelSize:"large",mipmapBlur:!0,inverted:!1,ignoreBackground:!1},ramp:{enabled:!1,rampType:"linear",rampStart:[.5,.5],rampEnd:[1,1],startColor:"#000000",endColor:"#ffffff",opacity:.5,rampBias:.5,rampGain:.5,rampMask:!1,rampInvert:!1}},ja={model:{rotation:[0,0,0],showAdvancedRotation:!1,renderer:"pbr",shading:"lit",autoRotate:!1,autoRotateSpeed:1},camera:{fieldOfView:50,showAdvancedSettings:!1},lighting:{ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},shadows:{enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3},environment:{source:"preset",preset:"apartment",customEnvironmentUrl:"",intensity:.25,rotation:0,shadowLight:{enabled:!1,intensity:2.5,bias:-5e-4}},wireframe:{enabled:!1,color:"#000000",opacity:1},background:{enabled:!1,type:"color",color:"#1c1c1d",imageUrl:""},groundShadows:{enabled:!1,mode:"shadowCatcher",intensity:.7,borderFade:1,height:0,size:10},postProcessing:U2,animations:z2,annotations:[]};var lr=require("@react-three/fiber"),Oy=require("@react-three/drei"),Gh=require("@react-three/xr"),zu=require("three"),Cr=require("react"),Ga=require("react/jsx-runtime");function By({renderMode:e,suspended:t=!1}){let{scene:n}=(0,lr.useThree)(),i=(0,lr.useThree)(s=>s.setFrameloop),r=(0,Gh.useXR)(s=>s.session!=null),o=(0,Gh.useXR)(s=>s.mode==="immersive-ar"),a=(0,Cr.useRef)(void 0);return(0,Cr.useEffect)(()=>{i(t?"never":r?"always":e)},[r,e,t,i]),(0,Cr.useEffect)(()=>{o?(a.current=n.background,n.background=null):a.current!==void 0&&(n.background=a.current,a.current=void 0)},[o,n]),(0,lr.useFrame)(()=>{o&&n.background!==null&&(n.background=null)}),null}function Iy({onPresentingChange:e}){let t=(0,lr.useThree)(r=>r.gl),n=(0,Cr.useRef)(null);(0,Cr.useEffect)(()=>{let r=t.xr;if(!r)return;let o=l=>{l?(n.current=t.shadowMap.enabled,t.shadowMap.enabled=!1):n.current!==null&&(t.shadowMap.enabled=n.current,n.current=null),e(l)},a=()=>o(!0),s=()=>o(!1);return r.addEventListener("sessionstart",a),r.addEventListener("sessionend",s),o(r.isPresenting),()=>{r.removeEventListener("sessionstart",a),r.removeEventListener("sessionend",s)}},[t,e]);let i=(0,Cr.useRef)(0);return(0,lr.useFrame)(()=>{if(!t.xr.isPresenting)return;let r=performance.now();if(r-i.current<1e3)return;i.current=r;let o=t.xr}),null}function zy({active:e}){let t=(0,lr.useThree)(n=>n.invalidate);return(0,Cr.useEffect)(()=>{e&&t()},[e,t]),(0,lr.useFrame)(()=>{e&&t()}),null}function Uy(e){let t=(0,lr.useThree)(i=>i.gl),n=(0,Cr.useRef)(t.autoClear);return(0,lr.useFrame)(()=>{n.current=t.autoClear,t.autoClear=!0},-1),(0,Ga.jsxs)(Ga.Fragment,{children:[(0,Ga.jsx)(Oy.ContactShadows,{...e}),(0,Ga.jsx)(V2,{saved:n})]})}function V2({saved:e}){let t=(0,lr.useThree)(n=>n.gl);return(0,lr.useFrame)(()=>{t.autoClear=e.current}),null}function Vy({color:e}){let{scene:t}=(0,lr.useThree)();return(0,Cr.useEffect)(()=>{let n=t.background;return t.background=e?new zu.Color(e):null,()=>{t.background=n}},[t,e]),null}function Fy({rotation:e}){let{scene:t}=(0,lr.useThree)();return(0,Cr.useLayoutEffect)(()=>{let n=e*Math.PI/180;t.environmentRotation.set(0,n,0),t.backgroundRotation.set(0,n,0)}),null}function jy({cameraConfig:e}){let{camera:t}=(0,lr.useThree)();return(0,Cr.useEffect)(()=>{if(!(t instanceof zu.PerspectiveCamera))return;let n=e?.fov;typeof n=="number"&&t.fov!==n&&(t.fov=n,t.updateProjectionMatrix())},[t,e]),null}var Cc=require("@react-three/fiber"),Fe=require("@react-three/postprocessing"),Ho=require("postprocessing"),bi=require("three"),Nn=require("react");var rl=require("react"),Uu=require("postprocessing"),Gy=require("three"),Wy=require("react/jsx-runtime"),F2=`
|
|
3669
3669
|
uniform float exposure;
|
|
3670
3670
|
void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
|
|
3671
3671
|
outputColor = vec4(inputColor.rgb * exposure, inputColor.a);
|
|
3672
3672
|
}
|
|
3673
|
-
`,Nh=class extends $d.Effect{constructor(t=1){super("ExposureEffect",mM,{blendFunction:$d.BlendFunction.NORMAL,uniforms:new Map([["exposure",new Jv.Uniform(t)]])})}set exposure(t){this.uniforms.get("exposure").value=t}},Qv=(0,Os.forwardRef)(function({exposure:t},n){let i=(0,Os.useMemo)(()=>new Nh(t),[]);return i.exposure=t,(0,Os.useImperativeHandle)(n,()=>i,[i]),(0,ex.jsx)("primitive",{object:i,dispose:null})});var Ea=require("@react-three/fiber"),tx=Qg(require("@react-three/postprocessing")),nx=require("postprocessing"),oi=require("three"),ii=require("react"),ix=require("react/jsx-runtime"),fM=tx.LensFlareEffect;function rx({config:e}){let t=(0,Ea.useThree)(d=>d.camera),n=(0,Ea.useThree)(d=>d.raycaster),i=(0,Ea.useThree)(d=>d.scene),r=(0,Ea.useThree)(d=>d.viewport),o=(0,ii.useRef)(null),a=(0,ii.useRef)(new oi.Vector3),s=(0,ii.useRef)(new oi.Vector2),l=(0,ii.useMemo)(()=>new oi.Vector3(...e.lensPosition),[e.lensPosition]),c=(0,ii.useMemo)(()=>new oi.Color(e.colorGain??"#141414"),[e.colorGain]),p=(0,ii.useMemo)(()=>new oi.Vector2(0,0),[]),u=(0,ii.useMemo)(()=>new fM({blendFunction:nx.BlendFunction.NORMAL,enabled:!0,glareSize:e.glareSize,lensPosition:l,screenRes:p,starPoints:6,flareSize:e.flareSize,flareSpeed:e.flareSpeed,flareShape:e.flareShape,animated:e.animated,anamorphic:e.anamorphic,colorGain:c,lensDirtTexture:null,haloScale:e.haloScale,secondaryGhosts:e.secondaryGhosts,aditionalStreaks:e.aditionalStreaks,ghostScale:e.ghostScale,opacity:e.opacity,starBurst:e.starBurst}),[c,e.aditionalStreaks,e.anamorphic,e.animated,e.flareShape,e.flareSize,e.flareSpeed,e.glareSize,e.haloScale,e.ghostScale,e.opacity,e.secondaryGhosts,e.starBurst,l,p]);return(0,ii.useEffect)(()=>(o.current=u,()=>{u.dispose(),o.current=null}),[u]),(0,ii.useEffect)(()=>{let d=u.uniforms.get("screenRes");d&&(d.value.x=r.width,d.value.y=r.height)},[u,r]),(0,Ea.useFrame)((d,m)=>{let g=o.current;if(!g)return;let v=g.uniforms.get("lensPosition"),M=g.uniforms.get("opacity");if(!v||!M)return;let w=1;if(a.current.copy(l).project(t),a.current.z>1)return;v.value.x=a.current.x,v.value.y=a.current.y,s.current.x=a.current.x,s.current.y=a.current.y,n.setFromCamera(s.current,t);let x=n.intersectObjects(i.children,!0),{object:S}=x[0]||{};S&&(S.userData?.lensflare==="no-occlusion"?w=0:S instanceof oi.Mesh&&(S.material.uniforms?._transmission?.value>.2||S.material._transmission&&S.material._transmission>.2?w=.2:S.material.transparent&&(w=S.material.opacity))),M.value=oi.MathUtils.damp(M.value,w,12,m)}),(0,ix.jsx)("primitive",{object:u,dispose:null})}var Yd=require("@react-three/postprocessing"),ar=require("postprocessing"),ox=require("three");function ax(e){return e==="linear"?ar.ToneMappingMode.LINEAR:e==="reinhard"?ar.ToneMappingMode.REINHARD:ar.ToneMappingMode.ACES_FILMIC}function Kd(e){switch(e){case"verySmall":return ar.KernelSize.VERY_SMALL;case"small":return ar.KernelSize.SMALL;case"medium":return ar.KernelSize.MEDIUM;case"large":return ar.KernelSize.LARGE;case"veryLarge":return ar.KernelSize.VERY_LARGE;case"huge":return ar.KernelSize.HUGE}}function sx(e){switch(e){case"constantMild":return ar.GlitchMode.CONSTANT_MILD;case"constantWild":return ar.GlitchMode.CONSTANT_WILD;default:return ar.GlitchMode.SPORADIC}}function Bh(e){let t=new ox.Color(e);return[t.r,t.g,t.b,1]}function lx(e){return e==="radial"?Yd.RampType.Radial:e==="mirroredLinear"?Yd.RampType.MirroredLinear:Yd.RampType.Linear}var xt=require("react/jsx-runtime"),Ra={edgeStrength:1,pulseSpeed:0,visibleEdgeColor:new Ai.Color(uo.color).getHex(),hiddenEdgeColor:new Ai.Color(uo.color).multiplyScalar(.35).getHex(),kernelSize:zo.KernelSize.VERY_SMALL,blur:!1,xRay:!1};function gM(e){let t=[];return e.traverse(n=>{n.isMesh&&t.push(n)}),t}var Oh=[],bM=(0,Ln.memo)(function({sceneConfig:t,selectedObjectRef:n,highlightOnHover:i=!1,disabled:r=!1,onOutlineEffect:o}){let a=(0,$l.useThree)(b=>b.scene),s=(0,$l.useThree)(b=>b.gl),l=(0,Ln.useRef)(null),c=t?.postProcessing,p=n??null,u=c?.outline.enabled===!0,d=u||i,[m,g]=(0,Ln.useState)(()=>s.xr?.isPresenting??!1);(0,Ln.useEffect)(()=>{let b=s.xr;if(!b)return;let _=()=>g(!0),y=()=>g(!1);return b.addEventListener("sessionstart",_),b.addEventListener("sessionend",y),g(b.isPresenting),()=>{b.removeEventListener("sessionstart",_),b.removeEventListener("sessionend",y)}},[s]);let v=a.children.filter(b=>b.isLight),M=(0,Ln.useMemo)(()=>new Ai.Vector2(c?.chromaticAberration.offsetX??.002,c?.chromaticAberration.offsetY??.002),[c?.chromaticAberration.offsetX,c?.chromaticAberration.offsetY]),w=(0,Ln.useMemo)(()=>new Ai.Color(c?.outline.visibleEdgeColor??"#ffffff").getHex(),[c?.outline.visibleEdgeColor]),x=(0,Ln.useMemo)(()=>new Ai.Color(c?.outline.hiddenEdgeColor??"#22090a").getHex(),[c?.outline.hiddenEdgeColor]),S=(0,Ln.useMemo)(()=>Bh(c?.ramp.startColor??"#000000"),[c?.ramp.startColor]),k=(0,Ln.useMemo)(()=>Bh(c?.ramp.endColor??"#ffffff"),[c?.ramp.endColor]);return!c||m||r?null:(0,xt.jsxs)(xt.Fragment,{children:[c.godRays.enabled===!0&&(0,xt.jsxs)("mesh",{ref:l,position:c.godRays.sunPosition,visible:!1,frustumCulled:!1,children:[(0,xt.jsx)("sphereGeometry",{args:[.1,8,8]}),(0,xt.jsx)("meshBasicMaterial",{transparent:!0,opacity:0,depthWrite:!1})]}),(0,xt.jsxs)(Ue.EffectComposer,{multisampling:0,enableNormalPass:c.ssao.enabled===!0,autoClear:!1,children:[c.smaa.enabled===!0&&(0,xt.jsx)(Ue.SMAA,{}),c.ssao.enabled===!0&&(0,xt.jsx)(Ue.SSAO,{samples:c.ssao.samples,rings:c.ssao.rings,intensity:c.ssao.intensity,radius:c.ssao.radius,bias:c.ssao.bias,luminanceInfluence:c.ssao.luminanceInfluence,fade:c.ssao.fade,minRadiusScale:c.ssao.minRadiusScale,worldDistanceThreshold:c.ssao.worldDistanceThreshold,worldDistanceFalloff:c.ssao.worldDistanceFalloff,worldProximityThreshold:c.ssao.worldProximityThreshold,worldProximityFalloff:c.ssao.worldProximityFalloff}),c.autofocus.enabled===!0&&(0,xt.jsx)(Ue.Autofocus,{focusDistance:c.autofocus.focusDistance,focusRange:c.autofocus.focusRange,focalLength:c.autofocus.focalLength,bokehScale:c.autofocus.bokehScale,target:c.autofocus.target,mouse:c.autofocus.mouse,debug:c.autofocus.debug||void 0,manual:c.autofocus.manual,smoothTime:c.autofocus.smoothTime}),c.autofocus.enabled!==!0&&c.depthOfField.enabled===!0&&(0,xt.jsx)(Ue.DepthOfField,{focusDistance:c.depthOfField.focusDistance,focusRange:c.depthOfField.focusRange,focalLength:c.depthOfField.focalLength,bokehScale:c.depthOfField.bokehScale}),c.bloom.enabled===!0&&(0,xt.jsx)(Ue.Bloom,{intensity:c.bloom.intensity,luminanceThreshold:c.bloom.luminanceThreshold,luminanceSmoothing:c.bloom.luminanceSmoothing,mipmapBlur:c.bloom.mipmapBlur,radius:c.bloom.radius,levels:c.bloom.levels}),c.selectiveBloom.enabled===!0&&(0,xt.jsx)(Ue.SelectiveBloom,{selection:p??void 0,lights:v,selectionLayer:c.selectiveBloom.selectionLayer,intensity:c.selectiveBloom.intensity,luminanceThreshold:c.selectiveBloom.luminanceThreshold,luminanceSmoothing:c.selectiveBloom.luminanceSmoothing,kernelSize:Kd(c.selectiveBloom.kernelSize),mipmapBlur:c.selectiveBloom.mipmapBlur,inverted:c.selectiveBloom.inverted,ignoreBackground:c.selectiveBloom.ignoreBackground}),d&&(0,xt.jsx)(Ue.Outline,{ref:o,selection:Oh,selectionLayer:c.outline.selectionLayer,blendFunction:zo.BlendFunction.SCREEN,edgeStrength:u?c.outline.edgeStrength:Ra.edgeStrength,pulseSpeed:u?c.outline.pulseSpeed:Ra.pulseSpeed,visibleEdgeColor:u?w:Ra.visibleEdgeColor,hiddenEdgeColor:u?x:Ra.hiddenEdgeColor,kernelSize:u?Kd(c.outline.kernelSize):Ra.kernelSize,blur:u?c.outline.blur:Ra.blur,xRay:u?c.outline.xRay:Ra.xRay}),c.chromaticAberration.enabled===!0&&(0,xt.jsx)(Ue.ChromaticAberration,{offset:M,radialModulation:c.chromaticAberration.radialModulation,modulationOffset:c.chromaticAberration.modulationOffset}),c.colorAverage.enabled===!0&&(0,xt.jsx)(Ue.ColorAverage,{}),c.dotScreen.enabled===!0&&(0,xt.jsx)(Ue.DotScreen,{angle:c.dotScreen.angle,scale:c.dotScreen.scale}),c.glitch.enabled===!0&&(0,xt.jsx)(Ue.Glitch,{mode:sx(c.glitch.mode),delay:new Ai.Vector2(c.glitch.delay[0],c.glitch.delay[1]),duration:new Ai.Vector2(c.glitch.duration[0],c.glitch.duration[1]),strength:new Ai.Vector2(c.glitch.strength[0],c.glitch.strength[1]),chromaticAberrationOffset:new Ai.Vector2(c.glitch.chromaticAberrationOffset[0],c.glitch.chromaticAberrationOffset[1]),columns:c.glitch.columns,ratio:c.glitch.ratio,active:!0}),c.grid.enabled===!0&&(0,xt.jsx)(Ue.Grid,{scale:c.grid.scale,lineWidth:c.grid.lineWidth}),c.lensflare.enabled===!0&&(0,xt.jsx)(rx,{config:c.lensflare}),c.godRays.enabled===!0&&(0,xt.jsx)(Ue.GodRays,{sun:l,samples:c.godRays.samples,density:c.godRays.density,decay:c.godRays.decay,weight:c.godRays.weight,exposure:c.godRays.exposure,clampMax:c.godRays.clampMax,blur:c.godRays.blur,kernelSize:Kd(c.godRays.kernelSize)}),c.noise.enabled===!0&&(0,xt.jsx)(Ue.Noise,{premultiply:c.noise.premultiply,opacity:c.noise.opacity,blendFunction:zo.BlendFunction.ADD}),c.brightnessContrast.enabled===!0&&(0,xt.jsx)(Ue.BrightnessContrast,{brightness:c.brightnessContrast.brightness,contrast:c.brightnessContrast.contrast}),c.hueSaturation.enabled===!0&&(0,xt.jsx)(Ue.HueSaturation,{hue:c.hueSaturation.hue,saturation:c.hueSaturation.saturation}),c.toneMapping.enabled===!0&&(0,xt.jsx)(Qv,{exposure:c.toneMapping.exposure}),c.vignette.enabled===!0&&(0,xt.jsx)(Ue.Vignette,{eskil:c.vignette.eskil,offset:c.vignette.offset,darkness:c.vignette.darkness,blendFunction:zo.BlendFunction.NORMAL}),c.toneMapping.enabled===!0&&(0,xt.jsx)(Ue.ToneMapping,{mode:ax(c.toneMapping.mode),resolution:c.toneMapping.resolution,whitePoint:c.toneMapping.whitePoint,middleGrey:c.toneMapping.middleGrey,minLuminance:c.toneMapping.minLuminance,averageLuminance:c.toneMapping.averageLuminance,adaptationRate:c.toneMapping.adaptationRate}),c.sepia.enabled===!0&&(0,xt.jsx)(Ue.Sepia,{intensity:c.sepia.intensity,blendFunction:zo.BlendFunction.NORMAL}),c.scanline.enabled===!0&&(0,xt.jsx)(Ue.Scanline,{density:c.scanline.density,blendFunction:zo.BlendFunction.OVERLAY}),c.pixelation.enabled===!0&&(0,xt.jsx)(Ue.Pixelation,{granularity:c.pixelation.granularity}),c.ramp.enabled===!0&&(0,xt.jsx)(Ue.Ramp,{rampType:lx(c.ramp.rampType),rampStart:c.ramp.rampStart,rampEnd:c.ramp.rampEnd,startColor:S,endColor:k,opacity:c.ramp.rampMask?1:c.ramp.opacity??.5,rampBias:c.ramp.rampBias,rampGain:c.ramp.rampGain,rampMask:c.ramp.rampMask,rampInvert:c.ramp.rampInvert})]})]})});function vM(e){let t=[e];for(;t.length>0;){let n=t.pop();if(n.visible){if(n.isMesh)return!0;t.push(...n.children)}}return!1}function xM(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function cx({hoveredObjectRef:e,...t}){let n=(0,$l.useThree)(l=>l.scene),i=(0,$l.useThree)(l=>l.invalidate),[r,o]=(0,Ln.useState)(null),a=(0,Ln.useCallback)(l=>o(l),[]),s=(0,Ln.useRef)({effect:null,objects:Oh});return(0,Ln.useEffect)(()=>{if(!r)return;let c=t.sceneConfig?.postProcessing?.outline.enabled===!0?gM(n):e&&vM(e)?[e]:Oh;s.current.effect===r&&xM(s.current.objects,c)||(s.current={effect:r,objects:c},r.selection.set(c),i())}),(0,xt.jsx)(bM,{...t,onOutlineEffect:a})}var Dn=require("react/jsx-runtime"),yM=1.5;function wM({captureRef:e}){let{gl:t,scene:n,camera:i,invalidate:r}=(0,Zd.useThree)();return(0,Ei.useEffect)(()=>{if(e)return e.current={gl:t,scene:n,camera:i,invalidate:r},()=>{e.current=null}},[e,t,n,i,r]),null}function Ih({children:e,camera:t,backgroundColor:n,shadows:i=!0,sceneConfig:r,selectedObjectRef:o,hoveredObjectRef:a,highlightOnHover:s,renderMode:l="demand",maxDpr:c=2,xrStore:p,rendererCaptureRef:u,preserveDrawingBuffer:d=!1,reduceGpuLoad:m,suspended:g=!1,onRendererCreated:v}){let M=m??Lh(),w=M?Math.min(c,yM):c,x=i&&!M,S=(0,Ei.useMemo)(()=>n?{background:n}:r?.background.enabled?r.background.type==="color"?{background:r.background.color}:r.background.type==="image"&&r.background.imageUrl.trim()?{backgroundImage:`url("${r.background.imageUrl}")`,backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"cover"}:{background:"linear-gradient(180deg, #3a3a3c 0%, #1c1c1d 100%)"}:{background:"transparent"},[n,r]),k=(0,Ei.useMemo)(()=>{if(n)return n;let D=r?.background;if(D?.enabled){if(D.type==="color")return D.color;if(D.type==="image"&&D.imageUrl.trim()||D.type==="environment")return null}return"#1c1c1d"},[n,r]),b=(0,Ei.useMemo)(()=>{let D=r?.postProcessing;return D?!!(D.glitch.enabled||D.noise.enabled||D.lensflare.enabled&&D.lensflare.animated):!1},[r?.postProcessing]),[_,y]=(0,Ei.useState)(!1),h=r?.environment,P=r?.groundShadows,A=(0,Ei.useMemo)(()=>{if(!h)return null;if(h.source==="custom"){let D=h.customEnvironmentUrl.trim();return Wd(D)?{files:D}:null}return{preset:h.preset}},[h]),C=(0,Dn.jsxs)(Dn.Fragment,{children:[(0,Dn.jsx)(wM,{captureRef:u}),(0,Dn.jsx)(Zv,{cameraConfig:t}),(0,Dn.jsx)($v,{active:b}),(0,Dn.jsx)(Yv,{color:k}),A?(0,Dn.jsx)(Cs,{onError:D=>console.warn("Failed to load environment map:",D),children:(0,Dn.jsx)(Ei.Suspense,{fallback:null,children:(0,Dn.jsx)(Jd.Environment,{...A,environmentIntensity:h?.intensity??.25,backgroundIntensity:h?.intensity??.25,background:r?.background.enabled===!0&&r.background.type==="environment"})})}):null,(0,Dn.jsx)(Kv,{rotation:h?.rotation??0}),p&&(0,Dn.jsx)(qv,{onPresentingChange:y}),P?.enabled&&P.mode==="shadowCatcher"&&!_&&(0,Dn.jsx)(Jd.ContactShadows,{position:[0,P.height,0],scale:P.size,opacity:P.intensity,blur:P.borderFade,far:15,resolution:1024,color:"#000000"}),e,(0,Dn.jsx)(cx,{sceneConfig:r,selectedObjectRef:o,hoveredObjectRef:a,highlightOnHover:s,disabled:M})]});return(0,Dn.jsx)(Zd.Canvas,{frameloop:g?"never":l,onCreated:({gl:D})=>v?.(D),dpr:[1,w],shadows:x?"soft":!1,resize:{debounce:0,scroll:!1},raycaster:{firstHitOnly:!0},style:S,camera:t??{fov:50},gl:{preserveDrawingBuffer:d,toneMapping:ux.NoToneMapping,toneMappingExposure:1},children:p?(0,Dn.jsxs)(dx.XR,{store:p,children:[(0,Dn.jsx)(Xv,{renderMode:l,suspended:g}),C]}):C})}var eu=require("@react-three/drei"),Yl=require("three"),Uo=require("react");var Qd=e=>e*Math.PI/180;function px(e){return{minDistance:e?.minDistance??0,maxDistance:e?.maxDistance??1/0,minPolarAngle:Qd(e?.minPolarAngle??0),maxPolarAngle:Qd(e?.maxPolarAngle??180),minAzimuthAngle:Qd(e?.minAzimuthAngle??-1/0),maxAzimuthAngle:Qd(e?.maxAzimuthAngle??1/0),boundaryEnclosesCamera:e?.boundaryEnclosesCamera??!1,boundaryFriction:e?.boundaryFriction??0,panBoundary:e?.panBoundary}}var zh=require("react/jsx-runtime");function Uh({controlsRef:e,onCameraChange:t,cameraLimits:n,controllerType:i="orbit",onPointerLockExit:r}){let o=i==="orbit",a=(0,Uo.useRef)(null);return(0,Uo.useEffect)(()=>{if(!o)return a.current?.lock(),()=>{a.current?.unlock()}},[o]),(0,Uo.useEffect)(()=>{o&&document.pointerLockElement&&document.exitPointerLock()},[o]),(0,Uo.useEffect)(()=>{if(o)return;let s=()=>{document.pointerLockElement||r?.()};return document.addEventListener("pointerlockchange",s),()=>{document.removeEventListener("pointerlockchange",s)}},[o,r]),(0,Uo.useEffect)(()=>{if(!o||!t||!e||typeof e!="object"||!("current"in e))return;let s=e.current;if(!s)return;let l=()=>{t(s.camera,s)};return s.addEventListener("update",l),()=>{s.removeEventListener("update",l)}},[o,e,t]),(0,Uo.useEffect)(()=>{if(!o||!e||typeof e!="object"||!("current"in e))return;let s=e.current;if(!s)return;let l=px(n);s.minDistance=l.minDistance,s.maxDistance=l.maxDistance,s.minPolarAngle=l.minPolarAngle,s.maxPolarAngle=l.maxPolarAngle,s.minAzimuthAngle=l.minAzimuthAngle,s.maxAzimuthAngle=l.maxAzimuthAngle,s.boundaryEnclosesCamera=l.boundaryEnclosesCamera,s.boundaryFriction=l.boundaryFriction,s.setBoundary(l.panBoundary?new Yl.Box3(new Yl.Vector3(...l.panBoundary[0]),new Yl.Vector3(...l.panBoundary[1])):void 0)},[o,e,n?.minDistance,n?.maxDistance,n?.minPolarAngle,n?.maxPolarAngle,n?.minAzimuthAngle,n?.maxAzimuthAngle,n?.boundaryEnclosesCamera,n?.boundaryFriction,n?.panBoundary]),o?(0,zh.jsx)(eu.CameraControls,{ref:e,makeDefault:!0,smoothTime:.3,dollyToCursor:!0}):(0,zh.jsx)(eu.PointerLockControls,{ref:a,makeDefault:!0,selector:"[data-ri-pointer-lock-trigger]"})}var Ri=require("react"),Zl=require("@react-three/fiber"),mx=require("three");var Fh=Symbol("react-immersive.model-node-id");function SM(e,t){Object.defineProperty(e,Fh,{value:t,configurable:!0})}function Fo(e){let t=new Map;e.traverse(l=>{if(!l.name)return;let c=t.get(l.name);c?c.push(l):t.set(l.name,[l])});let n=Object.create(null),i=new WeakMap,r=new Map,o=new Set(Array.from(t,([l,c])=>c.length===1?l:null).filter(l=>l!==null)),a=new Set,s=(l,c)=>{SM(l,c),n[c]=l,i.set(l,c),a.add(c)};for(let[l,c]of t)c.length===1&&s(c[0],l);for(let[l,c]of t){if(c.length<2)continue;let p=[];c.forEach((u,d)=>{let m=`${l} [${d+1}]`,g=m,v=2;for(;o.has(g)||a.has(g);)g=`${m}.${v++}`;s(u,g),p.push(g)}),r.set(l,p)}return{nodesById:n,idByNode:i,duplicateNames:r}}function Kl(e){return e[Fh]??e.name??null}function Xi(e,t){let n=null,i=[];return e.traverse(r=>{r[Fh]===t&&(n=r),r.name===t&&i.push(r)}),n??(i.length===1?i[0]:null)}var ai=require("react/jsx-runtime");function fx(e,t){if(!t)return e;let n=t*Math.PI/180,i=Math.cos(n),r=Math.sin(n);return[e[0]*i+e[2]*r,e[1],-e[0]*r+e[2]*i]}function _M(e,t){let[n,i,r]=e.center,o=e.radius,a=Math.hypot(t[0],t[1],t[2]),s=a>1e-6?[t[0]/a,t[1]/a,t[2]/a]:[0,1,0],l=o*2;return{position:[n+s[0]*l,i+s[1]*l,r+s[2]*l],target:e.center,extent:o,near:Math.max(o/100,.001),far:l+o*2}}function MM(e,t){let n=t[0]-e.center[0],i=t[1]-e.center[1],r=t[2]-e.center[2],o=Math.hypot(n,i,r);return{near:Math.max(o-e.radius,o*.01,.001),far:o+e.radius*2}}function CM(e,t,n){return t&&n&&!e.attachedToCamera?n.center:[0,0,0]}var TM={ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},PM={enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3};function hx({light:e,shadows:t,shadowsEnabled:n,environmentRotation:i,modelBounds:r,objectBindings:o,nodeRefs:a}){let s=(0,Ri.useRef)(null),l=(0,Ri.useRef)(null),c=(0,Ri.useRef)(null),p=(0,Zl.useThree)(w=>w.camera),u=(0,Zl.useThree)(w=>w.scene),d=(0,Ri.useMemo)(()=>new mx.Vector3,[]),m=(0,Ri.useMemo)(()=>e.attachedToCamera||e.attachment?e.position:fx(e.position,i),[e.position,e.attachedToCamera,e.attachment,i]);(0,Zl.useFrame)(()=>{let w=s.current??l.current??c.current;if(!w)return;if(e.attachedToCamera){w.position.copy(p.position);return}let x=e.attachment;if(!x)return;let S=o?Oo(o,x.objectId):null,b=(S?o?.[S]:void 0)?.modelObjectId??x.objectId,_=(S?a?.current[S]:void 0)??Xi(u,b);_&&(d.fromArray(x.offset),_.localToWorld(d),w.position.copy(d))});let g=n&&t.enabled&&e.castShadow,v=(0,Ri.useMemo)(()=>e.type==="directional"&&g&&r&&!e.attachedToCamera?_M(r,m):null,[e.type,e.attachedToCamera,g,r,m]),M=(0,Ri.useMemo)(()=>e.type==="spot"&&g&&r&&!e.attachedToCamera?MM(r,m):null,[e.type,e.attachedToCamera,g,r,m]);return(0,Ri.useEffect)(()=>{let w=s.current??c.current;if(!w)return;let[x,S,k]=CM(e,g,r);w.target.position.set(x,S,k),w.target.updateMatrixWorld()},[e,g,r]),!e.visible||e.type==="none"?null:e.type==="directional"?(0,ai.jsx)("directionalLight",{ref:s,color:e.color,intensity:e.intensity,position:v?.position??m,castShadow:g,"shadow-mapSize-width":t.mapSize,"shadow-mapSize-height":t.mapSize,"shadow-bias":e.shadowBias,"shadow-normalBias":t.normalBias,"shadow-radius":t.radius,"shadow-camera-near":v?.near??.5,"shadow-camera-far":v?.far??40,"shadow-camera-left":-(v?.extent??8),"shadow-camera-right":v?.extent??8,"shadow-camera-top":v?.extent??8,"shadow-camera-bottom":-(v?.extent??8)}):e.type==="point"?(0,ai.jsx)("pointLight",{ref:l,color:e.color,intensity:e.intensity,position:m,distance:e.distance,decay:e.decay,castShadow:g,"shadow-mapSize-width":t.mapSize,"shadow-mapSize-height":t.mapSize,"shadow-bias":e.shadowBias}):e.type==="spot"?(0,ai.jsx)("spotLight",{ref:c,color:e.color,intensity:e.intensity,position:m,angle:e.angle??Math.PI/6,penumbra:e.penumbra??.2,distance:e.distance,decay:e.decay,castShadow:g,"shadow-mapSize-width":t.mapSize,"shadow-mapSize-height":t.mapSize,"shadow-bias":e.shadowBias,"shadow-normalBias":t.normalBias,"shadow-radius":t.radius,"shadow-camera-near":M?.near??.5,"shadow-camera-far":M?.far??40}):e.type==="hemisphere"?(0,ai.jsx)("hemisphereLight",{color:e.color,groundColor:"#444444",intensity:e.intensity}):null}function Vh({lightingConfig:e,shadowConfig:t,shadowsEnabled:n=!0,environmentRotation:i=0,environmentConfig:r,modelBounds:o,objectBindings:a,nodeRefs:s}){let l=e??TM,c=t??PM,p=r?.shadowLight,u=fx([5,10,5],i);return(0,ai.jsxs)(ai.Fragment,{children:[(0,ai.jsx)("ambientLight",{intensity:l.ambient.intensity,color:l.ambient.color}),l.lights.map(d=>(0,ai.jsx)(hx,{light:d,shadows:c,shadowsEnabled:n,environmentRotation:i,modelBounds:o,objectBindings:a,nodeRefs:s},d.id)),p?.enabled&&(0,ai.jsx)(hx,{light:{id:"light-env-shadow",type:"directional",color:"#ffffff",intensity:p.intensity,position:u,attachedToCamera:!1,castShadow:!0,shadowBias:p.bias,visible:!0},shadows:c,shadowsEnabled:n,environmentRotation:0,modelBounds:o,objectBindings:a,nodeRefs:s})]})}var me=require("react"),Da=require("@react-three/fiber");var Jl=require("@react-three/fiber"),Us=require("three"),Vo=require("three-stdlib"),Mx=require("three/examples/jsm/loaders/USDLoader.js");var AM=require("@react-three/drei"),EM=require("@react-three/fiber"),RM=require("react"),gx=require("three"),Is=require("three-stdlib");function kM(e){return{name:"RI_unlit_emissive_texture",async afterRoot(t){let n=e.json.materials??[],i=new Map;if(n.forEach(o=>{let a=!!o?.extensions?.KHR_materials_unlit,s=!!o?.pbrMetallicRoughness?.baseColorTexture;a&&!s&&o?.emissiveTexture&&o.name&&i.set(o.name,o.emissiveTexture.index)}),i.size===0||!t.scene)return;let r=new Map;await Promise.all([...i].map(async([o,a])=>{let s=await e.getDependency("texture",a);s&&(s.colorSpace=gx.SRGBColorSpace,r.set(o,s))})),t.scene.traverse(o=>{let a=Array.isArray(o.material)?o.material:o.material?[o.material]:[];for(let s of a){let l=s.name?r.get(s.name):void 0;l&&!s.map&&(s.map=l,s.needsUpdate=!0)}})}}}var jh="https://assets.react-immersive.liveroom.dev/three-r184/draco/",Hh="https://assets.react-immersive.liveroom.dev/three-r184/basis/";function bx(e,t={},n){let{dracoDecoderPath:i=jh,ktx2TranscoderPath:r=Hh,meshopt:o=!0}=t;if(i){let a=new Is.DRACOLoader;a.setDecoderPath(i),e.setDRACOLoader(a)}if(o&&e.setMeshoptDecoder(Is.MeshoptDecoder),r&&n){let a=new Is.KTX2Loader().setTranscoderPath(r).detectSupport(n);e.setKTX2Loader(a)}e.register((a=>kM(a)))}var vx="KHR_materials_variants",xx="riMaterialVariants";function ka(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function LM(e){if(!ka(e)||!ka(e.extensions))return[];let t=e.extensions[vx];if(!ka(t)||!Array.isArray(t.variants))return[];let n=new Set;return t.variants.map((i,r)=>{let o=ka(i)&&typeof i.name=="string"&&i.name?i.name:`Variant ${r+1}`,a=o;for(let s=2;n.has(a);s+=1)a=`${o} (${s})`;return n.add(a),a})}function yx(e){let t=e.userData?.gltfExtensions;if(!ka(t))return[];let n=t[vx];return!ka(n)||!Array.isArray(n.mappings)?[]:n.mappings.filter(i=>ka(i)&&Number.isInteger(i.material)&&Array.isArray(i.variants)&&i.variants.every(Number.isInteger))}function wx(e,t){if(t<0)return null;let n=e.find(i=>i.variants.includes(t));return n?n.material:null}function Sx(e){let t=e.parser,n=LM(t?.json);if(!(!t||n.length===0))return e.scene.userData[xx]=n,{names:n,resolveMaterial:async(i,r)=>{let o={geometry:r.geometry,material:await t.getDependency("material",i),isPoints:r.isPoints,isLine:r.isLine};return t.assignFinalMaterial(o),o.material}}}function zs(e){let t=e.userData?.[xx];return Array.isArray(t)&&t.every(n=>typeof n=="string")?t:[]}var tu=class extends Us.Loader{constructor(){super(...arguments);this.options={source:{format:"glb"}}}configure(n){return this.options=n,this}load(n,i,r,o){this.loadAsset(n,r).then(i).catch(o)}async loadAsset(n,i){let r=NM(this.options.source),{format:o}=this.options.source;if(o==="obj")return DM(n,r,this.options.source,i);if(o==="fbx"){let l=Gh(this,new Vo.FBXLoader(r)),c=IM(n,this.options.source);c&&l.setResourcePath(c);let p=await l.loadAsync(n,i);return Wh(p,"FBXMesh",!1),{scene:p,animations:p.animations??[]}}if(o==="usdz"){let c=await Gh(this,new Mx.USDLoader(r)).loadAsync(n,i);return Wh(c,"USDZMesh",!1),{scene:c,animations:c.animations??[]}}let a=Gh(this,new Vo.GLTFLoader(r));bx(a,this.options.decoderConfig,this.options.renderer);let s=await a.loadAsync(n,i);return{scene:s.scene,animations:s.animations??[],materialVariants:Sx(s)}}};bb(e=>{Jl.useLoader.clear(tu,e)});function Cx(e,t={},n,i){let r=(0,Jl.useThree)(s=>s.gl),o=Pb(e),a=n?{...o,format:n}:o;return(0,Jl.useLoader)(tu,e,s=>{s.configure({source:a,decoderConfig:t,renderer:r})},i)}async function DM(e,t,n,i){let r=await _x(e,t,i),o=new Vo.OBJLoader(t),a=BM(r);if(a){let l=OM(a,e,n);if(l)try{let c=await _x(l.url,t),u=new Vo.MTLLoader(t).parse(c,l.basePath);u.preload(),o.setMaterials(u)}catch(c){console.warn(`[react-immersive] Could not load OBJ material ${a}; rendering geometry with fallback materials.`,c)}}let s=o.parse(r);return Wh(s,"OBJMesh",!0),{scene:s,animations:[]}}function Wh(e,t,n){let i=new Set,r=0;e.traverse(o=>{if(!("isMesh"in o&&o.isMesh===!0)){o.name&&i.add(o.name);return}let s=o.name||`${t}_${++r}`;if(!n&&o.name){i.add(o.name);return}let l=s,c=2;for(;i.has(l);)l=`${s}_${c++}`;o.name=l,i.add(l)})}function _x(e,t,n){let i=new Us.FileLoader(t);return i.setResponseType("text"),i.loadAsync(e,n)}function Gh(e,t){return t.setCrossOrigin(e.crossOrigin),t.setWithCredentials(e.withCredentials),t.setRequestHeader(e.requestHeader),t}function NM(e){let t=new Us.LoadingManager,n=e.resourceUrls;return n&&t.setURLModifier(i=>{if(/^(?:blob:|data:)/i.test(i))return i;let r=ru(Px(i).split(/[?#]/)[0]),o=n[r];if(o)return o;let a=nu(e.entryPath??""),s=ru(a?`${a}/${r}`:r);return n[s]??i}),t}function BM(e){return/^\s*mtllib\s+(.+?)\s*$/im.exec(e)?.[1]?.trim()||null}function OM(e,t,n){if(n.resourceUrls&&n.entryPath){let i=ru(`${nu(n.entryPath)}/${Px(e)}`),r=n.resourceUrls[i];if(!r)return null;let o=nu(i);return{url:r,basePath:o?`${o}/`:""}}try{let i=new URL(e,t).href;return{url:i,basePath:Tx(i)}}catch{return null}}function IM(e,t){if(t.resourceUrls&&t.entryPath){let n=nu(t.entryPath);return n?`${n}/`:""}return Tx(e)}function Tx(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t+1)}function nu(e){let t=ru(e),n=t.lastIndexOf("/");return n===-1?"":t.slice(0,n)}function ru(e){let t=[];for(let n of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(i=>i&&i!=="."))n===".."?t.pop():t.push(n);return t.join("/")}function Px(e){try{return decodeURI(e)}catch{return e}}var ft=require("three"),Nx=require("three-stdlib");function Ax(e){let t=new Map;return e.map((n,i)=>{let o=n.name.trim()||`Animation ${i+1}`,a=t.get(o)??0;return t.set(o,a+1),{clip:n,sourceName:a===0?o:`${o} (${a+1})`,duration:n.duration}})}var mo=require("three");function Ex(e){let t=e._loopCount;return e.loop===mo.LoopPingPong&&(t&1)===1}function zM(e){return Ex(e)?e.getClip().duration-e.time:e.time}function Rx({root:e,clips:t,getClipConfig:n,onChange:i}){let r=new mo.AnimationMixer(e),o=new Map;for(let{clip:A,sourceName:C}of t)o.set(C,r.clipAction(A));let a=new Map,s=new Set,l=new Map,c=1,p=A=>typeof A=="string",u=A=>p(A)?a.has(A)?[A]:[]:[...a.keys()],d=(A,C)=>{let D=rv(n(C));D==="once"?A.setLoop(mo.LoopOnce,1):D==="ping-pong"?A.setLoop(mo.LoopPingPong,1/0):A.setLoop(mo.LoopRepeat,1/0),A.clampWhenFinished=D==="once"},m=A=>{A.action.setEffectiveTimeScale(A.reverse?-A.speed:A.speed)},g=A=>{let C=a.get(A);C&&(C.action.stop(),a.delete(A))},v=(A,C={})=>{let D=o.get(A);if(!D||n(A)?.hidden)return;let B=Number.isFinite(C.fade)&&C.fade>0?C.fade:0,j=C.reverse??!1;if(!C.alongside)for(let[O,$]of[...a])O!==A&&(B>0?(a.delete(O),$.action.fadeOut(B),s.add($.action)):g(O));s.delete(D)&&D.stop();let W=D.getClip().duration,U=a.get(A),te=()=>{D.reset(),j&&(D.time=W),D.play()};if(!U)te(),B>0&&D.fadeIn(B);else{let O=j?D.time<=0:D.time>=W;U.finished&&O&&te(),D.paused=!1,D.enabled=!0,a.delete(A)}d(D,A),U={action:D,speed:n(A)?.speed??l.get(A)??c,reverse:j,finished:!1},U.speed=Ad(U.speed),m(U),a.set(A,U),i()},M=A=>{for(let C of u(A))a.get(C).action.paused=!0;i()},w=A=>{for(let C of u(A))g(C);if(!p(A)){for(let C of s)C.stop();s.clear()}i()},x=(A,C)=>{let D=Ad(A);p(C)?l.set(C,D):c=D;for(let B of u(C)){let j=a.get(B);l.set(B,D),j.speed=D,m(j)}i()},S=(A,C)=>{for(let D of u(C)){let B=a.get(D),j=B.action.getClip().duration,W=Math.min(Math.max(A,0),j);B.action.time=Ex(B.action)?j-W:W,B.finished&&(B.finished=!1,B.action.paused=!0)}r.update(0),i()},k=()=>{for(let[A,C]of[...a]){let D=n(A);if(D?.hidden){g(A);continue}d(C.action,A),D?.speed!==void 0&&(C.speed=Ad(D.speed),m(C))}i()},b=A=>{for(let C of a.values())C.action===A.action&&(C.finished=!0);i()};return r.addEventListener("finished",b),{play:v,pause:M,stop:w,setSpeed:x,seek:S,getState:()=>{let A=[...a].map(([D,B])=>({clip:D,status:B.finished?"finished":B.action.paused?"paused":"playing",time:zM(B.action),duration:B.action.getClip().duration,speed:B.speed,reverse:B.reverse})),C=A[A.length-1];return{currentClip:C?.clip??null,isPlaying:A.some(D=>D.status==="playing"),speed:C?.speed??c,time:C?.time??0,duration:C?.duration??0,active:A}},applyClipConfigs:k,isRunning:()=>{if(s.size>0)return!0;for(let{action:A}of a.values())if(!A.paused&&A.enabled)return!0;return!1},update:A=>{r.update(A);for(let C of s)(!C.enabled||C.getEffectiveWeight()<=0)&&(C.stop(),s.delete(C))},dispose:()=>{r.removeEventListener("finished",b),r.stopAllAction(),r.uncacheRoot(e),a.clear(),s.clear()}}}var si=require("three");function iu(e){if(Yb(e))return e;if(!e||typeof e!="object")return null;let t=e,n=new si.MeshStandardMaterial;typeof t.name=="string"&&(n.name=t.name),n.metalness=0,n.roughness=1,t.type==="MeshBasicMaterial"||t.isMeshBasicMaterial===!0?(n.color.set(0),n.emissiveIntensity=1,t.map instanceof si.Texture?(n.emissiveMap=t.map,n.emissive.set(16777215)):t.color instanceof si.Color&&n.emissive.copy(t.color)):(t.color instanceof si.Color&&n.color.copy(t.color),t.map instanceof si.Texture&&(n.map=t.map),t.emissive instanceof si.Color&&n.emissive.copy(t.emissive),t.emissiveMap instanceof si.Texture&&(n.emissiveMap=t.emissiveMap));let r=["aoMap","aoMapIntensity","lightMap","lightMapIntensity","alphaMap","opacity","transparent","alphaTest","side","vertexColors","wireframe","depthTest","depthWrite","visible","toneMapped","fog"];for(let o of r)t[o]!==void 0&&(n[o]=t[o]);return n.needsUpdate=!0,n}function ou(e){if(Kb(e))return e.clone();let t=new si.MeshPhysicalMaterial;return t.name=e.name,t.color.copy(e.color),t.map=e.map,t.lightMap=e.lightMap,t.lightMapIntensity=e.lightMapIntensity,t.aoMap=e.aoMap,t.aoMapIntensity=e.aoMapIntensity,t.emissive.copy(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.emissiveMap=e.emissiveMap,t.bumpMap=e.bumpMap,t.bumpScale=e.bumpScale,t.normalMap=e.normalMap,t.normalMapType=e.normalMapType,t.normalScale.copy(co(e.normalScale)),t.displacementMap=e.displacementMap,t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias,t.roughness=e.roughness,t.roughnessMap=e.roughnessMap,t.metalness=e.metalness,t.metalnessMap=e.metalnessMap,t.alphaMap=e.alphaMap,t.envMap=e.envMap,t.envMapRotation.copy(e.envMapRotation),t.envMapIntensity=e.envMapIntensity,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.flatShading=e.flatShading,t.fog=e.fog,t.opacity=e.opacity,t.transparent=e.transparent,t.alphaHash=e.alphaHash,t.blendSrc=e.blendSrc,t.blendDst=e.blendDst,t.blendEquation=e.blendEquation,t.blendSrcAlpha=e.blendSrcAlpha,t.blendDstAlpha=e.blendDstAlpha,t.blendEquationAlpha=e.blendEquationAlpha,t.blending=e.blending,t.premultipliedAlpha=e.premultipliedAlpha,t.dithering=e.dithering,t.alphaTest=e.alphaTest,t.depthTest=e.depthTest,t.depthWrite=e.depthWrite,t.colorWrite=e.colorWrite,t.stencilWrite=e.stencilWrite,t.stencilWriteMask=e.stencilWriteMask,t.stencilFunc=e.stencilFunc,t.stencilRef=e.stencilRef,t.stencilFuncMask=e.stencilFuncMask,t.stencilFail=e.stencilFail,t.stencilZFail=e.stencilZFail,t.stencilZPass=e.stencilZPass,t.side=e.side,t.shadowSide=e.shadowSide,t.toneMapped=e.toneMapped,t.vertexColors=e.vertexColors,t.visible=e.visible,t.clippingPlanes=e.clippingPlanes,t.clipIntersection=e.clipIntersection,t.clipShadows=e.clipShadows,t.forceSinglePass=e.forceSinglePass,t.polygonOffset=e.polygonOffset,t.polygonOffsetFactor=e.polygonOffsetFactor,t.polygonOffsetUnits=e.polygonOffsetUnits,t}function au(e){e.userData.baseColor=e.color.clone(),e.userData.baseMap=e.map??null,e.userData.baseMetalness=e.metalness,e.userData.baseMetalnessMap=e.metalnessMap??null,e.userData.baseRoughness=e.roughness,e.userData.baseRoughnessMap=e.roughnessMap??null,e.userData.baseEmissive=e.emissive.clone(),e.userData.baseEmissiveIntensity=e.emissiveIntensity,e.userData.baseEmissiveMap=e.emissiveMap??null,e.userData.baseOpacity=e.opacity,e.userData.baseTransparent=e.transparent,e.userData.baseAlphaMap=e.alphaMap??null,e.userData.baseAlphaTest=e.alphaTest,e.userData.baseAlphaHash=e.alphaHash,e.userData.baseDithering=e.dithering,e.userData.baseBlending=e.blending,e.userData.baseDepthWrite=e.depthWrite,e.userData.baseSide=e.side,e.userData.baseNormalMap=e.normalMap??null,e.userData.baseNormalScale=co(e.normalScale),e.userData.baseBumpMap=e.bumpMap??null,e.userData.baseBumpScale=e.bumpScale,e.userData.baseAoMap=e.aoMap??null,e.userData.baseAoMapIntensity=e.aoMapIntensity,e.userData.baseDisplacementMap=e.displacementMap??null,e.userData.baseDisplacementScale=e.displacementScale,e.userData.baseDisplacementBias=e.displacementBias,e.userData.baseClearcoat=e.clearcoat,e.userData.baseClearcoatMap=e.clearcoatMap??null,e.userData.baseClearcoatRoughness=e.clearcoatRoughness,e.userData.baseClearcoatRoughnessMap=e.clearcoatRoughnessMap??null,e.userData.baseClearcoatNormalMap=e.clearcoatNormalMap??null,e.userData.baseClearcoatNormalScale=co(e.clearcoatNormalScale),e.userData.baseSheen=e.sheen,e.userData.baseSheenColor=e.sheenColor.clone(),e.userData.baseSheenColorMap=e.sheenColorMap??null,e.userData.baseSheenRoughness=e.sheenRoughness,e.userData.baseSheenRoughnessMap=e.sheenRoughnessMap??null,e.userData.baseAnisotropy=e.anisotropy,e.userData.baseAnisotropyRotation=e.anisotropyRotation,e.userData.baseAnisotropyMap=e.anisotropyMap??null,e.userData.baseTransmission=e.transmission,e.userData.baseTransmissionMap=e.transmissionMap??null,e.userData.baseThickness=e.thickness,e.userData.baseThicknessMap=e.thicknessMap??null,e.userData.baseAttenuationColor=e.attenuationColor.clone(),e.userData.baseAttenuationDistance=e.attenuationDistance,e.userData.baseReflectivity=e.reflectivity,e.userData.baseSpecularIntensity=e.specularIntensity,e.userData.baseSpecularIntensityMap=e.specularIntensityMap??null,e.userData.baseSpecularColor=e.specularColor.clone(),e.userData.baseSpecularColorMap=e.specularColorMap??null,e.userData.baseFlatShading=e.flatShading,e.userData.baseEnvMapIntensity=e.envMapIntensity}var qi=require("three");function kx(e,t,n,i){let r=Mi(t),o=Gl(n,r),a=Zb(i,t),s=Jb(i,t),l=Qb(i,t);return a||s||l?Ld(e.userData,t,o,n,a??[0,0],s??1,l??0):(Dd(e.userData,t),o)}function Fn(e,t,n,i){if(!n){Dd(e.userData,t);return}let r=Pd[t];e[r]=kx(e,t,n,i)}function su(e,t,n){e.map=e.userData.baseMap??null,e.color.copy(e.userData.baseColor),e.metalness=e.userData.baseMetalness??e.metalness,e.metalnessMap=e.userData.baseMetalnessMap??null,e.roughness=e.userData.baseRoughness??e.roughness,e.roughnessMap=e.userData.baseRoughnessMap??null,e.emissive.copy(e.userData.baseEmissive??new qi.Color(0,0,0)),e.emissiveIntensity=e.userData.baseEmissiveIntensity??e.emissiveIntensity,e.emissiveMap=e.userData.baseEmissiveMap??null,e.opacity=e.userData.baseOpacity??1,e.transparent=e.userData.baseTransparent??!1,e.alphaMap=e.userData.baseAlphaMap??null,e.alphaTest=e.userData.baseAlphaTest??0,e.alphaHash=e.userData.baseAlphaHash??!1,e.dithering=e.userData.baseDithering??!1,e.blending=e.userData.baseBlending??qi.NormalBlending,e.depthWrite=e.userData.baseDepthWrite??!0,e.side=e.userData.baseSide??qi.FrontSide,e.normalMap=e.userData.baseNormalMap??null,e.normalScale.copy(co(e.userData.baseNormalScale)),e.bumpMap=e.userData.baseBumpMap??null,e.bumpScale=e.userData.baseBumpScale??e.bumpScale,e.aoMap=e.userData.baseAoMap??null,e.aoMapIntensity=e.userData.baseAoMapIntensity??e.aoMapIntensity,e.displacementMap=e.userData.baseDisplacementMap??null,e.displacementScale=e.userData.baseDisplacementScale??e.displacementScale,e.displacementBias=e.userData.baseDisplacementBias??e.displacementBias,e.clearcoat=e.userData.baseClearcoat??e.clearcoat,e.clearcoatMap=e.userData.baseClearcoatMap??null,e.clearcoatRoughness=e.userData.baseClearcoatRoughness??e.clearcoatRoughness,e.clearcoatRoughnessMap=e.userData.baseClearcoatRoughnessMap??null,e.clearcoatNormalMap=e.userData.baseClearcoatNormalMap??null,e.clearcoatNormalScale.copy(co(e.userData.baseClearcoatNormalScale)),e.sheen=e.userData.baseSheen??e.sheen,e.sheenColor.copy(e.userData.baseSheenColor??new qi.Color(0,0,0)),e.sheenColorMap=e.userData.baseSheenColorMap??null,e.sheenRoughness=e.userData.baseSheenRoughness??e.sheenRoughness,e.sheenRoughnessMap=e.userData.baseSheenRoughnessMap??null,e.anisotropy=e.userData.baseAnisotropy??e.anisotropy,e.anisotropyRotation=e.userData.baseAnisotropyRotation??e.anisotropyRotation,e.anisotropyMap=e.userData.baseAnisotropyMap??null,e.transmission=e.userData.baseTransmission??e.transmission,e.transmissionMap=e.userData.baseTransmissionMap??null,e.thickness=e.userData.baseThickness??e.thickness,e.thicknessMap=e.userData.baseThicknessMap??null,e.attenuationColor.copy(e.userData.baseAttenuationColor??new qi.Color("#ffffff")),e.attenuationDistance=e.userData.baseAttenuationDistance??e.attenuationDistance,e.reflectivity=e.userData.baseReflectivity??e.reflectivity,e.specularIntensity=e.userData.baseSpecularIntensity??e.specularIntensity,e.specularIntensityMap=e.userData.baseSpecularIntensityMap??null,e.specularColor.copy(e.userData.baseSpecularColor??new qi.Color("#ffffff")),e.specularColorMap=e.userData.baseSpecularColorMap??null,e.flatShading=e.userData.baseFlatShading??e.flatShading,e.envMapIntensity=e.userData.baseEnvMapIntensity??e.envMapIntensity;let i=rn(t,"texture"),r=rn(t,"metalnessMap"),o=rn(t,"roughnessMap"),a=rn(t,"emissiveMap"),s=rn(t,"alphaMap"),l=rn(t,"normalMap"),c=rn(t,"bumpMap"),p=rn(t,"aoMap"),u=rn(t,"displacementMap"),d=rn(t,"clearcoatMap"),m=rn(t,"clearcoatRoughnessMap"),g=rn(t,"clearcoatNormalMap"),v=rn(t,"anisotropyMap"),M=rn(t,"transmissionMap"),w=rn(t,"thicknessMap"),x=rn(t,"sheenColorMap"),S=rn(t,"sheenRoughnessMap"),k=rn(t,"specularIntensityMap"),b=rn(t,"specularColorMap");if(i?(e.map=kx(e,"texture",i,t),e.color.set(n??"#ffffff")):(Dd(e.userData,"texture"),n&&(e.map=null,e.color.set(n))),Fn(e,"metalnessMap",r,t),t?.metalness!==void 0&&(e.metalness=t.metalness),Fn(e,"roughnessMap",o,t),t?.roughness!==void 0&&(e.roughness=t.roughness),t?.emissive?e.emissive.set(t.emissive):a&&e.emissive.set("#ffffff"),t?.emissiveIntensity!==void 0&&(e.emissiveIntensity=t.emissiveIntensity),Fn(e,"emissiveMap",a,t),t?.opacity!==void 0&&(e.opacity=t.opacity),Fn(e,"alphaMap",s,t),t?.alphaTest!==void 0&&(e.alphaTest=t.alphaTest),t?.alphaHash!==void 0&&(e.alphaHash=t.alphaHash),t?.dithering!==void 0&&(e.dithering=t.dithering),t?.blendingMode&&(e.blending=tv(t.blendingMode),e.depthWrite=t.blendingMode!=="additive"),t?.side&&(e.side=ev(t.side)),Fn(e,"normalMap",l,t),l||t?.normalScale!==void 0){let _=t?.normalScale??Math.abs(co(e.userData.baseNormalScale).x);e.normalScale.set(_,t?.flipNormalY?-_:_)}if(Fn(e,"bumpMap",c,t),t?.bumpScale!==void 0&&(e.bumpScale=t.bumpScale),Fn(e,"aoMap",p,t),t?.aoMapIntensity!==void 0&&(e.aoMapIntensity=t.aoMapIntensity),Fn(e,"displacementMap",u,t),t?.displacementScale!==void 0&&(e.displacementScale=t.displacementScale),t?.displacementBias!==void 0&&(e.displacementBias=t.displacementBias),Fn(e,"clearcoatMap",d,t),t?.clearcoat!==void 0&&(e.clearcoat=t.clearcoat),Fn(e,"clearcoatRoughnessMap",m,t),t?.clearcoatRoughness!==void 0&&(e.clearcoatRoughness=t.clearcoatRoughness),Fn(e,"clearcoatNormalMap",g,t),g||t?.clearcoatNormalScale!==void 0){let _=t?.clearcoatNormalScale??Math.abs(co(e.userData.baseClearcoatNormalScale).x);e.clearcoatNormalScale.set(_,t?.flipClearcoatNormalY?-_:_)}t?.sheen!==void 0&&(e.sheen=t.sheen),t?.sheenColor&&e.sheenColor.set(t.sheenColor),Fn(e,"sheenColorMap",x,t),t?.sheenRoughness!==void 0&&(e.sheenRoughness=t.sheenRoughness),Fn(e,"sheenRoughnessMap",S,t),t?.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t?.anisotropyRotation!==void 0&&(e.anisotropyRotation=t.anisotropyRotation),Fn(e,"anisotropyMap",v,t),t?.transmission!==void 0&&(e.transmission=t.transmission),Fn(e,"transmissionMap",M,t),t?.thickness!==void 0&&(e.thickness=t.thickness),Fn(e,"thicknessMap",w,t),t?.attenuationColor&&e.attenuationColor.set(t.attenuationColor),t?.attenuationDistance!==void 0&&(e.attenuationDistance=t.attenuationDistance),t?.reflectivity!==void 0&&(e.reflectivity=t.reflectivity),t?.specularIntensity!==void 0&&(e.specularIntensity=t.specularIntensity),Fn(e,"specularIntensityMap",k,t),t?.specularColor&&e.specularColor.set(t.specularColor),Fn(e,"specularColorMap",b,t),e.transparent=e.opacity<1||e.transmission>0||e.blending!==qi.NormalBlending||!!((s||e.alphaMap)&&e.alphaTest<=0),e.transparent||(e.depthWrite=!0)}function Ql(e){return e.material}function $i(e,t){return Array.isArray(e)?e.map(t):t(e,0)}function vr(e,t){Array.isArray(e)?e.forEach(t):t(e,0)}function lu(e,t){return Array.isArray(e)?e[t]:e}function Xh(e){e.updateMatrixWorld(!0),e.traverse(t=>{let n=t;n.isSkinnedMesh&&(n.skeleton?.update(),n.computeBoundingBox?.(),n.computeBoundingSphere?.())})}var La=require("react"),Lx=require("@react-three/fiber");function Dx(){let e=(0,Lx.useThree)(r=>r.gl.domElement),t=(0,La.useRef)(void 0),n=(0,La.useCallback)(r=>{t.current===void 0&&(t.current=e.style.cursor),e.style.cursor=r},[e]),i=(0,La.useCallback)(()=>{let r=t.current;r!==void 0&&(e.style.cursor=r,t.current=void 0)},[e]);return(0,La.useEffect)(()=>()=>{i()},[i]),{setCanvasCursor:n,restoreCanvasCursor:i}}var qh=require("react/jsx-runtime");function cu(e,t,n){let i=n.get(e);i&&(t?.position?e.position.fromArray(t.position):e.position.copy(i.position),t?.rotation?e.rotation.set(t.rotation[0],t.rotation[1],t.rotation[2],i.rotation.order):e.rotation.copy(i.rotation),t?.scale?e.scale.fromArray(t.scale):e.scale.copy(i.scale),e.updateMatrix())}function Sn(e,t=!1){if(!e||typeof e!="object")return"-";let n=e;return[n.channel??0,t?n.format??"":"",n.isVideoTexture?n.colorSpace??"":""].join(":")}function Fs(e){let t=e,n=Number(t.clearcoat)>0,i=Number(t.sheen)>0,r=Number(t.anisotropy)>0,o=Number(t.transmission)>0,a=t.transparent===!1&&t.blending===ft.NormalBlending&&t.alphaToCoverage!==!0;return[Sn(t.map),Sn(t.aoMap),Sn(t.lightMap),Sn(t.bumpMap),Sn(t.normalMap,!0),t.normalMap?t.normalMapType:"",Sn(t.displacementMap),Sn(t.emissiveMap),Sn(t.metalnessMap),Sn(t.roughnessMap),r,Sn(r?t.anisotropyMap:null),n,Sn(n?t.clearcoatMap:null),Sn(n?t.clearcoatNormalMap:null,!0),Sn(n?t.clearcoatRoughnessMap:null),i,Sn(i?t.sheenColorMap:null),Sn(i?t.sheenRoughnessMap:null),Sn(t.specularColorMap),Sn(t.specularIntensityMap),o,Sn(o?t.transmissionMap:null),Sn(o?t.thicknessMap:null),Sn(t.alphaMap),Number(t.alphaTest)>0,!!t.alphaHash,!!t.flatShading,!!t.dithering,t.side,a].join("|")}var UM={};function $h({url:e,objectBindings:t,selectedItem:n,itemMaterials:i,onItemClick:r,onItemHover:o,onItemDoubleClick:a,onItemContextMenu:s,onModelLoaded:l,onAnimationsReady:c,nodeRefsOut:p,onNodeRefsChange:u,materialRefsOut:d,panelHoveredItem:m,sceneConfig:g,zoomOnSelected:v=!0,highlightOnHover:M=!0,decoderConfig:w,modelFormat:x,onLoadProgress:S,explodeFactor:k=0,suspendBindingTransforms:b=!1,pulses:_=UM}){let y=Cx(e,w,x,S),h=(0,Da.useThree)(F=>F.invalidate),[P,A]=(0,me.useState)(null),C=(0,me.useRef)(null),{setCanvasCursor:D,restoreCanvasCursor:B}=Dx();(0,me.useEffect)(()=>{M||(A(null),o?.(null),B())},[M,o,B]);let j=(0,me.useMemo)(()=>Nx.SkeletonUtils.clone(y.scene),[y.scene]),W=(0,me.useMemo)(()=>Fo(j),[j]),U=W.nodesById,te=(0,me.useMemo)(()=>{let F=new WeakMap;return j.traverse(H=>{Wn(H)&&F.set(H,H.material)}),F},[j]),O=y.materialVariants,$=g?.model.materialVariant??null,le=$&&O?O.names.indexOf($):-1,[tt,xe]=(0,me.useState)(null);(0,me.useEffect)(()=>{if($&&le<0&&console.warn(`[react-immersive] The model has no material variant "${$}".`+(O?` Its variants are: ${O.names.join(", ")}.`:" It has no material variants.")),!O||le<0){xe(null);return}let F=!1,H=[];return j.traverse(q=>{if(!Wn(q)||!te.has(q))return;let ie=wx(yx(q),le);ie!==null&&H.push(O.resolveMaterial(ie,q).then(ae=>[q,ae]))}),Promise.all(H).then(q=>{F||xe({scene:j,materials:new Map(q)})}).catch(q=>{F||console.warn(`[react-immersive] Material variant "${$}" failed to load.`,q)}),()=>{F=!0}},[j,te,O,le,$]);let nt=tt?.scene===j?tt.materials:void 0,ce=F=>nt?.get(F)??te.get(F)??Ql(F);(0,me.useEffect)(()=>{W.duplicateNames.size!==0&&console.warn("[react-immersive] Duplicate model node names were assigned unique binding IDs.",Object.fromEntries(W.duplicateNames))},[W]);let Le=(0,me.useMemo)(()=>{let F=new WeakMap;return j.traverse(H=>{F.set(H,{position:H.position.clone(),rotation:H.rotation.clone(),scale:H.scale.clone()})}),F},[j]);(0,me.useEffect)(()=>{let F=!1,H=null,q=null,ie=window,ae=Object.entries(U).filter(([,qt])=>Wn(qt)),we=new ft.Box3,Pe=[],at=0;j.traverse(qt=>{!Wn(qt)||qt.userData[Ca]||(qt.castShadow=!1,qt.receiveShadow=!0)});let De=()=>{if(F)return;let qt=new Set,Me=we.getSize(new ft.Vector3),Ve=new ft.Vector3;for(let{name:hn,box:On}of Pe)On.getSize(Ve),Ve.x>Me.x*.7&&Ve.z>Me.z*.7&&Ve.y>Me.y*.4&&qt.add(hn);j.traverse(hn=>{if(!Wn(hn)||hn.userData[Ca])return;let On=Kl(hn);hn.castShadow=!On||!qt.has(On),hn.receiveShadow=!0}),h()},Rt=()=>{F||(ie.requestIdleCallback?H=ie.requestIdleCallback(vt,{timeout:100}):q=window.setTimeout(()=>vt(),0))},vt=qt=>{if(H=null,q=null,F)return;let Me=performance.now(),Ve=0;for(;at<ae.length&&!(Ve>0&&!(qt?qt.didTimeout?Ve<16:qt.timeRemaining()>1:performance.now()-Me<8));){let[hn,On]=ae[at];at+=1,Ve+=1;let hr=new ft.Box3().setFromObject(On);hr.isEmpty()||(Pe.push({name:hn,box:hr}),we.union(hr))}at<ae.length?Rt():De()};return Rt(),()=>{F=!0,H!==null&&ie.cancelIdleCallback?.(H),q!==null&&window.clearTimeout(q)}},[h,U,j]),(0,me.useEffect)(()=>{Xh(j)},[j]),(0,me.useEffect)(()=>{let F=new AbortController;return bd(j,F.signal),()=>{F.abort(),Nl(j)}},[j]);let he=(0,me.useMemo)(()=>{let F={};for(let[H,q]of Object.entries(t))F[q.modelObjectId??H]=H;return F},[t]),pt=(0,me.useMemo)(()=>Object.entries(t).map(([F,H])=>`${F}${H.modelObjectId??F}`).sort().join(""),[t]),Bt=(0,me.useMemo)(()=>Object.entries(t).map(([F,H])=>JSON.stringify([F,H.modelObjectId??F,H.transform??null])).sort().join(""),[t]),un=(0,me.useRef)(new Map);(0,me.useEffect)(()=>{let F=new Map,H=new Map;for(let[ae,we]of Object.entries(t)){if(!we.transform)continue;let Pe=U[we.modelObjectId??ae];Pe&&(F.set(Pe,we.transform),H.set(Pe,Rs(Pe)))}let q=new Set([...un.current.keys(),...F.keys()]);for(let ae of q){cu(ae,void 0,Le);for(let we of Rs(ae))ks(we)}j.updateMatrixWorld(!0);let ie=new Map;for(let ae of H.values())for(let we of ae)ie.has(we)||ie.set(we,we.matrixWorld.clone());for(let[ae,we]of F)cu(ae,we,Le);un.current=F,j.updateMatrixWorld(!0);for(let[ae,we]of ie)Ed(ae,we);h()},[j,U,Le,Bt,h]),(0,me.useEffect)(()=>()=>{for(let F of Rs(j))ks(F)},[j]);let Ie=(0,me.useMemo)(()=>{let F={};for(let[H,q]of Object.entries(t)){let ie=q.modelObjectId??H,ae=U[ie];if(!Wn(ae))continue;let we=ce(ae);we&&(F[H]=$i(we,Pe=>{let at=iu(Pe),De=ou(at??new ft.MeshStandardMaterial);return au(De),De}))}return F},[U,pt,te,nt]);(0,me.useEffect)(()=>{d&&(d.current=Ie)},[Ie,d]),(0,me.useEffect)(()=>()=>{for(let F of Object.values(Ie))vr(F,H=>{uv(H.userData),H.dispose()})},[Ie]);let bt=g?.model.shading??"lit",Ot=g?.model.renderer??"pbr",dr=g?.wireframe.enabled??!1,de=g?.wireframe.color??"#93c5fd",Cr=g?.wireframe.opacity??1,Xt=(0,me.useMemo)(()=>{let F={};if(bt!=="unlit")return F;for(let[H,q]of Object.entries(Ie))F[H]=$i(q,ie=>{let ae=new ft.MeshBasicMaterial;return ae.color.copy(ie.color),ae.map=ie.map,ae.alphaMap=ie.alphaMap,ae.alphaTest=ie.alphaTest,ae.transparent=ie.transparent,ae.opacity=ie.opacity,ae.side=ie.side,ae});return F},[Ie,bt]),Et=(0,me.useMemo)(()=>{let F={};if(bt!=="normals")return F;for(let[H,q]of Object.entries(Ie))F[H]=$i(q,()=>new ft.MeshNormalMaterial);return F},[Ie,bt]),rt=(0,me.useMemo)(()=>{let F={};if(bt!=="lit"||Ot!=="matcap")return F;let H=Nd();for(let[q,ie]of Object.entries(Ie))F[q]=$i(ie,ae=>{let we=new ft.MeshMatcapMaterial;return we.matcap=H,we.color.copy(ae.color),we.alphaMap=ae.alphaMap,we.alphaTest=ae.alphaTest,we.side=ae.side,we});return F},[Ie,bt,Ot]);(0,me.useEffect)(()=>()=>{for(let F of Object.values(Xt))vr(F,H=>H.dispose());for(let F of Object.values(Et))vr(F,H=>H.dispose());for(let F of Object.values(rt))vr(F,H=>H.dispose())},[Xt,Et,rt]);let bn=F=>bt==="normals"?Et[F]:bt==="unlit"?Xt[F]:Ot==="matcap"?rt[F]:Ie[F],Tr=(0,me.useRef)(l);Tr.current=l,(0,me.useEffect)(()=>{Tr.current?.(j)},[j]);let Tn=(0,me.useMemo)(()=>{let F={};for(let[H,q]of Object.entries(t)){let ie=q.modelObjectId??H,ae=U[ie];ae&&(F[H]=ae)}return F},[U,pt]);(0,me.useEffect)(()=>(p.current=Tn,u?.(),()=>{p.current===Tn&&(p.current={})}),[Tn,p,u]);let Kt=(0,me.useRef)({});(0,me.useEffect)(()=>()=>{for(let F of Object.values(Kt.current))for(let[H,q]of Object.entries(F))q&&po(q,Mi(H));Kt.current={}},[]);let fe=(0,me.useMemo)(()=>{let F=new Map;for(let[H,q]of Object.entries(t)){let ie=m===q||m?.id===q.id||m?.modelObjectId===q.modelObjectId,ae=M&&(P===H||ie),we=ae||n===H;(ae||we)&&F.set(H,{emissive:ae,matcap:we})}return F},[t,M,P,n,m]),We=(0,me.useRef)(fe);We.current=fe,(0,me.useEffect)(()=>{let F=new Set;for(let[H,q]of Object.entries(t)){F.add(H);let ie=q.modelObjectId??H,ae=U[ie];if(!Wn(ae))continue;ae.visible=q.visible!==!1;let we=Ie[H];if(!we)continue;if(Ot!=="uv-checker"){let Me=bn(H);Me&&(ae.material=Me)}if(q.visible===!1)continue;let Pe=Xt[H],at=rt[H],De=i[H]??i[q.modelObjectId??H],Rt=q.style?.material,vt=Kt.current[H]??{};for(let Me of Wi){let Ve=rn(Rt,Me),hn=vt[Me];if(hn===Ve)continue;let On=Mi(Me);hn&&po(hn,On),Ve?(Ns(Ve,On,h),vt[Me]=Ve):delete vt[Me]}Object.keys(vt).length>0?Kt.current[H]=vt:delete Kt.current[H];let qt=De?.hex??Rt?.baseColor;vr(we,(Me,Ve)=>{let hn=Fs(Me);su(Me,Rt,qt);let On=Me.userData.reactImmersiveConfiguredEmissive;On?.isColor?On.copy(Me.emissive):Me.userData.reactImmersiveConfiguredEmissive=Me.emissive.clone();let hr=We.current.get(H);hr?.emissive&&Me.emissive.add(_a),hn!==Fs(Me)&&(Me.needsUpdate=!0);let $n=lu(Pe,Ve);if($n){let mi=Fs($n);$n.color.copy(Me.color),$n.map=Me.map,$n.alphaMap=Me.alphaMap,$n.alphaTest=Me.alphaTest,$n.transparent=Me.transparent,$n.opacity=Me.opacity,$n.side=Me.side,mi!==Fs($n)&&($n.needsUpdate=!0)}let Pn=lu(at,Ve);if(Pn){let mi=Fs(Pn);hr?.matcap?Pn.color.set(uo.color):Pn.color.copy(Me.color),Pn.map=Me.map,Pn.alphaMap=Me.alphaMap,Pn.alphaTest=Me.alphaTest,Pn.transparent=Me.transparent,Pn.opacity=Me.opacity,Pn.side=Me.side,mi!==Fs(Pn)&&(Pn.needsUpdate=!0)}})}for(let H of Object.keys(Kt.current))if(!F.has(H)){for(let[q,ie]of Object.entries(Kt.current[H]))ie&&po(ie,Mi(q));delete Kt.current[H]}h()},[t,U,Ie,Xt,Et,rt,i,bt,Ot,h]);let xn=(0,me.useRef)(new Map);(0,me.useEffect)(()=>{let F=xn.current,H=new Set([...F.keys(),...fe.keys()]),q=!1;for(let ie of H){let ae=F.get(ie),we=fe.get(ie),Pe=!!ae?.emissive!=!!we?.emissive,at=!!ae?.matcap!=!!we?.matcap;if(!Pe&&!at)continue;q=!0;let De=Ie[ie],Rt=rt[ie];De&&vr(De,(vt,qt)=>{let Me=vt.userData.reactImmersiveConfiguredEmissive;Pe&&Me?.isColor&&(vt.emissive.copy(Me),we?.emissive&&vt.emissive.add(_a));let Ve=lu(Rt,qt);at&&Ve&&(we?.matcap?Ve.color.set(uo.color):Ve.color.copy(vt.color))})}xn.current=fe,q&&h()},[fe,Ie,rt,h]),mv({objectBindings:t,nodeMap:U,invalidate:h});let It=(0,me.useMemo)(()=>Object.entries(_).map(([F,H])=>({key:F,color:new ft.Color(H.color),speed:H.speed})),[_]),zt=(0,me.useRef)(new Set);(0,me.useEffect)(()=>{let F=new Set(It.map(({key:H})=>H));for(let H of zt.current){if(F.has(H)||!Ie[H])continue;let q=We.current.get(H)?.emissive;vr(Ie[H],ie=>{let ae=ie.userData.reactImmersiveConfiguredEmissive;ae?.isColor&&(ie.emissive.copy(ae),q&&ie.emissive.add(_a))})}zt.current=F,h()},[It,Ie,h]),(0,Da.useFrame)(({clock:F})=>{if(It.length===0)return;let H=F.getElapsedTime();for(let{key:q,color:ie,speed:ae}of It){let we=Ie[q];if(!we)continue;let Pe=(1-Math.cos(2*Math.PI*ae*H))/2,at=We.current.get(q)?.emissive;vr(we,De=>{let Rt=De.userData.reactImmersiveConfiguredEmissive;Rt?.isColor&&(De.emissive.copy(Rt).lerp(ie,Pe),at&&De.emissive.add(_a))})}h()}),(0,me.useEffect)(()=>{if(Ot==="uv-checker")return;let F=new Set(Object.values(Tn)),H=!1;j.traverse(q=>{if(!Wn(q)||F.has(q)||!te.has(q))return;let ie=nt?.get(q)??te.get(q);q.material!==ie&&(q.material=ie,H=!0)}),H&&h()},[j,Tn,te,nt,Ot,h]),(0,me.useEffect)(()=>{if(Ot!=="uv-checker")return;let F=pv(),H=[];return j.traverse(q=>{if(!Wn(q)||q.userData[Ca])return;let ie=q.material,ae=Array.isArray(ie)?ie:[ie],we=!!q.geometry.getAttribute("uv"),Pe=ae.map((De,Rt)=>{let vt=new ft.MeshBasicMaterial({color:we?"#ffffff":"#ff00ff",map:we?F:null,side:De.side});return vt.name=`${q.name||"mesh"}-uv-checker-${Rt}`,vt.toneMapped=!1,vt}),at=Array.isArray(ie)?Pe:Pe[0];q.material=at,H.push({node:q,original:ie,diagnostic:at})}),h(),()=>{for(let{node:q,original:ie,diagnostic:ae}of H){q.material=ie;let we=Array.isArray(ae)?ae:[ae];for(let Pe of we)Pe.dispose()}h()}},[j,Ot,h]),(0,me.useEffect)(()=>{if(!dr)return;let F=[];for(let[H,q]of Object.entries(t)){let ie=q.modelObjectId??H,ae=U[ie];if(!Wn(ae))continue;let we=new ft.MeshBasicMaterial({color:de,wireframe:!0,transparent:!0,opacity:Cr,depthTest:!1,depthWrite:!1,side:ft.DoubleSide,toneMapped:!1}),Pe=ae.clone(!1);Pe.name="",Pe.position.set(0,0,0),Pe.quaternion.identity(),Pe.scale.set(1,1,1),Pe.matrix.identity(),Pe.matrixAutoUpdate=!0,Pe.material=we,Pe.castShadow=!1,Pe.receiveShadow=!1,Pe.frustumCulled=!1,Pe.renderOrder=1,Pe.userData={isWireframeOverlay:!0},Pe.raycast=()=>{},ae.morphTargetInfluences&&(Pe.morphTargetInfluences=ae.morphTargetInfluences),ae.add(Pe),F.push({node:ae,overlay:Pe})}return h(),()=>{for(let{node:H,overlay:q}of F)H.remove(q),q.material.dispose()}},[dr,de,Cr,U,t,h]);let oe=(0,me.useMemo)(()=>Ax(y.animations),[y.animations]),ye=(0,me.useRef)(c);ye.current=c;let Ae=(0,me.useRef)(g);Ae.current=g;let ct=(0,me.useRef)(null),ht=(0,me.useRef)(new Set),Ke=(0,me.useRef)(0),wt=F=>{ht.current.forEach(H=>H(F))};(0,me.useEffect)(()=>{let F=Rx({root:j,clips:oe,getClipConfig:q=>nv(Ae.current,q),onChange:()=>{wt(F.getState()),h()}});ct.current=F,ye.current?.({clips:oe.map(({sourceName:q})=>q),clipDetails:oe.map(({sourceName:q,duration:ie})=>({sourceName:q,duration:ie})),play:F.play,pause:F.pause,stop:F.stop,setSpeed:F.setSpeed,seek:F.seek,getState:F.getState,subscribe:q=>(ht.current.add(q),q(F.getState()),()=>{ht.current.delete(q)})}),wt(F.getState());let H=Ae.current?.animations.autoplayClip;return H&&F.play(H),()=>{F.dispose(),ct.current=null,wt(F.getState())}},[j,oe]),(0,me.useEffect)(()=>{g?.animations&&ct.current?.applyClipConfigs()},[g?.animations]),(0,Da.useFrame)((F,H)=>{let q=ct.current;if(q?.isRunning()){if(q.update(H),!b)for(let[ie,ae]of un.current)cu(ie,ae,Le);h(),Ke.current+=H,Ke.current>=.066&&(Ke.current=0,wt(q.getState()),Xh(j))}});let _e=(0,me.useMemo)(()=>(g?.model.rotation??[0,0,0]).map(F=>F*Math.PI/180),[g?.model.rotation]);(0,Da.useFrame)((F,H)=>{if(!C.current)return;let q=C.current.rotation;q.x=ft.MathUtils.lerp(q.x,_e[0],1-Math.exp(-5*H)),q.y=ft.MathUtils.lerp(q.y,_e[1],1-Math.exp(-5*H)),q.z=ft.MathUtils.lerp(q.z,_e[2],1-Math.exp(-5*H)),Math.abs(q.x-_e[0])<1e-4&&Math.abs(q.y-_e[1])<1e-4&&Math.abs(q.z-_e[2])<1e-4||h()});let qe=(0,me.useRef)([]),dt=(0,me.useRef)(0),pn=(0,me.useRef)(0),ur=(0,me.useMemo)(()=>new ft.Vector3,[]);(0,me.useEffect)(()=>{let F=new Map;for(let[De,Rt]of Object.entries(t)){let vt=U[Rt.modelObjectId??De];vt&&F.set(vt,Rt)}for(let De of qe.current)cu(De.node,F.get(De.node)?.transform,Le);pn.current=0,j.updateWorldMatrix(!0,!0);let H=new ft.Box3().setFromObject(j),q=H.getCenter(new ft.Vector3),ie=H.getSize(new ft.Vector3).length()*.5;dt.current=Number.isFinite(ie)?ie:0;let ae=[...F.keys()],we=new Set(ae),Pe=[],at=new ft.Vector3;for(let De of ae){if(!De.parent)continue;let Rt=De.parent,vt=!1;for(;Rt;){if(we.has(Rt)){vt=!0;break}Rt=Rt.parent}if(vt)continue;let qt=new ft.Box3().setFromObject(De);if(qt.isEmpty())continue;qt.getCenter(at);let Me=at.clone().sub(q);Me.lengthSq()<1e-8||(Me.normalize(),Pe.push({node:De,restLocalPos:De.position.clone(),restWorldPos:De.getWorldPosition(new ft.Vector3),worldDir:Me,parentInverse:new ft.Matrix4().copy(De.parent.matrixWorld).invert()}))}qe.current=Pe,h()},[j,U,pt,Bt,Le,h]),(0,me.useEffect)(()=>{h()},[k,h]),(0,Da.useFrame)((F,H)=>{let q=qe.current;if(q.length===0)return;let ie=Math.min(Math.max(k,0),1),ae=pn.current;if(Math.abs(ae-ie)<1e-4){if(ae===ie)return;pn.current=ie}else pn.current=ft.MathUtils.lerp(ae,ie,1-Math.exp(-6*H)),h();let we=pn.current*dt.current;for(let Pe of q)ur.copy(Pe.worldDir).multiplyScalar(we).add(Pe.restWorldPos).applyMatrix4(Pe.parentInverse),Pe.node.position.copy(ur)});let en=F=>{let H=F;for(;H;){let q=Kl(H),ie=q?he[q]:void 0;if(ie&&t[ie])return[ie,t[ie]];H=H.parent}return null},Hn=F=>{let H=en(F);if(!H)return null;let[q,ie]=H;return U[ie.modelObjectId??q]??null},Xr=Bd(F=>{let H=en(F);return H&&H[1].selectable!==!1?H[1]:null},s,Hn),pr=F=>{if(Xr.consumeClick())return;let H=en(F.object);if(!H)return;let[,q]=H;q.selectable!==!1&&(F.stopPropagation(),r(q,Bs(F,Hn(F.object))))},to=F=>{let H=en(F.object);if(!H)return;let[,q]=H;if(q.selectable===!1)return;a?.(q,Bs(F,Hn(F.object)))&&F.stopPropagation()},aa=F=>{if(!M)return;let H=en(F.object);if(!H)return;let[q,ie]=H;ie.hoverable!==!1&&(F.stopPropagation(),D("pointer"),A(q),o?.(ie))},tn=F=>{M&&(F.stopPropagation(),B(),A(null),o?.(null))},Pr=(0,me.useMemo)(()=>!ib(j),[j]);return(0,qh.jsx)("group",{ref:C,children:(0,qh.jsx)("primitive",{object:j,...Pr?{onClick:pr,onDoubleClick:to,...s?{onPointerDown:Xr.onPointerDown}:{},...M?{onPointerOver:aa,onPointerOut:tn}:{}}:{}})})}var $e=require("react");var Uu=require("@react-three/fiber");var Jt=require("three");var $t=require("three");function Ix(e){let t={};for(let[n,i]of Object.entries(e))t[i.modelObjectId??n]=n;return t}function Kh(e){let t=e,n=null;for(;t;){let i=t.userData?.ri_name;if(typeof i=="string"&&i)return i;!n&&t.name&&(n=t.name),t=t.parent}return n}function zx(e,t){return e||(t?t.modelObjectId??t.id:null)}function pu(e,t){let n=Kh(e);if(!n)return null;let i=t.keyByModelObject[n]??n,r=t.objectBindings[i];return r?{key:i,binding:r}:null}var Vs=new $t.Vector3,Yh=new $t.Vector3,FM=new $t.Matrix4,Bx=new $t.Matrix4,du=new $t.Matrix4,VM=new $t.Matrix4,uu=new $t.Matrix4,jM=new $t.Matrix4,HM=new $t.Matrix4,GM=new $t.Vector3,WM=new $t.Vector3,jo=new $t.Vector3,Ox=new $t.Quaternion,XM=new $t.Euler;function qM(e,t,n,i,r){let o=!!(n?.position||n?.rotation||n?.scale),a=!!(r&&r.factor>0&&r.radius>0);if(!o&&!a){e.matrixAutoUpdate=!0,e.position.copy(t.position),e.rotation.copy(t.rotation),e.scale.copy(t.scale),e.updateMatrix(),e.updateWorldMatrix(!0,!1);return}Bx.compose(t.position,Ox.setFromEuler(t.rotation),t.scale);let s=n?.rotation;du.compose(GM.fromArray(n?.position??[0,0,0]),Ox.setFromEuler(XM.set(s?.[0]??0,s?.[1]??0,s?.[2]??0)),WM.fromArray(n?.scale??[1,1,1])),du.premultiply(i).multiply(VM.copy(i).invert()),e.parent?.updateWorldMatrix(!0,!1);let l=e.parent?.matrixWorld??FM;if(uu.multiplyMatrices(l,Bx).premultiply(du),a&&r){let c=e;for(;c.parent&&!c.userData.ri_name;)c=c.parent;let p=c.userData.ri_center;Array.isArray(p)&&p.length===3?jo.fromArray(p).applyMatrix4(i).applyMatrix4(du):jo.setFromMatrixPosition(uu),jo.sub(r.centre),jo.lengthSq()>1e-8&&(jo.normalize().multiplyScalar(r.factor*r.radius),uu.premultiply(HM.makeTranslation(jo.x,jo.y,jo.z)))}e.matrixAutoUpdate=!1,e.matrix.multiplyMatrices(jM.copy(l).invert(),uu),e.matrixWorldNeedsUpdate=!0,e.updateWorldMatrix(!1,!1)}function hu(e,t){if(!Wn(e)&&!e.userData.riLogicalObject)return;let n=pu(e,t);if(!n)return;let i=Ux(e);if(i.rest??(i.rest={position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}),t.suspendTransforms)return;if(t.placementFrame&&!e.userData.riLogicalObject){qM(e,i.rest,n.binding.transform,t.placementFrame,t.explode);return}let r=i.rest,o=n.binding.transform;o?.position?e.position.fromArray(o.position):e.position.copy(r.position),o?.rotation?e.rotation.set(o.rotation[0],o.rotation[1],o.rotation[2],r.rotation.order):e.rotation.copy(r.rotation),o?.scale?e.scale.fromArray(o.scale):e.scale.copy(r.scale);let a=t.explode;if(a&&a.factor>0&&a.radius>0){e.updateWorldMatrix(!0,!1),Yh.setFromMatrixPosition(e.matrixWorld);let s=e;for(;s.parent&&!s.userData.ri_name;)s=s.parent;let l=s.userData.ri_center;Array.isArray(l)&&l.length===3?Vs.fromArray(l).applyMatrix4(e.matrixWorld).sub(a.centre):Vs.copy(Yh).sub(a.centre),Vs.lengthSq()>1e-8&&(Vs.normalize().multiplyScalar(a.factor*a.radius).add(Yh),e.parent&&e.parent.worldToLocal(Vs),e.position.copy(Vs))}e.updateMatrix(),e.updateWorldMatrix(!0,!1)}function js(e,t){e.traverse(n=>hu(n,t))}function Ux(e){var t;return(t=e.userData).riVisuals??(t.riVisuals={}),e.userData.riVisuals}function $M(e,t,n,i){return JSON.stringify([e?.style?.material??null,t??null,n.shadingMode,n.rendererMode,i])}function YM(e){if(e.textures){for(let t of Wi){let n=e.textures[t];n&&po(n,Mi(t))}e.textures=void 0}}function KM(e,t,n){let i=e.textures??{};for(let r of Wi){let o=rn(t,r),a=i[r];if(a===o)continue;let s=Mi(r);a&&po(a,s),o?(Ns(o,s,n),i[r]=o):delete i[r]}e.textures=Object.keys(i).length>0?i:void 0}function ZM(e,t){if(t.shadingMode==="normals")return $i(e,()=>new $t.MeshNormalMaterial);if(t.shadingMode==="unlit")return $i(e,n=>{let i=new $t.MeshBasicMaterial;return i.color.copy(n.color),i.map=n.map,i.alphaMap=n.alphaMap,i.alphaTest=n.alphaTest,i.transparent=n.transparent,i.opacity=n.opacity,i.side=n.side,i});if(t.rendererMode==="matcap"){let n=Nd();return $i(e,i=>{let r=new $t.MeshMatcapMaterial;return r.matcap=n,r.color.copy(i.color),r.alphaMap=i.alphaMap,r.alphaTest=i.alphaTest,r.side=i.side,r})}return e}function JM(e,t){if(!Wn(e))return;let i=Ux(e);i.original??(i.original=Ql(e));let r=pu(e,t);if(!r){i.original&&(e.material=i.original),e.visible=!0;return}let{key:o,binding:a}=r;e.visible=a.visible!==!1,hu(e,t);let s=t.itemMaterials?.[o]?.hex??t.itemMaterials?.[a.modelObjectId??o]?.hex,l=t.highlightOnHover!==!1&&o===t.hoveredKey,c=$M(a,s,t,l);if(i.signature===c&&i.display){e.material=i.display;return}let p=a.style?.material;if(KM(i,p,t.invalidate),!i.physical){let u=i.original??Ql(e);if(!u)return;i.physical=$i(u,d=>{let m=iu(d),g=ou(m??new $t.MeshStandardMaterial);return au(g),g})}vr(i.physical,u=>{su(u,p,s??p?.baseColor),l&&(u.emissive.add(_a),u.color.lerp(sv,lv)),u.needsUpdate=!0}),i.display&&i.display!==i.physical&&vr(i.display,u=>u.dispose()),i.display=ZM(i.physical,t),i.signature=c,e.material=i.display}function Fx(e,t){e.traverse(n=>JM(n,t))}function Zh(e){e.traverse(t=>{if(!Wn(t))return;let n=t.userData.riVisuals;n&&(n.rest&&(t.matrixAutoUpdate=!0,t.position.copy(n.rest.position),t.rotation.copy(n.rest.rotation),t.scale.copy(n.rest.scale),t.updateMatrix()),n.original&&(t.material=n.original),n.display&&n.display!==n.physical&&vr(n.display,i=>i.dispose()),n.physical&&vr(n.physical,i=>i.dispose()),YM(n),delete t.userData.riVisuals)})}var jx=new Jt.Matrix4().makeRotationX(Math.PI/2),Vx=jx.clone().invert();function QM(e){let t=new Jt.Vector3(e[0],e[1],e[2]),n=new Jt.Vector3(Math.abs(e[3])+Math.abs(e[6])+Math.abs(e[9]),Math.abs(e[4])+Math.abs(e[7])+Math.abs(e[10]),Math.abs(e[5])+Math.abs(e[8])+Math.abs(e[11]));return new Jt.Box3(t.clone().sub(n),t.clone().add(n))}function eC(e){let t=e.getCenter(new Jt.Vector3),n=e.getSize(new Jt.Vector3).multiplyScalar(.5);return[t.x,t.y,t.z,n.x,0,0,0,n.y,0,0,0,n.z]}var mu=class{constructor(){this.group=new Jt.Group;this.objects=new Map;this.geometry=new Jt.BoxGeometry(1,1,1);this.material=new Jt.MeshBasicMaterial;this.originalBounds=new WeakMap;this.signature="";this.lastContext=null;this.lastEffective=null;this.lastDragging=!1;this.version=0;this.tileVersions=new WeakMap;this.transforms=new Map}setCatalog(t){this.group.clear(),this.objects.clear();for(let n of t){let i=new Jt.Box3(new Jt.Vector3(...n.minimum),new Jt.Vector3(...n.maximum)).applyMatrix4(Vx),r=new Jt.Group;r.name=n.name,r.userData.ri_name=n.name,r.userData.riLogicalObject=!0,r.userData.ri_center=i.getCenter(new Jt.Vector3).toArray();let o=new Jt.Mesh(this.geometry,this.material);o.visible=!1,o.raycast=()=>{},o.position.copy(i.getCenter(new Jt.Vector3)),o.scale.copy(i.getSize(new Jt.Vector3)),r.add(o),this.group.add(r),this.objects.set(n.name,r)}this.signature="",this.lastContext=null}nodesByBinding(t){let n={};for(let[i,r]of this.objects){let o=t.keyByModelObject[i]??i;t.objectBindings[o]&&(n[o]=r)}return n}sync(t,n,i=!1){if(!i&&!this.lastDragging&&t===this.lastContext&&this.lastEffective)return this.lastEffective;this.lastContext=t,this.lastDragging=i;let r={...t,suspendTransforms:!1},o=n?t.objectBindings[n]:void 0,a=o?this.objects.get(o.modelObjectId??n):void 0;i&&a&&o&&(r={...r,objectBindings:{...t.objectBindings,[n]:{...o,transform:{position:a.position.toArray(),rotation:[a.rotation.x,a.rotation.y,a.rotation.z],scale:a.scale.toArray()}}}});for(let l of this.objects.values())i&&l===a||hu(l,r);this.group.updateWorldMatrix(!0,!0);let s=[...this.objects].map(([l,c])=>`${l}:${c.matrix.elements.join(",")}`).join(";");if(s!==this.signature){this.signature=s,this.version++,this.transforms.clear();for(let[l,c]of this.objects)c.matrix.equals(new Jt.Matrix4)||this.transforms.set(l,jx.clone().multiply(c.matrix).multiply(Vx))}return this.lastEffective=r,r}updateBounds(t){if(!t)return;let n=i=>{if(this.tileVersions.get(i)!==this.version){if(i.boundingVolume.box&&this.tileVersions.get(i)!==this.version){let r=this.originalBounds.get(i);r||(r={box:[...i.boundingVolume.box],error:i.geometricError},this.originalBounds.set(i,r));let o=QM(r.box),a=o.clone(),s=1;for(let c of i.extras?.featureIds??[]){let p=this.transforms.get(c);p&&(a.union(o.clone().applyMatrix4(p)),s=Math.max(s,p.getMaxScaleOnAxis()))}let l=eC(a);i.boundingVolume.box=l,i.geometricError=r.error*s,i.engineData?.boundingVolume?.setObbData(l,i.engineData.transform),this.tileVersions.set(i,this.version)}i.children?.forEach(n)}};n(t)}dispose(){this.group.clear(),this.objects.clear(),this.geometry.dispose(),this.material.dispose()}};var Jh=Object.freeze({factor:1,loosened:!1,tooFine:0,raisedAt:-1/0,changedAt:-1/0}),ec=16,Qh=1.25,tC=1.5,nC=1.25,rC=500,iC=3e3,Hx=5e3,Gx=2e3,oC=.9;function Wx(e){return e.full&&(e.wanting||e.usage>1)}function Xx(e){return e.loosened?iC:rC}function qx(e){let t=e.factor/nC;return t<=1+1e-6?1:t}function $x(e,t){return e.factor>1&&!e.loosened&&!t.full&&!t.wanting&&t.usage<oC&&qx(e)>e.tooFine}function Yx(e,t){let{now:n}=t,i=t.moved&&e.tooFine>0?{...e,tooFine:0}:e;if(Wx(t)){if(n-i.changedAt<Xx(i))return i;let r=Math.max(i.tooFine,i.factor);return i.factor>=ec?i.loosened&&i.tooFine===r?i:{...i,loosened:!0,tooFine:r,changedAt:n}:{factor:Math.min(ec,i.factor*tC),loosened:!0,tooFine:r,raisedAt:n,changedAt:n}}return i.loosened&&!t.wanting?{...i,loosened:!1,changedAt:n}:$x(i,t)&&n-i.raisedAt>=Hx&&n-i.changedAt>=Gx?{...i,factor:qx(i),changedAt:n}:i}function Kx(e,t){let{now:n}=t;return Wx(t)?e.factor>=ec&&e.loosened?null:Math.max(0,Xx(e)-(n-e.changedAt)):e.loosened&&!t.wanting?0:$x(e,t)?Math.max(0,Hx-(n-e.raisedAt),Gx-(n-e.changedAt)):null}function ey(e){try{let t=typeof location<"u"?location.href:void 0;return new URL(e,t).origin}catch{return null}}function em(e){if(!e)return null;let t=e.length,n=e.indexOf("?"),i=e.indexOf("#");n!==-1&&(t=Math.min(t,n)),i!==-1&&(t=Math.min(t,i));let r=e.lastIndexOf(".",t),o=e.lastIndexOf("/",t),a=e.indexOf("://");return a!==-1&&a+2===o||r===-1||r<o?null:e.substring(r+1,t)||null}var gu,tc=(gu=class{static setXRSession(e){e!==this.session&&(this.flushPending(),this.session=e)}static requestAnimationFrame(e){let{session:t,pending:n}=this,i,r=()=>{n.delete(i),e()};return i=t?t.requestAnimationFrame(r):requestAnimationFrame(r),n.set(i,e),i}static cancelAnimationFrame(e){let{pending:t,session:n}=this;t.delete(e),n?n.cancelAnimationFrame(e):cancelAnimationFrame(e)}static flushPending(){this.pending.forEach((e,t)=>{e(),this.cancelAnimationFrame(t)})}},ch(gu,"pending",new Map),ch(gu,"session",null),gu),Zx=2**30,ic=class{get unloadPriorityCallback(){return this._unloadPriorityCallback}set unloadPriorityCallback(e){e.length===1?(console.warn('LRUCache: "unloadPriorityCallback" function has been changed to take two arguments.'),this._unloadPriorityCallback=(t,n)=>{let i=e(t),r=e(n);return i<r?-1:+(i>r)}):this._unloadPriorityCallback=e}constructor(){this.minSize=6e3,this.maxSize=8e3,this.minBytesSize=.3*Zx,this.maxBytesSize=.4*Zx,this.unloadPercent=.05,this.autoMarkUnused=!0,this.cachedBytes=0,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadingHandle=-1,this.bytesMap=new Map,this.loadedSet=new Set,this._unloadPriorityCallback=null;let e=this.itemSet;this.defaultPriorityCallback=t=>e.get(t)}isFull(){return this.itemSet.size>=this.maxSize||this.cachedBytes>=this.maxBytesSize}getMemoryUsage(e){return this.bytesMap.get(e)||0}setMemoryUsage(e,t){let{bytesMap:n,itemSet:i}=this;i.has(e)&&(this.cachedBytes-=n.get(e)||0,n.set(e,t),this.cachedBytes+=t)}add(e,t){let n=this.itemSet;if(n.has(e)||this.isFull())return!1;let i=this.usedSet,r=this.itemList,o=this.callbacks;return r.push(e),i.add(e),n.set(e,Date.now()),o.set(e,t),!0}has(e){return this.itemSet.has(e)}remove(e){let t=this.usedSet,n=this.itemSet,i=this.itemList,r=this.bytesMap,o=this.callbacks,a=this.loadedSet;if(n.has(e)){this.cachedBytes-=r.get(e)||0,r.delete(e),o.get(e)(e);let s=i.indexOf(e);return i.splice(s,1),t.delete(e),n.delete(e),o.delete(e),a.delete(e),!0}return!1}setLoaded(e,t){let{itemSet:n,loadedSet:i}=this;n.has(e)&&(t===!0?i.add(e):i.delete(e))}markUsed(e){let t=this.itemSet,n=this.usedSet;t.has(e)&&!n.has(e)&&(t.set(e,Date.now()),n.add(e))}markUnused(e){this.usedSet.delete(e)}markAllUnused(){this.usedSet.clear()}isUsed(e){return this.usedSet.has(e)}unloadUnusedContent(){let{unloadPercent:e,minSize:t,maxSize:n,itemList:i,itemSet:r,usedSet:o,loadedSet:a,callbacks:s,bytesMap:l,minBytesSize:c,maxBytesSize:p}=this,u=i.length-o.size,d=i.length-a.size,m=Math.max(Math.min(i.length-t,u),0),g=this.cachedBytes-c,v=this.unloadPriorityCallback||this.defaultPriorityCallback,M=!1,w=m>0&&u>0||d&&i.length>n;if(u&&this.cachedBytes>c||d&&this.cachedBytes>p||w){i.sort((h,P)=>{let A=o.has(h);if(A===o.has(P)){let C=a.has(h);return C===a.has(P)?-v(h,P):C?1:-1}else return A?1:-1});let x=Math.max(t*e,m*e),S=Math.ceil(Math.min(x,u,m)),k=Math.max(e*g,e*c),b=Math.min(k,g),_=0,y=0;for(;this.cachedBytes-y>p||i.length-_>n;){let h=i[_],P=l.get(h)||0;if(o.has(h)&&a.has(h)||this.cachedBytes-y-P<p&&i.length-_<=n)break;y+=P,_++}for(;y<b||_<S;){let h=i[_],P=l.get(h)||0;if(o.has(h)||this.cachedBytes-y-P<c&&_>=S)break;y+=P,_++}i.splice(0,_).forEach(h=>{this.cachedBytes-=l.get(h)||0,s.get(h)(h),l.delete(h),r.delete(h),s.delete(h),a.delete(h),o.delete(h)}),M=_<m||y<g&&_<u,M&&(M=_>0)}M&&(this.unloadingHandle=tc.requestAnimationFrame(()=>this.scheduleUnload()))}scheduleUnload(){tc.cancelAnimationFrame(this.unloadingHandle),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.unloadUnusedContent()}))}},aC=class extends DOMException{constructor(){super("PriorityQueue: Item removed","AbortError")}},Yi=class{get running(){return this.items.length!==0||this.currJobs!==0}constructor(){this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=null,this._schedulingCallback=e=>{tc.requestAnimationFrame(e)},this._runjobs=()=>{this.scheduled=!1,this.tryRunJobs()}}sort(){let e=this.priorityCallback,t=this.items;e!==null&&t.sort(e)}has(e){return this.callbacks.has(e)}add(e,t){let n={callback:t,reject:null,resolve:null,promise:null};return n.promise=new Promise((i,r)=>{let o=this.items,a=this.callbacks;n.resolve=i,n.reject=r,o.unshift(e),a.set(e,n),this.autoUpdate&&this.scheduleJobRun()}),n.promise}remove(e){let t=this.items,n=this.callbacks,i=t.indexOf(e);if(i!==-1){let r=n.get(e);r.promise.catch(o=>{if(o.name!=="AbortError")throw o}),r.reject(new aC),t.splice(i,1),n.delete(e)}}removeByFilter(e){let{items:t}=this;for(let n=0;n<t.length;n++){let i=t[n];e(i)&&(this.remove(i),n--)}}tryRunJobs(){this.sort();let e=this.items,t=this.callbacks,n=this.maxJobs,i=0,r=()=>{this.currJobs--,this.autoUpdate&&this.scheduleJobRun()};for(;n>this.currJobs&&e.length>0&&i<n;){this.currJobs++,i++;let o=e.pop(),{callback:a,resolve:s,reject:l}=t.get(o);t.delete(o);let c;try{c=a(o)}catch(p){l(p),r();continue}c instanceof Promise?c.then(s).catch(l).finally(r):(s(c),r())}}flush(e){let{items:t,callbacks:n}=this,i=t.indexOf(e);if(!n.has(e))return;let{callback:r,resolve:o,reject:a}=n.get(e);n.delete(e),t.splice(i,1);let s;try{s=r(e)}catch(l){a(l);return}return s instanceof Promise?s.then(o).catch(a):o(s),s}scheduleJobRun(){this.scheduled||(this.scheduled=(this._schedulingCallback(this._runjobs),!0))}},yu=class{get running(){for(let e of this.originQueues.values())if(e.running)return!0;return!1}get maxJobsPerOrigin(){return this._maxJobsPerOrigin}set maxJobsPerOrigin(e){this._maxJobsPerOrigin=e,this.originQueues.forEach(t=>t.maxJobs=e)}get maxJobs(){return this.maxJobsPerOrigin}set maxJobs(e){console.warn('DownloadPriorityQueue: "maxJobs" is no longer valid and limits jobs per server origin. Use "maxJobsPerOrigin", instead.'),this.maxJobsPerOrigin=e}get priorityCallback(){return this._priorityCallback}set priorityCallback(e){this._priorityCallback=e,this.originQueues.forEach(t=>t.priorityCallback=e)}constructor(){this.originQueues=new Map,this._itemQueues=new WeakMap,this._maxJobsPerOrigin=6,this._priorityCallback=null}add(e,t,n,i=null){this.originQueues.forEach((l,c)=>{l.running||this.originQueues.delete(c)});let r=e===null?null:ey(e),o=this.originQueues.get(r);o||(o=new Yi,o.maxJobs=this._maxJobsPerOrigin,o.priorityCallback=this._priorityCallback,this.originQueues.set(r,o));let a=this._itemQueues.get(t);if(a&&a!==o&&a.has(t))throw Error("DownloadPriorityQueue: Item is already queued with a different url origin.");this._itemQueues.set(t,o);let s=o.add(t,n);return i!==null&&(i.aborted?this.remove(t):i.addEventListener("abort",()=>this.remove(t),{once:!0})),s}remove(e){let t=this._itemQueues.get(e);t&&(t.remove(e),this._itemQueues.delete(e))}has(e){let t=this._itemQueues.get(e);return!!(t&&t.has(e))}};var Oa=6378137,sC=1/298.257223563,nm=6356752314245179e-9,fu={inView:!1,error:1/0,distanceFromCamera:1/0};function wu(e){return e===4||e===-1}function fo(e,t){return Su(e)&&e.traversal.lastFrameVisited===t&&e.traversal.used}function Su(e){return!!e.traversal}function oc(e){let{children:t}=e,n=t.length===0||Su(t[t.length-1]),i=!e.internal.hasUnrenderableContent||wu(e.internal.loadingState);return n&&i}function Na(e){return e.traversal.unconditionallyRefine}function nc(e,t){if(Su(e)&&(t.ensureChildrenArePreprocessed(e),e.traversal.lastFrameVisited!==t.frameCount&&(e.traversal.wasInFrustum=e.traversal.inFrustum,e.traversal.wasSetActive=e.traversal.active,e.traversal.wasSetVisible=e.traversal.visible,e.traversal.usedLastFrame=e.traversal.used,e.traversal.lastFrameVisited=t.frameCount,e.traversal.used=!1,e.traversal.inFrustum=!1,e.traversal.isLeaf=!1,e.traversal.visible=!1,e.traversal.active=!1,e.traversal.error=1/0,e.traversal.distanceFromCamera=1/0,e.traversal.allChildrenReady=!1,e.traversal.allChildrenLoaded=!1,e.traversal.kicked=!1,e.traversal.allUsedChildrenProcessed=!1,t.calculateTileViewErrorWithPlugin(e,fu),e.traversal.inFrustum=fu.inView,e.traversal.error=fu.error,e.traversal.distanceFromCamera=fu.distanceFromCamera,e.traversal.unconditionallyRefine=e.internal.hasUnrenderableContent,!e.traversal.unconditionallyRefine))){let n=e.parent;for(;n&&n.traversal.unconditionallyRefine;)n=n.parent;n&&n.geometricError<=e.geometricError&&(e.traversal.unconditionallyRefine=!0)}}function tm(e,t,n=!1){if(nc(e,t),n?t.markTileUsed(e):bu(e),Na(e)&&oc(e)){let i=e.children;for(let r=0,o=i.length;r<o;r++)tm(i[r],t,n)}}function ty(e,t){if(nc(e,t),e.traversal.usedLastFrame&&(bu(e),e.traversal.wasSetActive&&(e.traversal.active=!0),(!e.traversal.active||Na(e))&&oc(e))){let n=e.children;for(let i=0,r=n.length;i<r;i++)ty(n[i],t)}}function bu(e){e.traversal.used=!0}function lC(e,t){return!(e.traversal.error<=t.errorTarget&&!Na(e)||t.maxDepth>0&&e.internal.depth+1>=t.maxDepth||!oc(e))}function ny(e,t){let{frameCount:n}=t,{children:i}=e;for(let r=0,o=i.length;r<o;r++){let a=i[r];fo(a,n)&&(a.traversal.active&&(a.traversal.kicked=!0,a.traversal.active=!1),ny(a,t))}}function Jx(e){return!Na(e)&&(!e.internal.hasContent||wu(e.internal.loadingState))}function ry(e,t){if(nc(e,t),!e.traversal.inFrustum)return;let n=e.parent;if(n&&n.refine==="ADD"&&e.geometricError>0&&e.traversal.error*(n.geometricError/e.geometricError)<=t.errorTarget)return;if(!lC(e,t)){bu(e);return}let i=!1,r=!1,o=e.children;for(let a=0,s=o.length;a<s;a++){let l=o[a];ry(l,t),i||(i=fo(l,t.frameCount)),r||(r=l.traversal.inFrustum)}if(e.refine==="REPLACE"&&!r&&o.length!==0){e.traversal.inFrustum=!1,t.markTileUsed(e);for(let a=0,s=o.length;a<s;a++)tm(o[a],t,!0);return}if(bu(e),e.refine==="REPLACE"&&i&&(t.loadSiblings||t.loadAncestors))for(let a=0,s=o.length;a<s;a++)tm(o[a],t)}function iy(e,t){let n=t.frameCount;if(!fo(e,n))return;let i=e.children,r=!1;for(let a=0,s=i.length;a<s;a++){let l=i[a];r||(r=fo(l,n))}if(!r)e.traversal.isLeaf=!0;else{for(let s=0,l=i.length;s<l;s++)iy(i[s],t);let a=!0;for(let s=0,l=i.length;s<l;s++){let c=i[s];if(fo(c,n)){let p=!Na(c),u=!c.internal.hasContent||wu(c.internal.loadingState);p&&u||c.traversal.allChildrenLoaded||(a=!1)}}e.traversal.allChildrenLoaded=a}let o=!0;for(let a=0,s=i.length;a<s;a++){let l=i[a];fo(l,t.frameCount)&&!l.traversal.allUsedChildrenProcessed&&(o=!1)}e.traversal.allUsedChildrenProcessed=o&&oc(e)}function oy(e,t){if(!fo(e,t.frameCount))return;let n=e.children;if(e.refine==="REPLACE"&&t.loadAncestors&&!e.traversal.allChildrenLoaded&&!Na(e)&&(e.traversal.isLeaf=!0),e.traversal.isLeaf){if(!Na(e)&&(e.traversal.active=!0,oc(e)&&e.internal.hasContent&&!wu(e.internal.loadingState)))for(let r=0,o=n.length;r<o;r++)ty(n[r],t);return}let i=n.length>0;for(let r=0,o=n.length;r<o;r++){let a=n[r];oy(a,t),fo(a,t.frameCount)&&!(a.traversal.active&&Jx(a))&&!a.traversal.allChildrenReady&&(i=!1)}e.traversal.allChildrenReady=i,e.refine==="REPLACE"&&!i&&e.traversal.wasSetActive&&Jx(e)&&(e.traversal.active=!0,ny(e,t))}function ay(e,t){nc(e,t);let n=fo(e,t.frameCount);if(n&&(e.internal.hasUnrenderableContent&&(t.markTileUsed(e),t.queueTileForDownload(e)),e.internal.hasRenderableContent&&e.refine==="ADD"&&(e.traversal.active=!0),(e.traversal.active||e.traversal.kicked)&&e.internal.hasContent&&(t.markTileUsed(e),e.traversal.allUsedChildrenProcessed&&t.queueTileForDownload(e),e.internal.loadingState!==4&&(e.traversal.active=!1)),t.loadAncestors&&e.internal.hasContent&&(t.markTileUsed(e),t.queueTileForDownload(e)),e.internal.virtualChildCount>0&&e.internal.hasContent&&t.markTileUsed(e),e.traversal.visible=e.internal.hasRenderableContent&&e.traversal.active&&e.traversal.inFrustum&&e.internal.loadingState===4,t.stats.used++,e.traversal.inFrustum&&t.stats.inFrustum++),n||Su(e)&&e.traversal.usedLastFrame){let i=!1,r=!1;n?(i=e.traversal.active,r=t.displayActiveTiles&&e.traversal.active||e.traversal.visible):nc(e,t),e.internal.hasRenderableContent&&e.internal.loadingState===4?(i&&t.stats.active++,r&&t.stats.visible++,e.traversal.wasSetActive!==i&&t.invokeOnePlugin(a=>a.setTileActive&&a.setTileActive(e,i)),e.traversal.wasSetVisible!==r&&t.invokeOnePlugin(a=>a.setTileVisible&&a.setTileVisible(e,r))):e.internal.hasRenderableContent||(r=e.traversal.isLeaf,e.traversal.wasSetVisible!==r&&t.invokeOnePlugin(a=>a.setEmptyTileVisible&&a.setEmptyTileVisible(e,r))),e.traversal.visible=r,e.traversal.active=i;let o=e.children;for(let a=0,s=o.length;a<s;a++){let l=o[a];ay(l,t)}}}function cC(e,t){ry(e,t),iy(e,t),oy(e,t),ay(e,t)}function dC(e){let t=null;return()=>{t===null&&(t=tc.requestAnimationFrame(()=>{t=null,e()}))}}function uC(e,t=null,n=null){let i=[];for(i.push(e),i.push(null),i.push(0);i.length>0;){let r=i.pop(),o=i.pop(),a=i.pop();if(t&&t(a,o,r)){n&&n(a,o,r);return}let s=a.children;if(s)for(let l=s.length-1;l>=0;l--)i.push(s[l]),i.push(a),i.push(r+1);n&&n(a,o,r)}}var Qx=Symbol("PLUGIN_REGISTERED"),Ho={inView:!0,error:0,distance:1/0},pC=(e,t)=>{let n=e.priority||0,i=t.priority||0;return n===i?!e.traversal||!t.traversal?0:e.traversal.used===t.traversal.used?e.traversal.error===t.traversal.error?e.traversal.distanceFromCamera===t.traversal.distanceFromCamera?e.internal.depthFromRenderedParent===t.internal.depthFromRenderedParent?0:e.internal.depthFromRenderedParent>t.internal.depthFromRenderedParent?-1:1:e.traversal.distanceFromCamera>t.traversal.distanceFromCamera?-1:1:e.traversal.error>t.traversal.error?1:-1:e.traversal.used?1:-1:n>i?1:-1},hC=(e,t)=>e.traversal.used===t.traversal.used?e.traversal.inFrustum===t.traversal.inFrustum?e.internal.hasUnrenderableContent===t.internal.hasUnrenderableContent?e.traversal.distanceFromCamera===t.traversal.distanceFromCamera?e.internal.depthFromRenderedParent===t.internal.depthFromRenderedParent?0:e.internal.depthFromRenderedParent>t.internal.depthFromRenderedParent?-1:1:e.traversal.distanceFromCamera>t.traversal.distanceFromCamera?-1:1:e.internal.hasUnrenderableContent?1:-1:e.traversal.inFrustum?1:-1:e.traversal.used?1:-1,mC=(e,t)=>e.traversal.lastFrameVisited===t.traversal.lastFrameVisited?e.internal.depthFromRenderedParent===t.internal.depthFromRenderedParent?e.internal.loadingState===t.internal.loadingState?e.internal.hasUnrenderableContent===t.internal.hasUnrenderableContent?e.traversal.error===t.traversal.error?0:e.traversal.error>t.traversal.error?-1:1:e.internal.hasUnrenderableContent?-1:1:e.internal.loadingState>t.internal.loadingState?-1:1:e.internal.depthFromRenderedParent>t.internal.depthFromRenderedParent?1:-1:e.traversal.lastFrameVisited>t.traversal.lastFrameVisited?-1:1,Hs=(e,t)=>{let n=e.priority??1/0,i=t.priority??1/0;if(n!==i)return n>i?1:-1;if(!e.internal||!t.internal)return 0;let r=e.internal.renderer,o=t.internal.renderer,a=!r.loadAncestors,s=!o.loadAncestors;return a&&s?hC(e,t):pC(e,t)},rm=new ic;rm.unloadPriorityCallback=mC;var rc=new yu;rc.maxJobsPerOrigin=25,rc.priorityCallback=Hs;var vu=new Yi;vu.maxJobs=5,vu.priorityCallback=Hs;var xu=new Yi;xu.maxJobs=25,xu.priorityCallback=(e,t)=>{let n=e.parent,i=t.parent;return n===i?0:n?i?Hs(n,i):-1:1};var im=class{get root(){let e=this.rootTileset;return e?e.root:null}get loadProgress(){let{stats:e,isLoading:t}=this,n=e.queued+e.downloading+e.parsing,i=e.inCacheSinceLoad+ +!!t;return i===0?1:1-n/i}get downloadQueue(){return this._downloadQueue}set downloadQueue(e){if(e instanceof Yi){console.warn('TilesRenderer: "downloadQueue" is no longer valid as a PriorityQueue. Use a DownloadPriorityQueue, instead.');return}this._downloadQueue=e}constructor(e=null){this.rootLoadingState=0,this.rootTileset=null,this.rootURL=e,this.fetchOptions={},this.plugins=[],this.queuedTiles=[],this.cachedSinceLoadComplete=new Set,this.isLoading=!1,this.processedTiles=new WeakSet,this.visibleTiles=new Set,this.activeTiles=new Set,this.usedSet=new Set,this.loadingTiles=new Set,this.lruCache=rm,this.downloadQueue=rc,this.parseQueue=vu,this.processNodeQueue=xu,this.stats={inCacheSinceLoad:0,inCache:0,queued:0,downloading:0,parsing:0,loaded:0,failed:0,inFrustum:0,used:0,active:0,visible:0,tilesProcessed:0},this.frameCount=0,this._dispatchNeedsUpdateEvent=dC(()=>{this.dispatchEvent({type:"needs-update"})}),this.errorTarget=16,this.errorFalloff=0,this.errorFalloffDensity=2e-4,this.displayActiveTiles=!1,this.maxDepth=1/0,this.loadSiblings=!0,this.loadAncestors=!0,this.maxTilesProcessed=250}registerPlugin(e){if(e[Qx]===!0)throw Error("TilesRendererBase: A plugin can only be registered to a single tileset");let t=this.plugins,n=e.priority||0,i=t.length;for(let r=0;r<t.length;r++)if((t[r].priority||0)>n){i=r;break}t.splice(i,0,e),e[Qx]=!0,e.init&&e.init(this)}unregisterPlugin(e){let t=this.plugins;if(typeof e=="string"&&(e=this.getPluginByName(e)),t.includes(e)){let n=t.indexOf(e);return t.splice(n,1),e.dispose&&e.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}invokeOnePlugin(e){let t=[...this.plugins,this];for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}invokeAllPlugins(e){let t=[...this.plugins,this],n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);r&&n.push(r)}return n.length===0?null:Promise.all(n)}traverse(e,t,n=!0){this.root&&uC(this.root,(i,...r)=>(n&&this.ensureChildrenArePreprocessed(i,!0),e?e(i,...r):!1),t)}getAttributions(e=[]){return this.invokeAllPlugins(t=>t!==this&&t.getAttributions&&t.getAttributions(e)),e}update(){let{lruCache:e,usedSet:t,stats:n,root:i,downloadQueue:r,parseQueue:o,processNodeQueue:a}=this;if(this.rootLoadingState===0&&(this.rootLoadingState=2,this.invokeOnePlugin(c=>c.loadRootTileset&&c.loadRootTileset()).then(c=>{let p=this.rootURL;p!==null&&this.invokeAllPlugins(u=>p=u.preprocessURL?u.preprocessURL(p,null):p),this.rootLoadingState=4,this.rootTileset=c,this.dispatchEvent({type:"needs-update"}),this.dispatchEvent({type:"load-tileset",tileset:c,url:p}),this.dispatchEvent({type:"load-root-tileset",tileset:c,url:p})}).catch(c=>{this.rootLoadingState=-1,console.error(c),this.rootTileset=null,this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})})),!i)return;let s=null;if(this.invokeAllPlugins(c=>{if(c.doTilesNeedUpdate){let p=c.doTilesNeedUpdate();s=s===null?p:!!(s||p)}}),s===!1){this.dispatchEvent({type:"update-before"}),this.dispatchEvent({type:"update-after"});return}this.dispatchEvent({type:"update-before"}),n.inFrustum=0,n.used=0,n.active=0,n.visible=0,n.tilesProcessed=0,this.frameCount++,t.forEach(c=>e.markUnused(c)),t.clear(),this.prepareForTraversal(),cC(i,this),this.removeUnusedPendingTiles();let l=this.queuedTiles;l.sort(e.unloadPriorityCallback);for(let c=0,p=l.length;c<p&&!e.isFull();c++)this.requestTileContents(l[c]);l.length=0,e.scheduleUnload(),(r.running||o.running||a.running)===!1&&this.isLoading===!0&&(this.cachedSinceLoadComplete.clear(),n.inCacheSinceLoad=0,this.dispatchEvent({type:"tiles-load-end"}),this.isLoading=!1),this.dispatchEvent({type:"update-after"})}resetFailedTiles(){this.rootLoadingState===-1&&(this.rootLoadingState=0);let e=this.stats;e.failed!==0&&(this.traverse(t=>{t.internal.loadingState===-1&&(t.internal.loadingState=0)},null,!1),e.failed=0)}calculateTileViewErrorWithPlugin(e,t){this.calculateTileViewError(e,t);let{errorFalloff:n,errorFalloffDensity:i}=this;if(n>0&&Number.isFinite(t.distanceFromCamera)){let s=t.distanceFromCamera*i;t.error-=n*(1-Math.exp(-s*s))}let r=null,o=0,a=1/0;this.invokeAllPlugins(s=>{s!==this&&s.calculateTileViewError&&(Ho.inView=!0,Ho.error=0,Ho.distance=1/0,s.calculateTileViewError(e,Ho)&&(r===null&&(r=!0),r&&(r=Ho.inView),Ho.inView&&(a=Math.min(a,Ho.distance),o=Math.max(o,Ho.error))))}),t.inView&&r!==!1?(t.error=Math.max(t.error,o),t.distanceFromCamera=Math.min(t.distanceFromCamera,a)):r?(t.inView=!0,t.error=o,t.distanceFromCamera=a):t.inView=!1}dispose(){[...this.plugins].forEach(n=>{this.unregisterPlugin(n)});let e=this.lruCache,t=[];this.traverse(n=>(t.push(n),!1),null,!1);for(let n=0,i=t.length;n<i;n++)e.remove(t[n]);this.stats={queued:0,parsing:0,downloading:0,failed:0,inFrustum:0,traversed:0,used:0,active:0,visible:0},this.frameCount=0,this.loadingTiles.clear()}calculateBytesUsed(e,t){return 0}dispatchEvent(e){}addEventListener(e,t){}removeEventListener(e,t){}parseTile(e,t,n){return null}prepareForTraversal(){}disposeTile(e){e.traversal.visible&&(e.internal.hasRenderableContent?this.invokeOnePlugin(n=>n.setTileVisible&&n.setTileVisible(e,!1)):this.invokeOnePlugin(n=>n.setEmptyTileVisible&&n.setEmptyTileVisible(e,!1)),e.traversal.visible=!1),e.traversal.active&&e.internal.hasRenderableContent&&this.invokeOnePlugin(n=>n.setTileActive&&n.setTileActive(e,!1)),e.traversal.active=!1;let{scene:t}=e.engineData;t&&this.dispatchEvent({type:"dispose-model",scene:t,tile:e})}preprocessNode(e,t,n=null){if(this.processedTiles.add(e),this.stats.tilesProcessed++,e.content&&(!("uri"in e.content)&&"url"in e.content&&(e.content.uri=e.content.url,delete e.content.url),e.content.boundingVolume&&!("box"in e.content.boundingVolume||"sphere"in e.content.boundingVolume||"region"in e.content.boundingVolume)&&delete e.content.boundingVolume),e.parent=n,e.children=e.children||[],e.internal={hasContent:!1,hasRenderableContent:!1,hasUnrenderableContent:!1,loadingState:0,basePath:t,depth:-1,depthFromRenderedParent:-1,isVirtual:!1,virtualChildCount:0,renderer:this,...e.internal},e.content?.uri){let i=em(e.content.uri),r=!!(i&&/json$/.test(i));e.internal.hasContent=!0,e.internal.hasUnrenderableContent=r,e.internal.hasRenderableContent=!r}else e.internal.hasContent=!1,e.internal.hasUnrenderableContent=!1,e.internal.hasRenderableContent=!1;n?(e.internal.depth=n.internal.depth+1,e.internal.depthFromRenderedParent=n.internal.depthFromRenderedParent+ +!!e.internal.hasRenderableContent):(e.internal.depth=0,e.internal.depthFromRenderedParent=+!!e.internal.hasRenderableContent),e.traversal={distanceFromCamera:1/0,error:1/0,inFrustum:!1,wasInFrustum:!1,isLeaf:!1,used:!1,usedLastFrame:!1,visible:!1,wasSetVisible:!1,active:!1,wasSetActive:!1,allChildrenReady:!1,allChildrenLoaded:!1,kicked:!1,allUsedChildrenProcessed:!1,lastFrameVisited:-1},n===null?e.refine=e.refine||"REPLACE":e.refine=e.refine||n.refine,e.engineData={scene:null,metadata:null,boundingVolume:null},Object.defineProperty(e,"cached",{get(){return console.warn('TilesRenderer: "tile.cached" field has been renamed to "tile.engineData".'),this.engineData},enumerable:!1,configurable:!0}),this.invokeAllPlugins(i=>{i!==this&&i.preprocessNode&&i.preprocessNode(e,t,n)})}setTileActive(e,t){t?this.activeTiles.add(e):this.activeTiles.delete(e)}setTileVisible(e,t){t?this.visibleTiles.add(e):this.visibleTiles.delete(e),this.dispatchEvent({type:"tile-visibility-change",scene:e.engineData.scene,tile:e,visible:t})}calculateTileViewError(e,t){}removeUnusedPendingTiles(){let{lruCache:e,loadingTiles:t}=this,n=[];for(let i of t)!e.isUsed(i)&&i.internal.loadingState===1&&n.push(i);for(let i=0;i<n.length;i++)e.remove(n[i])}queueTileForDownload(e){e.internal.loadingState!==0||this.lruCache.isFull()||this.queuedTiles.push(e)}markTileUsed(e){this.usedSet.add(e),this.lruCache.markUsed(e)}fetchData(e,t){return fetch(e,t)}ensureChildrenArePreprocessed(e,t=this.stats.tilesProcessed<this.maxTilesProcessed){let n=e.children;if(n.length===0||n[n.length-1].traversal)return;let i=r=>{for(let o=0,a=r.length;o<a;o++){let s=r[o];s&&!s.traversal&&this.preprocessNode(s,e.internal.basePath,e)}};t?(this.processNodeQueue.remove(e),i(n)):this.processNodeQueue.has(e)||this.processNodeQueue.add(e,r=>{i(r.children),this._dispatchNeedsUpdateEvent()})}getBytesUsed(e){let t=0;return this.invokeAllPlugins(n=>{n.calculateBytesUsed&&(t+=n.calculateBytesUsed(e,e.engineData.scene)||0)}),t}recalculateBytesUsed(e=null){let{lruCache:t,processedTiles:n}=this;e===null?t.itemSet.forEach(i=>{n.has(i)&&t.setMemoryUsage(i,this.getBytesUsed(i))}):t.setMemoryUsage(e,this.getBytesUsed(e))}preprocessTileset(e,t,n=null){let[i,r]=e.asset.version.split(".").map(a=>parseInt(a));console.assert(i<=1,"TilesRenderer: asset.version is expected to be a 1.x or a compatible version."),i===1&&r>0&&console.warn("TilesRenderer: tiles versions at 1.1 or higher have limited support. Some new extensions and features may not be supported.");let o=t.replace(/\/[^/]*$/,"");o=new URL(o,window.location.href).toString(),this.preprocessNode(e.root,o,n)}loadRootTileset(){let e=this.rootURL;return this.invokeAllPlugins(t=>e=t.preprocessURL?t.preprocessURL(e,null):e),this.invokeOnePlugin(t=>t.fetchData&&t.fetchData(e,this.fetchOptions)).then(t=>{if(!(t instanceof Response))return t;if(t.ok)return t.json();throw Error(`TilesRenderer: Failed to load tileset "${e}" with status ${t.status} : ${t.statusText}`)}).then(t=>(this.preprocessTileset(t,e),t))}requestTileContents(e){if(e.internal.loadingState!==0)return;let t=!1,n=null,i=new URL(e.content.uri,e.internal.basePath+"/").toString();this.invokeAllPlugins(d=>i=d.preprocessURL?d.preprocessURL(i,e):i);let r=this.stats,o=this.lruCache,a=this.downloadQueue,s=this.parseQueue,l=this.loadingTiles,c=em(i),p=new AbortController,u=p.signal;if(o.add(e,d=>{p.abort(),t?d.children.length=0:this.invokeAllPlugins(m=>{m.disposeTile&&m.disposeTile(d)}),r.inCache--,this.cachedSinceLoadComplete.has(e)&&(this.cachedSinceLoadComplete.delete(e),r.inCacheSinceLoad--),d.internal.loadingState===1?r.queued--:d.internal.loadingState===2?r.downloading--:d.internal.loadingState===3?r.parsing--:d.internal.loadingState===4&&r.loaded--,d.internal.loadingState=0,s.remove(d),a.remove(d),l.delete(d)}))return this.isLoading||(this.isLoading=!0,this.dispatchEvent({type:"tiles-load-start"})),o.setMemoryUsage(e,this.getBytesUsed(e)),this.cachedSinceLoadComplete.add(e),r.inCacheSinceLoad++,r.inCache++,r.queued++,e.internal.loadingState=1,l.add(e),a.add(i,e,d=>{if(u.aborted)return Promise.resolve();e.internal.loadingState=2,r.downloading++,r.queued--;let m=this.invokeOnePlugin(g=>g.fetchData&&g.fetchData(i,{...this.fetchOptions,signal:u}));return this.dispatchEvent({type:"tile-download-start",tile:e,url:i,get uri(){return console.warn('tile-download-start event: "uri" has been renamed to "url".'),this.url}}),m}).then(d=>{if(!u.aborted){if(!(d instanceof Response))return d;if(d.ok)return c==="json"?d.json():d.arrayBuffer();throw Error(`Failed to load model with error code ${d.status}`)}}).then(d=>{if(!u.aborted)return r.downloading--,r.parsing++,e.internal.loadingState=3,s.add(e,m=>u.aborted?Promise.resolve():c==="json"&&d.root?(this.preprocessTileset(d,i,e),e.children.push(d.root),n=d,t=!0,Promise.resolve()):this.invokeOnePlugin(g=>g.parseTile&&g.parseTile(d,m,c,i,u)))}).then(()=>{if(u.aborted)return;r.parsing--,r.loaded++,e.internal.loadingState=4,l.delete(e),o.setLoaded(e,!0);let d=this.getBytesUsed(e);if(o.getMemoryUsage(e)===0&&d>0&&o.isFull()){o.remove(e);return}o.setMemoryUsage(e,d),this.dispatchEvent({type:"needs-update"}),t&&this.dispatchEvent({type:"load-tileset",tileset:n,url:i}),e.engineData.scene&&this.dispatchEvent({type:"load-model",scene:e.engineData.scene,tile:e,url:i})}).catch(d=>{u.aborted||(d.name==="AbortError"?o.remove(e):(s.remove(e),a.remove(e),e.internal.loadingState===1?r.queued--:e.internal.loadingState===2?r.downloading--:e.internal.loadingState===3?r.parsing--:e.internal.loadingState===4&&r.loaded--,r.failed++,console.error(`TilesRenderer : Failed to load tile at url "${e.content.uri}".`),console.error(d),e.internal.loadingState=-1,l.delete(e),o.setLoaded(e,!0),this.dispatchEvent({type:"load-error",tile:e,error:d,url:i})))})}};function Ba(e){if(e===null||e.byteLength<4)return"";let t;if(t=e instanceof DataView?e:new DataView(e),String.fromCharCode(t.getUint8(0))==="{")return null;let n="";for(let i=0;i<4;i++)n+=String.fromCharCode(t.getUint8(i));return n}var fC=new TextDecoder;function sy(e){return fC.decode(e)}function _u(e){return e.replace(/[\\/][^\\/]+$/,"")+"/"}var Gs=class{constructor(){this.fetchOptions={},this.workingPath=""}loadAsync(e){return fetch(e,this.fetchOptions).then(t=>{if(!t.ok)throw Error(`Failed to load file "${e}" with status ${t.status} : ${t.statusText}`);return t.arrayBuffer()}).then(t=>(this.workingPath===""&&(this.workingPath=_u(e)),this.parse(t)))}resolveExternalURL(e){return new URL(e,this.workingPath).href}parse(e){throw Error("LoaderBase: Parse not implemented.")}};function om(e,t,n,i,r,o){let a;switch(i){case"SCALAR":a=1;break;case"VEC2":a=2;break;case"VEC3":a=3;break;case"VEC4":a=4;break;default:throw Error(`FeatureTable : Feature type not provided for "${o}".`)}let s,l=n*a;switch(r){case"BYTE":s=new Int8Array(e,t,l);break;case"UNSIGNED_BYTE":s=new Uint8Array(e,t,l);break;case"SHORT":s=new Int16Array(e,t,l);break;case"UNSIGNED_SHORT":s=new Uint16Array(e,t,l);break;case"INT":s=new Int32Array(e,t,l);break;case"UNSIGNED_INT":s=new Uint32Array(e,t,l);break;case"FLOAT":s=new Float32Array(e,t,l);break;case"DOUBLE":s=new Float64Array(e,t,l);break;default:throw Error(`FeatureTable : Feature component type not provided for "${o}".`)}return s}var ac=class{constructor(e,t,n,i){this.buffer=e,this.binOffset=t+n,this.binLength=i;let r=null;if(n!==0){let o=new Uint8Array(e,t,n);r=JSON.parse(sy(o))}else r={};this.header=r}getKeys(){return Object.keys(this.header).filter(e=>e!=="extensions")}getData(e,t,n=null,i=null){let r=this.header;if(!(e in r))return null;let o=r[e];if(!(o instanceof Object)||Array.isArray(o))return o;{let{buffer:a,binOffset:s,binLength:l}=this,c=o.byteOffset||0,p=o.type||i,u=o.componentType||n;if("type"in o&&i&&o.type!==i)throw Error("FeatureTable: Specified type does not match expected type.");let d=s+c,m=om(a,d,t,p,u,e);if(d+m.byteLength>s+l)throw Error("FeatureTable: Feature data read outside binary body length.");return m}}getBuffer(e,t){let{buffer:n,binOffset:i}=this;return n.slice(i+e,i+e+t)}},gC=class{constructor(e){this.batchTable=e;let t=e.header.extensions["3DTILES_batch_table_hierarchy"];this.classes=t.classes;for(let i of this.classes){let r=i.instances;for(let o in r)i.instances[o]=this._parseProperty(r[o],i.length,o)}if(this.instancesLength=t.instancesLength,this.classIds=this._parseProperty(t.classIds,this.instancesLength,"classIds"),t.parentCounts?this.parentCounts=this._parseProperty(t.parentCounts,this.instancesLength,"parentCounts"):this.parentCounts=Array(this.instancesLength).fill(1),t.parentIds){let i=this.parentCounts.reduce((r,o)=>r+o,0);this.parentIds=this._parseProperty(t.parentIds,i,"parentIds")}else this.parentIds=null;this.instancesIds=[];let n={};for(let i of this.classIds)n[i]=n[i]??0,this.instancesIds.push(n[i]),n[i]++}_parseProperty(e,t,n){if(Array.isArray(e))return e;{let{buffer:i,binOffset:r}=this.batchTable,o=e.byteOffset,a=e.componentType||"UNSIGNED_SHORT";return om(i,r+o,t,"SCALAR",a,n)}}getDataFromId(e,t={}){let n=this.parentCounts[e];if(this.parentIds&&n>0){let s=0;for(let l=0;l<e;l++)s+=this.parentCounts[l];for(let l=0;l<n;l++){let c=this.parentIds[s+l];c!==e&&this.getDataFromId(c,t)}}let i=this.classIds[e],r=this.classes[i].instances,o=this.classes[i].name,a=this.instancesIds[e];for(let s in r)t[o]=t[o]||{},t[o][s]=r[s][a];return t}},Mu=class extends ac{constructor(e,t,n,i,r){super(e,n,i,r),this.count=t,this.extensions={};let o=this.header.extensions;o&&o["3DTILES_batch_table_hierarchy"]&&(this.extensions["3DTILES_batch_table_hierarchy"]=new gC(this))}getDataFromId(e,t={}){if(e<0||e>=this.count)throw Error(`BatchTable: id value "${e}" out of bounds for "${this.count}" features number.`);for(let n of this.getKeys())t[n]=super.getData(n,this.count)[e];for(let n in this.extensions){let i=this.extensions[n];i.getDataFromId instanceof Function&&(t[n]=t[n]||{},i.getDataFromId(e,t[n]))}return t}getPropertyArray(e){return super.getData(e,this.count)}},am=class extends Gs{parse(e){let t=new DataView(e),n=Ba(t);console.assert(n==="b3dm");let i=t.getUint32(4,!0);console.assert(i===1);let r=t.getUint32(8,!0);console.assert(r===e.byteLength);let o=t.getUint32(12,!0),a=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getUint32(24,!0),c=new ac(e.slice(28,28+o+a),0,o,a),p=28+o+a,u=new Mu(e.slice(p,p+s+l),c.getData("BATCH_LENGTH"),0,s,l),d=p+s+l;return{version:i,featureTable:c,batchTable:u,glbBytes:new Uint8Array(e,d,r-d)}}},sm=class extends Gs{parse(e){let t=new DataView(e),n=Ba(t);console.assert(n==="i3dm");let i=t.getUint32(4,!0);console.assert(i===1);let r=t.getUint32(8,!0);console.assert(r===e.byteLength);let o=t.getUint32(12,!0),a=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getUint32(24,!0),c=t.getUint32(28,!0),p=new ac(e.slice(32,32+o+a),0,o,a),u=32+o+a,d=new Mu(e.slice(u,u+s+l),p.getData("INSTANCES_LENGTH"),0,s,l),m=u+s+l,g=new Uint8Array(e,m,r-m),v=null,M=null,w=null;if(c)v=g,M=Promise.resolve();else{let x=this.resolveExternalURL(sy(g));w=_u(x),M=fetch(x,this.fetchOptions).then(S=>{if(!S.ok)throw Error(`I3DMLoaderBase : Failed to load file "${x}" with status ${S.status} : ${S.statusText}`);return S.arrayBuffer()}).then(S=>{v=new Uint8Array(S)})}return M.then(()=>({version:i,featureTable:p,batchTable:d,glbBytes:v,gltfWorkingPath:w}))}},lm=class extends Gs{parse(e){let t=new DataView(e),n=Ba(t);console.assert(n==="pnts");let i=t.getUint32(4,!0);console.assert(i===1);let r=t.getUint32(8,!0);console.assert(r===e.byteLength);let o=t.getUint32(12,!0),a=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getUint32(24,!0),c=new ac(e.slice(28,28+o+a),0,o,a),p=28+o+a,u=new Mu(e.slice(p,p+s+l),c.getData("BATCH_LENGTH")||c.getData("POINTS_LENGTH"),0,s,l);return Promise.resolve({version:i,featureTable:c,batchTable:u})}},cm=class extends Gs{parse(e){let t=new DataView(e),n=Ba(t);console.assert(n==="cmpt",'CMPTLoader: The magic bytes equal "cmpt".');let i=t.getUint32(4,!0);console.assert(i===1,'CMPTLoader: The version listed in the header is "1".');let r=t.getUint32(8,!0);console.assert(r===e.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");let o=t.getUint32(12,!0),a=[],s=16;for(let l=0;l<o;l++){let c=new DataView(e,s,12),p=Ba(c),u=c.getUint32(4,!0),d=c.getUint32(8,!0),m=new Uint8Array(e,s,d);a.push({type:p,buffer:m,version:u}),s+=d}return{version:i,tiles:a}}};var X=require("three"),Du=require("three/addons/loaders/GLTFLoader.js"),_y=require("three/addons/utils/BufferGeometryUtils.js"),xm=class extends am{constructor(e=X.DefaultLoadingManager){super(),this.manager=e,this.adjustmentTransform=new X.Matrix4}parse(e){let t=super.parse(e),n=t.glbBytes.slice().buffer;return new Promise((i,r)=>{let o=this.manager,a=this.fetchOptions,s=o.getHandler("path.gltf")||new Du.GLTFLoader(o);a.credentials==="include"&&a.mode==="cors"&&s.setCrossOrigin("use-credentials"),"credentials"in a&&s.setWithCredentials(a.credentials==="include"),a.headers&&s.setRequestHeader(a.headers);let l=this.workingPath;!/[\\/]$/.test(l)&&l.length&&(l+="/");let c=this.adjustmentTransform;s.parse(n,l,p=>{let{batchTable:u,featureTable:d}=t,{scene:m}=p,g=d.getData("RTC_CENTER",1,"FLOAT","VEC3");g&&(m.position.x+=g[0],m.position.y+=g[1],m.position.z+=g[2]),p.scene.updateMatrix(),p.scene.matrix.multiply(c),p.scene.matrix.decompose(p.scene.position,p.scene.quaternion,p.scene.scale),p.batchTable=u,p.featureTable=d,m.batchTable=u,m.featureTable=d,i(p)},r)})}};function bC(e){let t=e>>11,n=e>>5&63,i=e&31;return[Math.round(t/31*255),Math.round(n/63*255),Math.round(i/31*255)]}var sc=new X.Vector2;function vC(e,t,n=new X.Vector3){sc.set(e,t).divideScalar(256).multiplyScalar(2).subScalar(1),n.set(sc.x,sc.y,1-Math.abs(sc.x)-Math.abs(sc.y));let i=X.MathUtils.clamp(-n.z,0,1);return n.x>=0?n.setX(n.x-i):n.setX(n.x+i),n.y>=0?n.setY(n.y-i):n.setY(n.y+i),n.normalize(),n}var ly={RGB:"color",POSITION:"position"},ym=class extends lm{constructor(e=X.DefaultLoadingManager){super(),this.manager=e}parse(e){return super.parse(e).then(async t=>{let{featureTable:n,batchTable:i}=t,r=new X.PointsMaterial,o=n.header.extensions,a=new X.Vector3,s;if(o&&o["3DTILES_draco_point_compression"]){let{byteOffset:p,byteLength:u,properties:d}=o["3DTILES_draco_point_compression"],m=this.manager.getHandler("draco.drc");if(m==null)throw Error("PNTSLoader: dracoLoader not available.");let g={};for(let w in d)if(w in ly&&w in d){let x=ly[w];g[x]=d[w]}let v={attributeIDs:g,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},M=n.getBuffer(p,u);s=await m.decodeGeometry(M,v),s.attributes.color&&(r.vertexColors=!0)}else{let p=n.getData("POINTS_LENGTH"),u=n.getData("POSITION",p,"FLOAT","VEC3"),d=n.getData("NORMAL",p,"FLOAT","VEC3"),m=n.getData("NORMAL",p,"UNSIGNED_BYTE","VEC2"),g=n.getData("RGB",p,"UNSIGNED_BYTE","VEC3"),v=n.getData("RGBA",p,"UNSIGNED_BYTE","VEC4"),M=n.getData("RGB565",p,"UNSIGNED_SHORT","SCALAR"),w=n.getData("CONSTANT_RGBA",p,"UNSIGNED_BYTE","VEC4"),x=n.getData("POSITION_QUANTIZED",p,"UNSIGNED_SHORT","VEC3"),S=n.getData("QUANTIZED_VOLUME_SCALE",p,"FLOAT","VEC3"),k=n.getData("QUANTIZED_VOLUME_OFFSET",p,"FLOAT","VEC3");if(s=new X.BufferGeometry,x){let b=new Float32Array(p*3);for(let _=0;_<p;_++)for(let y=0;y<3;y++){let h=3*_+y;b[h]=x[h]/65535*S[y]}a.x=k[0],a.y=k[1],a.z=k[2],s.setAttribute("position",new X.BufferAttribute(b,3,!1))}else s.setAttribute("position",new X.BufferAttribute(u,3,!1));if(d!==null)s.setAttribute("normal",new X.BufferAttribute(d,3,!1));else if(m!==null){let b=new Float32Array(p*3),_=new X.Vector3;for(let y=0;y<p;y++){let h=m[y*2],P=m[y*2+1],A=vC(h,P,_);b[y*3]=A.x,b[y*3+1]=A.y,b[y*3+2]=A.z}s.setAttribute("normal",new X.BufferAttribute(b,3,!1))}if(v!==null)s.setAttribute("color",new X.BufferAttribute(v,4,!0)),r.vertexColors=!0,r.transparent=!0,r.depthWrite=!1;else if(g!==null)s.setAttribute("color",new X.BufferAttribute(g,3,!0)),r.vertexColors=!0;else if(M!==null){let b=new Uint8Array(p*3);for(let _=0;_<p;_++){let y=bC(M[_]);for(let h=0;h<3;h++){let P=3*_+h;b[P]=y[h]}}s.setAttribute("color",new X.BufferAttribute(b,3,!0)),r.vertexColors=!0}else if(w!==null){r.color=new X.Color(w[0],w[1],w[2]);let b=w[3]/255;b<1&&(r.opacity=b,r.transparent=!0,r.depthWrite=!1)}}let l=new X.Points(s,r);l.position.copy(a),t.scene=l,t.scene.featureTable=n,t.scene.batchTable=i;let c=n.getData("RTC_CENTER",1,"FLOAT","VEC3");return c&&(t.scene.position.x+=c[0],t.scene.position.y+=c[1],t.scene.position.z+=c[2]),t})}};function xC(e){let{x:t,y:n,z:i}=e;e.x=i,e.y=t,e.z=n}function yC(e){return-e+Math.PI/2}var cy=new X.Spherical,Go=new X.Vector3,sr=new X.Vector3,dm=new X.Vector3,li=new X.Matrix4,Ki=new X.Matrix4,um=new X.Sphere,xr=new X.Euler,dy=new X.Vector3,uy=new X.Vector3,py=new X.Vector3,lc=new X.Vector3,Cu=new X.Ray,wC=1e-12,SC=.1;var wm=class{constructor(e=1,t=1,n=1){this.name="",this.radius=new X.Vector3(e,t,n)}intersectRay(e,t){return li.makeScale(...this.radius).invert(),um.center.set(0,0,0),um.radius=1,Cu.copy(e).applyMatrix4(li),Cu.intersectSphere(um,t)?(li.makeScale(...this.radius),t.applyMatrix4(li),t):null}getEastNorthUpFrame(e,t,n,i){return n.isMatrix4&&(i=n,n=0,console.warn('Ellipsoid: The signature for "getEastNorthUpFrame" has changed.')),this.getEastNorthUpAxes(e,t,dy,uy,py),this.getCartographicToPosition(e,t,n,lc),i.makeBasis(dy,uy,py).setPosition(lc)}getOrientedEastNorthUpFrame(e,t,n,i,r,o,a){return this.getObjectFrame(e,t,n,i,r,o,a,0)}getObjectFrame(e,t,n,i,r,o,a,s=2){return this.getEastNorthUpFrame(e,t,n,li),xr.set(r,o,-i,"ZXY"),a.makeRotationFromEuler(xr).premultiply(li),s===1?(xr.set(Math.PI/2,0,0,"XYZ"),Ki.makeRotationFromEuler(xr),a.multiply(Ki)):s===2&&(xr.set(-Math.PI/2,0,Math.PI,"XYZ"),Ki.makeRotationFromEuler(xr),a.multiply(Ki)),a}getCartographicFromObjectFrame(e,t,n=2){return n===1?(xr.set(-Math.PI/2,0,0,"XYZ"),Ki.makeRotationFromEuler(xr).premultiply(e)):n===2?(xr.set(-Math.PI/2,0,Math.PI,"XYZ"),Ki.makeRotationFromEuler(xr).premultiply(e)):Ki.copy(e),lc.setFromMatrixPosition(Ki),this.getPositionToCartographic(lc,t),this.getEastNorthUpFrame(t.lat,t.lon,0,li).invert(),Ki.premultiply(li),xr.setFromRotationMatrix(Ki,"ZXY"),t.azimuth=-xr.z,t.elevation=xr.x,t.roll=xr.y,t}getEastNorthUpAxes(e,t,n,i,r,o=lc){this.getCartographicToPosition(e,t,0,o),this.getCartographicToNormal(e,t,r),n.set(-o.y,o.x,0).normalize(),i.crossVectors(r,n).normalize()}getCartographicToPosition(e,t,n,i){this.getCartographicToNormal(e,t,Go);let r=this.radius;sr.copy(Go),sr.x*=r.x**2,sr.y*=r.y**2,sr.z*=r.z**2;let o=Math.sqrt(Go.dot(sr));return sr.divideScalar(o),i.copy(sr).addScaledVector(Go,n)}getPositionToCartographic(e,t){this.getPositionToSurfacePoint(e,sr),this.getPositionToNormal(sr,Go);let n=dm.subVectors(e,sr);return t.lon=Math.atan2(Go.y,Go.x),t.lat=Math.asin(Go.z),t.height=Math.sign(n.dot(e))*n.length(),t}getCartographicToNormal(e,t,n){return cy.set(1,yC(e),t),n.setFromSpherical(cy).normalize(),xC(n),n}getPositionToNormal(e,t){let n=this.radius;return t.copy(e),t.x/=n.x**2,t.y/=n.y**2,t.z/=n.z**2,t.normalize(),t}getPositionToSurfacePoint(e,t){let n=this.radius,i=1/n.x**2,r=1/n.y**2,o=1/n.z**2,a=e.x*e.x*i,s=e.y*e.y*r,l=e.z*e.z*o,c=a+s+l,p=Math.sqrt(1/c),u=sr.copy(e).multiplyScalar(p);if(c<SC)return isFinite(p)?t.copy(u):null;let d=dm.set(u.x*i*2,u.y*r*2,u.z*o*2),m=(1-p)*e.length()/(.5*d.length()),g=0,v,M,w,x,S,k,b,_,y,h,P;do{m-=g,w=1/(1+m*i),x=1/(1+m*r),S=1/(1+m*o),k=w*w,b=x*x,_=S*S,y=k*w,h=b*x,P=_*S,v=a*k+s*b+l*_-1,M=a*y*i+s*h*r+l*P*o;let A=-2*M;g=v/A}while(Math.abs(v)>wC);return t.set(e.x*w,e.y*x,e.z*S)}calculateHorizonDistance(e,t){let n=this.calculateEffectiveRadius(e);return Math.sqrt(2*n*t+t**2)}calculateEffectiveRadius(e){let t=this.radius.x,n=1-this.radius.z**2/t**2,i=e*X.MathUtils.DEG2RAD,r=Math.sin(i)**2;return t/Math.sqrt(1-n*r)}getPositionElevation(e){this.getPositionToSurfacePoint(e,sr);let t=dm.subVectors(e,sr);return Math.sign(t.dot(e))*t.length()}closestPointToRayEstimate(e,t){return this.intersectRay(e,t)?t:(li.makeScale(...this.radius).invert(),Cu.copy(e).applyMatrix4(li),sr.set(0,0,0),Cu.closestPointToPoint(sr,t).normalize(),li.makeScale(...this.radius),t.applyMatrix4(li))}copy(e){return this.radius.copy(e.radius),this}clone(){return new this.constructor().copy(this)}},hc=new wm(Oa,Oa,nm);hc.name="WGS84 Earth";var Tu=new X.Vector3,Ws=new X.Vector3,Xs=new X.Vector3,pm=new X.Vector3,Pu=new X.Quaternion,Au=new X.Vector3,qs=new X.Matrix4,hy=new X.Matrix4,my=new X.Vector3,fy=new X.Matrix4,hm=new X.Quaternion,mm={};function gy(e,t,n,i){if(e=e/n*2-1,t=t/n*2-1,i.x=e,i.y=t,i.z=1-Math.abs(e)-Math.abs(t),i.z<0){let r=i.x;i.x=(1-Math.abs(i.y))*(r>=0?1:-1),i.y=(1-Math.abs(r))*(i.y>=0?1:-1)}return i.normalize(),i}var Sm=class extends sm{constructor(e=X.DefaultLoadingManager){super(),this.manager=e,this.adjustmentTransform=new X.Matrix4,this.ellipsoid=hc.clone()}resolveExternalURL(e){return this.manager.resolveURL(super.resolveExternalURL(e))}parse(e){return super.parse(e).then(t=>{let{featureTable:n,batchTable:i}=t,r=t.glbBytes.slice().buffer;return new Promise((o,a)=>{let s=this.fetchOptions,l=this.manager,c=l.getHandler("path.gltf")||new Du.GLTFLoader(l);s.credentials==="include"&&s.mode==="cors"&&c.setCrossOrigin("use-credentials"),"credentials"in s&&c.setWithCredentials(s.credentials==="include"),s.headers&&c.setRequestHeader(s.headers);let p=t.gltfWorkingPath??this.workingPath;/[\\/]$/.test(p)||(p+="/");let u=this.adjustmentTransform;c.parse(r,p,d=>{let m=n.getData("INSTANCES_LENGTH"),g=n.getData("POSITION",m,"FLOAT","VEC3"),v=n.getData("POSITION_QUANTIZED",m,"UNSIGNED_SHORT","VEC3"),M=n.getData("QUANTIZED_VOLUME_OFFSET",1,"FLOAT","VEC3"),w=n.getData("QUANTIZED_VOLUME_SCALE",1,"FLOAT","VEC3"),x=n.getData("NORMAL_UP",m,"FLOAT","VEC3"),S=n.getData("NORMAL_RIGHT",m,"FLOAT","VEC3"),k=n.getData("NORMAL_UP_OCT32P",m,"UNSIGNED_SHORT","VEC2"),b=n.getData("NORMAL_RIGHT_OCT32P",m,"UNSIGNED_SHORT","VEC2"),_=n.getData("SCALE_NON_UNIFORM",m,"FLOAT","VEC3"),y=n.getData("SCALE",m,"FLOAT","SCALAR"),h=n.getData("RTC_CENTER",1,"FLOAT","VEC3"),P=n.getData("EAST_NORTH_UP");if(!g&&v){g=new Float32Array(m*3);for(let B=0;B<m;B++)g[B*3+0]=M[0]+v[B*3+0]/65535*w[0],g[B*3+1]=M[1]+v[B*3+1]/65535*w[1],g[B*3+2]=M[2]+v[B*3+2]/65535*w[2]}let A=new X.Vector3;for(let B=0;B<m;B++)A.x+=g[B*3+0]/m,A.y+=g[B*3+1]/m,A.z+=g[B*3+2]/m;let C=[],D=[];d.scene.updateMatrixWorld(),d.scene.traverse(B=>{if(B.isMesh){D.push(B);let{geometry:j,material:W}=B,U=new X.InstancedMesh(j,W,m);U.position.copy(A),h&&(U.position.x+=h[0],U.position.y+=h[1],U.position.z+=h[2]),C.push(U)}});for(let B=0;B<m;B++){pm.set(g[B*3+0]-A.x,g[B*3+1]-A.y,g[B*3+2]-A.z),Pu.identity(),x&&S?(Ws.set(x[B*3+0],x[B*3+1],x[B*3+2]),Xs.set(S[B*3+0],S[B*3+1],S[B*3+2]),Tu.crossVectors(Xs,Ws).normalize(),qs.makeBasis(Xs,Ws,Tu),Pu.setFromRotationMatrix(qs)):k&&b&&(gy(k[B*2+0],k[B*2+1],65535,Ws),gy(b[B*2+0],b[B*2+1],65535,Xs),Tu.crossVectors(Xs,Ws).normalize(),qs.makeBasis(Xs,Ws,Tu),Pu.setFromRotationMatrix(qs)),Au.set(1,1,1),_&&Au.set(_[B*3+0],_[B*3+1],_[B*3+2]),y&&Au.multiplyScalar(y[B]);for(let j=0,W=C.length;j<W;j++){let U=C[j];hm.copy(Pu),P&&(U.updateMatrixWorld(),my.copy(pm).applyMatrix4(U.matrixWorld),this.ellipsoid.getPositionToCartographic(my,mm),this.ellipsoid.getEastNorthUpFrame(mm.lat,mm.lon,fy),hm.setFromRotationMatrix(fy)),qs.compose(pm,hm,Au).multiply(u);let te=D[j];hy.multiplyMatrices(qs,te.matrixWorld),U.setMatrixAt(B,hy)}}d.scene.clear(),d.scene.add(...C),d.batchTable=i,d.featureTable=n,d.scene.batchTable=i,d.scene.featureTable=n,o(d)},a)})})}},My=class extends cm{constructor(e=X.DefaultLoadingManager){super(),this.manager=e,this.adjustmentTransform=new X.Matrix4,this.ellipsoid=hc.clone()}parse(e){let t=super.parse(e),{manager:n,ellipsoid:i,adjustmentTransform:r}=this,o=[];for(let a in t.tiles){let{type:s,buffer:l}=t.tiles[a];switch(s){case"b3dm":{let c=l.slice(),p=new xm(n);p.workingPath=this.workingPath,p.fetchOptions=this.fetchOptions,p.adjustmentTransform.copy(r);let u=p.parse(c.buffer);o.push(u);break}case"pnts":{let c=l.slice(),p=new ym(n);p.workingPath=this.workingPath,p.fetchOptions=this.fetchOptions;let u=p.parse(c.buffer);o.push(u);break}case"i3dm":{let c=l.slice(),p=new Sm(n);p.workingPath=this.workingPath,p.fetchOptions=this.fetchOptions,p.ellipsoid.copy(i),p.adjustmentTransform.copy(r);let u=p.parse(c.buffer);o.push(u);break}}}return Promise.all(o).then(a=>{let s=new X.Group;return a.forEach(l=>{s.add(l.scene)}),{tiles:a,scene:s}})}},cc=new X.Matrix4,_C=class extends X.Group{constructor(e){super(),this.isTilesGroup=!0,this.name="TilesRenderer.TilesGroup",this.tilesRenderer=e,this.matrixWorldInverse=new X.Matrix4}raycast(e,t){return this.tilesRenderer.raycast(e,t),!1}updateMatrixWorld(e){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||e){this.parent===null?cc.copy(this.matrix):cc.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;let t=cc.elements,n=this.matrixWorld.elements,i=!1;for(let r=0;r<16;r++){let o=t[r],a=n[r];if(Math.abs(o-a)>2**-52){i=!0;break}}if(i){this.matrixWorld.copy(cc),this.matrixWorldInverse.copy(cc).invert();let r=this.children;for(let l=0,c=r.length;l<c;l++)r[l].updateMatrixWorld();let{tilesRenderer:o}=this,{activeTiles:a,visibleTiles:s}=o;a.forEach(l=>{s.has(l)||l.engineData.scene.updateMatrixWorld(!0)})}}}updateWorldMatrix(e,t){this.parent&&e&&this.parent.updateWorldMatrix(e,!1),this.updateMatrixWorld(!0)}},MC=new X.Ray;function CC(e,t,n,i){let{scene:r}=e.engineData;n.invokeOnePlugin(o=>o.raycastTile&&o.raycastTile(e,r,t,i))||t.intersectObject(r,!0,i)}function TC(e){return"traversal"in e}function Cy(e,t,n,i,r=null){if(!TC(t))return;let{group:o,activeTiles:a}=e,{boundingVolume:s}=t.engineData;if(r===null&&(r=MC,r.copy(n.ray).applyMatrix4(o.matrixWorldInverse)),!t.traversal.used||!s.intersectsRay(r))return;a.has(t)&&CC(t,n,e,i);let l=t.children;for(let c=0,p=l.length;c<p;c++)Cy(e,l[c],n,i,r)}var Eu=new X.Vector3,Ru=new X.Vector3,yr=new X.Vector3,ku=new X.Ray,bm=class{constructor(e=new X.Box3,t=new X.Matrix4){this.box=e.clone(),this.transform=t.clone(),this.inverseTransform=new X.Matrix4,this.points=Array(8).fill().map(()=>new X.Vector3),this.planes=[,,,,,,].fill().map(()=>new X.Plane)}copy(e){return this.box.copy(e.box),this.transform.copy(e.transform),this.update(),this}clone(){return new this.constructor().copy(this)}clampPoint(e,t){return t.copy(e).applyMatrix4(this.inverseTransform).clamp(this.box.min,this.box.max).applyMatrix4(this.transform)}distanceToPoint(e){return this.clampPoint(e,yr).distanceTo(e)}containsPoint(e){return yr.copy(e).applyMatrix4(this.inverseTransform),this.box.containsPoint(yr)}intersectsRay(e){return ku.copy(e).applyMatrix4(this.inverseTransform),ku.intersectsBox(this.box)}intersectRay(e,t){return ku.copy(e).applyMatrix4(this.inverseTransform),ku.intersectBox(this.box,t)?(t.applyMatrix4(this.transform),t):null}update(){let{points:e,inverseTransform:t,transform:n,box:i}=this;t.copy(n).invert();let{min:r,max:o}=i,a=0;for(let s=-1;s<=1;s+=2)for(let l=-1;l<=1;l+=2)for(let c=-1;c<=1;c+=2)e[a].set(s<0?r.x:o.x,l<0?r.y:o.y,c<0?r.z:o.z).applyMatrix4(n),a++;this.updatePlanes()}updatePlanes(){Eu.copy(this.box.min).applyMatrix4(this.transform),Ru.copy(this.box.max).applyMatrix4(this.transform),yr.set(0,0,1).transformDirection(this.transform),this.planes[0].setFromNormalAndCoplanarPoint(yr,Eu),this.planes[1].setFromNormalAndCoplanarPoint(yr,Ru).negate(),yr.set(0,1,0).transformDirection(this.transform),this.planes[2].setFromNormalAndCoplanarPoint(yr,Eu),this.planes[3].setFromNormalAndCoplanarPoint(yr,Ru).negate(),yr.set(1,0,0).transformDirection(this.transform),this.planes[4].setFromNormalAndCoplanarPoint(yr,Eu),this.planes[5].setFromNormalAndCoplanarPoint(yr,Ru).negate()}intersectsSphere(e){return this.clampPoint(e.center,yr),yr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsFrustum(e){return this._intersectsPlaneShape(e.planes,e.points)}intersectsOBB(e){return this._intersectsPlaneShape(e.planes,e.points)}_intersectsPlaneShape(e,t){let n=this.points,i=this.planes;for(let r=0;r<6;r++){let o=e[r],a=-1/0;for(let s=0;s<8;s++){let l=n[s],c=o.distanceToPoint(l);a=a<c?c:a}if(a<0)return!1}for(let r=0;r<6;r++){let o=i[r],a=-1/0;for(let s=0;s<8;s++){let l=t[s],c=o.distanceToPoint(l);a=a<c?c:a}if(a<0)return!1}return!0}},pc=Math.PI,fm=pc/2,dc=new X.Vector3,Ia=new X.Vector3,ki=new X.Vector3,Ne=new X.Vector3,lr=new X.Matrix4,PC=new X.Box3,by=new X.Matrix4;function Wo(e,t){t.radius=Math.max(t.radius,e.distanceToSquared(t.center))}function vy(e){return e.x!==e.y}var Ty=class extends wm{constructor(e=1,t=1,n=1,i=-fm,r=fm,o=0,a=2*pc,s=0,l=0){super(e,t,n),this.latStart=i,this.latEnd=r,this.lonStart=o,this.lonEnd=a,this.heightStart=s,this.heightEnd=l}getBoundingBox(e,t){vy(this.radius)&&console.warn("EllipsoidRegion: Triaxial ellipsoids are not supported.");let{latStart:n,latEnd:i,lonStart:r,lonEnd:o,heightStart:a,heightEnd:s}=this,l=(n+i)*.5,c=(r+o)*.5,p=n>0,u=i<0,d;d=p?n:u?i:0;let{min:m,max:g}=e;m.setScalar(1/0),g.setScalar(-1/0),o-r<=pc?(this.getCartographicToNormal(l,c,ki),Ia.set(0,0,1),dc.crossVectors(Ia,ki).normalize(),Ia.crossVectors(ki,dc).normalize(),t.makeBasis(dc,Ia,ki),lr.copy(t).invert(),this.getCartographicToPosition(d,r,s,Ne).applyMatrix4(lr),g.x=Math.abs(Ne.x),m.x=-g.x,this.getCartographicToPosition(i,r,s,Ne).applyMatrix4(lr),g.y=Ne.y,this.getCartographicToPosition(i,c,s,Ne).applyMatrix4(lr),g.y=Math.max(Ne.y,g.y),this.getCartographicToPosition(n,r,s,Ne).applyMatrix4(lr),m.y=Ne.y,this.getCartographicToPosition(n,c,s,Ne).applyMatrix4(lr),m.y=Math.min(Ne.y,m.y),this.getCartographicToPosition(l,c,s,Ne).applyMatrix4(lr),g.z=Ne.z,this.getCartographicToPosition(n,r,a,Ne).applyMatrix4(lr),m.z=Ne.z,this.getCartographicToPosition(i,r,a,Ne).applyMatrix4(lr),m.z=Math.min(Ne.z,m.z)):(this.getCartographicToPosition(d,c,s,ki),ki.z=0,ki.length()<1e-10?ki.set(1,0,0):ki.normalize(),Ia.set(0,0,1),dc.crossVectors(ki,Ia).normalize(),t.makeBasis(dc,Ia,ki),lr.copy(t).invert(),this.getCartographicToPosition(d,c+fm,s,Ne).applyMatrix4(lr),g.x=Math.abs(Ne.x),m.x=-g.x,this.getCartographicToPosition(i,0,u?a:s,Ne).applyMatrix4(lr),g.y=Ne.y,this.getCartographicToPosition(n,0,p?a:s,Ne).applyMatrix4(lr),m.y=Ne.y,this.getCartographicToPosition(d,c,s,Ne).applyMatrix4(lr),g.z=Ne.z,this.getCartographicToPosition(d,o,s,Ne).applyMatrix4(lr),m.z=Ne.z),e.getCenter(Ne),e.min.sub(Ne).multiplyScalar(1.0000000000001),e.max.sub(Ne).multiplyScalar(1.0000000000001),Ne.applyMatrix4(t),t.setPosition(Ne)}getBoundingSphere(e){vy(this.radius)&&console.warn("EllipsoidRegion: Triaxial ellipsoids are not supported."),this.getBoundingBox(PC,by),e.center.setFromMatrixPosition(by),e.radius=0;let{latStart:t,latEnd:n,lonStart:i,lonEnd:r,heightStart:o,heightEnd:a}=this,s=(t+n)*.5,l=(i+r)*.5,c=t>0,p=n<0,u;u=c?t:p?n:0,this.getCartographicToPosition(u,i,a,Ne),Wo(Ne,e),this.getCartographicToPosition(n,i,a,Ne),Wo(Ne,e),this.getCartographicToPosition(n,l,a,Ne),Wo(Ne,e),this.getCartographicToPosition(t,i,a,Ne),Wo(Ne,e),this.getCartographicToPosition(t,l,a,Ne),Wo(Ne,e),this.getCartographicToPosition(s,l,a,Ne),Wo(Ne,e),this.getCartographicToPosition(t,i,o,Ne),Wo(Ne,e),r-i>pc&&(this.getCartographicToPosition(u,l+pc,a,Ne),Wo(Ne,e)),e.radius=Math.sqrt(e.radius)*1.0000000000001}},go=new X.Vector3,bo=new X.Vector3,vo=new X.Vector3,xy=new X.Vector3,yy=new X.Vector3,AC=class{constructor(){this.sphere=null,this.obb=null,this.region=null,this.regionObb=null}intersectsRay(e){let t=this.sphere,n=this.obb||this.regionObb;return!(t&&!e.intersectsSphere(t)||n&&!n.intersectsRay(e))}intersectRay(e,t=null){let n=this.sphere,i=this.obb||this.regionObb,r=-1/0,o=-1/0;n&&e.intersectSphere(n,xy)&&(r=n.containsPoint(e.origin)?0:e.origin.distanceToSquared(xy)),i&&i.intersectRay(e,yy)&&(o=i.containsPoint(e.origin)?0:e.origin.distanceToSquared(yy));let a=Math.max(r,o);return a===-1/0?null:(e.at(Math.sqrt(a),t),t)}distanceToPoint(e){let t=this.sphere,n=this.obb||this.regionObb,i=-1/0,r=-1/0;return t&&(i=Math.max(t.distanceToPoint(e),0)),n&&(r=n.distanceToPoint(e)),i>r?i:r}intersectsFrustum(e){let t=this.obb||this.regionObb,n=this.sphere;return n&&!e.intersectsSphere(n)||t&&!t.intersectsFrustum(e)?!1:!!(n||t)}intersectsSphere(e){let t=this.obb||this.regionObb,n=this.sphere;return n&&!n.intersectsSphere(e)||t&&!t.intersectsSphere(e)?!1:!!(n||t)}intersectsOBB(e){let t=this.obb||this.regionObb,n=this.sphere;return n&&!e.intersectsSphere(n)||t&&!t.intersectsOBB(e)?!1:!!(n||t)}getOBB(e,t){let n=this.obb||this.regionObb;n?(e.copy(n.box),t.copy(n.transform)):(this.getAABB(e),t.identity())}getAABB(e){if(this.sphere)this.sphere.getBoundingBox(e);else{let t=this.obb||this.regionObb;e.copy(t.box).applyMatrix4(t.transform)}}getSphere(e){if(this.sphere)e.copy(this.sphere);else if(this.region)this.region.getBoundingSphere(e);else{let t=this.obb||this.regionObb;t.box.getBoundingSphere(e),e.applyMatrix4(t.transform)}}setObbData(e,t){let n=new bm;go.set(e[3],e[4],e[5]),bo.set(e[6],e[7],e[8]),vo.set(e[9],e[10],e[11]);let i=go.length(),r=bo.length(),o=vo.length();go.normalize(),bo.normalize(),vo.normalize(),i===0&&go.crossVectors(bo,vo),r===0&&bo.crossVectors(go,vo),o===0&&vo.crossVectors(go,bo),n.transform.set(go.x,bo.x,vo.x,e[0],go.y,bo.y,vo.y,e[1],go.z,bo.z,vo.z,e[2],0,0,0,1).premultiply(t),n.box.min.set(-i,-r,-o),n.box.max.set(i,r,o),n.update(),this.obb=n}setSphereData(e,t,n,i,r){let o=new X.Sphere;o.center.set(e,t,n),o.radius=i,o.applyMatrix4(r),this.sphere=o}setRegionData(e,t,n,i,r,o,a){let s=new Ty(...e.radius,n,r,t,i,o,a),l=new bm;s.getBoundingBox(l.box,l.transform),l.update(),this.region=s,this.regionObb=l}},EC=new X.Matrix3;function RC(e,t,n,i){let r=EC.set(e.normal.x,e.normal.y,e.normal.z,t.normal.x,t.normal.y,t.normal.z,n.normal.x,n.normal.y,n.normal.z);return i.set(-e.constant,-t.constant,-n.constant),i.applyMatrix3(r.invert()),i}var kC=class extends X.Frustum{constructor(){super(),this.points=Array(8).fill().map(()=>new X.Vector3)}setFromProjectionMatrix(...e){return super.setFromProjectionMatrix(...e),this.calculateFrustumPoints(),this}calculateFrustumPoints(){let{planes:e,points:t}=this;[[e[0],e[3],e[4]],[e[1],e[3],e[4]],[e[0],e[2],e[4]],[e[1],e[2],e[4]],[e[0],e[3],e[5]],[e[1],e[3],e[5]],[e[0],e[2],e[5]],[e[1],e[2],e[5]]].forEach((n,i)=>{RC(n[0],n[1],n[2],t[i])})}};var vm=0;function wy(e,t,n,i){try{return X.TextureUtils.getByteLength(e,t,n,i)}catch{return vm}}function LC(e){if(!e)return 0;if(e.isExternalTexture)return e.userData?.byteLength??vm;let{format:t,type:n,image:i,mipmaps:r}=e;if(e.isCompressedTexture&&Array.isArray(r)&&r.length>0){let a=0;for(let s of r)s?.data?.byteLength?a+=s.data.byteLength:a+=wy(s.width,s.height,t,n);return a}if(!i)return vm;let o=wy(i.width,i.height,t,n);return o*=e.generateMipmaps?4/3:1,o}function DC(e){let t=new Set,n=0;return e.traverse(i=>{if(i.geometry&&!t.has(i.geometry)&&(n+=(0,_y.estimateBytesUsed)(i.geometry),t.add(i.geometry)),i.material){let r=i.material;for(let o in r){let a=r[o];a&&a.isTexture&&!t.has(a)&&(n+=LC(a),t.add(a))}}}),n}var Py=Symbol("INITIAL_FRUSTUM_CULLED"),Lu=new X.Matrix4,uc=new X.Vector3,gm=new X.Vector2,NC=new X.Vector3(1,0,0),BC=new X.Vector3(0,1,0),OC=()=>null;function Sy(e,t){e.traverse(n=>{n.frustumCulled=n[Py]&&t})}var _m=class extends im{get autoDisableRendererCulling(){return this._autoDisableRendererCulling}set autoDisableRendererCulling(e){this._autoDisableRendererCulling!==e&&(super._autoDisableRendererCulling=e,this.forEachLoadedModel(t=>{Sy(t,!e)}))}constructor(...e){super(...e),this.accelerateRaycast=!0,this.group=new _C(this),this.ellipsoid=hc.clone(),this.cameras=[],this.cameraMap=new Map,this.cameraInfo=[],this._upRotationMatrix=new X.Matrix4,this._bytesUsed=new WeakMap,this._autoDisableRendererCulling=!0,this.manager=new X.LoadingManager,this._listeners={}}addEventListener(e,t){X.EventDispatcher.prototype.addEventListener.call(this,e,t)}hasEventListener(e,t){return X.EventDispatcher.prototype.hasEventListener.call(this,e,t)}removeEventListener(e,t){X.EventDispatcher.prototype.removeEventListener.call(this,e,t)}dispatchEvent(e){X.EventDispatcher.prototype.dispatchEvent.call(this,e)}getBoundingBox(e){if(!this.root)return!1;let t=this.root.engineData.boundingVolume;return t?(t.getAABB(e),!0):!1}getOrientedBoundingBox(e,t){if(!this.root)return!1;let n=this.root.engineData.boundingVolume;return n?(n.getOBB(e,t),!0):!1}getBoundingSphere(e){if(!this.root)return!1;let t=this.root.engineData.boundingVolume;return t?(t.getSphere(e),!0):!1}forEachLoadedModel(e){this.traverse(t=>{let n=t.engineData&&t.engineData.scene;n&&e(n,t)},null,!1)}raycast(e,t){if(this.root)if(this.accelerateRaycast)Cy(this,this.root,e,t);else{let n=e.firstHitOnly?[]:t;for(let i of this.activeTiles){let{scene:r}=i.engineData;this.invokeOnePlugin(o=>o.raycastTile&&o.raycastTile(i,r,e,n))||e.intersectObject(r,!0,n)}e.firstHitOnly&&n.length>0&&(n.sort((i,r)=>i.distance-r.distance),t.push(n[0]))}}hasCamera(e){return this.cameraMap.has(e)}setCamera(e){let t=this.cameras,n=this.cameraMap;return n.has(e)?!1:(n.set(e,new X.Vector2),t.push(e),this.dispatchEvent({type:"add-camera",camera:e}),!0)}setResolution(e,t,n){let i=this.cameraMap;if(!i.has(e))return!1;let r=t.isVector2?t.x:t,o=t.isVector2?t.y:n,a=i.get(e);return(a.width!==r||a.height!==o)&&(a.set(r,o),this.dispatchEvent({type:"camera-resolution-change"})),!0}getResolution(e,t){let n=this.cameraMap.get(e);return n?t.copy(n):null}setResolutionFromRenderer(e,t){return t.getSize(gm),this.setResolution(e,gm.x,gm.y)}deleteCamera(e){let t=this.cameras,n=this.cameraMap;if(n.has(e)){let i=t.indexOf(e);return t.splice(i,1),n.delete(e),this.dispatchEvent({type:"delete-camera",camera:e}),!0}return!1}loadRootTileset(...e){return super.loadRootTileset(...e).then(t=>{let{asset:n,extensions:i={}}=t;switch((n&&n.gltfUpAxis||"y").toLowerCase()){case"x":this._upRotationMatrix.makeRotationAxis(BC,-Math.PI/2);break;case"y":this._upRotationMatrix.makeRotationAxis(NC,Math.PI/2);break}if("3DTILES_ellipsoid"in i){let r=i["3DTILES_ellipsoid"],{ellipsoid:o}=this;o.name=r.body,r.radii?o.radius.set(...r.radii):o.radius.set(1,1,1)}return t})}prepareForTraversal(){let e=this.group,t=this.cameras,n=this.cameraMap,i=this.cameraInfo;for(;i.length>t.length;)i.pop();for(;i.length<t.length;)i.push({frustum:new kC,isOrthographic:!1,sseDenominator:-1,position:new X.Vector3,invScale:-1,pixelSize:0});uc.setFromMatrixScale(e.matrixWorldInverse),Math.abs(Math.max(uc.x-uc.y,uc.x-uc.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(let r=0,o=i.length;r<o;r++){let a=t[r],s=i[r],l=s.frustum,c=s.position,p=n.get(a);(p.width===0||p.height===0)&&console.warn("TilesRenderer: resolution for camera error calculation is not set.");let u=a.projectionMatrix.elements;if(s.isOrthographic=u[15]===1,s.isOrthographic){let d=2/u[0],m=2/u[5];s.pixelSize=Math.max(m/p.height,d/p.width)}else s.sseDenominator=2/u[5]/p.height;Lu.copy(e.matrixWorld),Lu.premultiply(a.matrixWorldInverse),Lu.premultiply(a.projectionMatrix),l.setFromProjectionMatrix(Lu,a.coordinateSystem,a.reversedDepth),c.set(0,0,0),c.applyMatrix4(a.matrixWorld),c.applyMatrix4(e.matrixWorldInverse)}}update(){if(super.update(),this.cameras.length===0&&this.root){let e=!1;this.invokeAllPlugins(t=>e||(e=!!(t!==this&&t.calculateTileViewError))),e===!1&&console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}}preprocessNode(e,t,n=null){super.preprocessNode(e,t,n);let i=new X.Matrix4;if(e.transform){let a=e.transform;for(let s=0;s<16;s++)i.elements[s]=a[s]}n&&i.premultiply(n.engineData.transform);let r=new X.Matrix4().copy(i).invert(),o=new AC;"sphere"in e.boundingVolume&&o.setSphereData(...e.boundingVolume.sphere,i),"box"in e.boundingVolume&&o.setObbData(e.boundingVolume.box,i),"region"in e.boundingVolume&&o.setRegionData(this.ellipsoid,...e.boundingVolume.region),e.engineData.transform=i,e.engineData.transformInverse=r,e.engineData.boundingVolume=o,e.engineData.geometry=null,e.engineData.materials=null,e.engineData.textures=null,e.toJSON=OC}async parseTile(e,t,n,i,r){let o=t.engineData,a=_u(i),s=this.fetchOptions,l=this.manager,c=null,p=o.transform,u=this._upRotationMatrix,d=(Ba(e)||n).toLowerCase();switch(d){case"b3dm":{let S=new xm(l);S.workingPath=a,S.fetchOptions=s,S.adjustmentTransform.copy(u),c=S.parse(e);break}case"pnts":{let S=new ym(l);S.workingPath=a,S.fetchOptions=s,c=S.parse(e);break}case"i3dm":{let S=new Sm(l);S.workingPath=a,S.fetchOptions=s,S.adjustmentTransform.copy(u),S.ellipsoid.copy(this.ellipsoid),c=S.parse(e);break}case"cmpt":{let S=new My(l);S.workingPath=a,S.fetchOptions=s,S.adjustmentTransform.copy(u),S.ellipsoid.copy(this.ellipsoid),c=S.parse(e).then(k=>k.scene);break}case"gltf":case"glb":{let S=l.getHandler("path.gltf")||l.getHandler("path.glb")||new Du.GLTFLoader(l);S.setWithCredentials(s.credentials==="include"),S.setRequestHeader(s.headers||{}),s.credentials==="include"&&s.mode==="cors"&&S.setCrossOrigin("use-credentials");let k=S.resourcePath||S.path||a;!/[\\/]$/.test(k)&&k.length&&(k+="/"),c=S.parseAsync(e,k).then(b=>{b.scene=b.scene||new X.Group;let{scene:_}=b;return _.updateMatrix(),_.matrix.multiply(u).decompose(_.position,_.quaternion,_.scale),b});break}default:c=this.invokeOnePlugin(S=>S.parseToMesh&&S.parseToMesh(e,t,n,i,r));break}let m=await c;if(m===null)throw Error(`TilesRenderer: Content type "${d}" not supported.`);let g,v;m.isObject3D?(g=m,v=null):(g=m.scene,v=m),g.updateMatrix(),g.matrix.premultiply(p),g.matrix.decompose(g.position,g.quaternion,g.scale),await this.invokeAllPlugins(S=>S.processTileModel&&S.processTileModel(g,t)),g.traverse(S=>{S[Py]=S.frustumCulled,S.userData.tile=t}),Sy(g,!this.autoDisableRendererCulling);let M=[],w=[],x=[];if(g.traverse(S=>{if(S.geometry&&w.push(S.geometry),S.material){let k=S.material;M.push(S.material);for(let b in k){let _=k[b];_&&_.isTexture&&x.push(_)}}}),r.aborted){for(let S=0,k=x.length;S<k;S++){let b=x[S];b.image instanceof ImageBitmap&&b.image.close(),b.dispose()}return}o.materials=M,o.geometry=w,o.textures=x,o.scene=g,o.metadata=v}disposeTile(e){super.disposeTile(e);let t=e.engineData;if(t.scene){let n=t.materials,i=t.geometry,r=t.textures,o=t.scene.parent;t.scene.traverse(a=>{a.userData.meshFeatures&&a.userData.meshFeatures.dispose(),a.userData.structuralMetadata&&a.userData.structuralMetadata.dispose()});for(let a=0,s=i.length;a<s;a++)i[a].dispose();for(let a=0,s=n.length;a<s;a++)n[a].dispose();for(let a=0,s=r.length;a<s;a++){let l=r[a];l.image instanceof ImageBitmap&&l.image.close(),l.dispose()}o&&o.remove(t.scene),t.scene=null,t.materials=null,t.textures=null,t.geometry=null,t.metadata=null}}setTileActive(e,t){super.setTileActive(e,t);let n=e.engineData.scene;n&&(t?(n.parent=this.group,n.updateMatrixWorld(!0)):n.parent=null)}setTileVisible(e,t){let n=e.engineData.scene,{activeTiles:i,group:r}=this;n&&(t?r.add(n):(r.remove(n),i.has(e)&&(n.parent=r))),super.setTileVisible(e,t)}calculateBytesUsed(e,t){let n=this._bytesUsed;return!n.has(e)&&t&&n.set(e,DC(t)),n.get(e)??null}calculateTileViewError(e,t){let n=e.engineData,i=this.cameras,r=this.cameraInfo,o=n.boundingVolume,a=!1,s=0,l=1/0,c=0,p=1/0;for(let u=0,d=i.length;u<d;u++){let m=r[u],g,v;if(m.isOrthographic){let w=m.pixelSize;g=e.geometricError/w,v=1/0}else{let w=m.sseDenominator;v=o.distanceToPoint(m.position),g=v===0?1/0:e.geometricError/(v*w)}let M=r[u].frustum;o.intersectsFrustum(M)&&(a=!0,s=Math.max(s,g),l=Math.min(l,v)),c=Math.max(c,g),p=Math.min(p,v)}a?(t.inView=!0,t.error=s,t.distanceFromCamera=l):(t.inView=!1,t.error=c,t.distanceFromCamera=p)}dispose(){super.dispose(),this.group.removeFromParent()}};var re=require("three"),jy=require("three/addons/loaders/GLTFLoader.js"),Tm=require("three/addons/postprocessing/Pass.js");var jk=Object.freeze({fill:"#cccccc",stroke:"transparent",strokeWidth:1,radius:2,order:0,visible:!0});var Ay=new Yi;Ay.maxJobs=10,Ay.priorityCallback=(e,t)=>{let n=e.tile,i=t.tile,r=n.internal.renderer,o=i.internal.renderer,a=r.visibleTiles.has(n);return a===o.visibleTiles.has(i)?Hs(n,i):a?1:-1};var Ey=new re.Vector3;function mc(e,t){if(e.isInterleavedBufferAttribute||e.array instanceof t)return e;let n=t===Int8Array||t===Int16Array||t===Int32Array?-1:0,i=new re.BufferAttribute(new t(e.count*e.itemSize),e.itemSize,!0),r=e.itemSize,o=e.count;for(let a=0;a<o;a++)for(let s=0;s<r;s++){let l=re.MathUtils.clamp(e.getComponent(a,s),n,1);i.setComponent(a,s,l)}return i}function IC(e,t=Int16Array){let n=e.geometry,i=n.attributes,r=i.position;if(r.isInterleavedBufferAttribute||r.array instanceof t)return r;let o=new re.BufferAttribute(new t(r.count*r.itemSize),r.itemSize,!1),a=r.itemSize,s=r.count;n.computeBoundingBox();let l=n.boundingBox,{min:c,max:p}=l,u=2**(8*t.BYTES_PER_ELEMENT-1)-1,d=-u;for(let m=0;m<s;m++)for(let g=0;g<a;g++){let v=g===0?"x":g===1?"y":"z",M=c[v],w=p[v],x=re.MathUtils.mapLinear(r.getComponent(m,g),M,w,d,u);o.setComponent(m,g,x)}l.getCenter(Ey).multiply(e.scale).applyQuaternion(e.quaternion),e.position.add(Ey),e.scale.x*=.5*(p.x-c.x)/u,e.scale.y*=.5*(p.y-c.y)/u,e.scale.z*=.5*(p.z-c.z)/u,i.position=o,e.geometry.boundingBox=null,e.geometry.boundingSphere=null,e.updateMatrixWorld()}var Pm=class{constructor(e){this._options={generateNormals:!1,disableMipmaps:!0,compressIndex:!0,compressNormals:!1,compressUvs:!1,compressPosition:!1,uvType:Int8Array,normalType:Int8Array,positionType:Int16Array,...e},this.name="TILES_COMPRESSION_PLUGIN",this.priority=-100}processTileModel(e,t){let{generateNormals:n,disableMipmaps:i,compressIndex:r,compressUvs:o,compressNormals:a,compressPosition:s,uvType:l,normalType:c,positionType:p}=this._options;e.traverse(u=>{if(u.material&&i){let d=u.material;for(let m in d){let g=d[m];g&&g.isTexture&&g.generateMipmaps&&(g.generateMipmaps=!1,g.minFilter=re.LinearFilter)}}if(u.geometry){let d=u.geometry,m=d.attributes;if(o){let{uv:g,uv1:v,uv2:M,uv3:w}=m;g&&(m.uv=mc(g,l)),v&&(m.uv1=mc(v,l)),M&&(m.uv2=mc(M,l)),w&&(m.uv3=mc(w,l))}if(n&&!m.normals&&d.computeVertexNormals(),a&&m.normals&&(m.normals=mc(m.normals,c)),s&&IC(u,p),r&&d.index){let g=m.position.count,v=d.index,M=g>65535?Uint32Array:g>255?Uint16Array:Uint8Array;if(!(v.array instanceof M)){let w=new M(d.index.count);w.set(v.array);let x=new re.BufferAttribute(w,1);d.setIndex(x)}}}})}};function Vn(e,t,n){return e&&t in e?e[t]:n}function Hy(e){return e!=="BOOLEAN"&&e!=="STRING"&&e!=="ENUM"}function zC(e){return/^FLOAT/.test(e)}function vc(e){return/^VEC/.test(e)}function xc(e){return/^MAT/.test(e)}function Gy(e,t,n,i=null){return xc(n)||vc(n)?i.fromArray(e,t):e[t]}function Mm(e){let{type:t,componentType:n}=e;switch(t){case"SCALAR":return n==="INT64"?0n:0;case"VEC2":return new re.Vector2;case"VEC3":return new re.Vector3;case"VEC4":return new re.Vector4;case"MAT2":return new re.Matrix2;case"MAT3":return new re.Matrix3;case"MAT4":return new re.Matrix4;case"BOOLEAN":return!1;case"STRING":return"";case"ENUM":return 0}}function Ry(e,t){if(t==null)return!1;switch(e){case"SCALAR":return typeof t=="number"||typeof t=="bigint";case"VEC2":return t.isVector2;case"VEC3":return t.isVector3;case"VEC4":return t.isVector4;case"MAT2":return t.isMatrix2;case"MAT3":return t.isMatrix3;case"MAT4":return t.isMatrix4;case"BOOLEAN":return typeof t=="boolean";case"STRING":return typeof t=="string";case"ENUM":return typeof t=="number"||typeof t=="bigint"}throw Error("ClassProperty: invalid type.")}function bc(e,t=null){switch(e){case"INT8":return Int8Array;case"INT16":return Int16Array;case"INT32":return Int32Array;case"INT64":return BigInt64Array;case"UINT8":return Uint8Array;case"UINT16":return Uint16Array;case"UINT32":return Uint32Array;case"UINT64":return BigUint64Array;case"FLOAT32":return Float32Array;case"FLOAT64":return Float64Array}switch(t){case"BOOLEAN":return Uint8Array;case"STRING":return Uint8Array}throw Error("ClassProperty: invalid type.")}function UC(e,t=null){if(e.array){t=t&&Array.isArray(t)?t:[],t.length=e.count;for(let n=0,i=t.length;n<i;n++)t[n]=Nu(e,t[n])}else t=Nu(e,t);return t}function Nu(e,t=null){let n=e.default,i=e.type;if(t||(t=Mm(e)),n===null){switch(i){case"SCALAR":return 0;case"VEC2":return t.set(0,0);case"VEC3":return t.set(0,0,0);case"VEC4":return t.set(0,0,0,0);case"MAT2":return t.identity();case"MAT3":return t.identity();case"MAT4":return t.identity();case"BOOLEAN":return!1;case"STRING":return"";case"ENUM":return""}throw Error("ClassProperty: invalid type.")}else if(xc(i))t.fromArray(n);else if(vc(i))t.fromArray(n);else return n}function FC(e,t){if(e.noData===null)return t;let n=e.noData,i=e.type;if(Array.isArray(t))for(let a=0,s=t.length;a<s;a++)t[a]=r(t[a]);else t=r(t);return t;function r(a){return o(a)&&(a=Nu(e,a)),a}function o(a){if(xc(i)){let s=a.elements;for(let l=0,c=n.length;l<c;l++)if(n[l]!==s[l])return!1;return!0}else if(vc(i)){for(let s=0,l=n.length;s<l;s++)if(n[s]!==a.getComponent(s))return!1;return!0}else return n===a}}function VC(e,t){switch(e){case"INT8":return Math.max(t/127,-1);case"INT16":return Math.max(t,32767,-1);case"INT32":return Math.max(t/2147483647,-1);case"INT64":return Math.max(Number(t)/9223372036854776e3,-1);case"UINT8":return t/255;case"UINT16":return t/65535;case"UINT32":return t/4294967295;case"UINT64":return Number(t)/18446744073709552e3}}function jC(e,t){let{type:n,componentType:i,scale:r,offset:o,normalized:a}=e;if(Array.isArray(t))for(let u=0,d=t.length;u<d;u++)t[u]=s(t[u]);else t=s(t);return t;function s(u){return u=xc(n)?c(u):vc(n)?l(u):p(u),u}function l(u){return u.x=p(u.x),u.y=p(u.y),"z"in u&&(u.z=p(u.z)),"w"in u&&(u.w=p(u.w)),u}function c(u){let d=u.elements;for(let m=0,g=d.length;m<g;m++)d[m]=p(d[m]);return u}function p(u){return a&&(u=VC(i,u)),(a||zC(i))&&(u=u*r+o),u}}function Am(e,t,n=null){if(e.array){Array.isArray(t)||(t=Array(e.count||0)),t.length=n===null?e.count:n;for(let i=0,r=t.length;i<r;i++)Ry(e.type,t[i])||(t[i]=Mm(e))}else Ry(e.type,t)||(t=Mm(e));return t}function Bu(e,t){for(let n in t)n in e||delete t[n];for(let n in e){let i=e[n];t[n]=Am(i,t[n])}}function HC(e){switch(e){case"ENUM":return 1;case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;case"BOOLEAN":return-1;case"STRING":return-1;default:return-1}}var Iu=class{constructor(e,t,n=null){this.name=t.name||null,this.description=t.description||null,this.type=t.type,this.componentType=t.componentType||null,this.enumType=t.enumType||null,this.array=t.array||!1,this.count=t.count||0,this.normalized=t.normalized||!1,this.offset=t.offset||0,this.scale=Vn(t,"scale",1),this.max=Vn(t,"max",1/0),this.min=Vn(t,"min",-1/0),this.required=t.required||!1,this.noData=Vn(t,"noData",null),this.default=Vn(t,"default",null),this.semantic=Vn(t,"semantic",null),this.enumSet=null,this.accessorProperty=n,n&&(this.offset=Vn(n,"offset",this.offset),this.scale=Vn(n,"scale",this.scale),this.max=Vn(n,"max",this.max),this.min=Vn(n,"min",this.min)),t.type==="ENUM"&&(this.enumSet=e[this.enumType],this.componentType===null&&(this.componentType=Vn(this.enumSet,"valueType","UINT16")))}shapeToProperty(e,t=null){return Am(this,e,t)}resolveDefaultElement(e){return Nu(this,e)}resolveDefault(e){return UC(this,e)}resolveNoData(e){return FC(this,e)}resolveEnumsToStrings(e){let t=this.enumSet;if(this.type==="ENUM")if(Array.isArray(e))for(let i=0,r=e.length;i<r;i++)e[i]=n(e[i]);else e=n(e);return e;function n(i){let r=t.values.find(o=>o.value===i);return r===null?"":r.name}}adjustValueScaleOffset(e){return Hy(this.type)?jC(this,e):e}},Em=class{constructor(e,t={},n={},i=null){this.definition=e,this.class=t[e.class],this.className=e.class,this.enums=n,this.data=i,this.name="name"in e?e.name:null,this.properties=null}getPropertyNames(){return Object.keys(this.class.properties)}includesData(e){return!!this.definition.properties[e]}dispose(){}_initProperties(e=Iu){let t={};for(let n in this.class.properties)t[n]=new e(this.enums,this.class.properties[n],this.definition.properties[n]);this.properties=t}},GC=class extends Iu{constructor(e,t,n=null){super(e,t,n),this.attribute=n?.attribute??null}},WC=class extends Em{constructor(...e){super(...e),this.isPropertyAttributeAccessor=!0,this._initProperties(GC)}getData(e,t,n={}){let i=this.properties;Bu(i,n);for(let r in i)n[r]=this.getPropertyValue(r,e,t,n[r]);return n}getPropertyValue(e,t,n,i=null){if(t>=this.count)throw Error("PropertyAttributeAccessor: Requested index is outside the range of the buffer.");let r=this.properties[e],o=r.type;if(!r)throw Error("PropertyAttributeAccessor: Requested class property does not exist.");if(!this.definition.properties[e])return r.resolveDefault(i);i=r.shapeToProperty(i);let a=n.getAttribute(r.attribute.toLowerCase());if(xc(o)){let s=i.elements;for(let l=s.length;0<l;)s[0]=a.getComponent(t,0)}else if(vc(o))i.fromBufferAttribute(a,t);else if(o==="SCALAR"||o==="ENUM")i=a.getX(t);else throw Error("StructuredMetadata.PropertyAttributeAccessor: BOOLEAN and STRING types are not supported by property attributes.");return i=r.adjustValueScaleOffset(i),i=r.resolveEnumsToStrings(i),i=r.resolveNoData(i),i}},XC=class extends Iu{constructor(e,t,n=null){super(e,t,n),this.values=n?.values??null,this.valueLength=HC(this.type),this.arrayOffsets=Vn(n,"arrayOffsets",null),this.stringOffsets=Vn(n,"stringOffsets",null),this.arrayOffsetType=Vn(n,"arrayOffsetType","UINT32"),this.stringOffsetType=Vn(n,"stringOffsetType","UINT32")}getArrayLengthFromId(e,t){let n=this.count;if(this.arrayOffsets!==null){let{arrayOffsets:i,arrayOffsetType:r}=this,o=new(bc(r))(e[i]);n=o[t+1]-o[t]}return n}getIndexOffsetFromId(e,t){let n=t;if(this.arrayOffsets){let{arrayOffsets:i,arrayOffsetType:r}=this;n=new(bc(r))(e[i])[n]}else this.array&&(n*=this.count);return n}},qC=class extends Em{constructor(...e){super(...e),this.isPropertyTableAccessor=!0,this.count=this.definition.count,this._initProperties(XC)}getData(e,t={}){let n=this.properties;Bu(n,t);for(let i in n)t[i]=this.getPropertyValue(i,e,t[i]);return t}_readValueAtIndex(e,t,n,i=null){let r=this.properties[e],{componentType:o,type:a}=r,s=this.data,l=s[r.values],c=new(bc(o,a))(l),p=r.getIndexOffsetFromId(s,t);if(Hy(a)||a==="ENUM")return Gy(c,(p+n)*r.valueLength,a,i);if(a==="STRING"){let u=p+n,d=0;if(r.stringOffsets!==null){let{stringOffsets:g,stringOffsetType:v}=r,M=new(bc(v))(s[g]);d=M[u+1]-M[u],u=M[u]}let m=new Uint8Array(c.buffer,u,d);i=new TextDecoder().decode(m)}else if(a==="BOOLEAN"){let u=p+n,d=Math.floor(u/8),m=u%8;i=(c[d]>>m&1)==1}return i}getPropertyValue(e,t,n=null){if(t>=this.count)throw Error("PropertyTableAccessor: Requested index is outside the range of the table.");let i=this.properties[e];if(!i)throw Error("PropertyTableAccessor: Requested property does not exist.");if(!this.definition.properties[e])return i.resolveDefault(n);let r=i.array,o=this.data,a=i.getArrayLengthFromId(o,t);if(n=i.shapeToProperty(n,a),r)for(let s=0,l=n.length;s<l;s++)n[s]=this._readValueAtIndex(e,t,s,n[s]);else n=this._readValueAtIndex(e,t,0,n);return n=i.adjustValueScaleOffset(n),n=i.resolveEnumsToStrings(n),n=i.resolveNoData(n),n}},fc=new re.Box2,ky=class{constructor(){this._renderer=new re.WebGLRenderer,this._target=new re.WebGLRenderTarget(1,1),this._texTarget=new re.WebGLRenderTarget,this._quad=new Tm.FullScreenQuad(new re.ShaderMaterial({blending:re.CustomBlending,blendDst:re.ZeroFactor,blendSrc:re.OneFactor,uniforms:{map:{value:null},pixel:{value:new re.Vector2}},vertexShader:`
|
|
3673
|
+
`,Hh=class extends Uu.Effect{constructor(t=1){super("ExposureEffect",F2,{blendFunction:Uu.BlendFunction.NORMAL,uniforms:new Map([["exposure",new Gy.Uniform(t)]])})}set exposure(t){this.uniforms.get("exposure").value=t}},Hy=(0,rl.forwardRef)(function({exposure:t},n){let i=(0,rl.useMemo)(()=>new Hh(t),[]);return i.exposure=t,(0,rl.useImperativeHandle)(n,()=>i,[i]),(0,Wy.jsx)("primitive",{object:i,dispose:null})});var Ha=require("@react-three/fiber"),Xy=Qd(require("@react-three/postprocessing")),qy=require("postprocessing"),Jr=require("three"),Zr=require("react"),Yy=require("react/jsx-runtime"),j2=Xy.LensFlareEffect;function $y({config:e}){let t=(0,Ha.useThree)(u=>u.camera),n=(0,Ha.useThree)(u=>u.raycaster),i=(0,Ha.useThree)(u=>u.scene),r=(0,Ha.useThree)(u=>u.viewport),o=(0,Zr.useRef)(null),a=(0,Zr.useRef)(new Jr.Vector3),s=(0,Zr.useRef)(new Jr.Vector2),l=(0,Zr.useMemo)(()=>new Jr.Vector3(...e.lensPosition),[e.lensPosition]),c=(0,Zr.useMemo)(()=>new Jr.Color(e.colorGain??"#141414"),[e.colorGain]),h=(0,Zr.useMemo)(()=>new Jr.Vector2(0,0),[]),p=(0,Zr.useMemo)(()=>new j2({blendFunction:qy.BlendFunction.NORMAL,enabled:!0,glareSize:e.glareSize,lensPosition:l,screenRes:h,starPoints:6,flareSize:e.flareSize,flareSpeed:e.flareSpeed,flareShape:e.flareShape,animated:e.animated,anamorphic:e.anamorphic,colorGain:c,lensDirtTexture:null,haloScale:e.haloScale,secondaryGhosts:e.secondaryGhosts,aditionalStreaks:e.aditionalStreaks,ghostScale:e.ghostScale,opacity:e.opacity,starBurst:e.starBurst}),[c,e.aditionalStreaks,e.anamorphic,e.animated,e.flareShape,e.flareSize,e.flareSpeed,e.glareSize,e.haloScale,e.ghostScale,e.opacity,e.secondaryGhosts,e.starBurst,l,h]);return(0,Zr.useEffect)(()=>(o.current=p,()=>{p.dispose(),o.current=null}),[p]),(0,Zr.useEffect)(()=>{let u=p.uniforms.get("screenRes");u&&(u.value.x=r.width,u.value.y=r.height)},[p,r]),(0,Ha.useFrame)((u,m)=>{let f=o.current;if(!f)return;let g=f.uniforms.get("lensPosition"),b=f.uniforms.get("opacity");if(!g||!b)return;let x=1;if(a.current.copy(l).project(t),a.current.z>1)return;g.value.x=a.current.x,g.value.y=a.current.y,s.current.x=a.current.x,s.current.y=a.current.y,n.setFromCamera(s.current,t);let v=n.intersectObjects(i.children,!0),{object:w}=v[0]||{};w&&(w.userData?.lensflare==="no-occlusion"?x=0:w instanceof Jr.Mesh&&(w.material.uniforms?._transmission?.value>.2||w.material._transmission&&w.material._transmission>.2?x=.2:w.material.transparent&&(x=w.material.opacity))),b.value=Jr.MathUtils.damp(b.value,x,12,m)}),(0,Yy.jsx)("primitive",{object:p,dispose:null})}var Vu=require("@react-three/postprocessing"),hr=require("postprocessing"),Ky=require("three");function Zy(e){return e==="linear"?hr.ToneMappingMode.LINEAR:e==="reinhard"?hr.ToneMappingMode.REINHARD:hr.ToneMappingMode.ACES_FILMIC}function Fu(e){switch(e){case"verySmall":return hr.KernelSize.VERY_SMALL;case"small":return hr.KernelSize.SMALL;case"medium":return hr.KernelSize.MEDIUM;case"large":return hr.KernelSize.LARGE;case"veryLarge":return hr.KernelSize.VERY_LARGE;case"huge":return hr.KernelSize.HUGE}}function Jy(e){switch(e){case"constantMild":return hr.GlitchMode.CONSTANT_MILD;case"constantWild":return hr.GlitchMode.CONSTANT_WILD;default:return hr.GlitchMode.SPORADIC}}function Wh(e){let t=new Ky.Color(e);return[t.r,t.g,t.b,1]}function Qy(e){return e==="radial"?Vu.RampType.Radial:e==="mirroredLinear"?Vu.RampType.MirroredLinear:Vu.RampType.Linear}var ht=require("react/jsx-runtime"),Wa={edgeStrength:1,pulseSpeed:0,visibleEdgeColor:new bi.Color(ro.color).getHex(),hiddenEdgeColor:new bi.Color(ro.color).multiplyScalar(.35).getHex(),kernelSize:Ho.KernelSize.VERY_SMALL,blur:!1,xRay:!1};function G2(e){let t=[];return e.traverse(n=>{n.isMesh&&t.push(n)}),t}var Xh=[],H2=(0,Nn.memo)(function({sceneConfig:t,selectedObjectRef:n,highlightOnHover:i=!1,disabled:r=!1,onOutlineEffect:o}){let a=(0,Cc.useThree)(_=>_.scene),s=(0,Cc.useThree)(_=>_.gl),l=(0,Nn.useRef)(null),c=t?.postProcessing,h=n??null,p=c?.outline.enabled===!0,u=p||i,[m,f]=(0,Nn.useState)(()=>s.xr?.isPresenting??!1);(0,Nn.useEffect)(()=>{let _=s.xr;if(!_)return;let y=()=>f(!0),P=()=>f(!1);return _.addEventListener("sessionstart",y),_.addEventListener("sessionend",P),f(_.isPresenting),()=>{_.removeEventListener("sessionstart",y),_.removeEventListener("sessionend",P)}},[s]);let g=a.children.filter(_=>_.isLight),b=(0,Nn.useMemo)(()=>new bi.Vector2(c?.chromaticAberration.offsetX??.002,c?.chromaticAberration.offsetY??.002),[c?.chromaticAberration.offsetX,c?.chromaticAberration.offsetY]),x=(0,Nn.useMemo)(()=>new bi.Color(c?.outline.visibleEdgeColor??"#ffffff").getHex(),[c?.outline.visibleEdgeColor]),v=(0,Nn.useMemo)(()=>new bi.Color(c?.outline.hiddenEdgeColor??"#22090a").getHex(),[c?.outline.hiddenEdgeColor]),w=(0,Nn.useMemo)(()=>Wh(c?.ramp.startColor??"#000000"),[c?.ramp.startColor]),M=(0,Nn.useMemo)(()=>Wh(c?.ramp.endColor??"#ffffff"),[c?.ramp.endColor]);return!c||m||r?null:(0,ht.jsxs)(ht.Fragment,{children:[c.godRays.enabled===!0&&(0,ht.jsxs)("mesh",{ref:l,position:c.godRays.sunPosition,visible:!1,frustumCulled:!1,children:[(0,ht.jsx)("sphereGeometry",{args:[.1,8,8]}),(0,ht.jsx)("meshBasicMaterial",{transparent:!0,opacity:0,depthWrite:!1})]}),(0,ht.jsxs)(Fe.EffectComposer,{multisampling:0,enableNormalPass:c.ssao.enabled===!0,autoClear:!1,children:[c.smaa.enabled===!0&&(0,ht.jsx)(Fe.SMAA,{}),c.ssao.enabled===!0&&(0,ht.jsx)(Fe.SSAO,{samples:c.ssao.samples,rings:c.ssao.rings,intensity:c.ssao.intensity,radius:c.ssao.radius,bias:c.ssao.bias,luminanceInfluence:c.ssao.luminanceInfluence,fade:c.ssao.fade,minRadiusScale:c.ssao.minRadiusScale,worldDistanceThreshold:c.ssao.worldDistanceThreshold,worldDistanceFalloff:c.ssao.worldDistanceFalloff,worldProximityThreshold:c.ssao.worldProximityThreshold,worldProximityFalloff:c.ssao.worldProximityFalloff}),c.autofocus.enabled===!0&&(0,ht.jsx)(Fe.Autofocus,{focusDistance:c.autofocus.focusDistance,focusRange:c.autofocus.focusRange,focalLength:c.autofocus.focalLength,bokehScale:c.autofocus.bokehScale,target:c.autofocus.target,mouse:c.autofocus.mouse,debug:c.autofocus.debug||void 0,manual:c.autofocus.manual,smoothTime:c.autofocus.smoothTime}),c.autofocus.enabled!==!0&&c.depthOfField.enabled===!0&&(0,ht.jsx)(Fe.DepthOfField,{focusDistance:c.depthOfField.focusDistance,focusRange:c.depthOfField.focusRange,focalLength:c.depthOfField.focalLength,bokehScale:c.depthOfField.bokehScale}),c.bloom.enabled===!0&&(0,ht.jsx)(Fe.Bloom,{intensity:c.bloom.intensity,luminanceThreshold:c.bloom.luminanceThreshold,luminanceSmoothing:c.bloom.luminanceSmoothing,mipmapBlur:c.bloom.mipmapBlur,radius:c.bloom.radius,levels:c.bloom.levels}),c.selectiveBloom.enabled===!0&&(0,ht.jsx)(Fe.SelectiveBloom,{selection:h??void 0,lights:g,selectionLayer:c.selectiveBloom.selectionLayer,intensity:c.selectiveBloom.intensity,luminanceThreshold:c.selectiveBloom.luminanceThreshold,luminanceSmoothing:c.selectiveBloom.luminanceSmoothing,kernelSize:Fu(c.selectiveBloom.kernelSize),mipmapBlur:c.selectiveBloom.mipmapBlur,inverted:c.selectiveBloom.inverted,ignoreBackground:c.selectiveBloom.ignoreBackground}),u&&(0,ht.jsx)(Fe.Outline,{ref:o,selection:Xh,selectionLayer:c.outline.selectionLayer,blendFunction:Ho.BlendFunction.SCREEN,edgeStrength:p?c.outline.edgeStrength:Wa.edgeStrength,pulseSpeed:p?c.outline.pulseSpeed:Wa.pulseSpeed,visibleEdgeColor:p?x:Wa.visibleEdgeColor,hiddenEdgeColor:p?v:Wa.hiddenEdgeColor,kernelSize:p?Fu(c.outline.kernelSize):Wa.kernelSize,blur:p?c.outline.blur:Wa.blur,xRay:p?c.outline.xRay:Wa.xRay}),c.chromaticAberration.enabled===!0&&(0,ht.jsx)(Fe.ChromaticAberration,{offset:b,radialModulation:c.chromaticAberration.radialModulation,modulationOffset:c.chromaticAberration.modulationOffset}),c.colorAverage.enabled===!0&&(0,ht.jsx)(Fe.ColorAverage,{}),c.dotScreen.enabled===!0&&(0,ht.jsx)(Fe.DotScreen,{angle:c.dotScreen.angle,scale:c.dotScreen.scale}),c.glitch.enabled===!0&&(0,ht.jsx)(Fe.Glitch,{mode:Jy(c.glitch.mode),delay:new bi.Vector2(c.glitch.delay[0],c.glitch.delay[1]),duration:new bi.Vector2(c.glitch.duration[0],c.glitch.duration[1]),strength:new bi.Vector2(c.glitch.strength[0],c.glitch.strength[1]),chromaticAberrationOffset:new bi.Vector2(c.glitch.chromaticAberrationOffset[0],c.glitch.chromaticAberrationOffset[1]),columns:c.glitch.columns,ratio:c.glitch.ratio,active:!0}),c.grid.enabled===!0&&(0,ht.jsx)(Fe.Grid,{scale:c.grid.scale,lineWidth:c.grid.lineWidth}),c.lensflare.enabled===!0&&(0,ht.jsx)($y,{config:c.lensflare}),c.godRays.enabled===!0&&(0,ht.jsx)(Fe.GodRays,{sun:l,samples:c.godRays.samples,density:c.godRays.density,decay:c.godRays.decay,weight:c.godRays.weight,exposure:c.godRays.exposure,clampMax:c.godRays.clampMax,blur:c.godRays.blur,kernelSize:Fu(c.godRays.kernelSize)}),c.noise.enabled===!0&&(0,ht.jsx)(Fe.Noise,{premultiply:c.noise.premultiply,opacity:c.noise.opacity,blendFunction:Ho.BlendFunction.ADD}),c.brightnessContrast.enabled===!0&&(0,ht.jsx)(Fe.BrightnessContrast,{brightness:c.brightnessContrast.brightness,contrast:c.brightnessContrast.contrast}),c.hueSaturation.enabled===!0&&(0,ht.jsx)(Fe.HueSaturation,{hue:c.hueSaturation.hue,saturation:c.hueSaturation.saturation}),c.toneMapping.enabled===!0&&(0,ht.jsx)(Hy,{exposure:c.toneMapping.exposure}),c.vignette.enabled===!0&&(0,ht.jsx)(Fe.Vignette,{eskil:c.vignette.eskil,offset:c.vignette.offset,darkness:c.vignette.darkness,blendFunction:Ho.BlendFunction.NORMAL}),c.toneMapping.enabled===!0&&(0,ht.jsx)(Fe.ToneMapping,{mode:Zy(c.toneMapping.mode),resolution:c.toneMapping.resolution,whitePoint:c.toneMapping.whitePoint,middleGrey:c.toneMapping.middleGrey,minLuminance:c.toneMapping.minLuminance,averageLuminance:c.toneMapping.averageLuminance,adaptationRate:c.toneMapping.adaptationRate}),c.sepia.enabled===!0&&(0,ht.jsx)(Fe.Sepia,{intensity:c.sepia.intensity,blendFunction:Ho.BlendFunction.NORMAL}),c.scanline.enabled===!0&&(0,ht.jsx)(Fe.Scanline,{density:c.scanline.density,blendFunction:Ho.BlendFunction.OVERLAY}),c.pixelation.enabled===!0&&(0,ht.jsx)(Fe.Pixelation,{granularity:c.pixelation.granularity}),c.ramp.enabled===!0&&(0,ht.jsx)(Fe.Ramp,{rampType:Qy(c.ramp.rampType),rampStart:c.ramp.rampStart,rampEnd:c.ramp.rampEnd,startColor:w,endColor:M,opacity:c.ramp.rampMask?1:c.ramp.opacity??.5,rampBias:c.ramp.rampBias,rampGain:c.ramp.rampGain,rampMask:c.ramp.rampMask,rampInvert:c.ramp.rampInvert})]})]})});function W2(e){let t=[e];for(;t.length>0;){let n=t.pop();if(n.visible){if(n.isMesh)return!0;t.push(...n.children)}}return!1}function X2(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function e0({hoveredObjectRef:e,...t}){let n=(0,Cc.useThree)(l=>l.scene),i=(0,Cc.useThree)(l=>l.invalidate),[r,o]=(0,Nn.useState)(null),a=(0,Nn.useCallback)(l=>o(l),[]),s=(0,Nn.useRef)({effect:null,objects:Xh});return(0,Nn.useEffect)(()=>{if(!r)return;let c=t.sceneConfig?.postProcessing?.outline.enabled===!0?G2(n):e&&W2(e)?[e]:Xh;s.current.effect===r&&X2(s.current.objects,c)||(s.current={effect:r,objects:c},r.selection.set(c),i())}),(0,ht.jsx)(H2,{...t,onOutlineEffect:a})}var Mn=require("react/jsx-runtime"),q2=1.5;function qh({children:e,camera:t,backgroundColor:n,shadows:i=!0,sceneConfig:r,selectedObjectRef:o,hoveredObjectRef:a,highlightOnHover:s,renderMode:l="demand",maxDpr:c=2,xrStore:h,rendererCaptureRef:p,preserveDrawingBuffer:u=!1,reduceGpuLoad:m,suspended:f=!1,paused:g=!1,onRendererCreated:b,backend:x="webgl"}){let v=x==="webgpu",w=m??uc(),M=w?Math.min(c,q2):c,_=i&&!w,y=(0,vi.useMemo)(()=>n?{background:n}:r?.background.enabled?r.background.type==="color"?{background:r.background.color}:r.background.type==="image"&&r.background.imageUrl.trim()?{backgroundImage:`url("${r.background.imageUrl}")`,backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"cover"}:{background:"linear-gradient(180deg, #3a3a3c 0%, #1c1c1d 100%)"}:{background:"transparent"},[n,r]),P=(0,vi.useMemo)(()=>{if(n)return n;let I=r?.background;if(I?.enabled){if(I.type==="color")return I.color;if(I.type==="image"&&I.imageUrl.trim()||I.type==="environment")return null}return"#1c1c1d"},[n,r]),d=(0,vi.useMemo)(()=>{let I=r?.postProcessing;return I?!!(I.glitch.enabled||I.noise.enabled||I.lensflare.enabled&&I.lensflare.animated):!1},[r?.postProcessing]),[S,C]=(0,vi.useState)(!1),T=r?.environment,E=r?.groundShadows,k=(0,vi.useMemo)(()=>{if(!T)return null;if(T.source==="custom"){let I=T.customEnvironmentUrl.trim();return Bu(I)?{files:I}:null}return{preset:T.preset}},[T]),D=(0,Mn.jsxs)(Mn.Fragment,{children:[(0,Mn.jsx)(Nv,{captureRef:p}),(0,Mn.jsx)(Ov,{}),(0,Mn.jsx)(jy,{cameraConfig:t}),(0,Mn.jsx)(zy,{active:d}),(0,Mn.jsx)(Vy,{color:P}),k?(0,Mn.jsx)(Xs,{onError:I=>console.warn("Failed to load environment map:",I),children:(0,Mn.jsx)(vi.Suspense,{fallback:null,children:(0,Mn.jsx)(t0.Environment,{...k,environmentIntensity:T?.intensity??.25,backgroundIntensity:T?.intensity??.25,background:r?.background.enabled===!0&&r.background.type==="environment"})})}):null,(0,Mn.jsx)(Fy,{rotation:T?.rotation??0}),h&&(0,Mn.jsx)(Iy,{onPresentingChange:C}),E?.enabled&&E.mode==="shadowCatcher"&&!S&&!v&&(0,Mn.jsx)(Uy,{position:[0,E.height,0],scale:E.size,opacity:E.intensity,blur:E.borderFade,far:15,resolution:1024,color:"#000000"}),e,(0,Mn.jsx)(e0,{sceneConfig:r,selectedObjectRef:o,hoveredObjectRef:a,highlightOnHover:s,disabled:w||v}),v?(0,Mn.jsx)(Y2,{toneMapping:r?.postProcessing.toneMapping}):null]});return(0,Mn.jsx)(Tc.Canvas,{frameloop:f||g&&!S?"never":l,onCreated:({gl:I})=>b?.(I),dpr:[1,M],shadows:_?"soft":!1,resize:{debounce:0,scroll:!1},raycaster:{firstHitOnly:!0},style:y,camera:t??{fov:50},gl:v?Pv:{preserveDrawingBuffer:u,toneMapping:ao.NoToneMapping,toneMappingExposure:1},flat:v||void 0,children:h&&!v?(0,Mn.jsxs)(n0.XR,{store:h,children:[(0,Mn.jsx)(By,{renderMode:l,suspended:f}),D]}):D})}var $2={linear:ao.LinearToneMapping,reinhard:ao.ReinhardToneMapping,aces:ao.ACESFilmicToneMapping};function Y2({toneMapping:e}){let t=(0,Tc.useThree)(a=>a.gl),n=(0,Tc.useThree)(a=>a.invalidate),i=e?.enabled===!0,r=e?.mode??"aces",o=e?.exposure??1;return(0,vi.useEffect)(()=>{t.toneMapping=i?$2[r]:ao.NoToneMapping,t.toneMappingExposure=i?o:1,n()},[t,n,i,r,o]),null}var Gu=require("@react-three/drei"),Pc=require("three"),so=require("react");var ju=e=>e*Math.PI/180;function r0(e){return{minDistance:e?.minDistance??0,maxDistance:e?.maxDistance??1/0,minPolarAngle:ju(e?.minPolarAngle??0),maxPolarAngle:ju(e?.maxPolarAngle??180),minAzimuthAngle:ju(e?.minAzimuthAngle??-1/0),maxAzimuthAngle:ju(e?.maxAzimuthAngle??1/0),boundaryEnclosesCamera:e?.boundaryEnclosesCamera??!1,boundaryFriction:e?.boundaryFriction??0,panBoundary:e?.panBoundary}}var $h=new WeakSet;function i0(e,t){t?$h.add(e):$h.delete(e)}function il(e,t){return $h.has(e)?0:t}var Yh=require("react/jsx-runtime");function Kh({controlsRef:e,onCameraChange:t,cameraLimits:n,controllerType:i="orbit",onPointerLockExit:r,reducedMotion:o=!1}){let a=i==="orbit",s=(0,so.useRef)(null);return(0,so.useEffect)(()=>{if(!a)return s.current?.lock(),()=>{s.current?.unlock()}},[a]),(0,so.useEffect)(()=>{a&&document.pointerLockElement&&document.exitPointerLock()},[a]),(0,so.useEffect)(()=>{if(a)return;let l=()=>{document.pointerLockElement||r?.()};return document.addEventListener("pointerlockchange",l),()=>{document.removeEventListener("pointerlockchange",l)}},[a,r]),(0,so.useEffect)(()=>{if(!a||!e||typeof e!="object"||!("current"in e))return;let l=e.current;l&&i0(l,o)},[a,e,o]),(0,so.useEffect)(()=>{if(!a||!t||!e||typeof e!="object"||!("current"in e))return;let l=e.current;if(!l)return;let c=()=>{t(l.camera,l)};return l.addEventListener("update",c),()=>{l.removeEventListener("update",c)}},[a,e,t]),(0,so.useEffect)(()=>{if(!a||!e||typeof e!="object"||!("current"in e))return;let l=e.current;if(!l)return;let c=r0(n);l.minDistance=c.minDistance,l.maxDistance=c.maxDistance,l.minPolarAngle=c.minPolarAngle,l.maxPolarAngle=c.maxPolarAngle,l.minAzimuthAngle=c.minAzimuthAngle,l.maxAzimuthAngle=c.maxAzimuthAngle,l.boundaryEnclosesCamera=c.boundaryEnclosesCamera,l.boundaryFriction=c.boundaryFriction,l.setBoundary(c.panBoundary?new Pc.Box3(new Pc.Vector3(...c.panBoundary[0]),new Pc.Vector3(...c.panBoundary[1])):void 0)},[a,e,n?.minDistance,n?.maxDistance,n?.minPolarAngle,n?.maxPolarAngle,n?.minAzimuthAngle,n?.maxAzimuthAngle,n?.boundaryEnclosesCamera,n?.boundaryFriction,n?.panBoundary]),a?(0,Yh.jsx)(Gu.CameraControls,{ref:e,makeDefault:!0,smoothTime:o?0:.3,dollyToCursor:!0}):(0,Yh.jsx)(Gu.PointerLockControls,{ref:s,makeDefault:!0,selector:"[data-ri-pointer-lock-trigger]"})}var yi=require("react"),Ec=require("@react-three/fiber"),a0=require("three");var Zh=Symbol("react-immersive.model-node-id");function K2(e,t){Object.defineProperty(e,Zh,{value:t,configurable:!0})}function lo(e){let t=new Map;e.traverse(l=>{if(!l.name)return;let c=t.get(l.name);c?c.push(l):t.set(l.name,[l])});let n=Object.create(null),i=new WeakMap,r=new Map,o=new Set(Array.from(t,([l,c])=>c.length===1?l:null).filter(l=>l!==null)),a=new Set,s=(l,c)=>{K2(l,c),n[c]=l,i.set(l,c),a.add(c)};for(let[l,c]of t)c.length===1&&s(c[0],l);for(let[l,c]of t){if(c.length<2)continue;let h=[];c.forEach((p,u)=>{let m=`${l} [${u+1}]`,f=m,g=2;for(;o.has(f)||a.has(f);)f=`${m}.${g++}`;s(p,f),h.push(f)}),r.set(l,h)}return{nodesById:n,idByNode:i,duplicateNames:r}}function Ac(e){return e[Zh]??e.name??null}function xi(e,t){let n=null,i=[];return e.traverse(r=>{r[Zh]===t&&(n=r),r.name===t&&i.push(r)}),n??(i.length===1?i[0]:null)}var Qr=require("react/jsx-runtime");function s0(e,t){if(!t)return e;let n=t*Math.PI/180,i=Math.cos(n),r=Math.sin(n);return[e[0]*i+e[2]*r,e[1],-e[0]*r+e[2]*i]}function Z2(e,t){let[n,i,r]=e.center,o=e.radius,a=Math.hypot(t[0],t[1],t[2]),s=a>1e-6?[t[0]/a,t[1]/a,t[2]/a]:[0,1,0],l=o*2;return{position:[n+s[0]*l,i+s[1]*l,r+s[2]*l],target:e.center,extent:o,near:Math.max(o/100,.001),far:l+o*2}}function J2(e,t){let n=t[0]-e.center[0],i=t[1]-e.center[1],r=t[2]-e.center[2],o=Math.hypot(n,i,r);return{near:Math.max(o-e.radius,o*.01,.001),far:o+e.radius*2}}function Q2(e,t,n){return t&&n&&!e.attachedToCamera?n.center:[0,0,0]}var eP={ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},tP={enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3};function o0({light:e,shadows:t,shadowsEnabled:n,environmentRotation:i,modelBounds:r,objectBindings:o,nodeRefs:a}){let s=(0,yi.useRef)(null),l=(0,yi.useRef)(null),c=(0,yi.useRef)(null),h=(0,Ec.useThree)(x=>x.camera),p=(0,Ec.useThree)(x=>x.scene),u=(0,yi.useMemo)(()=>new a0.Vector3,[]),m=(0,yi.useMemo)(()=>e.attachedToCamera||e.attachment?e.position:s0(e.position,i),[e.position,e.attachedToCamera,e.attachment,i]);(0,Ec.useFrame)(()=>{let x=s.current??l.current??c.current;if(!x)return;if(e.attachedToCamera){x.position.copy(h.position);return}let v=e.attachment;if(!v)return;let w=o?jo(o,v.objectId):null,_=(w?o?.[w]:void 0)?.modelObjectId??v.objectId,y=(w?a?.current[w]:void 0)??xi(p,_);y&&(u.fromArray(v.offset),y.localToWorld(u),x.position.copy(u))});let f=n&&t.enabled&&e.castShadow,g=(0,yi.useMemo)(()=>e.type==="directional"&&f&&r&&!e.attachedToCamera?Z2(r,m):null,[e.type,e.attachedToCamera,f,r,m]),b=(0,yi.useMemo)(()=>e.type==="spot"&&f&&r&&!e.attachedToCamera?J2(r,m):null,[e.type,e.attachedToCamera,f,r,m]);return(0,yi.useEffect)(()=>{let x=s.current??c.current;if(!x)return;let[v,w,M]=Q2(e,f,r);x.target.position.set(v,w,M),x.target.updateMatrixWorld()},[e,f,r]),!e.visible||e.type==="none"?null:e.type==="directional"?(0,Qr.jsx)("directionalLight",{ref:s,color:e.color,intensity:e.intensity,position:g?.position??m,castShadow:f,"shadow-mapSize-width":t.mapSize,"shadow-mapSize-height":t.mapSize,"shadow-bias":e.shadowBias,"shadow-normalBias":t.normalBias,"shadow-radius":t.radius,"shadow-camera-near":g?.near??.5,"shadow-camera-far":g?.far??40,"shadow-camera-left":-(g?.extent??8),"shadow-camera-right":g?.extent??8,"shadow-camera-top":g?.extent??8,"shadow-camera-bottom":-(g?.extent??8)}):e.type==="point"?(0,Qr.jsx)("pointLight",{ref:l,color:e.color,intensity:e.intensity,position:m,distance:e.distance,decay:e.decay,castShadow:f,"shadow-mapSize-width":t.mapSize,"shadow-mapSize-height":t.mapSize,"shadow-bias":e.shadowBias}):e.type==="spot"?(0,Qr.jsx)("spotLight",{ref:c,color:e.color,intensity:e.intensity,position:m,angle:e.angle??Math.PI/6,penumbra:e.penumbra??.2,distance:e.distance,decay:e.decay,castShadow:f,"shadow-mapSize-width":t.mapSize,"shadow-mapSize-height":t.mapSize,"shadow-bias":e.shadowBias,"shadow-normalBias":t.normalBias,"shadow-radius":t.radius,"shadow-camera-near":b?.near??.5,"shadow-camera-far":b?.far??40}):e.type==="hemisphere"?(0,Qr.jsx)("hemisphereLight",{color:e.color,groundColor:"#444444",intensity:e.intensity}):null}function Jh({lightingConfig:e,shadowConfig:t,shadowsEnabled:n=!0,environmentRotation:i=0,environmentConfig:r,modelBounds:o,objectBindings:a,nodeRefs:s}){let l=e??eP,c=t??tP,h=r?.shadowLight,p=s0([5,10,5],i);return(0,Qr.jsxs)(Qr.Fragment,{children:[(0,Qr.jsx)("ambientLight",{intensity:l.ambient.intensity,color:l.ambient.color}),l.lights.map(u=>(0,Qr.jsx)(o0,{light:u,shadows:c,shadowsEnabled:n,environmentRotation:i,modelBounds:o,objectBindings:a,nodeRefs:s},u.id)),h?.enabled&&(0,Qr.jsx)(o0,{light:{id:"light-env-shadow",type:"directional",color:"#ffffff",intensity:h.intensity,position:p,attachedToCamera:!1,castShadow:!0,shadowBias:h.bias,visible:!0},shadows:c,shadowsEnabled:n,environmentRotation:0,modelBounds:o,objectBindings:a,nodeRefs:s})]})}var me=require("react"),$a=require("@react-three/fiber");var Rc=require("@react-three/fiber"),Xa=require("three"),Xo=require("three-stdlib"),g0=require("three/examples/jsm/loaders/USDLoader.js");var nP=require("@react-three/drei"),rP=require("@react-three/fiber"),iP=require("react"),l0=require("three");var ol=require("three-stdlib");function oP(e){return{name:"RI_unlit_emissive_texture",async afterRoot(t){let n=e.json.materials??[],i=new Map;if(n.forEach(o=>{let a=!!o?.extensions?.KHR_materials_unlit,s=!!o?.pbrMetallicRoughness?.baseColorTexture;a&&!s&&o?.emissiveTexture&&o.name&&i.set(o.name,o.emissiveTexture.index)}),i.size===0||!t.scene)return;let r=new Map;await Promise.all([...i].map(async([o,a])=>{let s=await e.getDependency("texture",a);s&&(s.colorSpace=l0.SRGBColorSpace,r.set(o,s))})),t.scene.traverse(o=>{let a=Array.isArray(o.material)?o.material:o.material?[o.material]:[];for(let s of a){let l=s.name?r.get(s.name):void 0;l&&!s.map&&(s.map=l,s.needsUpdate=!0)}})}}}var Qh="https://assets.react-immersive.liveroom.dev/three-r184/draco/",ef="https://assets.react-immersive.liveroom.dev/three-r184/basis/";function aP(e,t){if(!Bi(t))return e.detectSupport(t);let n=t,i=r=>n.hasFeature(r);return e.workerConfig={astcSupported:i("texture-compression-astc"),etc1Supported:i("texture-compression-etc1"),etc2Supported:i("texture-compression-etc2"),dxtSupported:i("texture-compression-s3tc"),bptcSupported:i("texture-compression-bc"),pvrtcSupported:i("texture-compression-pvrtc")},e}function c0(e,t={},n){let{dracoDecoderPath:i=Qh,ktx2TranscoderPath:r=ef,meshopt:o=!0}=t;if(i){let a=new ol.DRACOLoader;a.setDecoderPath(i),e.setDRACOLoader(a)}if(o&&e.setMeshoptDecoder(ol.MeshoptDecoder),r&&n){let a=aP(new ol.KTX2Loader().setTranscoderPath(r),n);e.setKTX2Loader(a)}e.register((a=>oP(a)))}var tf="KHR_materials_variants",d0="riMaterialVariants",u0="riMaterialVariantGroups";function nr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sP(e){if(!nr(e)||!nr(e.extensions))return[];let t=e.extensions[tf];if(!nr(t)||!Array.isArray(t.variants))return[];let n=new Set;return t.variants.map((i,r)=>{let o=nr(i)&&typeof i.name=="string"&&i.name?i.name:`Variant ${r+1}`,a=o;for(let s=2;n.has(a);s+=1)a=`${o} (${s})`;return n.add(a),a})}function p0(e){let t=e.userData?.gltfExtensions;if(!nr(t))return[];let n=t[tf];return!nr(n)||!Array.isArray(n.mappings)?[]:n.mappings.filter(i=>nr(i)&&Number.isInteger(i.material)&&Array.isArray(i.variants)&&i.variants.every(Number.isInteger))}function m0(e,t){for(let n=t.length-1;n>=0;n-=1){let i=t[n];if(i<0)continue;let r=e.find(o=>o.variants.includes(i));if(r)return r.material}return null}var lP=/^\s*(.+?)\s*(?::|\s\/\s)\s*(.+?)\s*$/;function cP(e){let t=Math.min(Math.max(e,0),1),n=t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function dP(e){if(!nr(e))return;let t=nr(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{};if(t.baseColorTexture!==void 0)return;let n=Array.isArray(t.baseColorFactor)?t.baseColorFactor:[1,1,1,1];if(n.slice(0,3).every(i=>typeof i=="number"))return`#${n.slice(0,3).map(i=>cP(i).toString(16).padStart(2,"0")).join("")}`}function uP(e,t){if(t.length===0)return[];let n=nr(e)?e:{},i=Array.isArray(n.meshes)?n.meshes:[],r=Array.isArray(n.accessors)?n.accessors:[],o=Array.isArray(n.materials)?n.materials:[],a=t.map(()=>new Set),s=t.map(()=>new Map);i.forEach((m,f)=>{(nr(m)&&Array.isArray(m.primitives)?m.primitives:[]).forEach((b,x)=>{if(!nr(b))return;let v=nr(b.extensions)?b.extensions[tf]:void 0;if(!nr(v)||!Array.isArray(v.mappings))return;let w=nr(b.attributes)?b.attributes.POSITION:void 0,M=typeof w=="number"?r[w]:void 0,_=nr(M)&&typeof M.count=="number"?M.count:1;for(let y of v.mappings)if(!(!nr(y)||!Number.isInteger(y.material)||!Array.isArray(y.variants)))for(let P of y.variants){if(!Number.isInteger(P)||!a[P])continue;a[P].add(`${f}/${x}`);let d=s[P],S=y.material;d.set(S,(d.get(S)??0)+_)}})});let l=t.map((m,f)=>{let g=null;for(let[x,v]of s[f])(g===null||v>(s[f].get(g)??0))&&(g=x);let b=g===null?void 0:dP(o[g]);return{name:m,label:m,...b?{swatch:b}:{}}}),c=t.map(()=>-1),h=[],p=new Map;return t.forEach((m,f)=>{let g=lP.exec(m);if(!g)return;let[,b,x]=g;p.has(b)||(p.set(b,h.length),h.push({name:b,members:[]})),c[f]=p.get(b),h[c[f]].members.push(f),l[f].label=x}),t.map((m,f)=>f).filter(m=>c[m]<0).sort((m,f)=>+(a[m].size===0)-+(a[f].size===0)).forEach(m=>{let f=h.map((x,v)=>({group:x,groupIndex:v})).filter(({group:x})=>x.name===null&&x.members.some(v=>a[m].size===0||a[v].size===0?!1:[...a[m]].some(w=>a[v].has(w)))).map(({groupIndex:x})=>x);if(f.length===0&&a[m].size===0){let x=h.findIndex(v=>v.name===null);x>=0&&f.push(x)}if(f.length===0){c[m]=h.length,h.push({name:null,members:[m]});return}let[g,...b]=f;for(let x of b){for(let v of h[x].members)c[v]=g;h[g].members.push(...h[x].members),h[x].members=[]}c[m]=g,h[g].members.push(m)}),h.filter(m=>m.members.length>0).sort((m,f)=>Math.min(...m.members)-Math.min(...f.members)).map(m=>({name:m.name,variants:[...m.members].sort((f,g)=>f-g).map(f=>l[f])}))}function Hu(e,t,n){let i=n.find(o=>o.variants.some(a=>a.name===t)),r=new Set(i?.variants.map(o=>o.name)??[t]);return[...e.filter(o=>!r.has(o)),t]}function Wo(e){if(Array.isArray(e.activeVariants))return e.activeVariants.filter(n=>typeof n=="string");let t=e.materialVariant;return typeof t=="string"&&t?[t]:[]}function h0(e){let t=e.parser,n=sP(t?.json);if(!(!t||n.length===0))return e.scene.userData[d0]=n,e.scene.userData[u0]=uP(t.json,n),{names:n,resolveMaterial:async(i,r)=>{let o={geometry:r.geometry,material:await t.getDependency("material",i),isPoints:r.isPoints,isLine:r.isLine};return t.assignFinalMaterial(o),o.material}}}function nf(e){let t=e.userData?.[d0];return Array.isArray(t)&&t.every(n=>typeof n=="string")?t:[]}function al(e){let t=e.userData?.[u0];if(Array.isArray(t))return t;let n=nf(e);return n.length>0?[{name:null,variants:n.map(i=>({name:i,label:i}))}]:[]}function sl(e,t){let{materialVariant:n,...i}=e;return{...i,activeVariants:t}}var Xu=class extends Xa.Loader{constructor(){super(...arguments);this.options={source:{format:"glb"}}}configure(n){return this.options=n,this}load(n,i,r,o){this.loadAsset(n,r).then(i).catch(o)}async loadAsset(n,i){let r=hP(this.options.source),{format:o}=this.options.source;if(o==="obj")return pP(n,r,this.options.source,i);if(o==="fbx"){let l=rf(this,new Xo.FBXLoader(r)),c=bP(n,this.options.source);c&&l.setResourcePath(c);let h=await l.loadAsync(n,i);return Wu(h,"FBXMesh",!1),{scene:h,animations:h.animations??[]}}if(o==="stl"||o==="ply"){let l=await mP(n,r,i),c=yx(this.options.source.entryPath??n,o==="stl"?"STL model":"PLY model"),h=o==="stl"?wx(l,c):Sx(l,c);return Wu(h,o==="stl"?"STLMesh":"PLYMesh",!0),{scene:h,animations:[]}}if(o==="usdz"){let c=await rf(this,new g0.USDLoader(r)).loadAsync(n,i);return Wu(c,"USDZMesh",!1),{scene:c,animations:c.animations??[]}}let a=rf(this,new Xo.GLTFLoader(r));c0(a,this.options.decoderConfig,this.options.renderer);let s=await a.loadAsync(n,i);return{scene:s.scene,animations:s.animations??[],materialVariants:h0(s)}}};tx(e=>{Rc.useLoader.clear(Xu,e)});function b0(e,t={},n,i){let r=(0,Rc.useThree)(s=>s.gl),o=ux(e),a=n?{...o,format:n}:o;return(0,Rc.useLoader)(Xu,e,s=>{s.configure({source:a,decoderConfig:t,renderer:r})},i)}async function pP(e,t,n,i){let r=await f0(e,t,i),o=new Xo.OBJLoader(t),a=fP(r);if(a){let l=gP(a,e,n);if(l)try{let c=await f0(l.url,t),p=new Xo.MTLLoader(t).parse(c,l.basePath);p.preload(),o.setMaterials(p)}catch(c){console.warn(`[react-immersive] Could not load OBJ material ${a}; rendering geometry with fallback materials.`,c)}}let s=o.parse(r);return Wu(s,"OBJMesh",!0),{scene:s,animations:[]}}function Wu(e,t,n){let i=new Set,r=0;e.traverse(o=>{if(!("isMesh"in o&&o.isMesh===!0)){o.name&&i.add(o.name);return}let s=o.name||`${t}_${++r}`;if(!n&&o.name){i.add(o.name);return}let l=s,c=2;for(;i.has(l);)l=`${s}_${c++}`;o.name=l,i.add(l)})}function f0(e,t,n){let i=new Xa.FileLoader(t);return i.setResponseType("text"),i.loadAsync(e,n)}function mP(e,t,n){let i=new Xa.FileLoader(t);return i.setResponseType("arraybuffer"),i.loadAsync(e,n)}function rf(e,t){return t.setCrossOrigin(e.crossOrigin),t.setWithCredentials(e.withCredentials),t.setRequestHeader(e.requestHeader),t}function hP(e){let t=new Xa.LoadingManager,n=e.resourceUrls;return n&&t.setURLModifier(i=>{if(/^(?:blob:|data:)/i.test(i))return i;let r=$u(x0(i).split(/[?#]/)[0]),o=n[r];if(o)return o;let a=qu(e.entryPath??""),s=$u(a?`${a}/${r}`:r);return n[s]??i}),t}function fP(e){return/^\s*mtllib\s+(.+?)\s*$/im.exec(e)?.[1]?.trim()||null}function gP(e,t,n){if(n.resourceUrls&&n.entryPath){let i=$u(`${qu(n.entryPath)}/${x0(e)}`),r=n.resourceUrls[i];if(!r)return null;let o=qu(i);return{url:r,basePath:o?`${o}/`:""}}try{let i=new URL(e,t).href;return{url:i,basePath:v0(i)}}catch{return null}}function bP(e,t){if(t.resourceUrls&&t.entryPath){let n=qu(t.entryPath);return n?`${n}/`:""}return v0(e)}function v0(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t+1)}function qu(e){let t=$u(e),n=t.lastIndexOf("/");return n===-1?"":t.slice(0,n)}function $u(e){let t=[];for(let n of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(i=>i&&i!=="."))n===".."?t.pop():t.push(n);return t.join("/")}function x0(e){try{return decodeURI(e)}catch{return e}}var ut=require("three"),T0=require("three-stdlib");function y0(e){let t=new Map;return e.map((n,i)=>{let o=n.name.trim()||`Animation ${i+1}`,a=t.get(o)??0;return t.set(o,a+1),{clip:n,sourceName:a===0?o:`${o} (${a+1})`,duration:n.duration}})}var co=require("three");function w0(e){let t=e._loopCount;return e.loop===co.LoopPingPong&&(t&1)===1}function vP(e){return w0(e)?e.getClip().duration-e.time:e.time}function S0({root:e,clips:t,getClipConfig:n,onChange:i}){let r=new co.AnimationMixer(e),o=new Map;for(let{clip:C,sourceName:T}of t)o.set(T,r.clipAction(C));let a=new Map,s=new Set,l=new Map,c=1,h=C=>typeof C=="string",p=C=>h(C)?a.has(C)?[C]:[]:[...a.keys()],u=(C,T)=>{let E=$x(n(T));E==="once"?C.setLoop(co.LoopOnce,1):E==="ping-pong"?C.setLoop(co.LoopPingPong,1/0):C.setLoop(co.LoopRepeat,1/0),C.clampWhenFinished=E==="once"},m=C=>{C.action.setEffectiveTimeScale(C.reverse?-C.speed:C.speed)},f=C=>{let T=a.get(C);T&&(T.action.stop(),a.delete(C))},g=(C,T={})=>{let E=o.get(C);if(!E||n(C)?.hidden)return;let k=Number.isFinite(T.fade)&&T.fade>0?T.fade:0,D=T.reverse??!1;if(!T.alongside)for(let[O,B]of[...a])O!==C&&(k>0?(a.delete(O),B.action.fadeOut(k),s.add(B.action)):f(O));s.delete(E)&&E.stop();let I=E.getClip().duration,L=a.get(C),X=()=>{E.reset(),D&&(E.time=I),E.play()};if(!L)X(),k>0&&E.fadeIn(k);else{let O=D?E.time<=0:E.time>=I;L.finished&&O&&X(),E.paused=!1,E.enabled=!0,a.delete(C)}u(E,C),L={action:E,speed:n(C)?.speed??l.get(C)??c,reverse:D,finished:!1},L.speed=wu(L.speed),m(L),a.set(C,L),i()},b=C=>{for(let T of p(C))a.get(T).action.paused=!0;i()},x=C=>{for(let T of p(C))f(T);if(!h(C)){for(let T of s)T.stop();s.clear()}i()},v=(C,T)=>{let E=wu(C);h(T)?l.set(T,E):c=E;for(let k of p(T)){let D=a.get(k);l.set(k,E),D.speed=E,m(D)}i()},w=(C,T)=>{for(let E of p(T)){let k=a.get(E),D=k.action.getClip().duration,I=Math.min(Math.max(C,0),D);k.action.time=w0(k.action)?D-I:I,k.finished&&(k.finished=!1,k.action.paused=!0)}r.update(0),i()},M=()=>{for(let[C,T]of[...a]){let E=n(C);if(E?.hidden){f(C);continue}u(T.action,C),E?.speed!==void 0&&(T.speed=wu(E.speed),m(T))}i()},_=C=>{for(let T of a.values())T.action===C.action&&(T.finished=!0);i()};return r.addEventListener("finished",_),{play:g,pause:b,stop:x,setSpeed:v,seek:w,getState:()=>{let C=[...a].map(([E,k])=>({clip:E,status:k.finished?"finished":k.action.paused?"paused":"playing",time:vP(k.action),duration:k.action.getClip().duration,speed:k.speed,reverse:k.reverse})),T=C[C.length-1];return{currentClip:T?.clip??null,isPlaying:C.some(E=>E.status==="playing"),speed:T?.speed??c,time:T?.time??0,duration:T?.duration??0,active:C}},applyClipConfigs:M,isRunning:()=>{if(s.size>0)return!0;for(let{action:C}of a.values())if(!C.paused&&C.enabled)return!0;return!1},update:C=>{r.update(C);for(let T of s)(!T.enabled||T.getEffectiveWeight()<=0)&&(T.stop(),s.delete(T))},dispose:()=>{r.removeEventListener("finished",_),r.stopAllAction(),r.uncacheRoot(e),a.clear(),s.clear()}}}var ei=require("three");function Yu(e){if(Vx(e))return e;if(!e||typeof e!="object")return null;let t=e,n=new ei.MeshStandardMaterial;typeof t.name=="string"&&(n.name=t.name),n.metalness=0,n.roughness=1,t.type==="MeshBasicMaterial"||t.isMeshBasicMaterial===!0?(n.color.set(0),n.emissiveIntensity=1,t.map instanceof ei.Texture?(n.emissiveMap=t.map,n.emissive.set(16777215)):t.color instanceof ei.Color&&n.emissive.copy(t.color)):(t.color instanceof ei.Color&&n.color.copy(t.color),t.map instanceof ei.Texture&&(n.map=t.map),t.emissive instanceof ei.Color&&n.emissive.copy(t.emissive),t.emissiveMap instanceof ei.Texture&&(n.emissiveMap=t.emissiveMap));let r=["aoMap","aoMapIntensity","lightMap","lightMapIntensity","alphaMap","opacity","transparent","alphaTest","side","vertexColors","wireframe","depthTest","depthWrite","visible","toneMapped","fog"];for(let o of r)t[o]!==void 0&&(n[o]=t[o]);return n.needsUpdate=!0,n}function Ku(e){if(Fx(e))return e.clone();let t=new ei.MeshPhysicalMaterial;return t.name=e.name,t.color.copy(e.color),t.map=e.map,t.lightMap=e.lightMap,t.lightMapIntensity=e.lightMapIntensity,t.aoMap=e.aoMap,t.aoMapIntensity=e.aoMapIntensity,t.emissive.copy(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.emissiveMap=e.emissiveMap,t.bumpMap=e.bumpMap,t.bumpScale=e.bumpScale,t.normalMap=e.normalMap,t.normalMapType=e.normalMapType,t.normalScale.copy(no(e.normalScale)),t.displacementMap=e.displacementMap,t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias,t.roughness=e.roughness,t.roughnessMap=e.roughnessMap,t.metalness=e.metalness,t.metalnessMap=e.metalnessMap,t.alphaMap=e.alphaMap,t.envMap=e.envMap,t.envMapRotation.copy(e.envMapRotation),t.envMapIntensity=e.envMapIntensity,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.flatShading=e.flatShading,t.fog=e.fog,t.opacity=e.opacity,t.transparent=e.transparent,t.alphaHash=e.alphaHash,t.blendSrc=e.blendSrc,t.blendDst=e.blendDst,t.blendEquation=e.blendEquation,t.blendSrcAlpha=e.blendSrcAlpha,t.blendDstAlpha=e.blendDstAlpha,t.blendEquationAlpha=e.blendEquationAlpha,t.blending=e.blending,t.premultipliedAlpha=e.premultipliedAlpha,t.dithering=e.dithering,t.alphaTest=e.alphaTest,t.depthTest=e.depthTest,t.depthWrite=e.depthWrite,t.colorWrite=e.colorWrite,t.stencilWrite=e.stencilWrite,t.stencilWriteMask=e.stencilWriteMask,t.stencilFunc=e.stencilFunc,t.stencilRef=e.stencilRef,t.stencilFuncMask=e.stencilFuncMask,t.stencilFail=e.stencilFail,t.stencilZFail=e.stencilZFail,t.stencilZPass=e.stencilZPass,t.side=e.side,t.shadowSide=e.shadowSide,t.toneMapped=e.toneMapped,t.vertexColors=e.vertexColors,t.visible=e.visible,t.clippingPlanes=e.clippingPlanes,t.clipIntersection=e.clipIntersection,t.clipShadows=e.clipShadows,t.forceSinglePass=e.forceSinglePass,t.polygonOffset=e.polygonOffset,t.polygonOffsetFactor=e.polygonOffsetFactor,t.polygonOffsetUnits=e.polygonOffsetUnits,t}function Zu(e){e.userData.baseColor=e.color.clone(),e.userData.baseMap=e.map??null,e.userData.baseVertexColors=e.vertexColors,e.userData.baseMetalness=e.metalness,e.userData.baseMetalnessMap=e.metalnessMap??null,e.userData.baseRoughness=e.roughness,e.userData.baseRoughnessMap=e.roughnessMap??null,e.userData.baseEmissive=e.emissive.clone(),e.userData.baseEmissiveIntensity=e.emissiveIntensity,e.userData.baseEmissiveMap=e.emissiveMap??null,e.userData.baseOpacity=e.opacity,e.userData.baseTransparent=e.transparent,e.userData.baseAlphaMap=e.alphaMap??null,e.userData.baseAlphaTest=e.alphaTest,e.userData.baseAlphaHash=e.alphaHash,e.userData.baseDithering=e.dithering,e.userData.baseBlending=e.blending,e.userData.baseDepthWrite=e.depthWrite,e.userData.baseSide=e.side,e.userData.baseNormalMap=e.normalMap??null,e.userData.baseNormalScale=no(e.normalScale),e.userData.baseBumpMap=e.bumpMap??null,e.userData.baseBumpScale=e.bumpScale,e.userData.baseAoMap=e.aoMap??null,e.userData.baseAoMapIntensity=e.aoMapIntensity,e.userData.baseDisplacementMap=e.displacementMap??null,e.userData.baseDisplacementScale=e.displacementScale,e.userData.baseDisplacementBias=e.displacementBias,e.userData.baseClearcoat=e.clearcoat,e.userData.baseClearcoatMap=e.clearcoatMap??null,e.userData.baseClearcoatRoughness=e.clearcoatRoughness,e.userData.baseClearcoatRoughnessMap=e.clearcoatRoughnessMap??null,e.userData.baseClearcoatNormalMap=e.clearcoatNormalMap??null,e.userData.baseClearcoatNormalScale=no(e.clearcoatNormalScale),e.userData.baseSheen=e.sheen,e.userData.baseSheenColor=e.sheenColor.clone(),e.userData.baseSheenColorMap=e.sheenColorMap??null,e.userData.baseSheenRoughness=e.sheenRoughness,e.userData.baseSheenRoughnessMap=e.sheenRoughnessMap??null,e.userData.baseAnisotropy=e.anisotropy,e.userData.baseAnisotropyRotation=e.anisotropyRotation,e.userData.baseAnisotropyMap=e.anisotropyMap??null,e.userData.baseTransmission=e.transmission,e.userData.baseTransmissionMap=e.transmissionMap??null,e.userData.baseThickness=e.thickness,e.userData.baseThicknessMap=e.thicknessMap??null,e.userData.baseAttenuationColor=e.attenuationColor.clone(),e.userData.baseAttenuationDistance=e.attenuationDistance,e.userData.baseReflectivity=e.reflectivity,e.userData.baseSpecularIntensity=e.specularIntensity,e.userData.baseSpecularIntensityMap=e.specularIntensityMap??null,e.userData.baseSpecularColor=e.specularColor.clone(),e.userData.baseSpecularColorMap=e.specularColorMap??null,e.userData.baseFlatShading=e.flatShading,e.userData.baseEnvMapIntensity=e.envMapIntensity}var zi=require("three");function _0(e,t,n,i){let r=mi(t),o=wc(n,r),a=jx(i,t),s=Gx(i,t),l=Hx(i,t);return a||s||l?Cu(e.userData,t,o,n,a??[0,0],s??1,l??0):(Tu(e.userData,t),o)}function qn(e,t,n,i){if(!n){Tu(e.userData,t);return}let r=yu[t];e[r]=_0(e,t,n,i)}function Ju(e,t,n){e.map=e.userData.baseMap??null,e.color.copy(e.userData.baseColor),e.vertexColors=e.userData.baseVertexColors??e.vertexColors,e.metalness=e.userData.baseMetalness??e.metalness,e.metalnessMap=e.userData.baseMetalnessMap??null,e.roughness=e.userData.baseRoughness??e.roughness,e.roughnessMap=e.userData.baseRoughnessMap??null,e.emissive.copy(e.userData.baseEmissive??new zi.Color(0,0,0)),e.emissiveIntensity=e.userData.baseEmissiveIntensity??e.emissiveIntensity,e.emissiveMap=e.userData.baseEmissiveMap??null,e.opacity=e.userData.baseOpacity??1,e.transparent=e.userData.baseTransparent??!1,e.alphaMap=e.userData.baseAlphaMap??null,e.alphaTest=e.userData.baseAlphaTest??0,e.alphaHash=e.userData.baseAlphaHash??!1,e.dithering=e.userData.baseDithering??!1,e.blending=e.userData.baseBlending??zi.NormalBlending,e.depthWrite=e.userData.baseDepthWrite??!0,e.side=e.userData.baseSide??zi.FrontSide,e.normalMap=e.userData.baseNormalMap??null,e.normalScale.copy(no(e.userData.baseNormalScale)),e.bumpMap=e.userData.baseBumpMap??null,e.bumpScale=e.userData.baseBumpScale??e.bumpScale,e.aoMap=e.userData.baseAoMap??null,e.aoMapIntensity=e.userData.baseAoMapIntensity??e.aoMapIntensity,e.displacementMap=e.userData.baseDisplacementMap??null,e.displacementScale=e.userData.baseDisplacementScale??e.displacementScale,e.displacementBias=e.userData.baseDisplacementBias??e.displacementBias,e.clearcoat=e.userData.baseClearcoat??e.clearcoat,e.clearcoatMap=e.userData.baseClearcoatMap??null,e.clearcoatRoughness=e.userData.baseClearcoatRoughness??e.clearcoatRoughness,e.clearcoatRoughnessMap=e.userData.baseClearcoatRoughnessMap??null,e.clearcoatNormalMap=e.userData.baseClearcoatNormalMap??null,e.clearcoatNormalScale.copy(no(e.userData.baseClearcoatNormalScale)),e.sheen=e.userData.baseSheen??e.sheen,e.sheenColor.copy(e.userData.baseSheenColor??new zi.Color(0,0,0)),e.sheenColorMap=e.userData.baseSheenColorMap??null,e.sheenRoughness=e.userData.baseSheenRoughness??e.sheenRoughness,e.sheenRoughnessMap=e.userData.baseSheenRoughnessMap??null,e.anisotropy=e.userData.baseAnisotropy??e.anisotropy,e.anisotropyRotation=e.userData.baseAnisotropyRotation??e.anisotropyRotation,e.anisotropyMap=e.userData.baseAnisotropyMap??null,e.transmission=e.userData.baseTransmission??e.transmission,e.transmissionMap=e.userData.baseTransmissionMap??null,e.thickness=e.userData.baseThickness??e.thickness,e.thicknessMap=e.userData.baseThicknessMap??null,e.attenuationColor.copy(e.userData.baseAttenuationColor??new zi.Color("#ffffff")),e.attenuationDistance=e.userData.baseAttenuationDistance??e.attenuationDistance,e.reflectivity=e.userData.baseReflectivity??e.reflectivity,e.specularIntensity=e.userData.baseSpecularIntensity??e.specularIntensity,e.specularIntensityMap=e.userData.baseSpecularIntensityMap??null,e.specularColor.copy(e.userData.baseSpecularColor??new zi.Color("#ffffff")),e.specularColorMap=e.userData.baseSpecularColorMap??null,e.flatShading=e.userData.baseFlatShading??e.flatShading,e.envMapIntensity=e.userData.baseEnvMapIntensity??e.envMapIntensity;let i=on(t,"texture"),r=on(t,"metalnessMap"),o=on(t,"roughnessMap"),a=on(t,"emissiveMap"),s=on(t,"alphaMap"),l=on(t,"normalMap"),c=on(t,"bumpMap"),h=on(t,"aoMap"),p=on(t,"displacementMap"),u=on(t,"clearcoatMap"),m=on(t,"clearcoatRoughnessMap"),f=on(t,"clearcoatNormalMap"),g=on(t,"anisotropyMap"),b=on(t,"transmissionMap"),x=on(t,"thicknessMap"),v=on(t,"sheenColorMap"),w=on(t,"sheenRoughnessMap"),M=on(t,"specularIntensityMap"),_=on(t,"specularColorMap");if(i?(e.map=_0(e,"texture",i,t),e.color.set(n??"#ffffff"),e.vertexColors=!1):(Tu(e.userData,"texture"),n&&(e.map=null,e.color.set(n),e.vertexColors=!1)),qn(e,"metalnessMap",r,t),t?.metalness!==void 0&&(e.metalness=t.metalness),qn(e,"roughnessMap",o,t),t?.roughness!==void 0&&(e.roughness=t.roughness),t?.emissive?e.emissive.set(t.emissive):a&&e.emissive.set("#ffffff"),t?.emissiveIntensity!==void 0&&(e.emissiveIntensity=t.emissiveIntensity),qn(e,"emissiveMap",a,t),t?.opacity!==void 0&&(e.opacity=t.opacity),qn(e,"alphaMap",s,t),t?.alphaTest!==void 0&&(e.alphaTest=t.alphaTest),t?.alphaHash!==void 0&&(e.alphaHash=t.alphaHash),t?.dithering!==void 0&&(e.dithering=t.dithering),t?.blendingMode&&(e.blending=Xx(t.blendingMode),e.depthWrite=t.blendingMode!=="additive"),t?.side&&(e.side=Wx(t.side)),qn(e,"normalMap",l,t),l||t?.normalScale!==void 0){let y=t?.normalScale??Math.abs(no(e.userData.baseNormalScale).x);e.normalScale.set(y,t?.flipNormalY?-y:y)}if(qn(e,"bumpMap",c,t),t?.bumpScale!==void 0&&(e.bumpScale=t.bumpScale),qn(e,"aoMap",h,t),t?.aoMapIntensity!==void 0&&(e.aoMapIntensity=t.aoMapIntensity),qn(e,"displacementMap",p,t),t?.displacementScale!==void 0&&(e.displacementScale=t.displacementScale),t?.displacementBias!==void 0&&(e.displacementBias=t.displacementBias),qn(e,"clearcoatMap",u,t),t?.clearcoat!==void 0&&(e.clearcoat=t.clearcoat),qn(e,"clearcoatRoughnessMap",m,t),t?.clearcoatRoughness!==void 0&&(e.clearcoatRoughness=t.clearcoatRoughness),qn(e,"clearcoatNormalMap",f,t),f||t?.clearcoatNormalScale!==void 0){let y=t?.clearcoatNormalScale??Math.abs(no(e.userData.baseClearcoatNormalScale).x);e.clearcoatNormalScale.set(y,t?.flipClearcoatNormalY?-y:y)}t?.sheen!==void 0&&(e.sheen=t.sheen),t?.sheenColor&&e.sheenColor.set(t.sheenColor),qn(e,"sheenColorMap",v,t),t?.sheenRoughness!==void 0&&(e.sheenRoughness=t.sheenRoughness),qn(e,"sheenRoughnessMap",w,t),t?.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t?.anisotropyRotation!==void 0&&(e.anisotropyRotation=t.anisotropyRotation),qn(e,"anisotropyMap",g,t),t?.transmission!==void 0&&(e.transmission=t.transmission),qn(e,"transmissionMap",b,t),t?.thickness!==void 0&&(e.thickness=t.thickness),qn(e,"thicknessMap",x,t),t?.attenuationColor&&e.attenuationColor.set(t.attenuationColor),t?.attenuationDistance!==void 0&&(e.attenuationDistance=t.attenuationDistance),t?.reflectivity!==void 0&&(e.reflectivity=t.reflectivity),t?.specularIntensity!==void 0&&(e.specularIntensity=t.specularIntensity),qn(e,"specularIntensityMap",M,t),t?.specularColor&&e.specularColor.set(t.specularColor),qn(e,"specularColorMap",_,t),e.transparent=e.opacity<1||e.transmission>0||e.blending!==zi.NormalBlending||!!((s||e.alphaMap)&&e.alphaTest<=0),e.transparent||(e.depthWrite=!0)}function kc(e){return e.material}function Ui(e,t){return Array.isArray(e)?e.map(t):t(e,0)}function Tr(e,t){Array.isArray(e)?e.forEach(t):t(e,0)}function Qu(e,t){return Array.isArray(e)?e[t]:e}function of(e){e.updateMatrixWorld(!0),e.traverse(t=>{let n=t;n.isSkinnedMesh&&(n.skeleton?.update(),n.computeBoundingBox?.(),n.computeBoundingSphere?.())})}var qa=require("react"),M0=require("@react-three/fiber");function C0(){let e=(0,M0.useThree)(r=>r.gl.domElement),t=(0,qa.useRef)(void 0),n=(0,qa.useCallback)(r=>{t.current===void 0&&(t.current=e.style.cursor),e.style.cursor=r},[e]),i=(0,qa.useCallback)(()=>{let r=t.current;r!==void 0&&(e.style.cursor=r,t.current=void 0)},[e]);return(0,qa.useEffect)(()=>()=>{i()},[i]),{setCanvasCursor:n,restoreCanvasCursor:i}}var af=require("react/jsx-runtime");function ep(e,t,n){let i=n.get(e);i&&(t?.position?e.position.fromArray(t.position):e.position.copy(i.position),t?.rotation?e.rotation.set(t.rotation[0],t.rotation[1],t.rotation[2],i.rotation.order):e.rotation.copy(i.rotation),t?.scale?e.scale.fromArray(t.scale):e.scale.copy(i.scale),e.updateMatrix())}function An(e,t=!1){if(!e||typeof e!="object")return"-";let n=e;return[n.channel??0,t?n.format??"":"",n.isVideoTexture?n.colorSpace??"":""].join(":")}function ll(e){let t=e,n=Number(t.clearcoat)>0,i=Number(t.sheen)>0,r=Number(t.anisotropy)>0,o=Number(t.transmission)>0,a=t.transparent===!1&&t.blending===ut.NormalBlending&&t.alphaToCoverage!==!0;return[An(t.map),An(t.aoMap),An(t.lightMap),An(t.bumpMap),An(t.normalMap,!0),t.normalMap?t.normalMapType:"",An(t.displacementMap),An(t.emissiveMap),An(t.metalnessMap),An(t.roughnessMap),r,An(r?t.anisotropyMap:null),n,An(n?t.clearcoatMap:null),An(n?t.clearcoatNormalMap:null,!0),An(n?t.clearcoatRoughnessMap:null),i,An(i?t.sheenColorMap:null),An(i?t.sheenRoughnessMap:null),An(t.specularColorMap),An(t.specularIntensityMap),o,An(o?t.transmissionMap:null),An(o?t.thicknessMap:null),An(t.alphaMap),Number(t.alphaTest)>0,!!t.alphaHash,!!t.flatShading,!!t.dithering,!!t.vertexColors,t.side,a].join("|")}var xP={};function sf({url:e,objectBindings:t,selectedItem:n,itemMaterials:i,onItemClick:r,onItemHover:o,onItemDoubleClick:a,onItemContextMenu:s,onModelLoaded:l,onAnimationsReady:c,nodeRefsOut:h,onNodeRefsChange:p,materialRefsOut:u,panelHoveredItem:m,sceneConfig:f,zoomOnSelected:g=!0,highlightOnHover:b=!0,decoderConfig:x,modelFormat:v,onLoadProgress:w,explodeFactor:M=0,suspendBindingTransforms:_=!1,pulses:y=xP}){let P=b0(e,x,v,w),d=(0,$a.useThree)(z=>z.invalidate),[S,C]=(0,me.useState)(null),T=(0,me.useRef)(null),{setCanvasCursor:E,restoreCanvasCursor:k}=C0();(0,me.useEffect)(()=>{b||(C(null),o?.(null),k())},[b,o,k]);let D=(0,me.useMemo)(()=>T0.SkeletonUtils.clone(P.scene),[P.scene]),I=(0,me.useMemo)(()=>lo(D),[D]),L=I.nodesById,X=(0,me.useMemo)(()=>{let z=new WeakMap;return D.traverse(U=>{tr(U)&&z.set(U,U.material)}),z},[D]),O=P.materialVariants,re=(f?Wo(f.model):[]).join(`
|
|
3674
|
+
`),[ke,te]=(0,me.useState)(null);(0,me.useEffect)(()=>{let z=re?re.split(`
|
|
3675
|
+
`):[],U=[];for(let Q of z){let fe=O?O.names.indexOf(Q):-1;if(fe>=0){U.push(fe);continue}console.warn(`[react-immersive] The model has no material variant "${Q}".`+(O?` Its variants are: ${O.names.join(", ")}.`:" It has no material variants."))}if(!O||U.length===0){te(null);return}let H=!1,oe=[];return D.traverse(Q=>{if(!tr(Q)||!X.has(Q))return;let fe=m0(p0(Q),U);fe!==null&&oe.push(O.resolveMaterial(fe,Q).then(we=>[Q,we]))}),Promise.all(oe).then(Q=>{H||te({scene:D,materials:new Map(Q)})}).catch(Q=>{H||console.warn(`[react-immersive] Material variants "${z.join('", "')}" failed to load.`,Q)}),()=>{H=!0}},[D,X,O,re]);let We=ke?.scene===D?ke.materials:void 0,wt=z=>We?.get(z)??X.get(z)??kc(z);(0,me.useEffect)(()=>{I.duplicateNames.size!==0&&console.warn("[react-immersive] Duplicate model node names were assigned unique binding IDs.",Object.fromEntries(I.duplicateNames))},[I]);let be=(0,me.useMemo)(()=>{let z=new WeakMap;return D.traverse(U=>{z.set(U,{position:U.position.clone(),rotation:U.rotation.clone(),scale:U.scale.clone()})}),z},[D]);(0,me.useEffect)(()=>{let z=!1,U=null,H=null,oe=window,Q=Object.entries(L).filter(([,Vt])=>tr(Vt)),fe=new ut.Box3,we=[],pn=0;D.traverse(Vt=>{!tr(Vt)||Vt.userData[Ua]||(Vt.castShadow=!1,Vt.receiveShadow=!0)});let tt=()=>{if(z)return;let Vt=new Set,Se=fe.getSize(new ut.Vector3),Ht=new ut.Vector3;for(let{name:Ln,box:jn}of we)jn.getSize(Ht),Ht.x>Se.x*.7&&Ht.z>Se.z*.7&&Ht.y>Se.y*.4&&Vt.add(Ln);D.traverse(Ln=>{if(!tr(Ln)||Ln.userData[Ua])return;let jn=Ac(Ln);Ln.castShadow=!jn||!Vt.has(jn),Ln.receiveShadow=!0}),d()},$e=()=>{z||(oe.requestIdleCallback?U=oe.requestIdleCallback(Ye,{timeout:100}):H=window.setTimeout(()=>Ye(),0))},Ye=Vt=>{if(U=null,H=null,z)return;let Se=performance.now(),Ht=0;for(;pn<Q.length&&!(Ht>0&&!(Vt?Vt.didTimeout?Ht<16:Vt.timeRemaining()>1:performance.now()-Se<8));){let[Ln,jn]=Q[pn];pn+=1,Ht+=1;let yr=new ut.Box3().setFromObject(jn);yr.isEmpty()||(we.push({name:Ln,box:yr}),fe.union(yr))}pn<Q.length?$e():tt()};return $e(),()=>{z=!0,U!==null&&oe.cancelIdleCallback?.(U),H!==null&&window.clearTimeout(H)}},[d,L,D]),(0,me.useEffect)(()=>{of(D)},[D]),(0,me.useEffect)(()=>{let z=new AbortController;return eu(D,z.signal),()=>{z.abort(),cc(D)}},[D]);let ue=(0,me.useMemo)(()=>{let z={};for(let[U,H]of Object.entries(t))z[H.modelObjectId??U]=U;return z},[t]),Ne=(0,me.useMemo)(()=>Object.entries(t).map(([z,U])=>`${z}${U.modelObjectId??z}`).sort().join(""),[t]),Te=(0,me.useMemo)(()=>Object.entries(t).map(([z,U])=>JSON.stringify([z,U.modelObjectId??z,U.transform??null])).sort().join(""),[t]),bn=(0,me.useRef)(new Map);(0,me.useEffect)(()=>{let z=new Map,U=new Map;for(let[Q,fe]of Object.entries(t)){if(!fe.transform)continue;let we=L[fe.modelObjectId??Q];we&&(z.set(we,fe.transform),U.set(we,Zs(we)))}let H=new Set([...bn.current.keys(),...z.keys()]);for(let Q of H){ep(Q,void 0,be);for(let fe of Zs(Q))Js(fe)}D.updateMatrixWorld(!0);let oe=new Map;for(let Q of U.values())for(let fe of Q)oe.has(fe)||oe.set(fe,fe.matrixWorld.clone());for(let[Q,fe]of z)ep(Q,fe,be);bn.current=z,D.updateMatrixWorld(!0);for(let[Q,fe]of oe)Su(Q,fe);d()},[D,L,be,Te,d]),(0,me.useEffect)(()=>()=>{for(let z of Zs(D))Js(z)},[D]);let Oe=(0,me.useMemo)(()=>{let z={};for(let[U,H]of Object.entries(t)){let oe=H.modelObjectId??U,Q=L[oe];if(!tr(Q))continue;let fe=wt(Q);fe&&(z[U]=Ui(fe,we=>{let pn=Yu(we),tt=Ku(pn??new ut.MeshStandardMaterial);return Zu(tt),tt}))}return z},[L,Ne,X,We]);(0,me.useEffect)(()=>{u&&(u.current=Oe)},[Oe,u]),(0,me.useEffect)(()=>()=>{for(let z of Object.values(Oe))Tr(z,U=>{ny(U.userData),U.dispose()})},[Oe]);let ot=f?.model.shading??"lit",mt=f?.model.renderer??"pbr",vn=f?.wireframe.enabled??!1,de=f?.wireframe.color??"#93c5fd",ur=f?.wireframe.opacity??1,jt=(0,me.useMemo)(()=>{let z={};if(ot!=="unlit")return z;for(let[U,H]of Object.entries(Oe))z[U]=Ui(H,oe=>{let Q=new ut.MeshBasicMaterial;return Q.color.copy(oe.color),Q.map=oe.map,Q.alphaMap=oe.alphaMap,Q.alphaTest=oe.alphaTest,Q.transparent=oe.transparent,Q.opacity=oe.opacity,Q.side=oe.side,Q});return z},[Oe,ot]),Gt=(0,me.useMemo)(()=>{let z={};if(ot!=="normals")return z;for(let[U,H]of Object.entries(Oe))z[U]=Ui(H,()=>new ut.MeshNormalMaterial);return z},[Oe,ot]),ce=(0,me.useMemo)(()=>{let z={};if(ot!=="lit"||mt!=="matcap")return z;let U=Pu();for(let[H,oe]of Object.entries(Oe))z[H]=Ui(oe,Q=>{let fe=new ut.MeshMatcapMaterial;return fe.matcap=U,fe.color.copy(Q.color),fe.alphaMap=Q.alphaMap,fe.alphaTest=Q.alphaTest,fe.side=Q.side,fe});return z},[Oe,ot,mt]);(0,me.useEffect)(()=>()=>{for(let z of Object.values(jt))Tr(z,U=>U.dispose());for(let z of Object.values(Gt))Tr(z,U=>U.dispose());for(let z of Object.values(ce))Tr(z,U=>U.dispose())},[jt,Gt,ce]);let Be=z=>ot==="normals"?Gt[z]:ot==="unlit"?jt[z]:mt==="matcap"?ce[z]:Oe[z],zt=(0,me.useRef)(l);zt.current=l,(0,me.useEffect)(()=>{zt.current?.(D)},[D]);let gt=(0,me.useMemo)(()=>{let z={};for(let[U,H]of Object.entries(t)){let oe=H.modelObjectId??U,Q=L[oe];Q&&(z[U]=Q)}return z},[L,Ne]);(0,me.useEffect)(()=>(h.current=gt,p?.(),()=>{h.current===gt&&(h.current={})}),[gt,h,p]);let Ut=(0,me.useRef)({});(0,me.useEffect)(()=>()=>{for(let z of Object.values(Ut.current))for(let[U,H]of Object.entries(z))H&&io(H,mi(U));Ut.current={}},[]);let Ae=(0,me.useMemo)(()=>{let z=new Map;for(let[U,H]of Object.entries(t)){let oe=m===H||m?.id===H.id||m?.modelObjectId===H.modelObjectId,Q=b&&(S===U||oe),fe=Q||n===U;(Q||fe)&&z.set(U,{emissive:Q,matcap:fe})}return z},[t,b,S,n,m]),Ce=(0,me.useRef)(Ae);Ce.current=Ae,(0,me.useEffect)(()=>{let z=new Set;for(let[U,H]of Object.entries(t)){z.add(U);let oe=H.modelObjectId??U,Q=L[oe];if(!tr(Q))continue;Q.visible=H.visible!==!1;let fe=Oe[U];if(!fe)continue;if(mt!=="uv-checker"){let Se=Be(U);Se&&(Q.material=Se)}if(H.visible===!1)continue;let we=jt[U],pn=ce[U],tt=i[U]??i[H.modelObjectId??U],$e=H.style?.material,Ye=Ut.current[U]??{};for(let Se of Ii){let Ht=on($e,Se),Ln=Ye[Se];if(Ln===Ht)continue;let jn=mi(Se);Ln&&io(Ln,jn),Ht?(tl(Ht,jn,d),Ye[Se]=Ht):delete Ye[Se]}Object.keys(Ye).length>0?Ut.current[U]=Ye:delete Ut.current[U];let Vt=tt?.hex??$e?.baseColor;Tr(fe,(Se,Ht)=>{let Ln=ll(Se);Ju(Se,$e,Vt);let jn=Se.userData.reactImmersiveConfiguredEmissive;jn?.isColor?jn.copy(Se.emissive):Se.userData.reactImmersiveConfiguredEmissive=Se.emissive.clone();let yr=Ce.current.get(U);yr?.emissive&&Se.emissive.add(Ia),Ln!==ll(Se)&&(Se.needsUpdate=!0);let mn=Qu(we,Ht);if(mn){let Xi=ll(mn);mn.color.copy(Se.color),mn.map=Se.map,mn.vertexColors=Se.vertexColors,mn.alphaMap=Se.alphaMap,mn.alphaTest=Se.alphaTest,mn.transparent=Se.transparent,mn.opacity=Se.opacity,mn.side=Se.side,Xi!==ll(mn)&&(mn.needsUpdate=!0)}let Cn=Qu(pn,Ht);if(Cn){let Xi=ll(Cn);yr?.matcap?Cn.color.set(ro.color):Cn.color.copy(Se.color),Cn.map=Se.map,Cn.vertexColors=Se.vertexColors,Cn.alphaMap=Se.alphaMap,Cn.alphaTest=Se.alphaTest,Cn.transparent=Se.transparent,Cn.opacity=Se.opacity,Cn.side=Se.side,Xi!==ll(Cn)&&(Cn.needsUpdate=!0)}})}for(let U of Object.keys(Ut.current))if(!z.has(U)){for(let[H,oe]of Object.entries(Ut.current[U]))oe&&io(oe,mi(H));delete Ut.current[U]}d()},[t,L,Oe,jt,Gt,ce,i,ot,mt,d]);let Pt=(0,me.useRef)(new Map);(0,me.useEffect)(()=>{let z=Pt.current,U=new Set([...z.keys(),...Ae.keys()]),H=!1;for(let oe of U){let Q=z.get(oe),fe=Ae.get(oe),we=!!Q?.emissive!=!!fe?.emissive,pn=!!Q?.matcap!=!!fe?.matcap;if(!we&&!pn)continue;H=!0;let tt=Oe[oe],$e=ce[oe];tt&&Tr(tt,(Ye,Vt)=>{let Se=Ye.userData.reactImmersiveConfiguredEmissive;we&&Se?.isColor&&(Ye.emissive.copy(Se),fe?.emissive&&Ye.emissive.add(Ia));let Ht=Qu($e,Vt);pn&&Ht&&(fe?.matcap?Ht.color.set(ro.color):Ht.color.copy(Ye.color))})}Pt.current=Ae,H&&d()},[Ae,Oe,ce,d]),oy({objectBindings:t,nodeMap:L,invalidate:d});let St=(0,me.useMemo)(()=>Object.entries(y).map(([z,U])=>({key:z,color:new ut.Color(U.color),speed:U.speed})),[y]),dn=(0,me.useRef)(new Set);(0,me.useEffect)(()=>{let z=new Set(St.map(({key:U})=>U));for(let U of dn.current){if(z.has(U)||!Oe[U])continue;let H=Ce.current.get(U)?.emissive;Tr(Oe[U],oe=>{let Q=oe.userData.reactImmersiveConfiguredEmissive;Q?.isColor&&(oe.emissive.copy(Q),H&&oe.emissive.add(Ia))})}dn.current=z,d()},[St,Oe,d]),(0,$a.useFrame)(({clock:z})=>{if(St.length===0)return;let U=z.getElapsedTime();for(let{key:H,color:oe,speed:Q}of St){let fe=Oe[H];if(!fe)continue;let we=(1-Math.cos(2*Math.PI*Q*U))/2,pn=Ce.current.get(H)?.emissive;Tr(fe,tt=>{let $e=tt.userData.reactImmersiveConfiguredEmissive;$e?.isColor&&(tt.emissive.copy($e).lerp(oe,we),pn&&tt.emissive.add(Ia))})}d()}),(0,me.useEffect)(()=>{if(mt==="uv-checker")return;let z=new Set(Object.values(gt)),U=!1;D.traverse(H=>{if(!tr(H)||z.has(H)||!X.has(H))return;let oe=We?.get(H)??X.get(H);H.material!==oe&&(H.material=oe,U=!0)}),U&&d()},[D,gt,X,We,mt,d]),(0,me.useEffect)(()=>{if(mt!=="uv-checker")return;let z=ry(),U=[];return D.traverse(H=>{if(!tr(H)||H.userData[Ua])return;let oe=H.material,Q=Array.isArray(oe)?oe:[oe],fe=!!H.geometry.getAttribute("uv"),we=Q.map((tt,$e)=>{let Ye=new ut.MeshBasicMaterial({color:fe?"#ffffff":"#ff00ff",map:fe?z:null,side:tt.side});return Ye.name=`${H.name||"mesh"}-uv-checker-${$e}`,Ye.toneMapped=!1,Ye}),pn=Array.isArray(oe)?we:we[0];H.material=pn,U.push({node:H,original:oe,diagnostic:pn})}),d(),()=>{for(let{node:H,original:oe,diagnostic:Q}of U){H.material=oe;let fe=Array.isArray(Q)?Q:[Q];for(let we of fe)we.dispose()}d()}},[D,mt,d]),(0,me.useEffect)(()=>{if(!vn)return;let z=[];for(let[U,H]of Object.entries(t)){let oe=H.modelObjectId??U,Q=L[oe];if(!tr(Q))continue;let fe=new ut.MeshBasicMaterial({color:de,wireframe:!0,transparent:!0,opacity:ur,depthTest:!1,depthWrite:!1,side:ut.DoubleSide,toneMapped:!1}),we=Q.clone(!1);we.name="",we.position.set(0,0,0),we.quaternion.identity(),we.scale.set(1,1,1),we.matrix.identity(),we.matrixAutoUpdate=!0,we.material=fe,we.castShadow=!1,we.receiveShadow=!1,we.frustumCulled=!1,we.renderOrder=1,we.userData={isWireframeOverlay:!0},we.raycast=()=>{},Q.morphTargetInfluences&&(we.morphTargetInfluences=Q.morphTargetInfluences),Q.add(we),z.push({node:Q,overlay:we})}return d(),()=>{for(let{node:U,overlay:H}of z)U.remove(H),H.material.dispose()}},[vn,de,ur,L,t,d]);let ae=(0,me.useMemo)(()=>y0(P.animations),[P.animations]),he=(0,me.useRef)(c);he.current=c;let Ee=(0,me.useRef)(f);Ee.current=f;let Ie=(0,me.useRef)(null),_t=(0,me.useRef)(new Set),Je=(0,me.useRef)(0),et=z=>{_t.current.forEach(U=>U(z))};(0,me.useEffect)(()=>{let z=S0({root:D,clips:ae,getClipConfig:H=>qx(Ee.current,H),onChange:()=>{et(z.getState()),d()}});Ie.current=z,he.current?.({clips:ae.map(({sourceName:H})=>H),clipDetails:ae.map(({sourceName:H,duration:oe})=>({sourceName:H,duration:oe})),play:z.play,pause:z.pause,stop:z.stop,setSpeed:z.setSpeed,seek:z.seek,getState:z.getState,subscribe:H=>(_t.current.add(H),H(z.getState()),()=>{_t.current.delete(H)})}),et(z.getState());let U=Ee.current?.animations.autoplayClip;return U&&z.play(U),()=>{z.dispose(),Ie.current=null,et(z.getState())}},[D,ae]),(0,me.useEffect)(()=>{f?.animations&&Ie.current?.applyClipConfigs()},[f?.animations]),(0,$a.useFrame)((z,U)=>{let H=Ie.current;if(H?.isRunning()){if(H.update(U),!_)for(let[oe,Q]of bn.current)ep(oe,Q,be);d(),Je.current+=U,Je.current>=.066&&(Je.current=0,et(H.getState()),of(D))}});let ve=(0,me.useMemo)(()=>(f?.model.rotation??[0,0,0]).map(z=>z*Math.PI/180),[f?.model.rotation]);(0,$a.useFrame)((z,U)=>{if(!T.current)return;let H=T.current.rotation;H.x=ut.MathUtils.lerp(H.x,ve[0],1-Math.exp(-5*U)),H.y=ut.MathUtils.lerp(H.y,ve[1],1-Math.exp(-5*U)),H.z=ut.MathUtils.lerp(H.z,ve[2],1-Math.exp(-5*U)),Math.abs(H.x-ve[0])<1e-4&&Math.abs(H.y-ve[1])<1e-4&&Math.abs(H.z-ve[2])<1e-4||d()});let Qe=(0,me.useRef)([]),bt=(0,me.useRef)(0),un=(0,me.useRef)(0),or=(0,me.useMemo)(()=>new ut.Vector3,[]);(0,me.useEffect)(()=>{let z=new Map;for(let[tt,$e]of Object.entries(t)){let Ye=L[$e.modelObjectId??tt];Ye&&z.set(Ye,$e)}for(let tt of Qe.current)ep(tt.node,z.get(tt.node)?.transform,be);un.current=0,D.updateWorldMatrix(!0,!0);let U=new ut.Box3().setFromObject(D),H=U.getCenter(new ut.Vector3),oe=U.getSize(new ut.Vector3).length()*.5;bt.current=Number.isFinite(oe)?oe:0;let Q=[...z.keys()],fe=new Set(Q),we=[],pn=new ut.Vector3;for(let tt of Q){if(!tt.parent)continue;let $e=tt.parent,Ye=!1;for(;$e;){if(fe.has($e)){Ye=!0;break}$e=$e.parent}if(Ye)continue;let Vt=new ut.Box3().setFromObject(tt);if(Vt.isEmpty())continue;Vt.getCenter(pn);let Se=pn.clone().sub(H);Se.lengthSq()<1e-8||(Se.normalize(),we.push({node:tt,restLocalPos:tt.position.clone(),restWorldPos:tt.getWorldPosition(new ut.Vector3),worldDir:Se,parentInverse:new ut.Matrix4().copy(tt.parent.matrixWorld).invert()}))}Qe.current=we,d()},[D,L,Ne,Te,be,d]),(0,me.useEffect)(()=>{d()},[M,d]),(0,$a.useFrame)((z,U)=>{let H=Qe.current;if(H.length===0)return;let oe=Math.min(Math.max(M,0),1),Q=un.current;if(Math.abs(Q-oe)<1e-4){if(Q===oe)return;un.current=oe}else un.current=ut.MathUtils.lerp(Q,oe,1-Math.exp(-6*U)),d();let fe=un.current*bt.current;for(let we of H)or.copy(we.worldDir).multiplyScalar(fe).add(we.restWorldPos).applyMatrix4(we.parentInverse),we.node.position.copy(or)});let xn=z=>{let U=z;for(;U;){let H=Ac(U),oe=H?ue[H]:void 0;if(oe&&t[oe])return[oe,t[oe]];U=U.parent}return null},Vn=z=>{let U=xn(z);if(!U)return null;let[H,oe]=U;return L[oe.modelObjectId??H]??null},xr=Au(z=>{let U=xn(z);return U&&U[1].selectable!==!1?U[1]:null},s,Vn),Fn=z=>{if(xr.consumeClick())return;let U=xn(z.object);if(!U)return;let[,H]=U;H.selectable!==!1&&(z.stopPropagation(),r(H,nl(z,Vn(z.object))))},li=z=>{let U=xn(z.object);if(!U)return;let[,H]=U;if(H.selectable===!1)return;a?.(H,nl(z,Vn(z.object)))&&z.stopPropagation()},ha=z=>{if(!b)return;let U=xn(z.object);if(!U)return;let[H,oe]=U;oe.hoverable!==!1&&(z.stopPropagation(),E("pointer"),C(H),o?.(oe))},kn=z=>{b&&(z.stopPropagation(),k(),C(null),o?.(null))},Dr=(0,me.useMemo)(()=>!yv(D),[D]);return(0,af.jsx)("group",{ref:T,children:(0,af.jsx)("primitive",{object:D,...Dr?{onClick:Fn,onDoubleClick:li,...s?{onPointerDown:xr.onPointerDown}:{},...b?{onPointerOver:ha,onPointerOut:kn}:{}}:{}})})}var Ke=require("react");var Rp=require("@react-three/fiber");var en=require("three");var Zt=require("three");function E0(e){let t={};for(let[n,i]of Object.entries(e))t[i.modelObjectId??n]=n;return t}function cf(e){let t=e,n=null;for(;t;){let i=t.userData?.ri_name;if(typeof i=="string"&&i)return i;!n&&t.name&&(n=t.name),t=t.parent}return n}function R0(e,t){return e||(t?t.modelObjectId??t.id:null)}function rp(e,t){let n=cf(e);if(!n)return null;let i=t.keyByModelObject[n]??n,r=t.objectBindings[i];return r?{key:i,binding:r}:null}var cl=new Zt.Vector3,lf=new Zt.Vector3,yP=new Zt.Matrix4,P0=new Zt.Matrix4,tp=new Zt.Matrix4,wP=new Zt.Matrix4,np=new Zt.Matrix4,SP=new Zt.Matrix4,_P=new Zt.Matrix4,MP=new Zt.Vector3,CP=new Zt.Vector3,qo=new Zt.Vector3,A0=new Zt.Quaternion,TP=new Zt.Euler;function PP(e,t,n,i,r){let o=!!(n?.position||n?.rotation||n?.scale),a=!!(r&&r.factor>0&&r.radius>0);if(!o&&!a){e.matrixAutoUpdate=!0,e.position.copy(t.position),e.rotation.copy(t.rotation),e.scale.copy(t.scale),e.updateMatrix(),e.updateWorldMatrix(!0,!1);return}P0.compose(t.position,A0.setFromEuler(t.rotation),t.scale);let s=n?.rotation;tp.compose(MP.fromArray(n?.position??[0,0,0]),A0.setFromEuler(TP.set(s?.[0]??0,s?.[1]??0,s?.[2]??0)),CP.fromArray(n?.scale??[1,1,1])),tp.premultiply(i).multiply(wP.copy(i).invert()),e.parent?.updateWorldMatrix(!0,!1);let l=e.parent?.matrixWorld??yP;if(np.multiplyMatrices(l,P0).premultiply(tp),a&&r){let c=e;for(;c.parent&&!c.userData.ri_name;)c=c.parent;let h=c.userData.ri_center;Array.isArray(h)&&h.length===3?qo.fromArray(h).applyMatrix4(i).applyMatrix4(tp):qo.setFromMatrixPosition(np),qo.sub(r.centre),qo.lengthSq()>1e-8&&(qo.normalize().multiplyScalar(r.factor*r.radius),np.premultiply(_P.makeTranslation(qo.x,qo.y,qo.z)))}e.matrixAutoUpdate=!1,e.matrix.multiplyMatrices(SP.copy(l).invert(),np),e.matrixWorldNeedsUpdate=!0,e.updateWorldMatrix(!1,!1)}function ip(e,t){if(!tr(e)&&!e.userData.riLogicalObject)return;let n=rp(e,t);if(!n)return;let i=k0(e);if(i.rest??(i.rest={position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}),t.suspendTransforms)return;if(t.placementFrame&&!e.userData.riLogicalObject){PP(e,i.rest,n.binding.transform,t.placementFrame,t.explode);return}let r=i.rest,o=n.binding.transform;o?.position?e.position.fromArray(o.position):e.position.copy(r.position),o?.rotation?e.rotation.set(o.rotation[0],o.rotation[1],o.rotation[2],r.rotation.order):e.rotation.copy(r.rotation),o?.scale?e.scale.fromArray(o.scale):e.scale.copy(r.scale);let a=t.explode;if(a&&a.factor>0&&a.radius>0){e.updateWorldMatrix(!0,!1),lf.setFromMatrixPosition(e.matrixWorld);let s=e;for(;s.parent&&!s.userData.ri_name;)s=s.parent;let l=s.userData.ri_center;Array.isArray(l)&&l.length===3?cl.fromArray(l).applyMatrix4(e.matrixWorld).sub(a.centre):cl.copy(lf).sub(a.centre),cl.lengthSq()>1e-8&&(cl.normalize().multiplyScalar(a.factor*a.radius).add(lf),e.parent&&e.parent.worldToLocal(cl),e.position.copy(cl))}e.updateMatrix(),e.updateWorldMatrix(!0,!1)}function dl(e,t){e.traverse(n=>ip(n,t))}function k0(e){var t;return(t=e.userData).riVisuals??(t.riVisuals={}),e.userData.riVisuals}function AP(e,t,n,i){return JSON.stringify([e?.style?.material??null,t??null,n.shadingMode,n.rendererMode,i])}function EP(e){if(e.textures){for(let t of Ii){let n=e.textures[t];n&&io(n,mi(t))}e.textures=void 0}}function RP(e,t,n){let i=e.textures??{};for(let r of Ii){let o=on(t,r),a=i[r];if(a===o)continue;let s=mi(r);a&&io(a,s),o?(tl(o,s,n),i[r]=o):delete i[r]}e.textures=Object.keys(i).length>0?i:void 0}function kP(e,t){if(t.shadingMode==="normals")return Ui(e,()=>new Zt.MeshNormalMaterial);if(t.shadingMode==="unlit")return Ui(e,n=>{let i=new Zt.MeshBasicMaterial;return i.color.copy(n.color),i.map=n.map,i.vertexColors=n.vertexColors,i.alphaMap=n.alphaMap,i.alphaTest=n.alphaTest,i.transparent=n.transparent,i.opacity=n.opacity,i.side=n.side,i});if(t.rendererMode==="matcap"){let n=Pu();return Ui(e,i=>{let r=new Zt.MeshMatcapMaterial;return r.matcap=n,r.color.copy(i.color),r.vertexColors=i.vertexColors,r.alphaMap=i.alphaMap,r.alphaTest=i.alphaTest,r.side=i.side,r})}return e}function LP(e,t){if(!tr(e))return;let i=k0(e);i.original??(i.original=kc(e));let r=rp(e,t);if(!r){i.original&&(e.material=i.original),e.visible=!0;return}let{key:o,binding:a}=r;e.visible=a.visible!==!1,ip(e,t);let s=t.itemMaterials?.[o]?.hex??t.itemMaterials?.[a.modelObjectId??o]?.hex,l=t.highlightOnHover!==!1&&o===t.hoveredKey,c=AP(a,s,t,l);if(i.signature===c&&i.display){e.material=i.display;return}let h=a.style?.material;if(RP(i,h,t.invalidate),!i.physical){let p=i.original??kc(e);if(!p)return;i.physical=Ui(p,u=>{let m=Yu(u),f=Ku(m??new Zt.MeshStandardMaterial);return Zu(f),f})}Tr(i.physical,p=>{Ju(p,h,s??h?.baseColor),l&&(p.emissive.add(Ia),p.color.lerp(Jx,Qx)),p.needsUpdate=!0}),i.display&&i.display!==i.physical&&Tr(i.display,p=>p.dispose()),i.display=kP(i.physical,t),i.signature=c,e.material=i.display}function L0(e,t){e.traverse(n=>LP(n,t))}function df(e){e.traverse(t=>{if(!tr(t))return;let n=t.userData.riVisuals;n&&(n.rest&&(t.matrixAutoUpdate=!0,t.position.copy(n.rest.position),t.rotation.copy(n.rest.rotation),t.scale.copy(n.rest.scale),t.updateMatrix()),n.original&&(t.material=n.original),n.display&&n.display!==n.physical&&Tr(n.display,i=>i.dispose()),n.physical&&Tr(n.physical,i=>i.dispose()),EP(n),delete t.userData.riVisuals)})}var N0=new en.Matrix4().makeRotationX(Math.PI/2),D0=N0.clone().invert();function DP(e){let t=new en.Vector3(e[0],e[1],e[2]),n=new en.Vector3(Math.abs(e[3])+Math.abs(e[6])+Math.abs(e[9]),Math.abs(e[4])+Math.abs(e[7])+Math.abs(e[10]),Math.abs(e[5])+Math.abs(e[8])+Math.abs(e[11]));return new en.Box3(t.clone().sub(n),t.clone().add(n))}function NP(e){let t=e.getCenter(new en.Vector3),n=e.getSize(new en.Vector3).multiplyScalar(.5);return[t.x,t.y,t.z,n.x,0,0,0,n.y,0,0,0,n.z]}var op=class{constructor(){this.group=new en.Group;this.objects=new Map;this.geometry=new en.BoxGeometry(1,1,1);this.material=new en.MeshBasicMaterial;this.originalBounds=new WeakMap;this.signature="";this.lastContext=null;this.lastEffective=null;this.lastDragging=!1;this.version=0;this.tileVersions=new WeakMap;this.transforms=new Map}setCatalog(t){this.group.clear(),this.objects.clear();for(let n of t){let i=new en.Box3(new en.Vector3(...n.minimum),new en.Vector3(...n.maximum)).applyMatrix4(D0),r=new en.Group;r.name=n.name,r.userData.ri_name=n.name,r.userData.riLogicalObject=!0,r.userData.ri_center=i.getCenter(new en.Vector3).toArray();let o=new en.Mesh(this.geometry,this.material);o.visible=!1,o.raycast=()=>{},o.position.copy(i.getCenter(new en.Vector3)),o.scale.copy(i.getSize(new en.Vector3)),r.add(o),this.group.add(r),this.objects.set(n.name,r)}this.signature="",this.lastContext=null}nodesByBinding(t){let n={};for(let[i,r]of this.objects){let o=t.keyByModelObject[i]??i;t.objectBindings[o]&&(n[o]=r)}return n}sync(t,n,i=!1){if(!i&&!this.lastDragging&&t===this.lastContext&&this.lastEffective)return this.lastEffective;this.lastContext=t,this.lastDragging=i;let r={...t,suspendTransforms:!1},o=n?t.objectBindings[n]:void 0,a=o?this.objects.get(o.modelObjectId??n):void 0;i&&a&&o&&(r={...r,objectBindings:{...t.objectBindings,[n]:{...o,transform:{position:a.position.toArray(),rotation:[a.rotation.x,a.rotation.y,a.rotation.z],scale:a.scale.toArray()}}}});for(let l of this.objects.values())i&&l===a||ip(l,r);this.group.updateWorldMatrix(!0,!0);let s=[...this.objects].map(([l,c])=>`${l}:${c.matrix.elements.join(",")}`).join(";");if(s!==this.signature){this.signature=s,this.version++,this.transforms.clear();for(let[l,c]of this.objects)c.matrix.equals(new en.Matrix4)||this.transforms.set(l,N0.clone().multiply(c.matrix).multiply(D0))}return this.lastEffective=r,r}updateBounds(t){if(!t)return;let n=i=>{if(this.tileVersions.get(i)!==this.version){if(i.boundingVolume.box&&this.tileVersions.get(i)!==this.version){let r=this.originalBounds.get(i);r||(r={box:[...i.boundingVolume.box],error:i.geometricError},this.originalBounds.set(i,r));let o=DP(r.box),a=o.clone(),s=1;for(let c of i.extras?.featureIds??[]){let h=this.transforms.get(c);h&&(a.union(o.clone().applyMatrix4(h)),s=Math.max(s,h.getMaxScaleOnAxis()))}let l=NP(a);i.boundingVolume.box=l,i.geometricError=r.error*s,i.engineData?.boundingVolume?.setObbData(l,i.engineData.transform),this.tileVersions.set(i,this.version)}i.children?.forEach(n)}};n(t)}dispose(){this.group.clear(),this.objects.clear(),this.geometry.dispose(),this.material.dispose()}};var uf=Object.freeze({factor:1,loosened:!1,tooFine:0,raisedAt:-1/0,changedAt:-1/0}),Lc=16,pf=1.25,OP=1.5,BP=1.25,IP=500,zP=3e3,O0=5e3,B0=2e3,UP=.9;function I0(e){return e.full&&(e.wanting||e.usage>1)}function z0(e){return e.loosened?zP:IP}function U0(e){let t=e.factor/BP;return t<=1+1e-6?1:t}function V0(e,t){return e.factor>1&&!e.loosened&&!t.full&&!t.wanting&&t.usage<UP&&U0(e)>e.tooFine}function F0(e,t){let{now:n}=t,i=t.moved&&e.tooFine>0?{...e,tooFine:0}:e;if(I0(t)){if(n-i.changedAt<z0(i))return i;let r=Math.max(i.tooFine,i.factor);return i.factor>=Lc?i.loosened&&i.tooFine===r?i:{...i,loosened:!0,tooFine:r,changedAt:n}:{factor:Math.min(Lc,i.factor*OP),loosened:!0,tooFine:r,raisedAt:n,changedAt:n}}return i.loosened&&!t.wanting?{...i,loosened:!1,changedAt:n}:V0(i,t)&&n-i.raisedAt>=O0&&n-i.changedAt>=B0?{...i,factor:U0(i),changedAt:n}:i}function j0(e,t){let{now:n}=t;return I0(t)?e.factor>=Lc&&e.loosened?null:Math.max(0,z0(e)-(n-e.changedAt)):e.loosened&&!t.wanting?0:V0(e,t)?Math.max(0,O0-(n-e.raisedAt),B0-(n-e.changedAt)):null}function X0(e){try{let t=typeof location<"u"?location.href:void 0;return new URL(e,t).origin}catch{return null}}function mf(e){if(!e)return null;let t=e.length,n=e.indexOf("?"),i=e.indexOf("#");n!==-1&&(t=Math.min(t,n)),i!==-1&&(t=Math.min(t,i));let r=e.lastIndexOf(".",t),o=e.lastIndexOf("/",t),a=e.indexOf("://");return a!==-1&&a+2===o||r===-1||r<o?null:e.substring(r+1,t)||null}var sp,Dc=(sp=class{static setXRSession(e){e!==this.session&&(this.flushPending(),this.session=e)}static requestAnimationFrame(e){let{session:t,pending:n}=this,i,r=()=>{n.delete(i),e()};return i=t?t.requestAnimationFrame(r):requestAnimationFrame(r),n.set(i,e),i}static cancelAnimationFrame(e){let{pending:t,session:n}=this;t.delete(e),n?n.cancelAnimationFrame(e):cancelAnimationFrame(e)}static flushPending(){this.pending.forEach((e,t)=>{e(),this.cancelAnimationFrame(t)})}},fh(sp,"pending",new Map),fh(sp,"session",null),sp),G0=2**30,Bc=class{get unloadPriorityCallback(){return this._unloadPriorityCallback}set unloadPriorityCallback(e){e.length===1?(console.warn('LRUCache: "unloadPriorityCallback" function has been changed to take two arguments.'),this._unloadPriorityCallback=(t,n)=>{let i=e(t),r=e(n);return i<r?-1:+(i>r)}):this._unloadPriorityCallback=e}constructor(){this.minSize=6e3,this.maxSize=8e3,this.minBytesSize=.3*G0,this.maxBytesSize=.4*G0,this.unloadPercent=.05,this.autoMarkUnused=!0,this.cachedBytes=0,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadingHandle=-1,this.bytesMap=new Map,this.loadedSet=new Set,this._unloadPriorityCallback=null;let e=this.itemSet;this.defaultPriorityCallback=t=>e.get(t)}isFull(){return this.itemSet.size>=this.maxSize||this.cachedBytes>=this.maxBytesSize}getMemoryUsage(e){return this.bytesMap.get(e)||0}setMemoryUsage(e,t){let{bytesMap:n,itemSet:i}=this;i.has(e)&&(this.cachedBytes-=n.get(e)||0,n.set(e,t),this.cachedBytes+=t)}add(e,t){let n=this.itemSet;if(n.has(e)||this.isFull())return!1;let i=this.usedSet,r=this.itemList,o=this.callbacks;return r.push(e),i.add(e),n.set(e,Date.now()),o.set(e,t),!0}has(e){return this.itemSet.has(e)}remove(e){let t=this.usedSet,n=this.itemSet,i=this.itemList,r=this.bytesMap,o=this.callbacks,a=this.loadedSet;if(n.has(e)){this.cachedBytes-=r.get(e)||0,r.delete(e),o.get(e)(e);let s=i.indexOf(e);return i.splice(s,1),t.delete(e),n.delete(e),o.delete(e),a.delete(e),!0}return!1}setLoaded(e,t){let{itemSet:n,loadedSet:i}=this;n.has(e)&&(t===!0?i.add(e):i.delete(e))}markUsed(e){let t=this.itemSet,n=this.usedSet;t.has(e)&&!n.has(e)&&(t.set(e,Date.now()),n.add(e))}markUnused(e){this.usedSet.delete(e)}markAllUnused(){this.usedSet.clear()}isUsed(e){return this.usedSet.has(e)}unloadUnusedContent(){let{unloadPercent:e,minSize:t,maxSize:n,itemList:i,itemSet:r,usedSet:o,loadedSet:a,callbacks:s,bytesMap:l,minBytesSize:c,maxBytesSize:h}=this,p=i.length-o.size,u=i.length-a.size,m=Math.max(Math.min(i.length-t,p),0),f=this.cachedBytes-c,g=this.unloadPriorityCallback||this.defaultPriorityCallback,b=!1,x=m>0&&p>0||u&&i.length>n;if(p&&this.cachedBytes>c||u&&this.cachedBytes>h||x){i.sort((d,S)=>{let C=o.has(d);if(C===o.has(S)){let T=a.has(d);return T===a.has(S)?-g(d,S):T?1:-1}else return C?1:-1});let v=Math.max(t*e,m*e),w=Math.ceil(Math.min(v,p,m)),M=Math.max(e*f,e*c),_=Math.min(M,f),y=0,P=0;for(;this.cachedBytes-P>h||i.length-y>n;){let d=i[y],S=l.get(d)||0;if(o.has(d)&&a.has(d)||this.cachedBytes-P-S<h&&i.length-y<=n)break;P+=S,y++}for(;P<_||y<w;){let d=i[y],S=l.get(d)||0;if(o.has(d)||this.cachedBytes-P-S<c&&y>=w)break;P+=S,y++}i.splice(0,y).forEach(d=>{this.cachedBytes-=l.get(d)||0,s.get(d)(d),l.delete(d),r.delete(d),s.delete(d),a.delete(d),o.delete(d)}),b=y<m||P<f&&y<p,b&&(b=y>0)}b&&(this.unloadingHandle=Dc.requestAnimationFrame(()=>this.scheduleUnload()))}scheduleUnload(){Dc.cancelAnimationFrame(this.unloadingHandle),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.unloadUnusedContent()}))}},VP=class extends DOMException{constructor(){super("PriorityQueue: Item removed","AbortError")}},Vi=class{get running(){return this.items.length!==0||this.currJobs!==0}constructor(){this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=null,this._schedulingCallback=e=>{Dc.requestAnimationFrame(e)},this._runjobs=()=>{this.scheduled=!1,this.tryRunJobs()}}sort(){let e=this.priorityCallback,t=this.items;e!==null&&t.sort(e)}has(e){return this.callbacks.has(e)}add(e,t){let n={callback:t,reject:null,resolve:null,promise:null};return n.promise=new Promise((i,r)=>{let o=this.items,a=this.callbacks;n.resolve=i,n.reject=r,o.unshift(e),a.set(e,n),this.autoUpdate&&this.scheduleJobRun()}),n.promise}remove(e){let t=this.items,n=this.callbacks,i=t.indexOf(e);if(i!==-1){let r=n.get(e);r.promise.catch(o=>{if(o.name!=="AbortError")throw o}),r.reject(new VP),t.splice(i,1),n.delete(e)}}removeByFilter(e){let{items:t}=this;for(let n=0;n<t.length;n++){let i=t[n];e(i)&&(this.remove(i),n--)}}tryRunJobs(){this.sort();let e=this.items,t=this.callbacks,n=this.maxJobs,i=0,r=()=>{this.currJobs--,this.autoUpdate&&this.scheduleJobRun()};for(;n>this.currJobs&&e.length>0&&i<n;){this.currJobs++,i++;let o=e.pop(),{callback:a,resolve:s,reject:l}=t.get(o);t.delete(o);let c;try{c=a(o)}catch(h){l(h),r();continue}c instanceof Promise?c.then(s).catch(l).finally(r):(s(c),r())}}flush(e){let{items:t,callbacks:n}=this,i=t.indexOf(e);if(!n.has(e))return;let{callback:r,resolve:o,reject:a}=n.get(e);n.delete(e),t.splice(i,1);let s;try{s=r(e)}catch(l){a(l);return}return s instanceof Promise?s.then(o).catch(a):o(s),s}scheduleJobRun(){this.scheduled||(this.scheduled=(this._schedulingCallback(this._runjobs),!0))}},up=class{get running(){for(let e of this.originQueues.values())if(e.running)return!0;return!1}get maxJobsPerOrigin(){return this._maxJobsPerOrigin}set maxJobsPerOrigin(e){this._maxJobsPerOrigin=e,this.originQueues.forEach(t=>t.maxJobs=e)}get maxJobs(){return this.maxJobsPerOrigin}set maxJobs(e){console.warn('DownloadPriorityQueue: "maxJobs" is no longer valid and limits jobs per server origin. Use "maxJobsPerOrigin", instead.'),this.maxJobsPerOrigin=e}get priorityCallback(){return this._priorityCallback}set priorityCallback(e){this._priorityCallback=e,this.originQueues.forEach(t=>t.priorityCallback=e)}constructor(){this.originQueues=new Map,this._itemQueues=new WeakMap,this._maxJobsPerOrigin=6,this._priorityCallback=null}add(e,t,n,i=null){this.originQueues.forEach((l,c)=>{l.running||this.originQueues.delete(c)});let r=e===null?null:X0(e),o=this.originQueues.get(r);o||(o=new Vi,o.maxJobs=this._maxJobsPerOrigin,o.priorityCallback=this._priorityCallback,this.originQueues.set(r,o));let a=this._itemQueues.get(t);if(a&&a!==o&&a.has(t))throw Error("DownloadPriorityQueue: Item is already queued with a different url origin.");this._itemQueues.set(t,o);let s=o.add(t,n);return i!==null&&(i.aborted?this.remove(t):i.addEventListener("abort",()=>this.remove(t),{once:!0})),s}remove(e){let t=this._itemQueues.get(e);t&&(t.remove(e),this._itemQueues.delete(e))}has(e){let t=this._itemQueues.get(e);return!!(t&&t.has(e))}};var Za=6378137,FP=1/298.257223563,ff=6356752314245179e-9,ap={inView:!1,error:1/0,distanceFromCamera:1/0};function pp(e){return e===4||e===-1}function uo(e,t){return mp(e)&&e.traversal.lastFrameVisited===t&&e.traversal.used}function mp(e){return!!e.traversal}function Ic(e){let{children:t}=e,n=t.length===0||mp(t[t.length-1]),i=!e.internal.hasUnrenderableContent||pp(e.internal.loadingState);return n&&i}function Ya(e){return e.traversal.unconditionallyRefine}function Nc(e,t){if(mp(e)&&(t.ensureChildrenArePreprocessed(e),e.traversal.lastFrameVisited!==t.frameCount&&(e.traversal.wasInFrustum=e.traversal.inFrustum,e.traversal.wasSetActive=e.traversal.active,e.traversal.wasSetVisible=e.traversal.visible,e.traversal.usedLastFrame=e.traversal.used,e.traversal.lastFrameVisited=t.frameCount,e.traversal.used=!1,e.traversal.inFrustum=!1,e.traversal.isLeaf=!1,e.traversal.visible=!1,e.traversal.active=!1,e.traversal.error=1/0,e.traversal.distanceFromCamera=1/0,e.traversal.allChildrenReady=!1,e.traversal.allChildrenLoaded=!1,e.traversal.kicked=!1,e.traversal.allUsedChildrenProcessed=!1,t.calculateTileViewErrorWithPlugin(e,ap),e.traversal.inFrustum=ap.inView,e.traversal.error=ap.error,e.traversal.distanceFromCamera=ap.distanceFromCamera,e.traversal.unconditionallyRefine=e.internal.hasUnrenderableContent,!e.traversal.unconditionallyRefine))){let n=e.parent;for(;n&&n.traversal.unconditionallyRefine;)n=n.parent;n&&n.geometricError<=e.geometricError&&(e.traversal.unconditionallyRefine=!0)}}function hf(e,t,n=!1){if(Nc(e,t),n?t.markTileUsed(e):lp(e),Ya(e)&&Ic(e)){let i=e.children;for(let r=0,o=i.length;r<o;r++)hf(i[r],t,n)}}function q0(e,t){if(Nc(e,t),e.traversal.usedLastFrame&&(lp(e),e.traversal.wasSetActive&&(e.traversal.active=!0),(!e.traversal.active||Ya(e))&&Ic(e))){let n=e.children;for(let i=0,r=n.length;i<r;i++)q0(n[i],t)}}function lp(e){e.traversal.used=!0}function jP(e,t){return!(e.traversal.error<=t.errorTarget&&!Ya(e)||t.maxDepth>0&&e.internal.depth+1>=t.maxDepth||!Ic(e))}function $0(e,t){let{frameCount:n}=t,{children:i}=e;for(let r=0,o=i.length;r<o;r++){let a=i[r];uo(a,n)&&(a.traversal.active&&(a.traversal.kicked=!0,a.traversal.active=!1),$0(a,t))}}function H0(e){return!Ya(e)&&(!e.internal.hasContent||pp(e.internal.loadingState))}function Y0(e,t){if(Nc(e,t),!e.traversal.inFrustum)return;let n=e.parent;if(n&&n.refine==="ADD"&&e.geometricError>0&&e.traversal.error*(n.geometricError/e.geometricError)<=t.errorTarget)return;if(!jP(e,t)){lp(e);return}let i=!1,r=!1,o=e.children;for(let a=0,s=o.length;a<s;a++){let l=o[a];Y0(l,t),i||(i=uo(l,t.frameCount)),r||(r=l.traversal.inFrustum)}if(e.refine==="REPLACE"&&!r&&o.length!==0){e.traversal.inFrustum=!1,t.markTileUsed(e);for(let a=0,s=o.length;a<s;a++)hf(o[a],t,!0);return}if(lp(e),e.refine==="REPLACE"&&i&&(t.loadSiblings||t.loadAncestors))for(let a=0,s=o.length;a<s;a++)hf(o[a],t)}function K0(e,t){let n=t.frameCount;if(!uo(e,n))return;let i=e.children,r=!1;for(let a=0,s=i.length;a<s;a++){let l=i[a];r||(r=uo(l,n))}if(!r)e.traversal.isLeaf=!0;else{for(let s=0,l=i.length;s<l;s++)K0(i[s],t);let a=!0;for(let s=0,l=i.length;s<l;s++){let c=i[s];if(uo(c,n)){let h=!Ya(c),p=!c.internal.hasContent||pp(c.internal.loadingState);h&&p||c.traversal.allChildrenLoaded||(a=!1)}}e.traversal.allChildrenLoaded=a}let o=!0;for(let a=0,s=i.length;a<s;a++){let l=i[a];uo(l,t.frameCount)&&!l.traversal.allUsedChildrenProcessed&&(o=!1)}e.traversal.allUsedChildrenProcessed=o&&Ic(e)}function Z0(e,t){if(!uo(e,t.frameCount))return;let n=e.children;if(e.refine==="REPLACE"&&t.loadAncestors&&!e.traversal.allChildrenLoaded&&!Ya(e)&&(e.traversal.isLeaf=!0),e.traversal.isLeaf){if(!Ya(e)&&(e.traversal.active=!0,Ic(e)&&e.internal.hasContent&&!pp(e.internal.loadingState)))for(let r=0,o=n.length;r<o;r++)q0(n[r],t);return}let i=n.length>0;for(let r=0,o=n.length;r<o;r++){let a=n[r];Z0(a,t),uo(a,t.frameCount)&&!(a.traversal.active&&H0(a))&&!a.traversal.allChildrenReady&&(i=!1)}e.traversal.allChildrenReady=i,e.refine==="REPLACE"&&!i&&e.traversal.wasSetActive&&H0(e)&&(e.traversal.active=!0,$0(e,t))}function J0(e,t){Nc(e,t);let n=uo(e,t.frameCount);if(n&&(e.internal.hasUnrenderableContent&&(t.markTileUsed(e),t.queueTileForDownload(e)),e.internal.hasRenderableContent&&e.refine==="ADD"&&(e.traversal.active=!0),(e.traversal.active||e.traversal.kicked)&&e.internal.hasContent&&(t.markTileUsed(e),e.traversal.allUsedChildrenProcessed&&t.queueTileForDownload(e),e.internal.loadingState!==4&&(e.traversal.active=!1)),t.loadAncestors&&e.internal.hasContent&&(t.markTileUsed(e),t.queueTileForDownload(e)),e.internal.virtualChildCount>0&&e.internal.hasContent&&t.markTileUsed(e),e.traversal.visible=e.internal.hasRenderableContent&&e.traversal.active&&e.traversal.inFrustum&&e.internal.loadingState===4,t.stats.used++,e.traversal.inFrustum&&t.stats.inFrustum++),n||mp(e)&&e.traversal.usedLastFrame){let i=!1,r=!1;n?(i=e.traversal.active,r=t.displayActiveTiles&&e.traversal.active||e.traversal.visible):Nc(e,t),e.internal.hasRenderableContent&&e.internal.loadingState===4?(i&&t.stats.active++,r&&t.stats.visible++,e.traversal.wasSetActive!==i&&t.invokeOnePlugin(a=>a.setTileActive&&a.setTileActive(e,i)),e.traversal.wasSetVisible!==r&&t.invokeOnePlugin(a=>a.setTileVisible&&a.setTileVisible(e,r))):e.internal.hasRenderableContent||(r=e.traversal.isLeaf,e.traversal.wasSetVisible!==r&&t.invokeOnePlugin(a=>a.setEmptyTileVisible&&a.setEmptyTileVisible(e,r))),e.traversal.visible=r,e.traversal.active=i;let o=e.children;for(let a=0,s=o.length;a<s;a++){let l=o[a];J0(l,t)}}}function GP(e,t){Y0(e,t),K0(e,t),Z0(e,t),J0(e,t)}function HP(e){let t=null;return()=>{t===null&&(t=Dc.requestAnimationFrame(()=>{t=null,e()}))}}function WP(e,t=null,n=null){let i=[];for(i.push(e),i.push(null),i.push(0);i.length>0;){let r=i.pop(),o=i.pop(),a=i.pop();if(t&&t(a,o,r)){n&&n(a,o,r);return}let s=a.children;if(s)for(let l=s.length-1;l>=0;l--)i.push(s[l]),i.push(a),i.push(r+1);n&&n(a,o,r)}}var W0=Symbol("PLUGIN_REGISTERED"),$o={inView:!0,error:0,distance:1/0},XP=(e,t)=>{let n=e.priority||0,i=t.priority||0;return n===i?!e.traversal||!t.traversal?0:e.traversal.used===t.traversal.used?e.traversal.error===t.traversal.error?e.traversal.distanceFromCamera===t.traversal.distanceFromCamera?e.internal.depthFromRenderedParent===t.internal.depthFromRenderedParent?0:e.internal.depthFromRenderedParent>t.internal.depthFromRenderedParent?-1:1:e.traversal.distanceFromCamera>t.traversal.distanceFromCamera?-1:1:e.traversal.error>t.traversal.error?1:-1:e.traversal.used?1:-1:n>i?1:-1},qP=(e,t)=>e.traversal.used===t.traversal.used?e.traversal.inFrustum===t.traversal.inFrustum?e.internal.hasUnrenderableContent===t.internal.hasUnrenderableContent?e.traversal.distanceFromCamera===t.traversal.distanceFromCamera?e.internal.depthFromRenderedParent===t.internal.depthFromRenderedParent?0:e.internal.depthFromRenderedParent>t.internal.depthFromRenderedParent?-1:1:e.traversal.distanceFromCamera>t.traversal.distanceFromCamera?-1:1:e.internal.hasUnrenderableContent?1:-1:e.traversal.inFrustum?1:-1:e.traversal.used?1:-1,$P=(e,t)=>e.traversal.lastFrameVisited===t.traversal.lastFrameVisited?e.internal.depthFromRenderedParent===t.internal.depthFromRenderedParent?e.internal.loadingState===t.internal.loadingState?e.internal.hasUnrenderableContent===t.internal.hasUnrenderableContent?e.traversal.error===t.traversal.error?0:e.traversal.error>t.traversal.error?-1:1:e.internal.hasUnrenderableContent?-1:1:e.internal.loadingState>t.internal.loadingState?-1:1:e.internal.depthFromRenderedParent>t.internal.depthFromRenderedParent?1:-1:e.traversal.lastFrameVisited>t.traversal.lastFrameVisited?-1:1,ul=(e,t)=>{let n=e.priority??1/0,i=t.priority??1/0;if(n!==i)return n>i?1:-1;if(!e.internal||!t.internal)return 0;let r=e.internal.renderer,o=t.internal.renderer,a=!r.loadAncestors,s=!o.loadAncestors;return a&&s?qP(e,t):XP(e,t)},gf=new Bc;gf.unloadPriorityCallback=$P;var Oc=new up;Oc.maxJobsPerOrigin=25,Oc.priorityCallback=ul;var cp=new Vi;cp.maxJobs=5,cp.priorityCallback=ul;var dp=new Vi;dp.maxJobs=25,dp.priorityCallback=(e,t)=>{let n=e.parent,i=t.parent;return n===i?0:n?i?ul(n,i):-1:1};var bf=class{get root(){let e=this.rootTileset;return e?e.root:null}get loadProgress(){let{stats:e,isLoading:t}=this,n=e.queued+e.downloading+e.parsing,i=e.inCacheSinceLoad+ +!!t;return i===0?1:1-n/i}get downloadQueue(){return this._downloadQueue}set downloadQueue(e){if(e instanceof Vi){console.warn('TilesRenderer: "downloadQueue" is no longer valid as a PriorityQueue. Use a DownloadPriorityQueue, instead.');return}this._downloadQueue=e}constructor(e=null){this.rootLoadingState=0,this.rootTileset=null,this.rootURL=e,this.fetchOptions={},this.plugins=[],this.queuedTiles=[],this.cachedSinceLoadComplete=new Set,this.isLoading=!1,this.processedTiles=new WeakSet,this.visibleTiles=new Set,this.activeTiles=new Set,this.usedSet=new Set,this.loadingTiles=new Set,this.lruCache=gf,this.downloadQueue=Oc,this.parseQueue=cp,this.processNodeQueue=dp,this.stats={inCacheSinceLoad:0,inCache:0,queued:0,downloading:0,parsing:0,loaded:0,failed:0,inFrustum:0,used:0,active:0,visible:0,tilesProcessed:0},this.frameCount=0,this._dispatchNeedsUpdateEvent=HP(()=>{this.dispatchEvent({type:"needs-update"})}),this.errorTarget=16,this.errorFalloff=0,this.errorFalloffDensity=2e-4,this.displayActiveTiles=!1,this.maxDepth=1/0,this.loadSiblings=!0,this.loadAncestors=!0,this.maxTilesProcessed=250}registerPlugin(e){if(e[W0]===!0)throw Error("TilesRendererBase: A plugin can only be registered to a single tileset");let t=this.plugins,n=e.priority||0,i=t.length;for(let r=0;r<t.length;r++)if((t[r].priority||0)>n){i=r;break}t.splice(i,0,e),e[W0]=!0,e.init&&e.init(this)}unregisterPlugin(e){let t=this.plugins;if(typeof e=="string"&&(e=this.getPluginByName(e)),t.includes(e)){let n=t.indexOf(e);return t.splice(n,1),e.dispose&&e.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}invokeOnePlugin(e){let t=[...this.plugins,this];for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}invokeAllPlugins(e){let t=[...this.plugins,this],n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);r&&n.push(r)}return n.length===0?null:Promise.all(n)}traverse(e,t,n=!0){this.root&&WP(this.root,(i,...r)=>(n&&this.ensureChildrenArePreprocessed(i,!0),e?e(i,...r):!1),t)}getAttributions(e=[]){return this.invokeAllPlugins(t=>t!==this&&t.getAttributions&&t.getAttributions(e)),e}update(){let{lruCache:e,usedSet:t,stats:n,root:i,downloadQueue:r,parseQueue:o,processNodeQueue:a}=this;if(this.rootLoadingState===0&&(this.rootLoadingState=2,this.invokeOnePlugin(c=>c.loadRootTileset&&c.loadRootTileset()).then(c=>{let h=this.rootURL;h!==null&&this.invokeAllPlugins(p=>h=p.preprocessURL?p.preprocessURL(h,null):h),this.rootLoadingState=4,this.rootTileset=c,this.dispatchEvent({type:"needs-update"}),this.dispatchEvent({type:"load-tileset",tileset:c,url:h}),this.dispatchEvent({type:"load-root-tileset",tileset:c,url:h})}).catch(c=>{this.rootLoadingState=-1,console.error(c),this.rootTileset=null,this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})})),!i)return;let s=null;if(this.invokeAllPlugins(c=>{if(c.doTilesNeedUpdate){let h=c.doTilesNeedUpdate();s=s===null?h:!!(s||h)}}),s===!1){this.dispatchEvent({type:"update-before"}),this.dispatchEvent({type:"update-after"});return}this.dispatchEvent({type:"update-before"}),n.inFrustum=0,n.used=0,n.active=0,n.visible=0,n.tilesProcessed=0,this.frameCount++,t.forEach(c=>e.markUnused(c)),t.clear(),this.prepareForTraversal(),GP(i,this),this.removeUnusedPendingTiles();let l=this.queuedTiles;l.sort(e.unloadPriorityCallback);for(let c=0,h=l.length;c<h&&!e.isFull();c++)this.requestTileContents(l[c]);l.length=0,e.scheduleUnload(),(r.running||o.running||a.running)===!1&&this.isLoading===!0&&(this.cachedSinceLoadComplete.clear(),n.inCacheSinceLoad=0,this.dispatchEvent({type:"tiles-load-end"}),this.isLoading=!1),this.dispatchEvent({type:"update-after"})}resetFailedTiles(){this.rootLoadingState===-1&&(this.rootLoadingState=0);let e=this.stats;e.failed!==0&&(this.traverse(t=>{t.internal.loadingState===-1&&(t.internal.loadingState=0)},null,!1),e.failed=0)}calculateTileViewErrorWithPlugin(e,t){this.calculateTileViewError(e,t);let{errorFalloff:n,errorFalloffDensity:i}=this;if(n>0&&Number.isFinite(t.distanceFromCamera)){let s=t.distanceFromCamera*i;t.error-=n*(1-Math.exp(-s*s))}let r=null,o=0,a=1/0;this.invokeAllPlugins(s=>{s!==this&&s.calculateTileViewError&&($o.inView=!0,$o.error=0,$o.distance=1/0,s.calculateTileViewError(e,$o)&&(r===null&&(r=!0),r&&(r=$o.inView),$o.inView&&(a=Math.min(a,$o.distance),o=Math.max(o,$o.error))))}),t.inView&&r!==!1?(t.error=Math.max(t.error,o),t.distanceFromCamera=Math.min(t.distanceFromCamera,a)):r?(t.inView=!0,t.error=o,t.distanceFromCamera=a):t.inView=!1}dispose(){[...this.plugins].forEach(n=>{this.unregisterPlugin(n)});let e=this.lruCache,t=[];this.traverse(n=>(t.push(n),!1),null,!1);for(let n=0,i=t.length;n<i;n++)e.remove(t[n]);this.stats={queued:0,parsing:0,downloading:0,failed:0,inFrustum:0,traversed:0,used:0,active:0,visible:0},this.frameCount=0,this.loadingTiles.clear()}calculateBytesUsed(e,t){return 0}dispatchEvent(e){}addEventListener(e,t){}removeEventListener(e,t){}parseTile(e,t,n){return null}prepareForTraversal(){}disposeTile(e){e.traversal.visible&&(e.internal.hasRenderableContent?this.invokeOnePlugin(n=>n.setTileVisible&&n.setTileVisible(e,!1)):this.invokeOnePlugin(n=>n.setEmptyTileVisible&&n.setEmptyTileVisible(e,!1)),e.traversal.visible=!1),e.traversal.active&&e.internal.hasRenderableContent&&this.invokeOnePlugin(n=>n.setTileActive&&n.setTileActive(e,!1)),e.traversal.active=!1;let{scene:t}=e.engineData;t&&this.dispatchEvent({type:"dispose-model",scene:t,tile:e})}preprocessNode(e,t,n=null){if(this.processedTiles.add(e),this.stats.tilesProcessed++,e.content&&(!("uri"in e.content)&&"url"in e.content&&(e.content.uri=e.content.url,delete e.content.url),e.content.boundingVolume&&!("box"in e.content.boundingVolume||"sphere"in e.content.boundingVolume||"region"in e.content.boundingVolume)&&delete e.content.boundingVolume),e.parent=n,e.children=e.children||[],e.internal={hasContent:!1,hasRenderableContent:!1,hasUnrenderableContent:!1,loadingState:0,basePath:t,depth:-1,depthFromRenderedParent:-1,isVirtual:!1,virtualChildCount:0,renderer:this,...e.internal},e.content?.uri){let i=mf(e.content.uri),r=!!(i&&/json$/.test(i));e.internal.hasContent=!0,e.internal.hasUnrenderableContent=r,e.internal.hasRenderableContent=!r}else e.internal.hasContent=!1,e.internal.hasUnrenderableContent=!1,e.internal.hasRenderableContent=!1;n?(e.internal.depth=n.internal.depth+1,e.internal.depthFromRenderedParent=n.internal.depthFromRenderedParent+ +!!e.internal.hasRenderableContent):(e.internal.depth=0,e.internal.depthFromRenderedParent=+!!e.internal.hasRenderableContent),e.traversal={distanceFromCamera:1/0,error:1/0,inFrustum:!1,wasInFrustum:!1,isLeaf:!1,used:!1,usedLastFrame:!1,visible:!1,wasSetVisible:!1,active:!1,wasSetActive:!1,allChildrenReady:!1,allChildrenLoaded:!1,kicked:!1,allUsedChildrenProcessed:!1,lastFrameVisited:-1},n===null?e.refine=e.refine||"REPLACE":e.refine=e.refine||n.refine,e.engineData={scene:null,metadata:null,boundingVolume:null},Object.defineProperty(e,"cached",{get(){return console.warn('TilesRenderer: "tile.cached" field has been renamed to "tile.engineData".'),this.engineData},enumerable:!1,configurable:!0}),this.invokeAllPlugins(i=>{i!==this&&i.preprocessNode&&i.preprocessNode(e,t,n)})}setTileActive(e,t){t?this.activeTiles.add(e):this.activeTiles.delete(e)}setTileVisible(e,t){t?this.visibleTiles.add(e):this.visibleTiles.delete(e),this.dispatchEvent({type:"tile-visibility-change",scene:e.engineData.scene,tile:e,visible:t})}calculateTileViewError(e,t){}removeUnusedPendingTiles(){let{lruCache:e,loadingTiles:t}=this,n=[];for(let i of t)!e.isUsed(i)&&i.internal.loadingState===1&&n.push(i);for(let i=0;i<n.length;i++)e.remove(n[i])}queueTileForDownload(e){e.internal.loadingState!==0||this.lruCache.isFull()||this.queuedTiles.push(e)}markTileUsed(e){this.usedSet.add(e),this.lruCache.markUsed(e)}fetchData(e,t){return fetch(e,t)}ensureChildrenArePreprocessed(e,t=this.stats.tilesProcessed<this.maxTilesProcessed){let n=e.children;if(n.length===0||n[n.length-1].traversal)return;let i=r=>{for(let o=0,a=r.length;o<a;o++){let s=r[o];s&&!s.traversal&&this.preprocessNode(s,e.internal.basePath,e)}};t?(this.processNodeQueue.remove(e),i(n)):this.processNodeQueue.has(e)||this.processNodeQueue.add(e,r=>{i(r.children),this._dispatchNeedsUpdateEvent()})}getBytesUsed(e){let t=0;return this.invokeAllPlugins(n=>{n.calculateBytesUsed&&(t+=n.calculateBytesUsed(e,e.engineData.scene)||0)}),t}recalculateBytesUsed(e=null){let{lruCache:t,processedTiles:n}=this;e===null?t.itemSet.forEach(i=>{n.has(i)&&t.setMemoryUsage(i,this.getBytesUsed(i))}):t.setMemoryUsage(e,this.getBytesUsed(e))}preprocessTileset(e,t,n=null){let[i,r]=e.asset.version.split(".").map(a=>parseInt(a));console.assert(i<=1,"TilesRenderer: asset.version is expected to be a 1.x or a compatible version."),i===1&&r>0&&console.warn("TilesRenderer: tiles versions at 1.1 or higher have limited support. Some new extensions and features may not be supported.");let o=t.replace(/\/[^/]*$/,"");o=new URL(o,window.location.href).toString(),this.preprocessNode(e.root,o,n)}loadRootTileset(){let e=this.rootURL;return this.invokeAllPlugins(t=>e=t.preprocessURL?t.preprocessURL(e,null):e),this.invokeOnePlugin(t=>t.fetchData&&t.fetchData(e,this.fetchOptions)).then(t=>{if(!(t instanceof Response))return t;if(t.ok)return t.json();throw Error(`TilesRenderer: Failed to load tileset "${e}" with status ${t.status} : ${t.statusText}`)}).then(t=>(this.preprocessTileset(t,e),t))}requestTileContents(e){if(e.internal.loadingState!==0)return;let t=!1,n=null,i=new URL(e.content.uri,e.internal.basePath+"/").toString();this.invokeAllPlugins(u=>i=u.preprocessURL?u.preprocessURL(i,e):i);let r=this.stats,o=this.lruCache,a=this.downloadQueue,s=this.parseQueue,l=this.loadingTiles,c=mf(i),h=new AbortController,p=h.signal;if(o.add(e,u=>{h.abort(),t?u.children.length=0:this.invokeAllPlugins(m=>{m.disposeTile&&m.disposeTile(u)}),r.inCache--,this.cachedSinceLoadComplete.has(e)&&(this.cachedSinceLoadComplete.delete(e),r.inCacheSinceLoad--),u.internal.loadingState===1?r.queued--:u.internal.loadingState===2?r.downloading--:u.internal.loadingState===3?r.parsing--:u.internal.loadingState===4&&r.loaded--,u.internal.loadingState=0,s.remove(u),a.remove(u),l.delete(u)}))return this.isLoading||(this.isLoading=!0,this.dispatchEvent({type:"tiles-load-start"})),o.setMemoryUsage(e,this.getBytesUsed(e)),this.cachedSinceLoadComplete.add(e),r.inCacheSinceLoad++,r.inCache++,r.queued++,e.internal.loadingState=1,l.add(e),a.add(i,e,u=>{if(p.aborted)return Promise.resolve();e.internal.loadingState=2,r.downloading++,r.queued--;let m=this.invokeOnePlugin(f=>f.fetchData&&f.fetchData(i,{...this.fetchOptions,signal:p}));return this.dispatchEvent({type:"tile-download-start",tile:e,url:i,get uri(){return console.warn('tile-download-start event: "uri" has been renamed to "url".'),this.url}}),m}).then(u=>{if(!p.aborted){if(!(u instanceof Response))return u;if(u.ok)return c==="json"?u.json():u.arrayBuffer();throw Error(`Failed to load model with error code ${u.status}`)}}).then(u=>{if(!p.aborted)return r.downloading--,r.parsing++,e.internal.loadingState=3,s.add(e,m=>p.aborted?Promise.resolve():c==="json"&&u.root?(this.preprocessTileset(u,i,e),e.children.push(u.root),n=u,t=!0,Promise.resolve()):this.invokeOnePlugin(f=>f.parseTile&&f.parseTile(u,m,c,i,p)))}).then(()=>{if(p.aborted)return;r.parsing--,r.loaded++,e.internal.loadingState=4,l.delete(e),o.setLoaded(e,!0);let u=this.getBytesUsed(e);if(o.getMemoryUsage(e)===0&&u>0&&o.isFull()){o.remove(e);return}o.setMemoryUsage(e,u),this.dispatchEvent({type:"needs-update"}),t&&this.dispatchEvent({type:"load-tileset",tileset:n,url:i}),e.engineData.scene&&this.dispatchEvent({type:"load-model",scene:e.engineData.scene,tile:e,url:i})}).catch(u=>{p.aborted||(u.name==="AbortError"?o.remove(e):(s.remove(e),a.remove(e),e.internal.loadingState===1?r.queued--:e.internal.loadingState===2?r.downloading--:e.internal.loadingState===3?r.parsing--:e.internal.loadingState===4&&r.loaded--,r.failed++,console.error(`TilesRenderer : Failed to load tile at url "${e.content.uri}".`),console.error(u),e.internal.loadingState=-1,l.delete(e),o.setLoaded(e,!0),this.dispatchEvent({type:"load-error",tile:e,error:u,url:i})))})}};function Ka(e){if(e===null||e.byteLength<4)return"";let t;if(t=e instanceof DataView?e:new DataView(e),String.fromCharCode(t.getUint8(0))==="{")return null;let n="";for(let i=0;i<4;i++)n+=String.fromCharCode(t.getUint8(i));return n}var YP=new TextDecoder;function Q0(e){return YP.decode(e)}function hp(e){return e.replace(/[\\/][^\\/]+$/,"")+"/"}var pl=class{constructor(){this.fetchOptions={},this.workingPath=""}loadAsync(e){return fetch(e,this.fetchOptions).then(t=>{if(!t.ok)throw Error(`Failed to load file "${e}" with status ${t.status} : ${t.statusText}`);return t.arrayBuffer()}).then(t=>(this.workingPath===""&&(this.workingPath=hp(e)),this.parse(t)))}resolveExternalURL(e){return new URL(e,this.workingPath).href}parse(e){throw Error("LoaderBase: Parse not implemented.")}};function vf(e,t,n,i,r,o){let a;switch(i){case"SCALAR":a=1;break;case"VEC2":a=2;break;case"VEC3":a=3;break;case"VEC4":a=4;break;default:throw Error(`FeatureTable : Feature type not provided for "${o}".`)}let s,l=n*a;switch(r){case"BYTE":s=new Int8Array(e,t,l);break;case"UNSIGNED_BYTE":s=new Uint8Array(e,t,l);break;case"SHORT":s=new Int16Array(e,t,l);break;case"UNSIGNED_SHORT":s=new Uint16Array(e,t,l);break;case"INT":s=new Int32Array(e,t,l);break;case"UNSIGNED_INT":s=new Uint32Array(e,t,l);break;case"FLOAT":s=new Float32Array(e,t,l);break;case"DOUBLE":s=new Float64Array(e,t,l);break;default:throw Error(`FeatureTable : Feature component type not provided for "${o}".`)}return s}var zc=class{constructor(e,t,n,i){this.buffer=e,this.binOffset=t+n,this.binLength=i;let r=null;if(n!==0){let o=new Uint8Array(e,t,n);r=JSON.parse(Q0(o))}else r={};this.header=r}getKeys(){return Object.keys(this.header).filter(e=>e!=="extensions")}getData(e,t,n=null,i=null){let r=this.header;if(!(e in r))return null;let o=r[e];if(!(o instanceof Object)||Array.isArray(o))return o;{let{buffer:a,binOffset:s,binLength:l}=this,c=o.byteOffset||0,h=o.type||i,p=o.componentType||n;if("type"in o&&i&&o.type!==i)throw Error("FeatureTable: Specified type does not match expected type.");let u=s+c,m=vf(a,u,t,h,p,e);if(u+m.byteLength>s+l)throw Error("FeatureTable: Feature data read outside binary body length.");return m}}getBuffer(e,t){let{buffer:n,binOffset:i}=this;return n.slice(i+e,i+e+t)}},KP=class{constructor(e){this.batchTable=e;let t=e.header.extensions["3DTILES_batch_table_hierarchy"];this.classes=t.classes;for(let i of this.classes){let r=i.instances;for(let o in r)i.instances[o]=this._parseProperty(r[o],i.length,o)}if(this.instancesLength=t.instancesLength,this.classIds=this._parseProperty(t.classIds,this.instancesLength,"classIds"),t.parentCounts?this.parentCounts=this._parseProperty(t.parentCounts,this.instancesLength,"parentCounts"):this.parentCounts=Array(this.instancesLength).fill(1),t.parentIds){let i=this.parentCounts.reduce((r,o)=>r+o,0);this.parentIds=this._parseProperty(t.parentIds,i,"parentIds")}else this.parentIds=null;this.instancesIds=[];let n={};for(let i of this.classIds)n[i]=n[i]??0,this.instancesIds.push(n[i]),n[i]++}_parseProperty(e,t,n){if(Array.isArray(e))return e;{let{buffer:i,binOffset:r}=this.batchTable,o=e.byteOffset,a=e.componentType||"UNSIGNED_SHORT";return vf(i,r+o,t,"SCALAR",a,n)}}getDataFromId(e,t={}){let n=this.parentCounts[e];if(this.parentIds&&n>0){let s=0;for(let l=0;l<e;l++)s+=this.parentCounts[l];for(let l=0;l<n;l++){let c=this.parentIds[s+l];c!==e&&this.getDataFromId(c,t)}}let i=this.classIds[e],r=this.classes[i].instances,o=this.classes[i].name,a=this.instancesIds[e];for(let s in r)t[o]=t[o]||{},t[o][s]=r[s][a];return t}},fp=class extends zc{constructor(e,t,n,i,r){super(e,n,i,r),this.count=t,this.extensions={};let o=this.header.extensions;o&&o["3DTILES_batch_table_hierarchy"]&&(this.extensions["3DTILES_batch_table_hierarchy"]=new KP(this))}getDataFromId(e,t={}){if(e<0||e>=this.count)throw Error(`BatchTable: id value "${e}" out of bounds for "${this.count}" features number.`);for(let n of this.getKeys())t[n]=super.getData(n,this.count)[e];for(let n in this.extensions){let i=this.extensions[n];i.getDataFromId instanceof Function&&(t[n]=t[n]||{},i.getDataFromId(e,t[n]))}return t}getPropertyArray(e){return super.getData(e,this.count)}},xf=class extends pl{parse(e){let t=new DataView(e),n=Ka(t);console.assert(n==="b3dm");let i=t.getUint32(4,!0);console.assert(i===1);let r=t.getUint32(8,!0);console.assert(r===e.byteLength);let o=t.getUint32(12,!0),a=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getUint32(24,!0),c=new zc(e.slice(28,28+o+a),0,o,a),h=28+o+a,p=new fp(e.slice(h,h+s+l),c.getData("BATCH_LENGTH"),0,s,l),u=h+s+l;return{version:i,featureTable:c,batchTable:p,glbBytes:new Uint8Array(e,u,r-u)}}},yf=class extends pl{parse(e){let t=new DataView(e),n=Ka(t);console.assert(n==="i3dm");let i=t.getUint32(4,!0);console.assert(i===1);let r=t.getUint32(8,!0);console.assert(r===e.byteLength);let o=t.getUint32(12,!0),a=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getUint32(24,!0),c=t.getUint32(28,!0),h=new zc(e.slice(32,32+o+a),0,o,a),p=32+o+a,u=new fp(e.slice(p,p+s+l),h.getData("INSTANCES_LENGTH"),0,s,l),m=p+s+l,f=new Uint8Array(e,m,r-m),g=null,b=null,x=null;if(c)g=f,b=Promise.resolve();else{let v=this.resolveExternalURL(Q0(f));x=hp(v),b=fetch(v,this.fetchOptions).then(w=>{if(!w.ok)throw Error(`I3DMLoaderBase : Failed to load file "${v}" with status ${w.status} : ${w.statusText}`);return w.arrayBuffer()}).then(w=>{g=new Uint8Array(w)})}return b.then(()=>({version:i,featureTable:h,batchTable:u,glbBytes:g,gltfWorkingPath:x}))}},wf=class extends pl{parse(e){let t=new DataView(e),n=Ka(t);console.assert(n==="pnts");let i=t.getUint32(4,!0);console.assert(i===1);let r=t.getUint32(8,!0);console.assert(r===e.byteLength);let o=t.getUint32(12,!0),a=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getUint32(24,!0),c=new zc(e.slice(28,28+o+a),0,o,a),h=28+o+a,p=new fp(e.slice(h,h+s+l),c.getData("BATCH_LENGTH")||c.getData("POINTS_LENGTH"),0,s,l);return Promise.resolve({version:i,featureTable:c,batchTable:p})}},Sf=class extends pl{parse(e){let t=new DataView(e),n=Ka(t);console.assert(n==="cmpt",'CMPTLoader: The magic bytes equal "cmpt".');let i=t.getUint32(4,!0);console.assert(i===1,'CMPTLoader: The version listed in the header is "1".');let r=t.getUint32(8,!0);console.assert(r===e.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");let o=t.getUint32(12,!0),a=[],s=16;for(let l=0;l<o;l++){let c=new DataView(e,s,12),h=Ka(c),p=c.getUint32(4,!0),u=c.getUint32(8,!0),m=new Uint8Array(e,s,u);a.push({type:h,buffer:m,version:p}),s+=u}return{version:i,tiles:a}}};var F=require("three"),Mp=require("three/addons/loaders/GLTFLoader.js"),f1=require("three/addons/utils/BufferGeometryUtils.js"),Lf=class extends xf{constructor(e=F.DefaultLoadingManager){super(),this.manager=e,this.adjustmentTransform=new F.Matrix4}parse(e){let t=super.parse(e),n=t.glbBytes.slice().buffer;return new Promise((i,r)=>{let o=this.manager,a=this.fetchOptions,s=o.getHandler("path.gltf")||new Mp.GLTFLoader(o);a.credentials==="include"&&a.mode==="cors"&&s.setCrossOrigin("use-credentials"),"credentials"in a&&s.setWithCredentials(a.credentials==="include"),a.headers&&s.setRequestHeader(a.headers);let l=this.workingPath;!/[\\/]$/.test(l)&&l.length&&(l+="/");let c=this.adjustmentTransform;s.parse(n,l,h=>{let{batchTable:p,featureTable:u}=t,{scene:m}=h,f=u.getData("RTC_CENTER",1,"FLOAT","VEC3");f&&(m.position.x+=f[0],m.position.y+=f[1],m.position.z+=f[2]),h.scene.updateMatrix(),h.scene.matrix.multiply(c),h.scene.matrix.decompose(h.scene.position,h.scene.quaternion,h.scene.scale),h.batchTable=p,h.featureTable=u,m.batchTable=p,m.featureTable=u,i(h)},r)})}};function ZP(e){let t=e>>11,n=e>>5&63,i=e&31;return[Math.round(t/31*255),Math.round(n/63*255),Math.round(i/31*255)]}var Uc=new F.Vector2;function JP(e,t,n=new F.Vector3){Uc.set(e,t).divideScalar(256).multiplyScalar(2).subScalar(1),n.set(Uc.x,Uc.y,1-Math.abs(Uc.x)-Math.abs(Uc.y));let i=F.MathUtils.clamp(-n.z,0,1);return n.x>=0?n.setX(n.x-i):n.setX(n.x+i),n.y>=0?n.setY(n.y-i):n.setY(n.y+i),n.normalize(),n}var e1={RGB:"color",POSITION:"position"},Df=class extends wf{constructor(e=F.DefaultLoadingManager){super(),this.manager=e}parse(e){return super.parse(e).then(async t=>{let{featureTable:n,batchTable:i}=t,r=new F.PointsMaterial,o=n.header.extensions,a=new F.Vector3,s;if(o&&o["3DTILES_draco_point_compression"]){let{byteOffset:h,byteLength:p,properties:u}=o["3DTILES_draco_point_compression"],m=this.manager.getHandler("draco.drc");if(m==null)throw Error("PNTSLoader: dracoLoader not available.");let f={};for(let x in u)if(x in e1&&x in u){let v=e1[x];f[v]=u[x]}let g={attributeIDs:f,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},b=n.getBuffer(h,p);s=await m.decodeGeometry(b,g),s.attributes.color&&(r.vertexColors=!0)}else{let h=n.getData("POINTS_LENGTH"),p=n.getData("POSITION",h,"FLOAT","VEC3"),u=n.getData("NORMAL",h,"FLOAT","VEC3"),m=n.getData("NORMAL",h,"UNSIGNED_BYTE","VEC2"),f=n.getData("RGB",h,"UNSIGNED_BYTE","VEC3"),g=n.getData("RGBA",h,"UNSIGNED_BYTE","VEC4"),b=n.getData("RGB565",h,"UNSIGNED_SHORT","SCALAR"),x=n.getData("CONSTANT_RGBA",h,"UNSIGNED_BYTE","VEC4"),v=n.getData("POSITION_QUANTIZED",h,"UNSIGNED_SHORT","VEC3"),w=n.getData("QUANTIZED_VOLUME_SCALE",h,"FLOAT","VEC3"),M=n.getData("QUANTIZED_VOLUME_OFFSET",h,"FLOAT","VEC3");if(s=new F.BufferGeometry,v){let _=new Float32Array(h*3);for(let y=0;y<h;y++)for(let P=0;P<3;P++){let d=3*y+P;_[d]=v[d]/65535*w[P]}a.x=M[0],a.y=M[1],a.z=M[2],s.setAttribute("position",new F.BufferAttribute(_,3,!1))}else s.setAttribute("position",new F.BufferAttribute(p,3,!1));if(u!==null)s.setAttribute("normal",new F.BufferAttribute(u,3,!1));else if(m!==null){let _=new Float32Array(h*3),y=new F.Vector3;for(let P=0;P<h;P++){let d=m[P*2],S=m[P*2+1],C=JP(d,S,y);_[P*3]=C.x,_[P*3+1]=C.y,_[P*3+2]=C.z}s.setAttribute("normal",new F.BufferAttribute(_,3,!1))}if(g!==null)s.setAttribute("color",new F.BufferAttribute(g,4,!0)),r.vertexColors=!0,r.transparent=!0,r.depthWrite=!1;else if(f!==null)s.setAttribute("color",new F.BufferAttribute(f,3,!0)),r.vertexColors=!0;else if(b!==null){let _=new Uint8Array(h*3);for(let y=0;y<h;y++){let P=ZP(b[y]);for(let d=0;d<3;d++){let S=3*y+d;_[S]=P[d]}}s.setAttribute("color",new F.BufferAttribute(_,3,!0)),r.vertexColors=!0}else if(x!==null){r.color=new F.Color(x[0],x[1],x[2]);let _=x[3]/255;_<1&&(r.opacity=_,r.transparent=!0,r.depthWrite=!1)}}let l=new F.Points(s,r);l.position.copy(a),t.scene=l,t.scene.featureTable=n,t.scene.batchTable=i;let c=n.getData("RTC_CENTER",1,"FLOAT","VEC3");return c&&(t.scene.position.x+=c[0],t.scene.position.y+=c[1],t.scene.position.z+=c[2]),t})}};function QP(e){let{x:t,y:n,z:i}=e;e.x=i,e.y=t,e.z=n}function eA(e){return-e+Math.PI/2}var t1=new F.Spherical,Yo=new F.Vector3,fr=new F.Vector3,_f=new F.Vector3,ti=new F.Matrix4,Fi=new F.Matrix4,Mf=new F.Sphere,Pr=new F.Euler,n1=new F.Vector3,r1=new F.Vector3,i1=new F.Vector3,Vc=new F.Vector3,gp=new F.Ray,tA=1e-12,nA=.1;var Nf=class{constructor(e=1,t=1,n=1){this.name="",this.radius=new F.Vector3(e,t,n)}intersectRay(e,t){return ti.makeScale(...this.radius).invert(),Mf.center.set(0,0,0),Mf.radius=1,gp.copy(e).applyMatrix4(ti),gp.intersectSphere(Mf,t)?(ti.makeScale(...this.radius),t.applyMatrix4(ti),t):null}getEastNorthUpFrame(e,t,n,i){return n.isMatrix4&&(i=n,n=0,console.warn('Ellipsoid: The signature for "getEastNorthUpFrame" has changed.')),this.getEastNorthUpAxes(e,t,n1,r1,i1),this.getCartographicToPosition(e,t,n,Vc),i.makeBasis(n1,r1,i1).setPosition(Vc)}getOrientedEastNorthUpFrame(e,t,n,i,r,o,a){return this.getObjectFrame(e,t,n,i,r,o,a,0)}getObjectFrame(e,t,n,i,r,o,a,s=2){return this.getEastNorthUpFrame(e,t,n,ti),Pr.set(r,o,-i,"ZXY"),a.makeRotationFromEuler(Pr).premultiply(ti),s===1?(Pr.set(Math.PI/2,0,0,"XYZ"),Fi.makeRotationFromEuler(Pr),a.multiply(Fi)):s===2&&(Pr.set(-Math.PI/2,0,Math.PI,"XYZ"),Fi.makeRotationFromEuler(Pr),a.multiply(Fi)),a}getCartographicFromObjectFrame(e,t,n=2){return n===1?(Pr.set(-Math.PI/2,0,0,"XYZ"),Fi.makeRotationFromEuler(Pr).premultiply(e)):n===2?(Pr.set(-Math.PI/2,0,Math.PI,"XYZ"),Fi.makeRotationFromEuler(Pr).premultiply(e)):Fi.copy(e),Vc.setFromMatrixPosition(Fi),this.getPositionToCartographic(Vc,t),this.getEastNorthUpFrame(t.lat,t.lon,0,ti).invert(),Fi.premultiply(ti),Pr.setFromRotationMatrix(Fi,"ZXY"),t.azimuth=-Pr.z,t.elevation=Pr.x,t.roll=Pr.y,t}getEastNorthUpAxes(e,t,n,i,r,o=Vc){this.getCartographicToPosition(e,t,0,o),this.getCartographicToNormal(e,t,r),n.set(-o.y,o.x,0).normalize(),i.crossVectors(r,n).normalize()}getCartographicToPosition(e,t,n,i){this.getCartographicToNormal(e,t,Yo);let r=this.radius;fr.copy(Yo),fr.x*=r.x**2,fr.y*=r.y**2,fr.z*=r.z**2;let o=Math.sqrt(Yo.dot(fr));return fr.divideScalar(o),i.copy(fr).addScaledVector(Yo,n)}getPositionToCartographic(e,t){this.getPositionToSurfacePoint(e,fr),this.getPositionToNormal(fr,Yo);let n=_f.subVectors(e,fr);return t.lon=Math.atan2(Yo.y,Yo.x),t.lat=Math.asin(Yo.z),t.height=Math.sign(n.dot(e))*n.length(),t}getCartographicToNormal(e,t,n){return t1.set(1,eA(e),t),n.setFromSpherical(t1).normalize(),QP(n),n}getPositionToNormal(e,t){let n=this.radius;return t.copy(e),t.x/=n.x**2,t.y/=n.y**2,t.z/=n.z**2,t.normalize(),t}getPositionToSurfacePoint(e,t){let n=this.radius,i=1/n.x**2,r=1/n.y**2,o=1/n.z**2,a=e.x*e.x*i,s=e.y*e.y*r,l=e.z*e.z*o,c=a+s+l,h=Math.sqrt(1/c),p=fr.copy(e).multiplyScalar(h);if(c<nA)return isFinite(h)?t.copy(p):null;let u=_f.set(p.x*i*2,p.y*r*2,p.z*o*2),m=(1-h)*e.length()/(.5*u.length()),f=0,g,b,x,v,w,M,_,y,P,d,S;do{m-=f,x=1/(1+m*i),v=1/(1+m*r),w=1/(1+m*o),M=x*x,_=v*v,y=w*w,P=M*x,d=_*v,S=y*w,g=a*M+s*_+l*y-1,b=a*P*i+s*d*r+l*S*o;let C=-2*b;f=g/C}while(Math.abs(g)>tA);return t.set(e.x*x,e.y*v,e.z*w)}calculateHorizonDistance(e,t){let n=this.calculateEffectiveRadius(e);return Math.sqrt(2*n*t+t**2)}calculateEffectiveRadius(e){let t=this.radius.x,n=1-this.radius.z**2/t**2,i=e*F.MathUtils.DEG2RAD,r=Math.sin(i)**2;return t/Math.sqrt(1-n*r)}getPositionElevation(e){this.getPositionToSurfacePoint(e,fr);let t=_f.subVectors(e,fr);return Math.sign(t.dot(e))*t.length()}closestPointToRayEstimate(e,t){return this.intersectRay(e,t)?t:(ti.makeScale(...this.radius).invert(),gp.copy(e).applyMatrix4(ti),fr.set(0,0,0),gp.closestPointToPoint(fr,t).normalize(),ti.makeScale(...this.radius),t.applyMatrix4(ti))}copy(e){return this.radius.copy(e.radius),this}clone(){return new this.constructor().copy(this)}},Wc=new Nf(Za,Za,ff);Wc.name="WGS84 Earth";var bp=new F.Vector3,ml=new F.Vector3,hl=new F.Vector3,Cf=new F.Vector3,vp=new F.Quaternion,xp=new F.Vector3,fl=new F.Matrix4,o1=new F.Matrix4,a1=new F.Vector3,s1=new F.Matrix4,Tf=new F.Quaternion,Pf={};function l1(e,t,n,i){if(e=e/n*2-1,t=t/n*2-1,i.x=e,i.y=t,i.z=1-Math.abs(e)-Math.abs(t),i.z<0){let r=i.x;i.x=(1-Math.abs(i.y))*(r>=0?1:-1),i.y=(1-Math.abs(r))*(i.y>=0?1:-1)}return i.normalize(),i}var Of=class extends yf{constructor(e=F.DefaultLoadingManager){super(),this.manager=e,this.adjustmentTransform=new F.Matrix4,this.ellipsoid=Wc.clone()}resolveExternalURL(e){return this.manager.resolveURL(super.resolveExternalURL(e))}parse(e){return super.parse(e).then(t=>{let{featureTable:n,batchTable:i}=t,r=t.glbBytes.slice().buffer;return new Promise((o,a)=>{let s=this.fetchOptions,l=this.manager,c=l.getHandler("path.gltf")||new Mp.GLTFLoader(l);s.credentials==="include"&&s.mode==="cors"&&c.setCrossOrigin("use-credentials"),"credentials"in s&&c.setWithCredentials(s.credentials==="include"),s.headers&&c.setRequestHeader(s.headers);let h=t.gltfWorkingPath??this.workingPath;/[\\/]$/.test(h)||(h+="/");let p=this.adjustmentTransform;c.parse(r,h,u=>{let m=n.getData("INSTANCES_LENGTH"),f=n.getData("POSITION",m,"FLOAT","VEC3"),g=n.getData("POSITION_QUANTIZED",m,"UNSIGNED_SHORT","VEC3"),b=n.getData("QUANTIZED_VOLUME_OFFSET",1,"FLOAT","VEC3"),x=n.getData("QUANTIZED_VOLUME_SCALE",1,"FLOAT","VEC3"),v=n.getData("NORMAL_UP",m,"FLOAT","VEC3"),w=n.getData("NORMAL_RIGHT",m,"FLOAT","VEC3"),M=n.getData("NORMAL_UP_OCT32P",m,"UNSIGNED_SHORT","VEC2"),_=n.getData("NORMAL_RIGHT_OCT32P",m,"UNSIGNED_SHORT","VEC2"),y=n.getData("SCALE_NON_UNIFORM",m,"FLOAT","VEC3"),P=n.getData("SCALE",m,"FLOAT","SCALAR"),d=n.getData("RTC_CENTER",1,"FLOAT","VEC3"),S=n.getData("EAST_NORTH_UP");if(!f&&g){f=new Float32Array(m*3);for(let k=0;k<m;k++)f[k*3+0]=b[0]+g[k*3+0]/65535*x[0],f[k*3+1]=b[1]+g[k*3+1]/65535*x[1],f[k*3+2]=b[2]+g[k*3+2]/65535*x[2]}let C=new F.Vector3;for(let k=0;k<m;k++)C.x+=f[k*3+0]/m,C.y+=f[k*3+1]/m,C.z+=f[k*3+2]/m;let T=[],E=[];u.scene.updateMatrixWorld(),u.scene.traverse(k=>{if(k.isMesh){E.push(k);let{geometry:D,material:I}=k,L=new F.InstancedMesh(D,I,m);L.position.copy(C),d&&(L.position.x+=d[0],L.position.y+=d[1],L.position.z+=d[2]),T.push(L)}});for(let k=0;k<m;k++){Cf.set(f[k*3+0]-C.x,f[k*3+1]-C.y,f[k*3+2]-C.z),vp.identity(),v&&w?(ml.set(v[k*3+0],v[k*3+1],v[k*3+2]),hl.set(w[k*3+0],w[k*3+1],w[k*3+2]),bp.crossVectors(hl,ml).normalize(),fl.makeBasis(hl,ml,bp),vp.setFromRotationMatrix(fl)):M&&_&&(l1(M[k*2+0],M[k*2+1],65535,ml),l1(_[k*2+0],_[k*2+1],65535,hl),bp.crossVectors(hl,ml).normalize(),fl.makeBasis(hl,ml,bp),vp.setFromRotationMatrix(fl)),xp.set(1,1,1),y&&xp.set(y[k*3+0],y[k*3+1],y[k*3+2]),P&&xp.multiplyScalar(P[k]);for(let D=0,I=T.length;D<I;D++){let L=T[D];Tf.copy(vp),S&&(L.updateMatrixWorld(),a1.copy(Cf).applyMatrix4(L.matrixWorld),this.ellipsoid.getPositionToCartographic(a1,Pf),this.ellipsoid.getEastNorthUpFrame(Pf.lat,Pf.lon,s1),Tf.setFromRotationMatrix(s1)),fl.compose(Cf,Tf,xp).multiply(p);let X=E[D];o1.multiplyMatrices(fl,X.matrixWorld),L.setMatrixAt(k,o1)}}u.scene.clear(),u.scene.add(...T),u.batchTable=i,u.featureTable=n,u.scene.batchTable=i,u.scene.featureTable=n,o(u)},a)})})}},g1=class extends Sf{constructor(e=F.DefaultLoadingManager){super(),this.manager=e,this.adjustmentTransform=new F.Matrix4,this.ellipsoid=Wc.clone()}parse(e){let t=super.parse(e),{manager:n,ellipsoid:i,adjustmentTransform:r}=this,o=[];for(let a in t.tiles){let{type:s,buffer:l}=t.tiles[a];switch(s){case"b3dm":{let c=l.slice(),h=new Lf(n);h.workingPath=this.workingPath,h.fetchOptions=this.fetchOptions,h.adjustmentTransform.copy(r);let p=h.parse(c.buffer);o.push(p);break}case"pnts":{let c=l.slice(),h=new Df(n);h.workingPath=this.workingPath,h.fetchOptions=this.fetchOptions;let p=h.parse(c.buffer);o.push(p);break}case"i3dm":{let c=l.slice(),h=new Of(n);h.workingPath=this.workingPath,h.fetchOptions=this.fetchOptions,h.ellipsoid.copy(i),h.adjustmentTransform.copy(r);let p=h.parse(c.buffer);o.push(p);break}}}return Promise.all(o).then(a=>{let s=new F.Group;return a.forEach(l=>{s.add(l.scene)}),{tiles:a,scene:s}})}},Fc=new F.Matrix4,rA=class extends F.Group{constructor(e){super(),this.isTilesGroup=!0,this.name="TilesRenderer.TilesGroup",this.tilesRenderer=e,this.matrixWorldInverse=new F.Matrix4}raycast(e,t){return this.tilesRenderer.raycast(e,t),!1}updateMatrixWorld(e){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||e){this.parent===null?Fc.copy(this.matrix):Fc.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;let t=Fc.elements,n=this.matrixWorld.elements,i=!1;for(let r=0;r<16;r++){let o=t[r],a=n[r];if(Math.abs(o-a)>2**-52){i=!0;break}}if(i){this.matrixWorld.copy(Fc),this.matrixWorldInverse.copy(Fc).invert();let r=this.children;for(let l=0,c=r.length;l<c;l++)r[l].updateMatrixWorld();let{tilesRenderer:o}=this,{activeTiles:a,visibleTiles:s}=o;a.forEach(l=>{s.has(l)||l.engineData.scene.updateMatrixWorld(!0)})}}}updateWorldMatrix(e,t){this.parent&&e&&this.parent.updateWorldMatrix(e,!1),this.updateMatrixWorld(!0)}},iA=new F.Ray;function oA(e,t,n,i){let{scene:r}=e.engineData;n.invokeOnePlugin(o=>o.raycastTile&&o.raycastTile(e,r,t,i))||t.intersectObject(r,!0,i)}function aA(e){return"traversal"in e}function b1(e,t,n,i,r=null){if(!aA(t))return;let{group:o,activeTiles:a}=e,{boundingVolume:s}=t.engineData;if(r===null&&(r=iA,r.copy(n.ray).applyMatrix4(o.matrixWorldInverse)),!t.traversal.used||!s.intersectsRay(r))return;a.has(t)&&oA(t,n,e,i);let l=t.children;for(let c=0,h=l.length;c<h;c++)b1(e,l[c],n,i,r)}var yp=new F.Vector3,wp=new F.Vector3,Ar=new F.Vector3,Sp=new F.Ray,Rf=class{constructor(e=new F.Box3,t=new F.Matrix4){this.box=e.clone(),this.transform=t.clone(),this.inverseTransform=new F.Matrix4,this.points=Array(8).fill().map(()=>new F.Vector3),this.planes=[,,,,,,].fill().map(()=>new F.Plane)}copy(e){return this.box.copy(e.box),this.transform.copy(e.transform),this.update(),this}clone(){return new this.constructor().copy(this)}clampPoint(e,t){return t.copy(e).applyMatrix4(this.inverseTransform).clamp(this.box.min,this.box.max).applyMatrix4(this.transform)}distanceToPoint(e){return this.clampPoint(e,Ar).distanceTo(e)}containsPoint(e){return Ar.copy(e).applyMatrix4(this.inverseTransform),this.box.containsPoint(Ar)}intersectsRay(e){return Sp.copy(e).applyMatrix4(this.inverseTransform),Sp.intersectsBox(this.box)}intersectRay(e,t){return Sp.copy(e).applyMatrix4(this.inverseTransform),Sp.intersectBox(this.box,t)?(t.applyMatrix4(this.transform),t):null}update(){let{points:e,inverseTransform:t,transform:n,box:i}=this;t.copy(n).invert();let{min:r,max:o}=i,a=0;for(let s=-1;s<=1;s+=2)for(let l=-1;l<=1;l+=2)for(let c=-1;c<=1;c+=2)e[a].set(s<0?r.x:o.x,l<0?r.y:o.y,c<0?r.z:o.z).applyMatrix4(n),a++;this.updatePlanes()}updatePlanes(){yp.copy(this.box.min).applyMatrix4(this.transform),wp.copy(this.box.max).applyMatrix4(this.transform),Ar.set(0,0,1).transformDirection(this.transform),this.planes[0].setFromNormalAndCoplanarPoint(Ar,yp),this.planes[1].setFromNormalAndCoplanarPoint(Ar,wp).negate(),Ar.set(0,1,0).transformDirection(this.transform),this.planes[2].setFromNormalAndCoplanarPoint(Ar,yp),this.planes[3].setFromNormalAndCoplanarPoint(Ar,wp).negate(),Ar.set(1,0,0).transformDirection(this.transform),this.planes[4].setFromNormalAndCoplanarPoint(Ar,yp),this.planes[5].setFromNormalAndCoplanarPoint(Ar,wp).negate()}intersectsSphere(e){return this.clampPoint(e.center,Ar),Ar.distanceToSquared(e.center)<=e.radius*e.radius}intersectsFrustum(e){return this._intersectsPlaneShape(e.planes,e.points)}intersectsOBB(e){return this._intersectsPlaneShape(e.planes,e.points)}_intersectsPlaneShape(e,t){let n=this.points,i=this.planes;for(let r=0;r<6;r++){let o=e[r],a=-1/0;for(let s=0;s<8;s++){let l=n[s],c=o.distanceToPoint(l);a=a<c?c:a}if(a<0)return!1}for(let r=0;r<6;r++){let o=i[r],a=-1/0;for(let s=0;s<8;s++){let l=t[s],c=o.distanceToPoint(l);a=a<c?c:a}if(a<0)return!1}return!0}},Hc=Math.PI,Af=Hc/2,jc=new F.Vector3,Ja=new F.Vector3,wi=new F.Vector3,ze=new F.Vector3,gr=new F.Matrix4,sA=new F.Box3,c1=new F.Matrix4;function Ko(e,t){t.radius=Math.max(t.radius,e.distanceToSquared(t.center))}function d1(e){return e.x!==e.y}var v1=class extends Nf{constructor(e=1,t=1,n=1,i=-Af,r=Af,o=0,a=2*Hc,s=0,l=0){super(e,t,n),this.latStart=i,this.latEnd=r,this.lonStart=o,this.lonEnd=a,this.heightStart=s,this.heightEnd=l}getBoundingBox(e,t){d1(this.radius)&&console.warn("EllipsoidRegion: Triaxial ellipsoids are not supported.");let{latStart:n,latEnd:i,lonStart:r,lonEnd:o,heightStart:a,heightEnd:s}=this,l=(n+i)*.5,c=(r+o)*.5,h=n>0,p=i<0,u;u=h?n:p?i:0;let{min:m,max:f}=e;m.setScalar(1/0),f.setScalar(-1/0),o-r<=Hc?(this.getCartographicToNormal(l,c,wi),Ja.set(0,0,1),jc.crossVectors(Ja,wi).normalize(),Ja.crossVectors(wi,jc).normalize(),t.makeBasis(jc,Ja,wi),gr.copy(t).invert(),this.getCartographicToPosition(u,r,s,ze).applyMatrix4(gr),f.x=Math.abs(ze.x),m.x=-f.x,this.getCartographicToPosition(i,r,s,ze).applyMatrix4(gr),f.y=ze.y,this.getCartographicToPosition(i,c,s,ze).applyMatrix4(gr),f.y=Math.max(ze.y,f.y),this.getCartographicToPosition(n,r,s,ze).applyMatrix4(gr),m.y=ze.y,this.getCartographicToPosition(n,c,s,ze).applyMatrix4(gr),m.y=Math.min(ze.y,m.y),this.getCartographicToPosition(l,c,s,ze).applyMatrix4(gr),f.z=ze.z,this.getCartographicToPosition(n,r,a,ze).applyMatrix4(gr),m.z=ze.z,this.getCartographicToPosition(i,r,a,ze).applyMatrix4(gr),m.z=Math.min(ze.z,m.z)):(this.getCartographicToPosition(u,c,s,wi),wi.z=0,wi.length()<1e-10?wi.set(1,0,0):wi.normalize(),Ja.set(0,0,1),jc.crossVectors(wi,Ja).normalize(),t.makeBasis(jc,Ja,wi),gr.copy(t).invert(),this.getCartographicToPosition(u,c+Af,s,ze).applyMatrix4(gr),f.x=Math.abs(ze.x),m.x=-f.x,this.getCartographicToPosition(i,0,p?a:s,ze).applyMatrix4(gr),f.y=ze.y,this.getCartographicToPosition(n,0,h?a:s,ze).applyMatrix4(gr),m.y=ze.y,this.getCartographicToPosition(u,c,s,ze).applyMatrix4(gr),f.z=ze.z,this.getCartographicToPosition(u,o,s,ze).applyMatrix4(gr),m.z=ze.z),e.getCenter(ze),e.min.sub(ze).multiplyScalar(1.0000000000001),e.max.sub(ze).multiplyScalar(1.0000000000001),ze.applyMatrix4(t),t.setPosition(ze)}getBoundingSphere(e){d1(this.radius)&&console.warn("EllipsoidRegion: Triaxial ellipsoids are not supported."),this.getBoundingBox(sA,c1),e.center.setFromMatrixPosition(c1),e.radius=0;let{latStart:t,latEnd:n,lonStart:i,lonEnd:r,heightStart:o,heightEnd:a}=this,s=(t+n)*.5,l=(i+r)*.5,c=t>0,h=n<0,p;p=c?t:h?n:0,this.getCartographicToPosition(p,i,a,ze),Ko(ze,e),this.getCartographicToPosition(n,i,a,ze),Ko(ze,e),this.getCartographicToPosition(n,l,a,ze),Ko(ze,e),this.getCartographicToPosition(t,i,a,ze),Ko(ze,e),this.getCartographicToPosition(t,l,a,ze),Ko(ze,e),this.getCartographicToPosition(s,l,a,ze),Ko(ze,e),this.getCartographicToPosition(t,i,o,ze),Ko(ze,e),r-i>Hc&&(this.getCartographicToPosition(p,l+Hc,a,ze),Ko(ze,e)),e.radius=Math.sqrt(e.radius)*1.0000000000001}},po=new F.Vector3,mo=new F.Vector3,ho=new F.Vector3,u1=new F.Vector3,p1=new F.Vector3,lA=class{constructor(){this.sphere=null,this.obb=null,this.region=null,this.regionObb=null}intersectsRay(e){let t=this.sphere,n=this.obb||this.regionObb;return!(t&&!e.intersectsSphere(t)||n&&!n.intersectsRay(e))}intersectRay(e,t=null){let n=this.sphere,i=this.obb||this.regionObb,r=-1/0,o=-1/0;n&&e.intersectSphere(n,u1)&&(r=n.containsPoint(e.origin)?0:e.origin.distanceToSquared(u1)),i&&i.intersectRay(e,p1)&&(o=i.containsPoint(e.origin)?0:e.origin.distanceToSquared(p1));let a=Math.max(r,o);return a===-1/0?null:(e.at(Math.sqrt(a),t),t)}distanceToPoint(e){let t=this.sphere,n=this.obb||this.regionObb,i=-1/0,r=-1/0;return t&&(i=Math.max(t.distanceToPoint(e),0)),n&&(r=n.distanceToPoint(e)),i>r?i:r}intersectsFrustum(e){let t=this.obb||this.regionObb,n=this.sphere;return n&&!e.intersectsSphere(n)||t&&!t.intersectsFrustum(e)?!1:!!(n||t)}intersectsSphere(e){let t=this.obb||this.regionObb,n=this.sphere;return n&&!n.intersectsSphere(e)||t&&!t.intersectsSphere(e)?!1:!!(n||t)}intersectsOBB(e){let t=this.obb||this.regionObb,n=this.sphere;return n&&!e.intersectsSphere(n)||t&&!t.intersectsOBB(e)?!1:!!(n||t)}getOBB(e,t){let n=this.obb||this.regionObb;n?(e.copy(n.box),t.copy(n.transform)):(this.getAABB(e),t.identity())}getAABB(e){if(this.sphere)this.sphere.getBoundingBox(e);else{let t=this.obb||this.regionObb;e.copy(t.box).applyMatrix4(t.transform)}}getSphere(e){if(this.sphere)e.copy(this.sphere);else if(this.region)this.region.getBoundingSphere(e);else{let t=this.obb||this.regionObb;t.box.getBoundingSphere(e),e.applyMatrix4(t.transform)}}setObbData(e,t){let n=new Rf;po.set(e[3],e[4],e[5]),mo.set(e[6],e[7],e[8]),ho.set(e[9],e[10],e[11]);let i=po.length(),r=mo.length(),o=ho.length();po.normalize(),mo.normalize(),ho.normalize(),i===0&&po.crossVectors(mo,ho),r===0&&mo.crossVectors(po,ho),o===0&&ho.crossVectors(po,mo),n.transform.set(po.x,mo.x,ho.x,e[0],po.y,mo.y,ho.y,e[1],po.z,mo.z,ho.z,e[2],0,0,0,1).premultiply(t),n.box.min.set(-i,-r,-o),n.box.max.set(i,r,o),n.update(),this.obb=n}setSphereData(e,t,n,i,r){let o=new F.Sphere;o.center.set(e,t,n),o.radius=i,o.applyMatrix4(r),this.sphere=o}setRegionData(e,t,n,i,r,o,a){let s=new v1(...e.radius,n,r,t,i,o,a),l=new Rf;s.getBoundingBox(l.box,l.transform),l.update(),this.region=s,this.regionObb=l}},cA=new F.Matrix3;function dA(e,t,n,i){let r=cA.set(e.normal.x,e.normal.y,e.normal.z,t.normal.x,t.normal.y,t.normal.z,n.normal.x,n.normal.y,n.normal.z);return i.set(-e.constant,-t.constant,-n.constant),i.applyMatrix3(r.invert()),i}var uA=class extends F.Frustum{constructor(){super(),this.points=Array(8).fill().map(()=>new F.Vector3)}setFromProjectionMatrix(...e){return super.setFromProjectionMatrix(...e),this.calculateFrustumPoints(),this}calculateFrustumPoints(){let{planes:e,points:t}=this;[[e[0],e[3],e[4]],[e[1],e[3],e[4]],[e[0],e[2],e[4]],[e[1],e[2],e[4]],[e[0],e[3],e[5]],[e[1],e[3],e[5]],[e[0],e[2],e[5]],[e[1],e[2],e[5]]].forEach((n,i)=>{dA(n[0],n[1],n[2],t[i])})}};var kf=0;function m1(e,t,n,i){try{return F.TextureUtils.getByteLength(e,t,n,i)}catch{return kf}}function pA(e){if(!e)return 0;if(e.isExternalTexture)return e.userData?.byteLength??kf;let{format:t,type:n,image:i,mipmaps:r}=e;if(e.isCompressedTexture&&Array.isArray(r)&&r.length>0){let a=0;for(let s of r)s?.data?.byteLength?a+=s.data.byteLength:a+=m1(s.width,s.height,t,n);return a}if(!i)return kf;let o=m1(i.width,i.height,t,n);return o*=e.generateMipmaps?4/3:1,o}function mA(e){let t=new Set,n=0;return e.traverse(i=>{if(i.geometry&&!t.has(i.geometry)&&(n+=(0,f1.estimateBytesUsed)(i.geometry),t.add(i.geometry)),i.material){let r=i.material;for(let o in r){let a=r[o];a&&a.isTexture&&!t.has(a)&&(n+=pA(a),t.add(a))}}}),n}var x1=Symbol("INITIAL_FRUSTUM_CULLED"),_p=new F.Matrix4,Gc=new F.Vector3,Ef=new F.Vector2,hA=new F.Vector3(1,0,0),fA=new F.Vector3(0,1,0),gA=()=>null;function h1(e,t){e.traverse(n=>{n.frustumCulled=n[x1]&&t})}var Bf=class extends bf{get autoDisableRendererCulling(){return this._autoDisableRendererCulling}set autoDisableRendererCulling(e){this._autoDisableRendererCulling!==e&&(super._autoDisableRendererCulling=e,this.forEachLoadedModel(t=>{h1(t,!e)}))}constructor(...e){super(...e),this.accelerateRaycast=!0,this.group=new rA(this),this.ellipsoid=Wc.clone(),this.cameras=[],this.cameraMap=new Map,this.cameraInfo=[],this._upRotationMatrix=new F.Matrix4,this._bytesUsed=new WeakMap,this._autoDisableRendererCulling=!0,this.manager=new F.LoadingManager,this._listeners={}}addEventListener(e,t){F.EventDispatcher.prototype.addEventListener.call(this,e,t)}hasEventListener(e,t){return F.EventDispatcher.prototype.hasEventListener.call(this,e,t)}removeEventListener(e,t){F.EventDispatcher.prototype.removeEventListener.call(this,e,t)}dispatchEvent(e){F.EventDispatcher.prototype.dispatchEvent.call(this,e)}getBoundingBox(e){if(!this.root)return!1;let t=this.root.engineData.boundingVolume;return t?(t.getAABB(e),!0):!1}getOrientedBoundingBox(e,t){if(!this.root)return!1;let n=this.root.engineData.boundingVolume;return n?(n.getOBB(e,t),!0):!1}getBoundingSphere(e){if(!this.root)return!1;let t=this.root.engineData.boundingVolume;return t?(t.getSphere(e),!0):!1}forEachLoadedModel(e){this.traverse(t=>{let n=t.engineData&&t.engineData.scene;n&&e(n,t)},null,!1)}raycast(e,t){if(this.root)if(this.accelerateRaycast)b1(this,this.root,e,t);else{let n=e.firstHitOnly?[]:t;for(let i of this.activeTiles){let{scene:r}=i.engineData;this.invokeOnePlugin(o=>o.raycastTile&&o.raycastTile(i,r,e,n))||e.intersectObject(r,!0,n)}e.firstHitOnly&&n.length>0&&(n.sort((i,r)=>i.distance-r.distance),t.push(n[0]))}}hasCamera(e){return this.cameraMap.has(e)}setCamera(e){let t=this.cameras,n=this.cameraMap;return n.has(e)?!1:(n.set(e,new F.Vector2),t.push(e),this.dispatchEvent({type:"add-camera",camera:e}),!0)}setResolution(e,t,n){let i=this.cameraMap;if(!i.has(e))return!1;let r=t.isVector2?t.x:t,o=t.isVector2?t.y:n,a=i.get(e);return(a.width!==r||a.height!==o)&&(a.set(r,o),this.dispatchEvent({type:"camera-resolution-change"})),!0}getResolution(e,t){let n=this.cameraMap.get(e);return n?t.copy(n):null}setResolutionFromRenderer(e,t){return t.getSize(Ef),this.setResolution(e,Ef.x,Ef.y)}deleteCamera(e){let t=this.cameras,n=this.cameraMap;if(n.has(e)){let i=t.indexOf(e);return t.splice(i,1),n.delete(e),this.dispatchEvent({type:"delete-camera",camera:e}),!0}return!1}loadRootTileset(...e){return super.loadRootTileset(...e).then(t=>{let{asset:n,extensions:i={}}=t;switch((n&&n.gltfUpAxis||"y").toLowerCase()){case"x":this._upRotationMatrix.makeRotationAxis(fA,-Math.PI/2);break;case"y":this._upRotationMatrix.makeRotationAxis(hA,Math.PI/2);break}if("3DTILES_ellipsoid"in i){let r=i["3DTILES_ellipsoid"],{ellipsoid:o}=this;o.name=r.body,r.radii?o.radius.set(...r.radii):o.radius.set(1,1,1)}return t})}prepareForTraversal(){let e=this.group,t=this.cameras,n=this.cameraMap,i=this.cameraInfo;for(;i.length>t.length;)i.pop();for(;i.length<t.length;)i.push({frustum:new uA,isOrthographic:!1,sseDenominator:-1,position:new F.Vector3,invScale:-1,pixelSize:0});Gc.setFromMatrixScale(e.matrixWorldInverse),Math.abs(Math.max(Gc.x-Gc.y,Gc.x-Gc.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(let r=0,o=i.length;r<o;r++){let a=t[r],s=i[r],l=s.frustum,c=s.position,h=n.get(a);(h.width===0||h.height===0)&&console.warn("TilesRenderer: resolution for camera error calculation is not set.");let p=a.projectionMatrix.elements;if(s.isOrthographic=p[15]===1,s.isOrthographic){let u=2/p[0],m=2/p[5];s.pixelSize=Math.max(m/h.height,u/h.width)}else s.sseDenominator=2/p[5]/h.height;_p.copy(e.matrixWorld),_p.premultiply(a.matrixWorldInverse),_p.premultiply(a.projectionMatrix),l.setFromProjectionMatrix(_p,a.coordinateSystem,a.reversedDepth),c.set(0,0,0),c.applyMatrix4(a.matrixWorld),c.applyMatrix4(e.matrixWorldInverse)}}update(){if(super.update(),this.cameras.length===0&&this.root){let e=!1;this.invokeAllPlugins(t=>e||(e=!!(t!==this&&t.calculateTileViewError))),e===!1&&console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}}preprocessNode(e,t,n=null){super.preprocessNode(e,t,n);let i=new F.Matrix4;if(e.transform){let a=e.transform;for(let s=0;s<16;s++)i.elements[s]=a[s]}n&&i.premultiply(n.engineData.transform);let r=new F.Matrix4().copy(i).invert(),o=new lA;"sphere"in e.boundingVolume&&o.setSphereData(...e.boundingVolume.sphere,i),"box"in e.boundingVolume&&o.setObbData(e.boundingVolume.box,i),"region"in e.boundingVolume&&o.setRegionData(this.ellipsoid,...e.boundingVolume.region),e.engineData.transform=i,e.engineData.transformInverse=r,e.engineData.boundingVolume=o,e.engineData.geometry=null,e.engineData.materials=null,e.engineData.textures=null,e.toJSON=gA}async parseTile(e,t,n,i,r){let o=t.engineData,a=hp(i),s=this.fetchOptions,l=this.manager,c=null,h=o.transform,p=this._upRotationMatrix,u=(Ka(e)||n).toLowerCase();switch(u){case"b3dm":{let w=new Lf(l);w.workingPath=a,w.fetchOptions=s,w.adjustmentTransform.copy(p),c=w.parse(e);break}case"pnts":{let w=new Df(l);w.workingPath=a,w.fetchOptions=s,c=w.parse(e);break}case"i3dm":{let w=new Of(l);w.workingPath=a,w.fetchOptions=s,w.adjustmentTransform.copy(p),w.ellipsoid.copy(this.ellipsoid),c=w.parse(e);break}case"cmpt":{let w=new g1(l);w.workingPath=a,w.fetchOptions=s,w.adjustmentTransform.copy(p),w.ellipsoid.copy(this.ellipsoid),c=w.parse(e).then(M=>M.scene);break}case"gltf":case"glb":{let w=l.getHandler("path.gltf")||l.getHandler("path.glb")||new Mp.GLTFLoader(l);w.setWithCredentials(s.credentials==="include"),w.setRequestHeader(s.headers||{}),s.credentials==="include"&&s.mode==="cors"&&w.setCrossOrigin("use-credentials");let M=w.resourcePath||w.path||a;!/[\\/]$/.test(M)&&M.length&&(M+="/"),c=w.parseAsync(e,M).then(_=>{_.scene=_.scene||new F.Group;let{scene:y}=_;return y.updateMatrix(),y.matrix.multiply(p).decompose(y.position,y.quaternion,y.scale),_});break}default:c=this.invokeOnePlugin(w=>w.parseToMesh&&w.parseToMesh(e,t,n,i,r));break}let m=await c;if(m===null)throw Error(`TilesRenderer: Content type "${u}" not supported.`);let f,g;m.isObject3D?(f=m,g=null):(f=m.scene,g=m),f.updateMatrix(),f.matrix.premultiply(h),f.matrix.decompose(f.position,f.quaternion,f.scale),await this.invokeAllPlugins(w=>w.processTileModel&&w.processTileModel(f,t)),f.traverse(w=>{w[x1]=w.frustumCulled,w.userData.tile=t}),h1(f,!this.autoDisableRendererCulling);let b=[],x=[],v=[];if(f.traverse(w=>{if(w.geometry&&x.push(w.geometry),w.material){let M=w.material;b.push(w.material);for(let _ in M){let y=M[_];y&&y.isTexture&&v.push(y)}}}),r.aborted){for(let w=0,M=v.length;w<M;w++){let _=v[w];_.image instanceof ImageBitmap&&_.image.close(),_.dispose()}return}o.materials=b,o.geometry=x,o.textures=v,o.scene=f,o.metadata=g}disposeTile(e){super.disposeTile(e);let t=e.engineData;if(t.scene){let n=t.materials,i=t.geometry,r=t.textures,o=t.scene.parent;t.scene.traverse(a=>{a.userData.meshFeatures&&a.userData.meshFeatures.dispose(),a.userData.structuralMetadata&&a.userData.structuralMetadata.dispose()});for(let a=0,s=i.length;a<s;a++)i[a].dispose();for(let a=0,s=n.length;a<s;a++)n[a].dispose();for(let a=0,s=r.length;a<s;a++){let l=r[a];l.image instanceof ImageBitmap&&l.image.close(),l.dispose()}o&&o.remove(t.scene),t.scene=null,t.materials=null,t.textures=null,t.geometry=null,t.metadata=null}}setTileActive(e,t){super.setTileActive(e,t);let n=e.engineData.scene;n&&(t?(n.parent=this.group,n.updateMatrixWorld(!0)):n.parent=null)}setTileVisible(e,t){let n=e.engineData.scene,{activeTiles:i,group:r}=this;n&&(t?r.add(n):(r.remove(n),i.has(e)&&(n.parent=r))),super.setTileVisible(e,t)}calculateBytesUsed(e,t){let n=this._bytesUsed;return!n.has(e)&&t&&n.set(e,mA(t)),n.get(e)??null}calculateTileViewError(e,t){let n=e.engineData,i=this.cameras,r=this.cameraInfo,o=n.boundingVolume,a=!1,s=0,l=1/0,c=0,h=1/0;for(let p=0,u=i.length;p<u;p++){let m=r[p],f,g;if(m.isOrthographic){let x=m.pixelSize;f=e.geometricError/x,g=1/0}else{let x=m.sseDenominator;g=o.distanceToPoint(m.position),f=g===0?1/0:e.geometricError/(g*x)}let b=r[p].frustum;o.intersectsFrustum(b)&&(a=!0,s=Math.max(s,f),l=Math.min(l,g)),c=Math.max(c,f),h=Math.min(h,g)}a?(t.inView=!0,t.error=s,t.distanceFromCamera=l):(t.inView=!1,t.error=c,t.distanceFromCamera=h)}dispose(){super.dispose(),this.group.removeFromParent()}};var J=require("three"),N1=require("three/addons/loaders/GLTFLoader.js"),Uf=require("three/addons/postprocessing/Pass.js");var iN=Object.freeze({fill:"#cccccc",stroke:"transparent",strokeWidth:1,radius:2,order:0,visible:!0});var y1=new Vi;y1.maxJobs=10,y1.priorityCallback=(e,t)=>{let n=e.tile,i=t.tile,r=n.internal.renderer,o=i.internal.renderer,a=r.visibleTiles.has(n);return a===o.visibleTiles.has(i)?ul(n,i):a?1:-1};var w1=new J.Vector3;function Xc(e,t){if(e.isInterleavedBufferAttribute||e.array instanceof t)return e;let n=t===Int8Array||t===Int16Array||t===Int32Array?-1:0,i=new J.BufferAttribute(new t(e.count*e.itemSize),e.itemSize,!0),r=e.itemSize,o=e.count;for(let a=0;a<o;a++)for(let s=0;s<r;s++){let l=J.MathUtils.clamp(e.getComponent(a,s),n,1);i.setComponent(a,s,l)}return i}function bA(e,t=Int16Array){let n=e.geometry,i=n.attributes,r=i.position;if(r.isInterleavedBufferAttribute||r.array instanceof t)return r;let o=new J.BufferAttribute(new t(r.count*r.itemSize),r.itemSize,!1),a=r.itemSize,s=r.count;n.computeBoundingBox();let l=n.boundingBox,{min:c,max:h}=l,p=2**(8*t.BYTES_PER_ELEMENT-1)-1,u=-p;for(let m=0;m<s;m++)for(let f=0;f<a;f++){let g=f===0?"x":f===1?"y":"z",b=c[g],x=h[g],v=J.MathUtils.mapLinear(r.getComponent(m,f),b,x,u,p);o.setComponent(m,f,v)}l.getCenter(w1).multiply(e.scale).applyQuaternion(e.quaternion),e.position.add(w1),e.scale.x*=.5*(h.x-c.x)/p,e.scale.y*=.5*(h.y-c.y)/p,e.scale.z*=.5*(h.z-c.z)/p,i.position=o,e.geometry.boundingBox=null,e.geometry.boundingSphere=null,e.updateMatrixWorld()}var Vf=class{constructor(e){this._options={generateNormals:!1,disableMipmaps:!0,compressIndex:!0,compressNormals:!1,compressUvs:!1,compressPosition:!1,uvType:Int8Array,normalType:Int8Array,positionType:Int16Array,...e},this.name="TILES_COMPRESSION_PLUGIN",this.priority=-100}processTileModel(e,t){let{generateNormals:n,disableMipmaps:i,compressIndex:r,compressUvs:o,compressNormals:a,compressPosition:s,uvType:l,normalType:c,positionType:h}=this._options;e.traverse(p=>{if(p.material&&i){let u=p.material;for(let m in u){let f=u[m];f&&f.isTexture&&f.generateMipmaps&&(f.generateMipmaps=!1,f.minFilter=J.LinearFilter)}}if(p.geometry){let u=p.geometry,m=u.attributes;if(o){let{uv:f,uv1:g,uv2:b,uv3:x}=m;f&&(m.uv=Xc(f,l)),g&&(m.uv1=Xc(g,l)),b&&(m.uv2=Xc(b,l)),x&&(m.uv3=Xc(x,l))}if(n&&!m.normals&&u.computeVertexNormals(),a&&m.normals&&(m.normals=Xc(m.normals,c)),s&&bA(p,h),r&&u.index){let f=m.position.count,g=u.index,b=f>65535?Uint32Array:f>255?Uint16Array:Uint8Array;if(!(g.array instanceof b)){let x=new b(u.index.count);x.set(g.array);let v=new J.BufferAttribute(x,1);u.setIndex(v)}}}})}};function $n(e,t,n){return e&&t in e?e[t]:n}function O1(e){return e!=="BOOLEAN"&&e!=="STRING"&&e!=="ENUM"}function vA(e){return/^FLOAT/.test(e)}function Kc(e){return/^VEC/.test(e)}function Zc(e){return/^MAT/.test(e)}function B1(e,t,n,i=null){return Zc(n)||Kc(n)?i.fromArray(e,t):e[t]}function If(e){let{type:t,componentType:n}=e;switch(t){case"SCALAR":return n==="INT64"?0n:0;case"VEC2":return new J.Vector2;case"VEC3":return new J.Vector3;case"VEC4":return new J.Vector4;case"MAT2":return new J.Matrix2;case"MAT3":return new J.Matrix3;case"MAT4":return new J.Matrix4;case"BOOLEAN":return!1;case"STRING":return"";case"ENUM":return 0}}function S1(e,t){if(t==null)return!1;switch(e){case"SCALAR":return typeof t=="number"||typeof t=="bigint";case"VEC2":return t.isVector2;case"VEC3":return t.isVector3;case"VEC4":return t.isVector4;case"MAT2":return t.isMatrix2;case"MAT3":return t.isMatrix3;case"MAT4":return t.isMatrix4;case"BOOLEAN":return typeof t=="boolean";case"STRING":return typeof t=="string";case"ENUM":return typeof t=="number"||typeof t=="bigint"}throw Error("ClassProperty: invalid type.")}function Yc(e,t=null){switch(e){case"INT8":return Int8Array;case"INT16":return Int16Array;case"INT32":return Int32Array;case"INT64":return BigInt64Array;case"UINT8":return Uint8Array;case"UINT16":return Uint16Array;case"UINT32":return Uint32Array;case"UINT64":return BigUint64Array;case"FLOAT32":return Float32Array;case"FLOAT64":return Float64Array}switch(t){case"BOOLEAN":return Uint8Array;case"STRING":return Uint8Array}throw Error("ClassProperty: invalid type.")}function xA(e,t=null){if(e.array){t=t&&Array.isArray(t)?t:[],t.length=e.count;for(let n=0,i=t.length;n<i;n++)t[n]=Cp(e,t[n])}else t=Cp(e,t);return t}function Cp(e,t=null){let n=e.default,i=e.type;if(t||(t=If(e)),n===null){switch(i){case"SCALAR":return 0;case"VEC2":return t.set(0,0);case"VEC3":return t.set(0,0,0);case"VEC4":return t.set(0,0,0,0);case"MAT2":return t.identity();case"MAT3":return t.identity();case"MAT4":return t.identity();case"BOOLEAN":return!1;case"STRING":return"";case"ENUM":return""}throw Error("ClassProperty: invalid type.")}else if(Zc(i))t.fromArray(n);else if(Kc(i))t.fromArray(n);else return n}function yA(e,t){if(e.noData===null)return t;let n=e.noData,i=e.type;if(Array.isArray(t))for(let a=0,s=t.length;a<s;a++)t[a]=r(t[a]);else t=r(t);return t;function r(a){return o(a)&&(a=Cp(e,a)),a}function o(a){if(Zc(i)){let s=a.elements;for(let l=0,c=n.length;l<c;l++)if(n[l]!==s[l])return!1;return!0}else if(Kc(i)){for(let s=0,l=n.length;s<l;s++)if(n[s]!==a.getComponent(s))return!1;return!0}else return n===a}}function wA(e,t){switch(e){case"INT8":return Math.max(t/127,-1);case"INT16":return Math.max(t,32767,-1);case"INT32":return Math.max(t/2147483647,-1);case"INT64":return Math.max(Number(t)/9223372036854776e3,-1);case"UINT8":return t/255;case"UINT16":return t/65535;case"UINT32":return t/4294967295;case"UINT64":return Number(t)/18446744073709552e3}}function SA(e,t){let{type:n,componentType:i,scale:r,offset:o,normalized:a}=e;if(Array.isArray(t))for(let p=0,u=t.length;p<u;p++)t[p]=s(t[p]);else t=s(t);return t;function s(p){return p=Zc(n)?c(p):Kc(n)?l(p):h(p),p}function l(p){return p.x=h(p.x),p.y=h(p.y),"z"in p&&(p.z=h(p.z)),"w"in p&&(p.w=h(p.w)),p}function c(p){let u=p.elements;for(let m=0,f=u.length;m<f;m++)u[m]=h(u[m]);return p}function h(p){return a&&(p=wA(i,p)),(a||vA(i))&&(p=p*r+o),p}}function Ff(e,t,n=null){if(e.array){Array.isArray(t)||(t=Array(e.count||0)),t.length=n===null?e.count:n;for(let i=0,r=t.length;i<r;i++)S1(e.type,t[i])||(t[i]=If(e))}else S1(e.type,t)||(t=If(e));return t}function Tp(e,t){for(let n in t)n in e||delete t[n];for(let n in e){let i=e[n];t[n]=Ff(i,t[n])}}function _A(e){switch(e){case"ENUM":return 1;case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;case"BOOLEAN":return-1;case"STRING":return-1;default:return-1}}var Ap=class{constructor(e,t,n=null){this.name=t.name||null,this.description=t.description||null,this.type=t.type,this.componentType=t.componentType||null,this.enumType=t.enumType||null,this.array=t.array||!1,this.count=t.count||0,this.normalized=t.normalized||!1,this.offset=t.offset||0,this.scale=$n(t,"scale",1),this.max=$n(t,"max",1/0),this.min=$n(t,"min",-1/0),this.required=t.required||!1,this.noData=$n(t,"noData",null),this.default=$n(t,"default",null),this.semantic=$n(t,"semantic",null),this.enumSet=null,this.accessorProperty=n,n&&(this.offset=$n(n,"offset",this.offset),this.scale=$n(n,"scale",this.scale),this.max=$n(n,"max",this.max),this.min=$n(n,"min",this.min)),t.type==="ENUM"&&(this.enumSet=e[this.enumType],this.componentType===null&&(this.componentType=$n(this.enumSet,"valueType","UINT16")))}shapeToProperty(e,t=null){return Ff(this,e,t)}resolveDefaultElement(e){return Cp(this,e)}resolveDefault(e){return xA(this,e)}resolveNoData(e){return yA(this,e)}resolveEnumsToStrings(e){let t=this.enumSet;if(this.type==="ENUM")if(Array.isArray(e))for(let i=0,r=e.length;i<r;i++)e[i]=n(e[i]);else e=n(e);return e;function n(i){let r=t.values.find(o=>o.value===i);return r===null?"":r.name}}adjustValueScaleOffset(e){return O1(this.type)?SA(this,e):e}},jf=class{constructor(e,t={},n={},i=null){this.definition=e,this.class=t[e.class],this.className=e.class,this.enums=n,this.data=i,this.name="name"in e?e.name:null,this.properties=null}getPropertyNames(){return Object.keys(this.class.properties)}includesData(e){return!!this.definition.properties[e]}dispose(){}_initProperties(e=Ap){let t={};for(let n in this.class.properties)t[n]=new e(this.enums,this.class.properties[n],this.definition.properties[n]);this.properties=t}},MA=class extends Ap{constructor(e,t,n=null){super(e,t,n),this.attribute=n?.attribute??null}},CA=class extends jf{constructor(...e){super(...e),this.isPropertyAttributeAccessor=!0,this._initProperties(MA)}getData(e,t,n={}){let i=this.properties;Tp(i,n);for(let r in i)n[r]=this.getPropertyValue(r,e,t,n[r]);return n}getPropertyValue(e,t,n,i=null){if(t>=this.count)throw Error("PropertyAttributeAccessor: Requested index is outside the range of the buffer.");let r=this.properties[e],o=r.type;if(!r)throw Error("PropertyAttributeAccessor: Requested class property does not exist.");if(!this.definition.properties[e])return r.resolveDefault(i);i=r.shapeToProperty(i);let a=n.getAttribute(r.attribute.toLowerCase());if(Zc(o)){let s=i.elements;for(let l=s.length;0<l;)s[0]=a.getComponent(t,0)}else if(Kc(o))i.fromBufferAttribute(a,t);else if(o==="SCALAR"||o==="ENUM")i=a.getX(t);else throw Error("StructuredMetadata.PropertyAttributeAccessor: BOOLEAN and STRING types are not supported by property attributes.");return i=r.adjustValueScaleOffset(i),i=r.resolveEnumsToStrings(i),i=r.resolveNoData(i),i}},TA=class extends Ap{constructor(e,t,n=null){super(e,t,n),this.values=n?.values??null,this.valueLength=_A(this.type),this.arrayOffsets=$n(n,"arrayOffsets",null),this.stringOffsets=$n(n,"stringOffsets",null),this.arrayOffsetType=$n(n,"arrayOffsetType","UINT32"),this.stringOffsetType=$n(n,"stringOffsetType","UINT32")}getArrayLengthFromId(e,t){let n=this.count;if(this.arrayOffsets!==null){let{arrayOffsets:i,arrayOffsetType:r}=this,o=new(Yc(r))(e[i]);n=o[t+1]-o[t]}return n}getIndexOffsetFromId(e,t){let n=t;if(this.arrayOffsets){let{arrayOffsets:i,arrayOffsetType:r}=this;n=new(Yc(r))(e[i])[n]}else this.array&&(n*=this.count);return n}},PA=class extends jf{constructor(...e){super(...e),this.isPropertyTableAccessor=!0,this.count=this.definition.count,this._initProperties(TA)}getData(e,t={}){let n=this.properties;Tp(n,t);for(let i in n)t[i]=this.getPropertyValue(i,e,t[i]);return t}_readValueAtIndex(e,t,n,i=null){let r=this.properties[e],{componentType:o,type:a}=r,s=this.data,l=s[r.values],c=new(Yc(o,a))(l),h=r.getIndexOffsetFromId(s,t);if(O1(a)||a==="ENUM")return B1(c,(h+n)*r.valueLength,a,i);if(a==="STRING"){let p=h+n,u=0;if(r.stringOffsets!==null){let{stringOffsets:f,stringOffsetType:g}=r,b=new(Yc(g))(s[f]);u=b[p+1]-b[p],p=b[p]}let m=new Uint8Array(c.buffer,p,u);i=new TextDecoder().decode(m)}else if(a==="BOOLEAN"){let p=h+n,u=Math.floor(p/8),m=p%8;i=(c[u]>>m&1)==1}return i}getPropertyValue(e,t,n=null){if(t>=this.count)throw Error("PropertyTableAccessor: Requested index is outside the range of the table.");let i=this.properties[e];if(!i)throw Error("PropertyTableAccessor: Requested property does not exist.");if(!this.definition.properties[e])return i.resolveDefault(n);let r=i.array,o=this.data,a=i.getArrayLengthFromId(o,t);if(n=i.shapeToProperty(n,a),r)for(let s=0,l=n.length;s<l;s++)n[s]=this._readValueAtIndex(e,t,s,n[s]);else n=this._readValueAtIndex(e,t,0,n);return n=i.adjustValueScaleOffset(n),n=i.resolveEnumsToStrings(n),n=i.resolveNoData(n),n}},qc=new J.Box2,_1=class{constructor(){this._renderer=new J.WebGLRenderer,this._target=new J.WebGLRenderTarget(1,1),this._texTarget=new J.WebGLRenderTarget,this._quad=new Uf.FullScreenQuad(new J.ShaderMaterial({blending:J.CustomBlending,blendDst:J.ZeroFactor,blendSrc:J.OneFactor,uniforms:{map:{value:null},pixel:{value:new J.Vector2}},vertexShader:`
|
|
3674
3676
|
void main() {
|
|
3675
3677
|
|
|
3676
3678
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
@@ -3685,9 +3687,11 @@ ${c.id}`,u=qb(c),d=r.get(p);d&&(d.node!==l||d.signature!==u)&&(Ch(d),d=void 0),d
|
|
|
3685
3687
|
gl_FragColor = texelFetch( map, pixel, 0 );
|
|
3686
3688
|
|
|
3687
3689
|
}
|
|
3688
|
-
`}))}increaseSizeTo(e){this._target.setSize(Math.max(this._target.width,e),1)}readDataAsync(e){let{_renderer:t,_target:n}=this;return t.readRenderTargetPixelsAsync(n,0,0,e.length/4,1,e)}readData(e){let{_renderer:t,_target:n}=this;t.readRenderTargetPixels(n,0,0,e.length/4,1,e)}renderPixelToTarget(e,t,n){let{_renderer:i,_target:r}=this;fc.min.copy(t),fc.max.copy(t),fc.max.x+=1,fc.max.y+=1,i.initRenderTarget(r),i.copyTextureToTexture(e,r.texture,fc,n,0)}},qo=new class{constructor(){let e=null;Object.getOwnPropertyNames(ky.prototype).forEach(t=>{t!=="constructor"&&(this[t]=(...n)=>(e||(e=new ky),e[t](...n)))})}},Ly=new re.Vector2,Dy=new re.Vector2,Ny=new re.Vector2;function $C(e,t){return t===0?e.getAttribute("uv"):e.getAttribute(`uv${t}`)}function Wy(e,t,n=[,,,]){let i=3*t,r=3*t+1,o=3*t+2;return e.index&&(i=e.index.getX(i),r=e.index.getX(r),o=e.index.getX(o)),n[0]=i,n[1]=r,n[2]=o,n}function Xy(e,t,n,i,r){let[o,a,s]=i,l=$C(e,t);Ly.fromBufferAttribute(l,o),Dy.fromBufferAttribute(l,a),Ny.fromBufferAttribute(l,s),r.set(0,0,0).addScaledVector(Ly,n.x).addScaledVector(Dy,n.y).addScaledVector(Ny,n.z)}function qy(e,t,n,i){let r=e.x-Math.floor(e.x),o=e.y-Math.floor(e.y),a=Math.floor(r*t%t),s=Math.floor(o*n%n);return i.set(a,s),i}var By=new re.Vector2,Oy=new re.Vector2,Iy=new re.Vector2,YC=class extends Iu{constructor(e,t,n=null){super(e,t,n),this.channels=Vn(n,"channels",[0]),this.index=Vn(n,"index",null),this.texCoord=Vn(n,"texCoord",null),this.valueLength=parseInt(this.type.replace(/[^0-9]/g,""))||1}readDataFromBuffer(e,t,n=null){let i=this.type;if(i==="BOOLEAN"||i==="STRING")throw Error("PropertyTextureAccessor: BOOLEAN and STRING types not supported.");return Gy(e,t*this.valueLength,i,n)}},KC=class extends Em{constructor(...e){super(...e),this.isPropertyTextureAccessor=!0,this._asyncRead=!1,this._initProperties(YC)}getData(e,t,n,i={}){let r=this.properties;Bu(r,i);let o=Object.keys(r),a=o.map(s=>i[s]);return this.getPropertyValuesAtTexel(o,e,t,n,a),o.forEach((s,l)=>i[s]=a[l]),i}async getDataAsync(e,t,n,i={}){let r=this.properties;Bu(r,i);let o=Object.keys(r),a=o.map(s=>i[s]);return await this.getPropertyValuesAtTexelAsync(o,e,t,n,a),o.forEach((s,l)=>i[s]=a[l]),i}getPropertyValuesAtTexelAsync(...e){this._asyncRead=!0;let t=this.getPropertyValuesAtTexel(...e);return this._asyncRead=!1,t}getPropertyValuesAtTexel(e,t,n,i,r=[]){for(;r.length<e.length;)r.push(null);r.length=e.length,qo.increaseSizeTo(r.length);let o=this.data,a=this.definition.properties,s=this.properties,l=Wy(i,t);for(let u=0,d=e.length;u<d;u++){let m=e[u];if(!a[m])continue;let g=s[m],v=o[g.index];Xy(i,g.texCoord,n,l,By),qy(By,v.image.width,v.image.height,Oy),Iy.set(u,0),qo.renderPixelToTarget(v,Oy,Iy)}let c=new Uint8Array(e.length*4);if(this._asyncRead)return qo.readDataAsync(c).then(()=>(p.call(this),r));return qo.readData(c),p.call(this),r;function p(){for(let u=0,d=e.length;u<d;u++){let m=e[u],g=s[m],v=g.type;if(r[u]=Am(g,r[u]),!g)throw Error("PropertyTextureAccessor: Requested property does not exist.");if(!a[m]){r[u]=g.resolveDefault(r);continue}let M=g.valueLength*(g.count||1),w=g.channels.map(k=>c[4*u+k]),x=g.componentType,S=new(bc(x,v))(M);if(new Uint8Array(S.buffer).set(w),g.array){let k=r[u];for(let b=0,_=k.length;b<_;b++)k[b]=g.readDataFromBuffer(S,b,k[b])}else r[u]=g.readDataFromBuffer(S,0,r[u]);r[u]=g.adjustValueScaleOffset(r[u]),r[u]=g.resolveEnumsToStrings(r[u]),r[u]=g.resolveNoData(r[u])}}}dispose(){this.data.forEach(e=>{e&&(e.dispose(),e.image instanceof ImageBitmap&&e.image.close())})}},Cm=class{constructor(e,t,n,i=null,r=null){let{schema:o,propertyTables:a=[],propertyTextures:s=[],propertyAttributes:l=[]}=e,{enums:c,classes:p}=o,u=a.map(g=>new qC(g,p,c,n)),d=[],m=[];i&&(i.propertyTextures&&(d=i.propertyTextures.map(g=>new KC(s[g],p,c,t))),i.propertyAttributes&&(m=i.propertyAttributes.map(g=>new WC(l[g],p,c)))),this.schema=o,this.tableAccessors=u,this.textureAccessors=d,this.attributeAccessors=m,this.object=r,this.textures=t,this.nodeMetadata=i}getPropertyTableData(e,t,n=null){if(!Array.isArray(e))n||(n={}),n=this.tableAccessors[e].getData(t,n);else{n||(n=[]);let i=Math.min(e.length,t.length);n.length=i;for(let r=0;r<i;r++){let o=this.tableAccessors[e[r]];n[r]=o.getData(t[r],n[r])}}if(Array.isArray(e)!==Array.isArray(n)||Array.isArray(e)!==Array.isArray(t))throw Error("StructuralMetadata: Scalar and array inputs cannot be mixed.");return n}getPropertyTableInfo(e=null){if(e===null&&(e=this.tableAccessors.map((t,n)=>n)),Array.isArray(e))return e.map(t=>{let n=this.tableAccessors[t];return{name:n.name,className:n.definition.class}});{let t=this.tableAccessors[e];return{name:t.name,className:t.definition.class}}}getPropertyTextureData(e,t,n=[]){let i=this.textureAccessors;n.length=i.length;for(let r=0;r<i.length;r++)n[r]=i[r].getData(e,t,this.object.geometry,n[r]);return n}async getPropertyTextureDataAsync(e,t,n=[]){let i=this.textureAccessors;n.length=i.length;let r=[];for(let o=0;o<i.length;o++){let a=i[o].getDataAsync(e,t,this.object.geometry,n[o]).then(s=>{n[o]=s});r.push(a)}return await Promise.all(r),n}getPropertyTextureInfo(){return this.textureAccessors}getPropertyAttributeData(e,t=[]){let n=this.attributeAccessors;t.length=n.length;for(let i=0;i<n.length;i++)t[i]=n[i].getData(e,this.object.geometry,t[i]);return t}getPropertyAttributeInfo(){return this.attributeAccessors.map(e=>({name:e.name,className:e.definition.class}))}dispose(){this.textureAccessors.forEach(e=>e.dispose()),this.tableAccessors.forEach(e=>e.dispose()),this.attributeAccessors.forEach(e=>e.dispose())}},gc="EXT_structural_metadata";function ZC(e,t=[]){let n=e.json.textures?.length||0,i=Array(n).fill(null);return t.forEach(({properties:r})=>{for(let o in r){let{index:a}=r[o];i[a]===null&&(i[a]=e.loadTexture(a))}}),Promise.all(i)}function JC(e,t=[]){let n=e.json.bufferViews?.length||0,i=Array(n).fill(null);return t.forEach(({properties:r})=>{for(let o in r){let{values:a,arrayOffsets:s,stringOffsets:l}=r[o];i[a]===null&&(i[a]=e.getDependency("bufferView",a)),i[s]===null&&(i[s]=e.getDependency("bufferView",s)),i[l]===null&&(i[l]=e.getDependency("bufferView",l))}}),Promise.all(i)}var $y=class{constructor(e){this.parser=e,this.name=gc}async afterRoot({scene:e,parser:t}){let n=t.json.extensionsUsed;if(!n||!n.includes(gc))return;let i=null,r=t.json.extensions[gc];if(r.schemaUri){let{manager:l,path:c,requestHeader:p,crossOrigin:u}=t.options,d=new URL(r.schemaUri,c).toString(),m=new re.FileLoader(l);m.setCrossOrigin(u),m.setResponseType("json"),m.setRequestHeader(p),i=m.loadAsync(d).then(g=>{r={...r,schema:g}})}let[o,a]=await Promise.all([ZC(t,r.propertyTextures),JC(t,r.propertyTables),i]),s=new Cm(r,o,a);e.userData.structuralMetadata=s,e.traverse(l=>{if(t.associations.has(l)){let{meshes:c,primitives:p}=t.associations.get(l),u=t.json.meshes[c]?.primitives[p];if(u&&u.extensions&&u.extensions[gc]){let d=u.extensions[gc];l.userData.structuralMetadata=new Cm(r,o,a,d,l)}else l.userData.structuralMetadata=s}})}},zy=new re.Vector2,Uy=new re.Vector2,Fy=new re.Vector2;function QC(e){return e.x>e.y&&e.x>e.z?0:e.y>e.z?1:2}var Yy=class{constructor(e,t,n){this.geometry=e,this.textures=t,this.data=n,this._asyncRead=!1,this.featureIds=n.featureIds.map(i=>{let{texture:r,...o}=i,a={label:null,propertyTable:null,nullFeatureId:null,...o};return r&&(a.texture={texCoord:0,channels:[0],...r}),a})}getTextures(){return this.textures}getFeatureInfo(){return this.featureIds}getFeaturesAsync(...e){this._asyncRead=!0;let t=this.getFeatures(...e);return this._asyncRead=!1,t}getFeatures(e,t){let{geometry:n,textures:i,featureIds:r}=this,o=Array(r.length).fill(null),a=r.length;qo.increaseSizeTo(a);let s=Wy(n,e),l=s[QC(t)];for(let u=0,d=r.length;u<d;u++){let m=r[u],g="nullFeatureId"in m?m.nullFeatureId:null;if("texture"in m){let v=i[m.texture.index];Xy(n,m.texture.texCoord,t,s,zy),qy(zy,v.image.width,v.image.height,Uy),Fy.set(u,0),qo.renderPixelToTarget(i[m.texture.index],Uy,Fy)}else if("attribute"in m){let v=n.getAttribute(`_feature_id_${m.attribute}`).getX(l);v!==g&&(o[u]=v)}else{let v=l;v!==g&&(o[u]=v)}}let c=new Uint8Array(a*4);if(this._asyncRead)return qo.readDataAsync(c).then(()=>(p(),o));return qo.readData(c),p(),o;function p(){let u=new Uint32Array(1);for(let d=0,m=r.length;d<m;d++){let g=r[d],v="nullFeatureId"in g?g.nullFeatureId:null;if("texture"in g){let{channels:M}=g.texture,w=M.map(S=>c[4*d+S]);new Uint8Array(u.buffer).set(w);let x=u[0];x!==v&&(o[d]=x)}}}}dispose(){this.textures.forEach(e=>{e&&(e.dispose(),e.image instanceof ImageBitmap&&e.image.close())})}},Ou="EXT_mesh_features";function Vy(e,t,n){e.traverse(i=>{if(t.associations.has(i)){let{meshes:r,primitives:o}=t.associations.get(i),a=t.json.meshes[r]?.primitives[o];a&&a.extensions&&a.extensions[Ou]&&n(i,a.extensions[Ou])}})}var Ky=class{constructor(e){this.parser=e,this.name=Ou}async afterRoot({scene:e,parser:t}){let n=t.json.extensionsUsed;if(!n||!n.includes(Ou))return;let i=t.json.textures?.length||0,r=Array(i).fill(null);Vy(e,t,(a,{featureIds:s})=>{s.forEach(l=>{if(l.texture&&r[l.texture.index]===null){let c=l.texture.index;r[c]=t.loadTexture(c)}})});let o=await Promise.all(r);Vy(e,t,(a,s)=>{a.userData.meshFeatures=new Yy(a.geometry,o,s)})}},Zy=class{constructor(){this.name="CESIUM_RTC"}afterRoot(e){if(e.parser.json.extensions&&e.parser.json.extensions.CESIUM_RTC){let{center:t}=e.parser.json.extensions.CESIUM_RTC;t&&(e.scene.position.x+=t[0],e.scene.position.y+=t[1],e.scene.position.z+=t[2])}}},Rm=class{constructor(e){e={metadata:!0,rtc:!0,plugins:[],dracoLoader:null,ktxLoader:null,meshoptDecoder:null,autoDispose:!0,...e},this.tiles=null,this.metadata=e.metadata,this.rtc=e.rtc,this.plugins=e.plugins,this.dracoLoader=e.dracoLoader,this.ktxLoader=e.ktxLoader,this.meshoptDecoder=e.meshoptDecoder,this._gltfRegex=/\.(gltf|glb)$/g,this._dracoRegex=/\.drc$/g,this._loader=null}init(e){let t=new jy.GLTFLoader(e.manager);this.dracoLoader&&(t.setDRACOLoader(this.dracoLoader),e.manager.addHandler(this._dracoRegex,this.dracoLoader)),this.ktxLoader&&t.setKTX2Loader(this.ktxLoader),this.meshoptDecoder&&t.setMeshoptDecoder(this.meshoptDecoder),this.rtc&&t.register(()=>new Zy),this.metadata&&(t.register(()=>new $y),t.register(()=>new Ky)),this.plugins.forEach(n=>t.register(n)),e.manager.addHandler(this._gltfRegex,t),this.tiles=e,this._loader=t}dispose(){this.tiles.manager.removeHandler(this._gltfRegex),this.tiles.manager.removeHandler(this._dracoRegex),this.autoDispose&&(this.ktxLoader.dispose(),this.dracoLoader.dispose())}};var{clamp:Hk}=re.MathUtils;var Gk=new Tm.FullScreenQuad(new re.MeshBasicMaterial),eT=new re.DataTexture(new Uint8Array([255,255,255,255]),1,1);eT.needsUpdate=!0;var tT=0,nT=1,rT=2,iT=3,oT=4,aT=5,sT=6,lT=7,cT=8,dT=9,uT=10,pT=11,Wk=Object.freeze({NONE:tT,SCREEN_ERROR:nT,GEOMETRIC_ERROR:rT,DISTANCE:iT,DEPTH:oT,RELATIVE_DEPTH:aT,IS_LEAF:sT,RANDOM_COLOR:lT,RANDOM_NODE_COLOR:cT,CUSTOM_COLOR:dT,LOAD_ORDER:uT,INDEXED_COLOR:pT});var Xk=Math.PI/4,qk=3/5;var Xo={NONE:0,NOT_READY:1,NO_FIT:2,DEPTH:3,OCCUPANCY:4,SPACING:5,ANGLE:6,FACING:7};var $k=new class{constructor(){this._cache={}}getColor(...e){let t=e.pop(),n=e.join("_"),{_cache:i}=this;return n in i||(t.setHSL(Math.random(),1,.5),i[n]=t.getHex()),t.set(i[n])}};var Yk={[Xo.NONE]:16777215,[Xo.NOT_READY]:7829367,[Xo.NO_FIT]:2250239,[Xo.DEPTH]:4473924,[Xo.OCCUPANCY]:65535,[Xo.SPACING]:16776960,[Xo.ANGLE]:16711680,[Xo.FACING]:16711935};var Kk=Math.PI/180;var Zk=Oa*Math.PI*2;var Jk=Oa*Math.PI*2;var t0=require("three/examples/jsm/loaders/DRACOLoader.js"),n0=require("three/examples/jsm/loaders/KTX2Loader.js"),r0=require("three/examples/jsm/libs/meshopt_decoder.module.js"),jr=require("three");var yc=require("three");function Jy(e){return!!e&&!e.isInterleavedBufferAttribute}function Qy(e,t,n,i){for(let r=0;r<e.count;r+=1)for(let o=0;o<e.itemSize;o+=1)t.setComponent(r,o,yc.MathUtils.clamp(e.getComponent(r,o),n,i));return t}function hT(e){for(let t=0;t<e.count;t+=1)for(let n=0;n<e.itemSize;n+=1){let i=e.getComponent(t,n);if(!Number.isFinite(i)||i<0||i>1)return!1}return!0}var zu=class{constructor(){this.name="RI_VERTEX_COMPRESSION_PLUGIN";this.priority=-99}processTileModel(t){t.traverse(n=>{let i=n.geometry;if(!i)return;let r=i.attributes.normal;Jy(r)&&!(r.array instanceof Int16Array)&&(i.attributes.normal=Qy(r,new yc.BufferAttribute(new Int16Array(r.count*r.itemSize),r.itemSize,!0),-1,1));for(let o of["uv","uv1","uv2","uv3"]){let a=i.attributes[o];!Jy(a)||a.array instanceof Uint16Array||!hT(a)||(i.attributes[o]=Qy(a,new yc.BufferAttribute(new Uint16Array(a.count*a.itemSize),a.itemSize,!0),0,1))}})}};var wc=require("react/jsx-runtime"),mT=0,e0=4,fT=6,gT=12,bT=4;function vT(e){try{let t=typeof window>"u"?new URL(e):new URL(e,window.location.href);return new URL("objects.json",t).toString()}catch{return null}}function km({url:e,rotation:t=[0,0,0],errorTarget:n=64,cacheSize:i=800,memoryBudgetMB:r=800,decoderConfig:o,objectBindings:a,itemMaterials:s,sceneConfig:l,selectedItem:c,panelHoveredItem:p,highlightOnHover:u=!0,onItemClick:d,onItemHover:m,onItemDoubleClick:g,onItemContextMenu:v,onObjectCatalog:M,onTilesetBounds:w,onModelLoaded:x,onLoadError:S,nodeRefsOut:k,onNodeRefsChange:b,materialRefsOut:_,explodeFactor:y=0,suspendBindingTransforms:h=!1}){let{camera:P,gl:A,invalidate:C}=(0,Uu.useThree)(),D=(0,$e.useRef)(null),[B,j]=(0,$e.useState)(null),W=(0,$e.useRef)({onItemClick:d,onItemHover:m,onItemDoubleClick:g,onObjectCatalog:M,onTilesetBounds:w,onModelLoaded:x,onLoadError:S,onNodeRefsChange:b});W.current={onItemClick:d,onItemHover:m,onItemDoubleClick:g,onObjectCatalog:M,onTilesetBounds:w,onModelLoaded:x,onLoadError:S,onNodeRefsChange:b};let U=(0,$e.useRef)(!0),[te,O]=(0,$e.useState)(null),$=(0,$e.useRef)(null);$.current=te;let le=(0,$e.useRef)([]),tt=(0,$e.useRef)(!1);(0,$e.useEffect)(()=>{let oe=new mu;return O(oe),()=>oe.dispose()},[e]);let xe=(0,$e.useRef)(null),nt=(0,$e.useRef)(0),ce=(0,$e.useRef)(!1),Le=r*1024*1024,he=(0,$e.useRef)(!1),pt=(0,$e.useRef)(Jh),Bt=(0,$e.useRef)(null),un=(0,$e.useRef)(null),Ie=(0,$e.useRef)(null);(0,$e.useEffect)(()=>()=>{Ie.current!==null&&clearTimeout(Ie.current)},[]);let bt=o?.dracoDecoderPath??jh,Ot=o?.ktx2TranscoderPath??Hh,dr=o?.meshopt??!0,[de,Cr]=(0,$e.useState)(null);(0,$e.useEffect)(()=>{ce.current=!1,he.current=!1;let oe=new _m(e);oe.loadAncestors=!0;let ye=new yu;ye.priorityCallback=oe.downloadQueue.priorityCallback,ye.maxJobsPerOrigin=gT;let Ae=new Yi;Ae.priorityCallback=oe.parseQueue.priorityCallback,Ae.maxJobs=fT;let ct=new Yi;ct.priorityCallback=oe.processNodeQueue.priorityCallback,ct.maxJobs=oe.processNodeQueue.maxJobs;let ht=new ic;ht.unloadPriorityCallback=oe.lruCache.unloadPriorityCallback,oe.downloadQueue=ye,oe.parseQueue=Ae,oe.processNodeQueue=ct,oe.lruCache=ht;let Ke=bt?new t0.DRACOLoader().setDecoderPath(bt).setWorkerLimit(bT):null,wt=Ot?new n0.KTX2Loader().setTranscoderPath(Ot).detectSupport(A):null;return oe.registerPlugin(new Rm({dracoLoader:Ke,ktxLoader:wt,meshoptDecoder:dr?r0.MeshoptDecoder:null,autoDispose:!1})),oe.registerPlugin(new Pm({disableMipmaps:!1,compressIndex:!0,compressNormals:!1,compressUvs:!1,compressPosition:!0})),oe.registerPlugin(new zu),Cr(oe),window.__riTiles=oe,()=>{oe.forEachLoadedModel(_e=>Nl(_e)),oe.dispose(),Ke?.dispose(),wt?.dispose(),Cr(_e=>_e===oe?null:_e)}},[bt,A,Ot,dr,e]),(0,$e.useEffect)(()=>{de&&(pt.current=Jh,Bt.current=null,de.errorTarget=n,de.lruCache.maxSize=i,de.lruCache.minSize=Math.max(1,Math.floor(i*.75)),de.lruCache.maxBytesSize=Le,de.lruCache.minBytesSize=Le*.75,C())},[i,n,C,Le,de]);let Xt=(0,$e.useMemo)(()=>{let oe=a??{};return{objectBindings:oe,keyByModelObject:Ix(oe),itemMaterials:s,shadingMode:l?.model.shading??"lit",rendererMode:l?.model.renderer??"pbr",selectedKey:c??null,hoveredKey:zx(B,p),highlightOnHover:u,suspendTransforms:h,placementFrame:de?.group.matrixWorld,invalidate:C}},[B,u,C,s,a,p,l,c,h,de]),Et=(0,$e.useCallback)(()=>{if(!de)return;let oe=Tn.current,ye=tt.current?$.current?.nodesByBinding(oe)??{}:{},Ae={};de.group.traverse(wt=>{if(!wt.isMesh)return;let _e=Kh(wt);if(!_e)return;let qe=oe.keyByModelObject[_e]??_e;if(!oe.objectBindings[qe])return;ye[qe]||(ye[qe]=wt);let dt=wt.material;dt&&(Ae[qe]=dt)});let ct=k?.current??{},ht=Object.keys(ct),Ke=ht.length!==Object.keys(ye).length||ht.some(wt=>ct[wt]!==ye[wt]);k&&(k.current=ye),_&&(_.current=Ae),(Ke||!k)&&W.current.onNodeRefsChange?.()},[_,k,de]),rt=(0,$e.useCallback)(oe=>pu(oe,Xt),[Xt]),bn=(0,$e.useCallback)(oe=>Fx(oe,Xt),[Xt]),Tr=(0,$e.useRef)(bn);Tr.current=bn;let Tn=(0,$e.useRef)(Xt);Tn.current=Xt;let Kt=(0,$e.useCallback)(()=>{let oe=xe.current,ye=nt.current;return!oe||ye<=0?Tn.current:{...Tn.current,explode:{factor:ye,centre:oe.centre,radius:oe.radius}}},[]);(0,$e.useEffect)(()=>{de&&(bn(de.group),U.current=!0,de.forEachLoadedModel(oe=>{bn(oe),js(oe,Kt())}),C())},[bn,C,Kt,de]),(0,$e.useEffect)(()=>{let oe=vT(e);if(!oe)return;let ye=!1;return fetch(oe).then(Ae=>Ae.ok?Ae.json():null).then(Ae=>{ye||!Ae?.objects||(le.current=Ae.objects,tt.current=Ae.bindingFrame==="gltf-identity-v2",tt.current&&$.current?.setCatalog(Ae.objects),U.current=!0,W.current.onObjectCatalog?.(Ae.objects),C())}).catch(()=>{}),()=>{ye=!0}},[e,C,te]),(0,$e.useEffect)(()=>{if(!de)return;let oe=!1,ye=()=>C(),Ae=_e=>{_e.scene&&(_e.scene.traverse(qe=>{let dt=qe.material;for(let pn of Array.isArray(dt)?dt:dt?[dt]:[])pn.transparent&&pn.side===jr.DoubleSide&&(pn.forceSinglePass=!0)}),Tr.current(_e.scene),js(_e.scene,Kt()),bd(_e.scene)),U.current=!0,oe||(oe=!0,W.current.onModelLoaded?.(de.group)),C()},ct=_e=>{W.current.onLoadError?.(_e.error)},ht=_e=>{_e.scene&&(Zh(_e.scene),Nl(_e.scene)),U.current=!0};de.setCamera(P),de.setResolutionFromRenderer(P,A),de.addEventListener("needs-update",ye),de.addEventListener("load-model",Ae),de.addEventListener("load-error",ct),de.addEventListener("dispose-model",ht);let Ke=()=>{U.current=!0,C()};de.addEventListener("tile-visibility-change",Ke);let wt=()=>{let _e=de.root;_e&&!_e.content?.uri&&_e.refine==="REPLACE"&&(_e.refine="ADD",C())};return de.addEventListener("load-root-tileset",wt),C(),()=>{de.removeEventListener("needs-update",ye),de.removeEventListener("load-model",Ae),de.removeEventListener("load-error",ct),de.removeEventListener("dispose-model",ht),de.removeEventListener("tile-visibility-change",Ke),de.removeEventListener("load-root-tileset",wt),Zh(de.group),de.deleteCamera(P),k&&(k.current={}),_&&(_.current={})}},[P,A,C,_,k,Kt,de]);let fe=Bd(oe=>rt(oe)?.binding??null,v),We=(0,$e.useCallback)(oe=>{if(fe.consumeClick())return;let ye=rt(oe.object);ye&&(oe.stopPropagation(),W.current.onItemClick?.(ye.binding))},[rt,fe,d]),xn=(0,$e.useCallback)(oe=>{let ye=rt(oe.object);if(!ye)return;W.current.onItemDoubleClick?.(ye.binding,Bs(oe))&&oe.stopPropagation()},[rt]),It=(0,$e.useCallback)(oe=>{let ye=rt(oe.object),Ae=ye?.key??null;Ae!==D.current&&(D.current=Ae,j(Ae),W.current.onItemHover?.(ye?.binding??null))},[rt]),zt=(0,$e.useCallback)(()=>{D.current!==null&&(D.current=null,j(null),W.current.onItemHover?.(null))},[]);return(0,$e.useEffect)(()=>{C()},[C,de]),(0,Uu.useFrame)((oe,ye)=>{if(!de)return;if(de.setResolutionFromRenderer(P,A),tt.current&&te){let tn=te.sync(Kt(),c,h);te.updateBounds(de.root),h&&de.forEachLoadedModel(Pr=>js(Pr,tn))}if(de.update(),!ce.current){let tn=new jr.Box3;if(de.getBoundingBox(tn)){ce.current=!0,de.group.updateMatrixWorld(),tn.applyMatrix4(de.group.matrixWorld);let Pr=tn.getBoundingSphere(new jr.Sphere);xe.current={centre:Pr.center.clone(),radius:tn.getSize(new jr.Vector3).length()*.5},W.current.onTilesetBounds?.(tn),C()}}U.current&&(U.current=!1,Et());let Ae=Math.min(Math.max(y,0),1),ct=nt.current;Math.abs(ct-Ae)>1e-4?(nt.current=jr.MathUtils.lerp(ct,Ae,1-Math.exp(-6*ye)),js(de.group,Kt()),C()):ct!==Ae&&(nt.current=Ae,js(de.group,Kt()),C());let ht=de,Ke=de.lruCache,wt=Ke.isFull(),_e=pt.current,qe=_e.loosened&&Bt.current?Bt.current:{bytes:Ke.maxBytesSize,items:Ke.maxSize},dt=0;for(let tn of Ke.usedSet??[])dt+=Ke.bytesMap?.get(tn)??0;let pn=!1,ur=de;for(let tn of ur.usedSet??[]){let Pr=tn.internal?.loadingState??e0;if(tn.traversal?.used&&tn.internal?.hasContent&&Pr>=mT&&Pr<e0){pn=!0;break}}let en=un.current??(un.current={world:new jr.Matrix4,projection:new jr.Matrix4}),Hn=!en.world.equals(P.matrixWorld)||!en.projection.equals(P.projectionMatrix);Hn&&(en.world.copy(P.matrixWorld),en.projection.copy(P.projectionMatrix));let Xr={full:wt,wanting:pn,moved:Hn,usage:Math.max(dt/Math.max(1,qe.bytes),(Ke.usedSet?.size??0)/Math.max(1,qe.items)),now:performance.now()},pr=Yx(_e,Xr);pr!==_e&&(pr.loosened&&(!_e.loosened||pr.raisedAt!==_e.raisedAt)?(_e.loosened||(Bt.current=qe),Ke.maxBytesSize=Math.max(qe.bytes,Ke.cachedBytes??0)*Qh,Ke.maxSize=Math.ceil(Math.max(qe.items,Ke.itemSet?.size??0)*Qh)):!pr.loosened&&_e.loosened&&Bt.current&&(Ke.maxBytesSize=Bt.current.bytes,Ke.maxSize=Bt.current.items,Bt.current=null),pt.current=pr,de.errorTarget=n*pr.factor,C()),!he.current&&wt&&Xr.wanting&&pr.factor>=ec&&(he.current=!0,console.warn("[react-immersive] The tile memory budget is full even at the coarsest level of detail, so the model may render incompletely. This usually means the model's textures are too large for streaming \u2014 re-process it with a smaller MAX_TEXTURE_SIZE, or raise memoryBudgetMB."));let to=Kx(pr,Xr);to===0?C():to!==null&&Ie.current===null&&(Ie.current=setTimeout(()=>{Ie.current=null,C()},to)),((ht.stats?.downloading??0)>0||(ht.stats?.parsing??0)>0||ht.loadProgress!==void 0&&ht.loadProgress<1&&!wt)&&C()}),de?(0,wc.jsxs)("group",{rotation:t,children:[te?(0,wc.jsx)("primitive",{object:te.group}):null,(0,wc.jsx)("primitive",{object:de.group,onClick:We,onDoubleClick:xn,onPointerDown:v?fe.onPointerDown:void 0,onPointerMove:It,onPointerOut:zt})]}):null}var Fu=require("three");var xT=new Fu.Matrix4().makeRotationX(Math.PI/2);function i0(e){e.updateMatrixWorld(!0);let t=new Fu.Matrix4().copy(e.matrixWorld).invert().premultiply(xT),n=new Fu.Matrix4,i=[];for(let[r,o]of Object.entries(Fo(e).nodesById)){let a=o;if(!a.isMesh||!a.geometry||!o.name)continue;let s=a.geometry;s.boundingBox||s.computeBoundingBox();let l=s.boundingBox.clone().applyMatrix4(n.multiplyMatrices(t,o.matrixWorld)),c=s.index?s.index.count:s.getAttribute("position")?.count??0;i.push({name:r,triangles:Math.floor(c/3),minimum:l.min.toArray(),maximum:l.max.toArray()})}return i.sort((r,o)=>r.name.localeCompare(o.name))}var ot=require("react"),Lm=require("@react-three/drei"),za=require("@react-three/fiber"),Zi=require("three");var Qn=require("react/jsx-runtime"),yT=.02;function o0(e,t){let n=(0,ot.useRef)(null),i=(0,za.useThree)(c=>c.scene),r=(0,ot.useRef)(null),o=(0,ot.useMemo)(()=>new Zi.Vector3(...e.anchorLocalPosition??e.localPosition??e.worldPosition),[e.anchorLocalPosition,e.localPosition,e.worldPosition]),a=(0,ot.useMemo)(()=>new Zi.Vector3,[]),s=(0,ot.useMemo)(()=>new Zi.Vector3,[]),l=(0,ot.useMemo)(()=>new Zi.Vector3,[]);return(0,ot.useEffect)(()=>{r.current=null},[e.anchorNodeName]),(0,za.useFrame)(({camera:c})=>{let p=n.current,u=p?.parent;if(!p||!u)return;let d=r.current;if(e.anchorNodeName&&(!d||!d.parent)&&(d=Xi(i,e.anchorNodeName),r.current=d),d?(d.updateWorldMatrix(!0,!1),a.copy(o).applyMatrix4(d.matrixWorld)):(a.copy(o),u.localToWorld(a)),t){let m=t.current.get(e.id);m||(m=new Zi.Vector3,t.current.set(e.id,m)),m.copy(a)}l.copy(c.position).sub(a),l.lengthSq()>0?(l.normalize(),s.copy(a).addScaledVector(l,yT)):s.copy(a),u.worldToLocal(s),p.position.copy(s)}),n}function wT({annotation:e,occluders:t,worldPositionsRef:n,onClick:i,onHover:r,showAnnotationOnHover:o}){let[a,s]=(0,ot.useState)(!1),l=o0(e,n),[c,p]=(0,ot.useState)(!1),[u,d]=(0,ot.useState)(1),m=(0,ot.useRef)(null),g=(0,ot.useRef)(null),v=(0,ot.useRef)(null);(0,ot.useEffect)(()=>()=>{m.current&&(clearTimeout(m.current),m.current=null),v.current&&(clearTimeout(v.current),v.current=null)},[]);let M=b=>{b.stopPropagation(),b.preventDefault(),m.current&&(clearTimeout(m.current),m.current=null),m.current=window.setTimeout(()=>{i?.(e),m.current=null},10)},w=b=>{b.stopPropagation(),p(!0),d(100),v.current&&(clearTimeout(v.current),v.current=null),r?.(e),o&&i?.(e)},x=b=>{b.stopPropagation(),p(!1),d(1),v.current&&clearTimeout(v.current),v.current=window.setTimeout(()=>{r?.(null),o&&r?.(null),v.current=null},50)},S=b=>{b.stopPropagation();let _=b.currentTarget;_.dataset.pointerX=String(b.clientX),_.dataset.pointerY=String(b.clientY)},k=b=>{b.stopPropagation();let _=b.currentTarget,y=parseFloat(_.dataset.pointerX||"0"),h=parseFloat(_.dataset.pointerY||"0"),P=b.clientX-y,A=b.clientY-h;Math.sqrt(P*P+A*A)<10&&M(b)};return(0,Qn.jsx)("group",{ref:l,children:(0,Qn.jsx)(Lm.Html,{center:!0,occlude:t,onOcclude:s,pointerEvents:a?"none":"auto",zIndexRange:[1,200],style:{pointerEvents:a?"none":"auto",zIndex:u},className:"annotation-html-wrapper",transparent:!0,children:(0,Qn.jsx)("div",{ref:g,className:`ri-annotationMarker ${c?"ri-annotationMarker--hovered":""}`,title:e.title,style:{display:a?"none":"flex"},onPointerDown:S,onPointerUp:k,onPointerEnter:w,onPointerLeave:x,onDoubleClick:b=>{b.stopPropagation(),i?.(e)},role:"button",tabIndex:0,"aria-label":`Annotation ${e.id}`,children:(0,Qn.jsx)("span",{className:"ri-annotationMarker-id",children:e.id})})})})}function ST({annotation:e,occluders:t,popupRef:n,onClose:i,hideCloseButton:r=!1}){let[o,a]=(0,ot.useState)(!1),s=o0(e),l=(0,Qn.jsxs)("div",{ref:n,className:"ri-viewAnnotationPopup",style:{display:o?"none":"block"},onPointerDown:c=>c.stopPropagation(),onClick:c=>c.stopPropagation(),children:[(0,Qn.jsxs)("div",{className:"ri-viewAnnotationHeader",children:[(0,Qn.jsx)("h4",{className:"ri-viewAnnotationTitle",children:e.title}),!r&&(0,Qn.jsx)("button",{onClick:c=>{c.stopPropagation(),i?.()},className:"ri-viewAnnotationClose","aria-label":"Close annotation",children:"\xD7"})]}),e.description&&(0,Qn.jsx)("p",{className:"ri-viewAnnotationDescription",children:e.description})]});return(0,Qn.jsx)("group",{ref:s,children:(0,Qn.jsx)(Lm.Html,{occlude:t,onOcclude:a,pointerEvents:o?"none":"auto",zIndexRange:[1e3,2e3],style:{pointerEvents:o?"none":"auto",zIndex:1e3},transparent:!0,children:l})})}function Dm({annotations:e,sceneConfig:t,activeAnnotation:n,popupRef:i,canvasRootRef:r,worldPositionsRef:o,modelLoaded:a,onAnnotationClick:s,onAnnotationHover:l,onCloseAnnotation:c,hideCloseButton:p=!1,showAnnotationOnHover:u=!1}){let d=(0,za.useThree)(W=>W.invalidate),m=(0,za.useThree)(W=>W.scene),[g,v]=(0,ot.useState)(null),[M,w]=(0,ot.useState)(!1),x=(0,ot.useRef)(null),S=(0,ot.useRef)(null),k=(0,ot.useRef)(null),b=(0,ot.useMemo)(()=>{let W=[];return m.traverse(U=>{let te=U;te.isMesh&&!te.isSkinnedMesh&&W.push({current:U})}),W},[m,e,a]),_=(0,ot.useCallback)(()=>{d();let W=()=>{d(),S.current=window.requestAnimationFrame(()=>{d(),S.current=null})};S.current=window.requestAnimationFrame(W)},[d]);(0,ot.useEffect)(()=>{_()},[e,_]),(0,ot.useEffect)(()=>{_()},[n,_]),(0,ot.useEffect)(()=>()=>{S.current!==null&&window.cancelAnimationFrame(S.current),k.current&&clearTimeout(k.current)},[]);let y=M?g:n||g,h=(0,ot.useMemo)(()=>y?e.find(W=>W.id===y.id)??y:null,[y,e]),P=(0,ot.useCallback)(W=>{if(M&&g?.id===W.id){w(!1),v(null),c?.();return}w(!0),v(W),s?.(W)},[M,g,s,c]),A=(0,ot.useCallback)(W=>{l?.(W),u&&!M&&(k.current&&(clearTimeout(k.current),k.current=null),W?v(W):k.current=window.setTimeout(()=>{v(null),c?.(),k.current=null},100))},[M,l,u,c]),C=(0,ot.useCallback)(()=>{w(!1),v(null),c?.()},[c]),D=(0,ot.useCallback)(W=>{let U=W.target;if(U.closest?.(".ri-annotationMarker")||U.closest?.(".ri-viewAnnotationPopup")||U.closest?.(".annotation-html-wrapper"))return;let te=r.current;te&&te.contains(U)&&(w(!1),v(null),c?.())},[r,c]),B=(0,ot.useCallback)(W=>{W.key==="Escape"&&M&&(w(!1),v(null),c?.())},[M,c]);(0,ot.useEffect)(()=>{let W=r.current;return W&&(W.addEventListener("click",D),W.addEventListener("pointerdown",D)),document.addEventListener("keydown",B),()=>{W&&(W.removeEventListener("click",D),W.removeEventListener("pointerdown",D)),document.removeEventListener("keydown",B)}},[r,D,B]);let j=(0,ot.useMemo)(()=>(t?.model.rotation??[0,0,0]).map(W=>W*Math.PI/180),[t?.model.rotation]);return(0,ot.useEffect)(()=>{d()},[d,j]),(0,za.useFrame)((W,U)=>{if(!x.current)return;x.current.rotation.x=Zi.MathUtils.lerp(x.current.rotation.x,j[0],1-Math.exp(-5*U)),x.current.rotation.y=Zi.MathUtils.lerp(x.current.rotation.y,j[1],1-Math.exp(-5*U)),x.current.rotation.z=Zi.MathUtils.lerp(x.current.rotation.z,j[2],1-Math.exp(-5*U));let{rotation:te}=x.current;Math.abs(te.x-j[0])+Math.abs(te.y-j[1])+Math.abs(te.z-j[2])>1e-4&&d()}),(0,Qn.jsxs)("group",{ref:x,children:[e.map(W=>{let U=`${W.worldPosition.join(",")}-${W.title}-${W.id}`;return(0,Qn.jsx)(wT,{annotation:W,occluders:b,worldPositionsRef:o,onClick:P,onHover:A,showAnnotationOnHover:u},U)}),h?(0,Qn.jsx)(ST,{annotation:h,occluders:b,popupRef:i,onClose:C,hideCloseButton:p},`popup-${h.id}`):null]})}var xo=require("react"),Li=require("@react-three/drei"),_n=require("three");var Ge=require("react/jsx-runtime"),Ua="#22d3ee",_T="#facc15";function $s(e,t){let n=e<10?e.toFixed(3):e.toFixed(2);return t?`${n} ${t}`:n}function a0(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2,(e[2]+t[2])/2]}function $o({position:e,children:t}){return(0,Ge.jsx)(Li.Html,{center:!0,position:e,zIndexRange:[20,0],style:{pointerEvents:"none"},children:(0,Ge.jsx)("div",{className:"ri-measureLabel",children:t})})}function s0({positions:e,triangles:t}){let n=(0,xo.useMemo)(()=>{let i=new _n.Vector3(...e[0]),r=new _n.BufferGeometry;return r.setAttribute("position",new _n.Float32BufferAttribute(e.flatMap(o=>new _n.Vector3(...o).sub(i).toArray()),3)),r.setIndex(t.flat()),r},[e,t]);return(0,xo.useEffect)(()=>()=>n.dispose(),[n]),(0,Ge.jsx)("mesh",{position:e[0],geometry:n,raycast:()=>{},renderOrder:100,children:(0,Ge.jsx)("meshBasicMaterial",{color:Ua,side:_n.DoubleSide,transparent:!0,opacity:.18,depthWrite:!1})})}var MT=[[0,1,2]];function CT({positions:e}){let t=jd(e);if(t===null)return null;let n=new _n.Vector3(...e[1]),i=new _n.Vector3(...e[0]).sub(n),r=new _n.Vector3(...e[2]).sub(n),o=Math.min(i.length(),r.length())*.22;i.normalize(),r.normalize();let a=i.clone().cross(r);a.lengthSq()<1e-12&&a.copy(i).cross(Math.abs(i.y)<.9?new _n.Vector3(0,1,0):new _n.Vector3(1,0,0)),a.normalize();let s=t*Math.PI/180,l=Array.from({length:33},(p,u)=>i.clone().applyAxisAngle(a,s*u/32).multiplyScalar(o).add(n).toArray()),c=i.clone().applyAxisAngle(a,s/2).multiplyScalar(o*1.4).add(n).toArray();return(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(Li.Line,{points:l,color:Ua,lineWidth:2}),(0,Ge.jsxs)($o,{position:c,children:[t.toFixed(2),"\xB0"]})]})}function TT({box:e,unit:t}){let n=(0,xo.useMemo)(()=>[(e.min[0]+e.max[0])/2,(e.min[1]+e.max[1])/2,(e.min[2]+e.max[2])/2],[e.min,e.max]),i=(0,xo.useMemo)(()=>{let[s,l,c]=e.size,p=new _n.BoxGeometry(s||1e-4,l||1e-4,c||1e-4),u=new _n.EdgesGeometry(p);return p.dispose(),u},[e.size]);(0,xo.useEffect)(()=>()=>{i.dispose()},[i]);let[r,o,a]=e.size;return(0,Ge.jsxs)("group",{position:n,children:[(0,Ge.jsx)("lineSegments",{geometry:i,children:(0,Ge.jsx)("lineBasicMaterial",{color:_T})}),(0,Ge.jsxs)($o,{position:[0,-o/2,a/2],children:["W ",$s(r,t)]}),(0,Ge.jsxs)($o,{position:[-r/2,0,a/2],children:["H ",$s(o,t)]}),(0,Ge.jsxs)($o,{position:[r/2,-o/2,0],children:["D ",$s(a,t)]})]})}function Nm({points:e,unit:t,box:n,showDimensions:i,tool:r="distance",areaClosed:o=!1,snapPreview:a}){let s=(0,xo.useMemo)(()=>e.map(p=>p.position),[e]),l=(0,xo.useMemo)(()=>r==="area"&&o?Hd(s):null,[r,o,s]),c=r==="pointToPlane"&&e.length===2?Av(e[0],e[1].position):null;return(0,Ge.jsxs)("group",{children:[e.map(p=>(0,Ge.jsx)(Li.Html,{center:!0,position:p.position,zIndexRange:[15,0],style:{pointerEvents:"none"},children:(0,Ge.jsx)("div",{className:`ri-measureDot${p.snapped?" ri-measureDot--snapped":""}`})},p.id)),r==="distance"&&e.slice(1).map((p,u)=>{let d=e[u].position,m=p.position,g=new _n.Vector3(...d).distanceTo(new _n.Vector3(...m));return(0,Ge.jsxs)("group",{children:[(0,Ge.jsx)(Li.Line,{points:[d,m],color:Ua,lineWidth:2}),(0,Ge.jsx)($o,{position:a0(d,m),children:$s(g,t)})]},`${e[u].id}-${p.id}`)}),(r==="angle"||r==="area")&&s.length>=2&&(0,Ge.jsx)(Li.Line,{points:o?[...s,s[0]]:s,color:Ua,lineWidth:2}),r==="angle"&&(0,Ge.jsx)(CT,{positions:s}),l&&!("error"in l)&&(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(s0,{positions:s,triangles:l.triangles}),(0,Ge.jsx)($o,{position:l.center,children:$s(l.area,t?`${t}\xB2`:"")})]}),r==="pointToPlane"&&e[0]?.faceVertices&&(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(s0,{positions:e[0].faceVertices,triangles:MT}),(0,Ge.jsx)(Li.Line,{points:[...e[0].faceVertices,e[0].faceVertices[0]],color:Ua,lineWidth:1}),e.length===1&&(0,Ge.jsx)($o,{position:e[0].position,children:"Reference plane"})]}),c&&(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(Li.Line,{points:[e[1].position,c.projection],color:Ua,lineWidth:2}),(0,Ge.jsx)(Li.Line,{points:[e[0].position,c.projection],color:Ua,lineWidth:1,dashed:!0}),(0,Ge.jsx)($o,{position:a0(e[1].position,c.projection),children:$s(c.distance,t)})]}),a&&(0,Ge.jsxs)(Li.Html,{center:!0,position:a.position,zIndexRange:[20,0],style:{pointerEvents:"none"},children:[(0,Ge.jsx)("div",{className:"ri-measureSnapTarget"}),(0,Ge.jsx)("div",{className:"ri-measureSnapLabel",children:a.snapped==="vertex"?"Vertex":"Edge"})]}),i&&n?(0,Ge.jsx)(TT,{box:n,unit:t}):null]})}var Yo=require("lucide-react"),Vu=require("react"),Ut=require("react/jsx-runtime");function Bm(e){let t=(0,Vu.useRef)(null);(0,Vu.useLayoutEffect)(()=>{if(!t.current)return;let a=()=>e.onHeight(t.current?.getBoundingClientRect().height??34),s=new ResizeObserver(a);return s.observe(t.current),a(),()=>s.disconnect()},[e.onHeight]);let{tool:n,pointCount:i,areaClosed:r}=e,o=n==="angle"?["Pick the first arm","Pick the angle's vertex","Pick the second arm","Pick a point to start a new angle"][i]:n==="area"?r?"Pick a point to start a new area":"Pick polygon corners in order, then Finish area":n==="pointToPlane"?["Pick the reference face","Pick a point to measure its perpendicular distance","Pick a face to start a new measurement"][i]:"Pick points on the model to measure distances";return(0,Ut.jsxs)("div",{ref:t,className:"ri-measureTools",style:{top:e.top},children:[(0,Ut.jsxs)("div",{className:"ri-measureToolbarRow",children:[(0,Ut.jsx)("button",{type:"button",className:`ri-measureButton ${e.active?"ri-measureButton--active":""}`,disabled:e.disabled,onClick:e.onToggle,title:e.active?"Stop measuring":"Start measuring","aria-pressed":e.active,children:(0,Ut.jsx)(Yo.PencilRuler,{size:16})}),(0,Ut.jsx)("button",{type:"button",className:`ri-measureButton ${e.showDimensions?"ri-measureButton--active":""}`,disabled:e.disabled,onClick:e.onDimensions,title:"Toggle bounding dimensions","aria-pressed":e.showDimensions,children:(0,Ut.jsx)(Yo.RulerDimensionLine,{size:16})}),e.active&&(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsxs)("select",{className:"ri-measureSelect","aria-label":"Measurement tool",value:n,disabled:e.disabled,onChange:a=>e.onTool(a.target.value),children:[(0,Ut.jsx)("option",{value:"distance",children:"Distance"}),(0,Ut.jsx)("option",{value:"angle",children:"Angle"}),(0,Ut.jsx)("option",{value:"area",children:"Area"}),(0,Ut.jsx)("option",{value:"pointToPlane",children:"Point to plane"})]}),(0,Ut.jsxs)("select",{className:"ri-measureSelect","aria-label":"Measurement snapping",value:e.snap,disabled:e.disabled,onChange:a=>e.onSnap(a.target.value),children:[(0,Ut.jsx)("option",{value:"none",children:"No snapping"}),(0,Ut.jsx)("option",{value:"auto",children:"Snap: auto"}),(0,Ut.jsx)("option",{value:"vertex",children:"Snap: vertex"}),(0,Ut.jsx)("option",{value:"edge",children:"Snap: edge"})]})]}),i>0&&(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsx)("button",{type:"button",className:"ri-measureButton",onClick:e.onUndo,disabled:e.disabled,title:"Undo measurement point",children:(0,Ut.jsx)(Yo.Undo2,{size:16})}),(0,Ut.jsx)("button",{type:"button",className:"ri-measureButton",onClick:e.onClear,disabled:e.disabled,title:"Clear measurements",children:(0,Ut.jsx)(Yo.Eraser,{size:16})})]}),e.active&&n==="area"&&!r&&(0,Ut.jsx)("button",{type:"button",className:"ri-measureFinish",onClick:e.onFinishArea,disabled:e.disabled||i<3,children:"Finish area"})]}),e.active&&(0,Ut.jsx)("div",{className:`ri-measureHint${e.error?" ri-measureHint--error":""}`,role:"status",children:e.error??o})]})}var Mt=require("react"),Fa=require("@react-three/xr"),u0=require("@react-three/fiber"),Sc=require("three"),Di=require("react/jsx-runtime"),PT=1,l0=1,AT=.1,ET=10;function RT(e,t){let[n,i,r]=e.size,o=(e.min[0]+e.max[0])/2,a=(e.min[2]+e.max[2])/2,s=Math.max(n,i,r)||1;return{scale:t==="real-world"?1:PT/s,offset:[-o,-e.min[1],-a]}}function c0(e){let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.hypot(t,n)}function d0(e){let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.atan2(n,t)}var kT=(0,Mt.forwardRef)(function({box:t,scaleMode:n,children:i,onARStateChange:r},o){let a=(0,Mt.useRef)(null),s=(0,Mt.useRef)(null),l=(0,Mt.useRef)(null),c=(0,Fa.useXR)(U=>U.session!=null),p=(0,Fa.useXR)(U=>U.mode==="immersive-ar"),u=(0,Mt.useMemo)(()=>t?RT(t,n):null,[t,n]),d=(0,Mt.useRef)(new Sc.Vector3(0,0,-l0)),m=(0,Mt.useRef)(1),g=(0,Mt.useRef)(0),v=(0,Mt.useRef)(!0),M=(0,Mt.useRef)(!1),w=(0,Mt.useMemo)(()=>new Sc.Matrix4,[]),x=(0,Mt.useRef)(new Sc.Vector3),S=(0,Mt.useRef)(!1),k=(0,Mt.useRef)(null),b=(0,Mt.useRef)(!1),_=(0,Mt.useRef)(0),y=(0,Mt.useRef)(0),h=(0,Mt.useRef)(1),P=(0,Mt.useRef)(0),A=(0,Mt.useCallback)(()=>{if(!r||!p)return;let U={canPlace:S.current,isPlacementMode:v.current,isModelPlaced:M.current},te=k.current;te&&te.canPlace===U.canPlace&&te.isPlacementMode===U.isPlacementMode&&te.isModelPlaced===U.isModelPlaced||(k.current=U,r(U))},[p,r]),C=(0,Mt.useCallback)(()=>!p||!S.current?!1:(d.current.copy(x.current),M.current=!0,v.current=!1,A(),!0),[A,p]),D=(0,Mt.useCallback)(()=>{p&&(v.current=!0,A())},[A,p]),B=(0,Mt.useCallback)(()=>{let U=C();return!U&&p&&(v.current=!1,A()),U},[A,p,C]),j=(0,Mt.useCallback)(()=>{p&&(v.current=!1,A())},[A,p]);(0,Mt.useImperativeHandle)(o,()=>({placeCurrent:C,startPlacementMode:D,finishPlacementMode:B,cancelPlacementMode:j}),[j,B,C,D]),(0,Mt.useEffect)(()=>{if(!c){d.current.set(0,0,-l0),m.current=1,g.current=0,S.current=!1,b.current=!1,v.current=!0,M.current=!1,k.current=null;return}p&&(S.current=!1,b.current=!1,v.current=!0,M.current=!1,k.current=null,A())},[A,c,p]),(0,Fa.useXRHitTest)((U,te)=>{if(!p||U.length===0){S.current&&(S.current=!1,A());return}te(w,U[0])&&(x.current.setFromMatrixPosition(w),S.current||(S.current=!0,A()))},"viewer"),(0,Fa.useXRInputSourceEvent)("all","select",()=>{!p||b.current||!v.current||C()},[p,C]),(0,Mt.useEffect)(()=>{if(!p)return;let U=$=>{$.touches.length===2&&(b.current=!0,_.current=c0($.touches),y.current=d0($.touches),h.current=m.current,P.current=g.current)},te=$=>{if(!b.current||$.touches.length!==2)return;$.preventDefault();let le=c0($.touches);if(_.current>0){let xe=le/_.current;m.current=Math.min(ET,Math.max(AT,h.current*xe))}let tt=d0($.touches);g.current=P.current-(tt-y.current)},O=$=>{$.touches.length===0&&requestAnimationFrame(()=>{b.current=!1})};return window.addEventListener("touchstart",U),window.addEventListener("touchmove",te,{passive:!1}),window.addEventListener("touchend",O),window.addEventListener("touchcancel",O),()=>{window.removeEventListener("touchstart",U),window.removeEventListener("touchmove",te),window.removeEventListener("touchend",O),window.removeEventListener("touchcancel",O)}},[p]),(0,u0.useFrame)(()=>{let U=a.current,te=s.current;if(!U||!te)return;!c||!u?(U.visible=!0,U.position.set(0,0,0),U.rotation.set(0,0,0),te.scale.setScalar(1)):(U.visible=!p||M.current,U.position.copy(d.current),U.rotation.set(0,g.current,0),te.scale.setScalar(u.scale*m.current));let O=l.current;if(O){let $=p&&v.current&&S.current;O.visible=$,$&&O.position.copy(x.current)}});let W=c&&u?u.offset:[0,0,0];return(0,Di.jsxs)(Di.Fragment,{children:[(0,Di.jsxs)("mesh",{ref:l,visible:!1,rotation:[-Math.PI/2,0,0],children:[(0,Di.jsx)("ringGeometry",{args:[.05,.07,32]}),(0,Di.jsx)("meshBasicMaterial",{color:"#22d3ee",transparent:!0,opacity:.95})]}),(0,Di.jsx)("group",{ref:a,children:(0,Di.jsx)("group",{ref:s,children:(0,Di.jsx)("group",{position:W,children:i})})})]})}),p0=kT;var Hu=require("react");var LT="ri:license-grant:v1",DT={"260cd89ea13f":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEwjr3ofKTkkcxOM0GYl/RlJj9JsuyjSF8sYmCd2YqsHJCEO8EvlNDrO2Kl4agFKo6dRhyR2/oWeiU6P9WIqRbvw=="},h0=new Map;function f0(e){let t=atob(e);return Uint8Array.from(t,n=>n.charCodeAt(0)).buffer}function m0(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return f0(t.padEnd(Math.ceil(t.length/4)*4,"="))}function NT(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===1&&typeof t.licenseKeyHash=="string"&&typeof t.domain=="string"&&(t.environment==="development"||t.environment==="production")&&typeof t.tier=="string"&&t.tier.length>0&&typeof t.issuedAt=="number"&&Number.isInteger(t.issuedAt)&&typeof t.expiresAt=="number"&&Number.isInteger(t.expiresAt)}async function ju(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e.trim())),n=String.fromCharCode(...new Uint8Array(t));return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Om(e,t){return`${LT}:${t}:${e}`}function BT(e,t){let n=h0.get(e);if(n)return n;let i=crypto.subtle.importKey("spki",f0(t),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);return h0.set(e,i),i}async function Im(e,t,n){if(!globalThis.crypto?.subtle)return null;try{let[i,r,o,a,...s]=e.split("."),l=DT[r];if(i!=="ri1"||!l||!o||!a||s.length>0)return null;let c=JSON.parse(new TextDecoder().decode(m0(o)));if(!NT(c)||!await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},await BT(r,l),m0(a),new TextEncoder().encode(`${i}.${r}.${o}`)))return null;let u=Math.floor(Date.now()/1e3),d=c.expiresAt-c.issuedAt;return c.licenseKeyHash!==t||c.domain!==n||c.expiresAt<=u||c.issuedAt>u+300||d<=0||d>43200?null:{environment:c.environment,tier:c.tier,expiresAt:c.expiresAt}}catch{return null}}async function g0(e,t,n){try{return await Im(e,await ju(t),n)}catch{return null}}async function b0(e,t,n){try{let i=await ju(t);return await Im(e,i,n)?(localStorage.setItem(Om(i,n),e),!0):!1}catch{return!1}}async function v0(e,t){try{let n=await ju(e),i=Om(n,t),r=localStorage.getItem(i);if(!r)return null;let o=await Im(r,n,t);return o||localStorage.removeItem(i),o}catch{return null}}async function zm(e,t){try{let n=await ju(e);localStorage.removeItem(Om(n,t))}catch{}}var OT=["localhost","127.0.0.1","0.0.0.0"],IT=e=>OT.includes(e)||e.endsWith(".local")||e.endsWith(".localhost"),y0="https://react-immersive.liveroom.dev/api/validate-license",zT=()=>typeof window<"u",UT=300*1e3,FT=5e3,VT=400,Fm=new Map,Um=new Map,Ko=class extends Error{},w0=async(e,t,n)=>{let i=await v0(e,t);return i?(console.warn("[react-immersive] License server unreachable \u2014 using a previously verified, time-limited offline grant."),{status:"valid",reason:"Previously verified offline grant",environment:i.environment,tier:i.tier,isLocalDomain:n}):null},x0=async(e,t,n)=>{let i=await w0(e,t,n);return i||(console.warn("[react-immersive] License server unreachable and no valid offline grant is available \u2014 license validation failed."),{status:"invalid",reason:"Could not reach license server",isLocalDomain:n})},jT=e=>e instanceof Ko||e instanceof TypeError,HT=()=>new Promise(e=>setTimeout(e,VT)),GT=e=>e==="development"||e==="production",WT=e=>{if(!e||typeof e!="object")return!1;let t=e;return!(typeof t.valid!="boolean"||t.reason!==void 0&&typeof t.reason!="string"||t.environment!==void 0&&!GT(t.environment)||t.tier!==void 0&&typeof t.tier!="string"||t.offlineGrant!==void 0&&typeof t.offlineGrant!="string")},XT=e=>{if(!e||typeof e!="object")return null;let t=e,n=t.reason??t.error;return typeof n=="string"&&n.trim()?n:null},qT=(e,t,n)=>`${n}::${e}::${t}`,$T=e=>{let t=Fm.get(e);return t?Date.now()-t.timestamp>UT?(Fm.delete(e),null):t.result:null},YT=(e,t)=>({status:e.valid?"valid":"invalid",reason:e.reason,environment:e.environment,tier:e.tier,isLocalDomain:t}),KT=(e,t)=>({status:"invalid",reason:e,isLocalDomain:t});async function ZT(e,t,n,i){let r=qT(e,t,i),o=$T(r);if(o)return o;let a=Um.get(r);if(a)return a;let s=(async()=>{for(let l=0;l<2;l+=1)try{return await JT(e,t,n,r,i)}catch(c){if(!jT(c))throw c;if(l===0){let p=await w0(e,t,n);if(p)return p;await HT();continue}return x0(e,t,n)}return x0(e,t,n)})().finally(()=>{Um.delete(r)});return Um.set(r,s),s}async function JT(e,t,n,i,r){let o=new AbortController,a=setTimeout(()=>o.abort(),FT),s;try{s=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store",signal:o.signal,body:JSON.stringify({licenseKey:e,domain:t})})}catch(p){throw o.signal.aborted?new Ko("License validation timed out"):p}finally{clearTimeout(a)}let l;try{l=await s.json()}catch{throw new Ko(`License server returned a non-JSON response${s.status?` (${s.status})`:""}`)}if(!s.ok){if(s.status===429||s.status>=500)throw new Ko(`License server error (${s.status})`);let p=XT(l)??`License validation failed${s.status?` (${s.status})`:""}`;return await zm(e,t),KT(p,n)}if(!WT(l))throw new Ko("License server returned an unexpected payload");let c=YT(l,n);if(c.status==="valid"&&r!==y0){let p=l.offlineGrant?await g0(l.offlineGrant,e,t):null;if(!p)throw new Ko("License validation endpoint did not return a verifiable signed grant");c={...c,environment:p.environment,tier:p.tier}}return c.status==="valid"?(Fm.set(i,{result:c,timestamp:Date.now()}),l.offlineGrant&&(await b0(l.offlineGrant,e,t)||console.warn("[react-immersive] The license server returned an invalid offline grant; it was not cached."))):await zm(e,t),c}var Gu=(e,t=y0)=>{let[n,i]=(0,Hu.useState)({status:"checking",isLocalDomain:!1});return(0,Hu.useEffect)(()=>{if(!zT())return;let r=!1,o=p=>{r||i(p)},a=e.trim(),s=window.location.hostname.toLowerCase(),l=IT(s);return o({status:"checking",isLocalDomain:l}),a?((async()=>{try{o(await ZT(a,s,l,t))}catch(p){let u=p instanceof TypeError?"Could not reach license server":p instanceof Error?p.message:"License validation failed";o({status:"invalid",reason:u,isLocalDomain:l})}})(),()=>{r=!0}):(o({status:"invalid",reason:"No license key provided",isLocalDomain:l}),()=>{r=!0})},[e,t]),n};var dn=require("react");var jn=require("react/jsx-runtime"),QT={up:{width:38,height:22},down:{width:38,height:22},left:{width:22,height:38},right:{width:22,height:38}},e2={up:"4 16 12 8 20 16",down:"4 8 12 16 20 8",left:"16 4 8 12 16 20",right:"8 4 16 12 8 20"},Wu=({direction:e})=>{let t=QT[e],n=e2[e];return(0,jn.jsxs)("svg",{"aria-hidden":"true",className:"mc__arrow-icon",focusable:"false",viewBox:"0 0 24 24",width:t.width,height:t.height,fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:`${t.width}px`,height:`${t.height}px`,pointerEvents:"none",padding:0,margin:0,overflow:"visible"},children:[(0,jn.jsx)("polyline",{points:n,stroke:"rgba(0, 0, 0, 0.9)",strokeWidth:"6",strokeLinecap:"round",strokeLinejoin:"round"}),(0,jn.jsx)("polyline",{points:n,stroke:"#2095F2",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})},yo=16,t2={"bottom-left":{bottom:yo,left:yo,top:"auto",right:"auto",transform:"none"},"bottom-right":{bottom:yo,right:yo,top:"auto",left:"auto",transform:"none"},"top-left":{top:yo,left:yo,bottom:"auto",right:"auto",transform:"none"},"top-right":{top:yo,right:yo,bottom:"auto",left:"auto",transform:"none"},center:{top:"50%",left:"50%",bottom:"auto",right:"auto",transform:"translate(-50%, -50%)"},"center-bottom":{bottom:-10,left:"50%",top:"auto",right:"auto",transform:"translateX(-50%)"},"center-top":{top:yo,left:"50%",bottom:"auto",right:"auto",transform:"translateX(-50%)"}},n2=({controlsRef:e,enabled:t=!0,opacity:n=.9,moveSensitivity:i=.001,rotateSensitivity:r=.01,position:o="center-bottom"})=>{let a=(0,dn.useRef)(null),[s,l]=(0,dn.useState)({x:0,y:0}),c=(0,dn.useRef)(!1),p=(0,dn.useRef)({x:0,y:0}),u=(0,dn.useRef)(void 0),d=(0,dn.useRef)(void 0),m=(0,dn.useRef)(null),g=(0,dn.useRef)(0),v=()=>e.current,M=(B,j,W)=>{let U=Math.hypot(B,j);if(U>W){let te=W/U;return{x:B*te,y:j*te}}return{x:B,y:j}},w=B=>{let W=Math.abs(B);return W<.12?0:Math.sign(B)*((W-.12)/(1-.12))},x=(0,dn.useCallback)(()=>{let B=()=>{let{x:j,y:W}=p.current,U=w(j),te=w(W);if(t&&(U!==0||te!==0)){let O=v();O&&O.rotate(-U*r,-te*r,!0)}u.current=requestAnimationFrame(B)};u.current=requestAnimationFrame(B)},[t,r]),S=(0,dn.useCallback)(()=>{u.current&&cancelAnimationFrame(u.current)},[]),k=(0,dn.useCallback)((B,j)=>{if(!a.current||!c.current)return;let W=a.current.getBoundingClientRect(),U=W.left+W.width/2,te=W.top+W.height/2,O=W.width/2-18,$=B-U,le=j-te,tt=M($,le,O);l(tt),p.current={x:tt.x/O,y:tt.y/O}},[]),b=(0,dn.useCallback)(B=>{if(!t)return;B.preventDefault(),B.stopPropagation(),c.current=!0,x();let j="touches"in B?B.touches[0]:B;k(j.clientX,j.clientY)},[t,x,k]),_=(0,dn.useCallback)(B=>{if(!c.current)return;B.preventDefault();let j="touches"in B?B.touches[0]:B;k(j.clientX,j.clientY)},[k]),y=(0,dn.useCallback)(()=>{c.current=!1,l({x:0,y:0}),p.current={x:0,y:0},S()},[S]),h=i*10,P=(0,dn.useCallback)(B=>{t&&v()?.forward(B*h,!0)},[t,h]),A=(0,dn.useCallback)(B=>{t&&v()?.truck(B*h,0,!0)},[t,h]),C=(0,dn.useCallback)((B,j,W)=>{if(!t)return;d.current&&cancelAnimationFrame(d.current),m.current={control:B,amount:j,action:W},g.current=0,W(j);let U=te=>{if(!m.current)return;if(g.current===0){g.current=te,d.current=requestAnimationFrame(U);return}if(te-g.current>200){let{amount:$,action:le}=m.current;le($),g.current=te}d.current=requestAnimationFrame(U)};d.current=requestAnimationFrame(U)},[t]),D=(0,dn.useCallback)(B=>{m.current?.control===B&&(d.current&&(cancelAnimationFrame(d.current),d.current=void 0),m.current=null,g.current=0)},[]);return(0,dn.useEffect)(()=>(window.addEventListener("mousemove",_),window.addEventListener("mouseup",y),window.addEventListener("touchmove",_,{passive:!1}),window.addEventListener("touchend",y),window.addEventListener("touchcancel",y),()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",y),window.removeEventListener("touchmove",_),window.removeEventListener("touchend",y),window.removeEventListener("touchcancel",y),S(),d.current&&cancelAnimationFrame(d.current)}),[_,y,S]),t?(0,jn.jsx)("div",{className:"mc__wrapper",style:{opacity:n,...t2[o]},children:(0,jn.jsxs)("div",{className:"mc__dpad",children:[(0,jn.jsx)("button",{"aria-label":"Move forward",className:"mc__arrow mc__arrow--up",onMouseDown:()=>C("up",1,P),onMouseUp:()=>D("up"),onMouseLeave:()=>D("up"),onTouchStart:B=>{B.preventDefault(),C("up",1,P)},onTouchEnd:()=>D("up"),onTouchCancel:()=>D("up"),children:(0,jn.jsx)(Wu,{direction:"up"})}),(0,jn.jsxs)("div",{className:"mc__middle-row",children:[(0,jn.jsx)("button",{"aria-label":"Move left",className:"mc__arrow mc__arrow--left",onMouseDown:()=>C("left",-1,A),onMouseUp:()=>D("left"),onMouseLeave:()=>D("left"),onTouchStart:B=>{B.preventDefault(),C("left",-1,A)},onTouchEnd:()=>D("left"),onTouchCancel:()=>D("left"),children:(0,jn.jsx)(Wu,{direction:"left"})}),(0,jn.jsx)("div",{ref:a,className:"mc__joystick",onMouseDown:b,onTouchStart:b,children:(0,jn.jsx)("div",{className:"mc__knob",style:{transform:`translate(${s.x}px, ${s.y}px)`}})}),(0,jn.jsx)("button",{"aria-label":"Move right",className:"mc__arrow mc__arrow--right",onMouseDown:()=>C("right",1,A),onMouseUp:()=>D("right"),onMouseLeave:()=>D("right"),onTouchStart:B=>{B.preventDefault(),C("right",1,A)},onTouchEnd:()=>D("right"),onTouchCancel:()=>D("right"),children:(0,jn.jsx)(Wu,{direction:"right"})})]}),(0,jn.jsx)("button",{"aria-label":"Move backward",className:"mc__arrow mc__arrow--down",onMouseDown:()=>C("down",-1,P),onMouseUp:()=>D("down"),onMouseLeave:()=>D("down"),onTouchStart:B=>{B.preventDefault(),C("down",-1,P)},onTouchEnd:()=>D("down"),onTouchCancel:()=>D("down"),children:(0,jn.jsx)(Wu,{direction:"down"})})]})}):null},S0=n2;var Qt=require("react"),jm=require("three");var Vm=new WeakSet;function Ys(e){Vm.add(e)}function _0(e){let t=Vm.has(e);return t&&Vm.delete(e),t}function M0(e){return[e.x,e.y,e.z]}function wo(e,t){let n=new jm.Vector3,i=new jm.Vector3;return t.getPosition(n),t.getTarget(i),{position:M0(n),target:M0(i),fov:"fov"in e&&typeof e.fov=="number"?e.fov:null,zoom:"zoom"in e&&typeof e.zoom=="number"?e.zoom:1,azimuthAngle:t.azimuthAngle,polarAngle:t.polarAngle}}function r2(e,t){return e?e.position[0]===t.position[0]&&e.position[1]===t.position[1]&&e.position[2]===t.position[2]&&e.target[0]===t.target[0]&&e.target[1]===t.target[1]&&e.target[2]===t.target[2]&&e.fov===t.fov&&e.zoom===t.zoom&&e.azimuthAngle===t.azimuthAngle&&e.polarAngle===t.polarAngle:!1}async function _c(e,t,n=.6){let i=e.smoothTime;e.smoothTime=n;try{return await t()}finally{e.smoothTime=i}}function C0(e={}){let t=(0,Qt.useRef)(e);t.current=e;let n=(0,Qt.useRef)(null),[i,r]=(0,Qt.useState)(null),[o,a]=(0,Qt.useState)(()=>({...e.presets})),s=(0,Qt.useRef)(o);s.current=o;let l=(0,Qt.useCallback)(P=>{r(A=>r2(A,P)?A:P)},[]),c=(0,Qt.useCallback)(P=>{l(P)},[l]),p=(0,Qt.useRef)(null),u=(0,Qt.useRef)(null),d=(0,Qt.useRef)(null),m=(0,Qt.useCallback)(P=>{n.current=P;let A=wo(P.raw.controls.camera,P.raw.controls);l(A),P.raw.scene!==u.current&&(u.current=P.raw.scene,p.current=null,d.current=null),P.homeCameraState&&!p.current&&(p.current=P.homeCameraState);let{initialPosition:C,initialTarget:D,initialTransition:B=!1}=t.current;if((C||D)&&P.raw.scene&&(C||P.homeCameraState)&&d.current!==P.raw.controls){d.current=P.raw.controls,P.homeCameraState||Ys(P.raw.controls);let j=C??A.position,W=D??A.target;P.raw.controls.setLookAt(j[0],j[1],j[2],W[0],W[1],W[2],B).then(()=>{if(n.current?.raw.controls!==P.raw.controls)return;let U=wo(P.raw.controls.camera,P.raw.controls);p.current={position:U.position,target:U.target},l(U)}).catch(()=>{})}},[l]),g=(0,Qt.useCallback)(async()=>{let P=n.current,A=P?.raw.controls;if(!A)return!1;try{let C=p.current;return C?await _c(A,()=>A.setLookAt(C.position[0],C.position[1],C.position[2],C.target[0],C.target[1],C.target[2],!0)):P?.raw.scene?await _c(A,()=>A.fitToBox(P.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})):await _c(A,()=>A.reset(!0)),!0}catch{return!1}},[]),v=(0,Qt.useCallback)(async()=>{let P=n.current;if(!P?.raw.controls||!P.raw.scene)return!1;try{return await _c(P.raw.controls,()=>P.raw.controls.fitToBox(P.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),M=(0,Qt.useCallback)(async P=>{let A=n.current;if(!A?.raw.controls)return!1;let C=Oo(A.objectBindings,P);if(!C)return!1;let D=A.raw.nodes[C];if(!D)return!1;try{return await _c(A.raw.controls,()=>A.raw.controls.fitToBox(D,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),w=(0,Qt.useCallback)(async(P,A=!0)=>{let C=n.current?.raw.controls;if(!C)return!1;try{return n.current?.homeCameraState||Ys(C),await C.setTarget(P[0],P[1],P[2],A),l(wo(C.camera,C)),!0}catch{return!1}},[l]),x=(0,Qt.useCallback)(async(P,A=!0)=>{let C=n.current?.raw.controls;if(!C)return!1;try{n.current?.homeCameraState||Ys(C);let D=[C.setLookAt(P.position[0],P.position[1],P.position[2],P.target[0],P.target[1],P.target[2],A)];P.azimuthAngle!=null&&P.polarAngle!=null&&D.push(C.rotateTo(P.azimuthAngle,P.polarAngle,A)),await Promise.all(D);let B=C.camera,j=!1;return P.fov!=null&&"fov"in B&&typeof B.fov=="number"&&(B.fov=P.fov,j=!0),P.zoom!=null&&"zoom"in B&&typeof B.zoom=="number"&&(B.zoom=P.zoom,j=!0),j&&"updateProjectionMatrix"in B&&B.updateProjectionMatrix(),l(wo(B,C)),!0}catch{return!1}},[l]),S=(0,Qt.useCallback)((P,A=!0)=>x(P,A),[x]),k=(0,Qt.useCallback)((P,A,C=!0)=>x({position:P,target:A},C),[x]),b=(0,Qt.useCallback)(async(P,A,C=!0)=>{let D=n.current?.raw.controls;if(!D)return!1;try{return n.current?.homeCameraState||Ys(D),await D.rotateTo(P*Math.PI/180,A*Math.PI/180,C),l(wo(D.camera,D)),!0}catch{return!1}},[l]),_=(0,Qt.useCallback)(async(P,A=!0)=>{let C=n.current?.raw.controls;if(!C)return!1;try{return n.current?.homeCameraState||Ys(C),await C.dollyTo(P,A),l(wo(C.camera,C)),!0}catch{return!1}},[l]),y=(0,Qt.useCallback)(P=>{let A=n.current?.raw.controls,C=P.trim();if(!A||!C)return null;let D=wo(A.camera,A);return s.current={...s.current,[C]:D},a(B=>({...B,[C]:D})),l(D),D},[l]),h=(0,Qt.useCallback)((P,A=!0)=>{let C=s.current[P];return C?x(C,A):Promise.resolve(!1)},[x]);return{cameraState:i,cameraPresets:o,resetView:g,focusObject:M,fitScene:v,setCameraTarget:w,setCameraState:S,lookAt:k,orbitTo:b,dollyTo:_,savePreset:y,goToPreset:h,handleCameraChange:c,handleViewerReady:m}}var Mc=require("three");function Xu(e){return[e.x,e.y,e.z]}function T0(e){let t=new Mc.Box3().setFromObject(e),n=0;return e.traverse(i=>{i.isMesh&&(n+=1)}),{bounds:{min:Xu(t.min),max:Xu(t.max),center:Xu(t.getCenter(new Mc.Vector3)),size:Xu(t.getSize(new Mc.Vector3))},objectCount:n,materialVariants:zs(e)}}function i2(e){return typeof e=="object"&&!Array.isArray(e)}function o2(e,t){return"group"in t?e.group===t.group:"tag"in t?e.tags?.includes(t.tag)??!1:(e.type??"other")===t.type}function Va(e,t){if(i2(t))return Object.entries(e).filter(([,r])=>o2(r,t)).map(([r])=>r);let i=(typeof t=="string"?[t]:t).map(r=>Oo(e,r)).filter(r=>r!==null);return[...new Set(i)]}var a2="#ff3b30",s2=Object.freeze({}),P0=e=>e;function l2(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function c2(e,t){let n=e.metadata;for(let i of t.split(".")){if(!l2(n))return;n=n[i]}return n}function Gm(e,t){if("metric"in t){let n=e.metrics?.[t.metric];return!(typeof n!="number"||!Number.isFinite(n)||t.above!==void 0&&!(n>t.above)||t.below!==void 0&&!(n<t.below))}if("status"in t){let n=e.status??"normal";return Array.isArray(t.status)?t.status.includes(n):t.status===n}return c2(e,t.metadata)===t.equals}function d2(e){let t=e.trim().replace(/^#/,""),n=t.length===3?t.split("").map(i=>i+i).join(""):t;return/^[0-9a-f]{6}$/i.test(n)?[0,2,4].map(i=>parseInt(n.slice(i,i+2),16)):null}var Hm=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function u2(e,t){let n=e.map(([l,c])=>({at:l,rgb:d2(c)})).filter(l=>Number.isFinite(l.at)&&l.rgb!==null).sort((l,c)=>l.at-c.at);if(n.length===0||!Number.isFinite(t))return null;if(t<=n[0].at)return Hm(n[0].rgb);let i=n[n.length-1];if(t>=i.at)return Hm(i.rgb);let r=n.findIndex(l=>l.at>=t),o=n[r-1],a=n[r],s=a.at===o.at?1:(t-o.at)/(a.at-o.at);return Hm(o.rgb.map((l,c)=>l+(a.rgb[c]-l)*s))}function A0(e,t){if(!t?.length)return{bindings:e,pulses:s2,sourceOf:P0};let n=new Map,i={};for(let a of t){let s=a.target?Va(e,a.target):Object.keys(e),l=a.when?Array.isArray(a.when)?a.when:[a.when]:[];for(let c of s){let p=e[c];if(!l.every(d=>Gm(p,d)))continue;let u={...a.material};if(a.colorScale){let d=p.metrics?.[a.colorScale.metric],m=typeof d=="number"?u2(a.colorScale.stops,d):null;m&&(u={...u,[a.colorScale.channel??"baseColor"]:m})}if(a.pulse){let d=a.pulse===!0?{}:a.pulse;i[c]={color:d.color??a2,speed:d.speed!==void 0&&d.speed>0?d.speed:1};let m=u.emissiveIntensity??n.get(c)?.emissiveIntensity??p.style?.material?.emissiveIntensity;m!==void 0&&m>0||(u.emissiveIntensity=1)}Object.keys(u).length>0&&n.set(c,{...n.get(c),...u})}}if(n.size===0)return{bindings:e,pulses:i,sourceOf:P0};let r={...e},o=new WeakMap;for(let[a,s]of n){let l=e[a],c={...l,style:{...l.style,material:{...l.style?.material,...s}}};r[a]=c,o.set(c,l)}return{bindings:r,pulses:i,sourceOf:a=>o.get(a)??a}}var p2=.12,E0=new Set;function Wm(e,t){return t?new Set(Va(e,t.target)):E0}function R0(e,t){let n=Wm(e.bindings,t);if(!t||n.size===0)return{...e,setAside:E0};let i=Math.min(Math.max(t.ghostOpacity??p2,0),1),r={...e.bindings},o=new WeakMap,a=new Set;for(let[s,l]of Object.entries(e.bindings)){if(n.has(s))continue;a.add(s);let c=t.mode==="hide"?{...l,visible:!1}:{...l,style:{...l.style,material:{...l.style?.material,opacity:Math.min(l.style?.material?.opacity??1,i)}}};r[s]=c,o.set(c,e.sourceOf(l))}return{bindings:r,pulses:e.pulses,sourceOf:s=>o.get(s)??e.sourceOf(s),setAside:a}}var D0=require("react");var L0=require("react"),Xm=require("@react-three/fiber"),k0=new WeakMap;function qu(e){let t=(0,Xm.useThree)(i=>i.get),n=(0,Xm.useThree)(i=>i.setEvents);(0,L0.useEffect)(()=>{if(!e)return;let i=k0.get(t);if(!i){let o=new Set;i=o,k0.set(t,o);let a=t().events.filter;n({filter:(s,l)=>{let c=a?a(s,l):s;return o.size===0?c:c.filter(p=>{for(let u of o)if(!u(p))return!1;return!0})}})}i.add(e);let r=i;return()=>{r.delete(e)}},[e,t,n])}function qm({setAside:e,nodeRefs:t}){let n=(0,D0.useMemo)(()=>{if(e.size===0)return null;let i={refs:null,bound:new Map};return r=>{let o=t.current??{};if(i.refs!==o){let s=new Map;for(let[l,c]of Object.entries(o))s.set(c,e.has(l));i={refs:o,bound:s}}let{bound:a}=i;for(let s=r.object;s;s=s.parent){let l=a.get(s);if(l!==void 0)return!l}return!0}},[e,t]);return qu(n),null}var wr=require("react"),U0=require("@react-three/drei"),Ks=require("@react-three/fiber"),ja=require("three");var $m=require("three"),$u={x:0,y:1,z:2},N0=e=>Math.min(Math.max(e,0),1);function Ym(e,t){let n=$u[t.axis],i=e.min[n],r=e.max[n];if(!Number.isFinite(i)||!Number.isFinite(r)||r<i)return null;let o=Number.isFinite(t.position)?t.position:.5;return i+(r-i)*N0(o)}function B0(e,t,n){let i=Ym(t,n);if(i===null)return!1;let r=new $m.Vector3;return r.setComponent($u[n.axis],n.flip?1:-1),e.normal.copy(r),e.constant=n.flip?-i:i,!0}function O0(e,t,n,i){let r=$u[i],o=new $m.Vector3().setComponent(r,1),a=n.clone().addScaledVector(o,-n.dot(o));if(a.lengthSq()<1e-8)return null;a.normalize();let s=e.direction.dot(a);if(Math.abs(s)<1e-8)return null;let l=t.clone().sub(e.origin).dot(a)/s;return Number.isFinite(l)?e.origin.getComponent(r)+e.direction.getComponent(r)*l:null}function I0(e,t,n){let i=$u[t],r=e.max[i]-e.min[i];return r>0?N0((n-e.min[i])/r):null}var Ha=require("react/jsx-runtime"),h2={x:0,y:1,z:2},z0="#22d3ee";function Km({section:e,box:t,modelRef:n,showHandle:i,onPositionChange:r,onDraggingChange:o}){let a=(0,Ks.useThree)(v=>v.gl),s=(0,Ks.useThree)(v=>v.raycaster),l=(0,Ks.useThree)(v=>v.invalidate),c=(0,wr.useMemo)(()=>new ja.Plane,[]),p=(0,wr.useMemo)(()=>[c],[c]),u=e.enabled&&t!==null&&B0(c,t,e),d=(0,wr.useRef)(new Map),m=()=>{for(let[v,M]of d.current)v.clippingPlanes=M.clippingPlanes,v.side=M.side,v.needsUpdate=!0;d.current.clear()};(0,wr.useEffect)(()=>{if(u)return a.localClippingEnabled=!0,l(),()=>{m(),l()}},[u,a,l]),(0,wr.useEffect)(()=>{u&&l()},[u,e.axis,e.position,e.flip,t,l]),(0,Ks.useFrame)(()=>{let v=n.current;if(!u||!v)return;let M=d.current;v.traverse(w=>{let x=w.material;if(x)for(let S of Array.isArray(x)?x:[x]){let k=M.get(S);if(S.clippingPlanes===p&&S.side===ja.DoubleSide)continue;let b=S.side===ja.DoubleSide&&k?k.side:S.side;M.set(S,{clippingPlanes:k?k.clippingPlanes:S.clippingPlanes,side:b}),S.clippingPlanes=p,S.clipShadows=!0,S.side=ja.DoubleSide,S.needsUpdate=!0}})});let g=(0,wr.useMemo)(()=>u?v=>!!v.object.userData.riSectionHandle||c.distanceToPoint(v.point)>=-1e-4:null,[u,c]);return qu(g),(0,wr.useEffect)(()=>{if(!u)return;let v=s,M=v.firstHitOnly;return v.firstHitOnly=!1,()=>{v.firstHitOnly=M}},[u,s]),!u||!i||!t?null:(0,Ha.jsx)(m2,{section:e,box:t,onPositionChange:r,onDraggingChange:o})}function m2({section:e,box:t,onPositionChange:n,onDraggingChange:i}){let[r,o]=(0,wr.useState)(!1),[a,s]=(0,wr.useState)(!1),l=(0,wr.useRef)(null),c=h2[e.axis],p=Ym(t,e)??0,u=[0,1,2].map(w=>(t.max[w]-t.min[w])*1.08||.01),d=[0,1,2].map(w=>(t.min[w]+t.max[w])/2);d[c]=p;let[m,g]=e.axis==="x"?[u[2],u[1]]:e.axis==="y"?[u[0],u[2]]:[u[0],u[1]],v=e.axis==="x"?[0,Math.PI/2,0]:e.axis==="y"?[-Math.PI/2,0,0]:[0,0,0],M=w=>{a&&(w.target?.releasePointerCapture?.(w.pointerId),l.current=null,s(!1),i(!1))};return(0,Ha.jsxs)("mesh",{ref:w=>{w&&(xd(w),w.userData.riSectionHandle=!0)},position:d,rotation:v,renderOrder:2,onPointerOver:w=>{w.stopPropagation(),o(!0)},onPointerOut:()=>o(!1),onPointerDown:w=>{w.stopPropagation(),w.target?.setPointerCapture?.(w.pointerId),l.current={point:w.point.clone(),direction:w.ray.direction.clone(),coordinate:w.point.getComponent(c),cut:p},s(!0),i(!0)},onPointerMove:w=>{let x=l.current;if(!a||!x)return;w.stopPropagation();let S=O0(w.ray,x.point,x.direction,e.axis);if(S===null)return;let k=I0(t,e.axis,x.cut+(S-x.coordinate));k!==null&&n(k)},onPointerUp:M,onPointerCancel:M,onClick:w=>w.stopPropagation(),children:[(0,Ha.jsx)("planeGeometry",{args:[m,g]}),(0,Ha.jsx)("meshBasicMaterial",{color:z0,transparent:!0,opacity:a?.22:r?.16:.08,side:ja.DoubleSide,depthWrite:!1,toneMapped:!1}),(0,Ha.jsx)(U0.Edges,{color:z0,renderOrder:3})]})}var F0=require("react-colorful"),Zo=require("react/jsx-runtime"),Zm=({colorPicker:e,onClose:t,itemMaterials:n,setItemMaterials:i,inline:r=!1})=>(0,Zo.jsxs)("div",{className:`ri-popover${r?" ri-popover--inline":""}`,style:r?{padding:12}:{left:e.x,top:e.y,width:"min(225px, calc(100vw - 24px))",padding:12},onPointerDown:o=>o.stopPropagation(),children:[(0,Zo.jsx)("p",{className:"ri-popoverLabel",children:"Color"}),(0,Zo.jsx)(F0.HexColorPicker,{color:n[e.objectId]?.hex??"#ffffff",onChange:o=>i(a=>({...a,[e.objectId]:{...a[e.objectId],hex:o}}))}),(0,Zo.jsxs)("div",{className:"ri-inlineRow",children:[(0,Zo.jsx)("span",{className:"ri-colorCode",children:n[e.objectId]?.hex??"#ffffff"}),(0,Zo.jsx)("button",{className:"ri-secondaryButton",onClick:t,children:"Done"})]})]});var kt=require("react/jsx-runtime"),Jm=({materialPopup:e,textureUrl:t,triggerFileUpload:n,clearTexture:i,inline:r=!1,offset:o,rotationDegrees:a,onOffsetChange:s,onRotationChange:l,isPositioning:c=!1,onEndPositioning:p})=>(0,kt.jsxs)("div",{className:`ri-popover${r?" ri-popover--inline":""}`,style:r?{overflow:"hidden"}:{left:e.x,top:e.y,width:"min(300px, calc(100vw - 24px))",overflow:"hidden"},onPointerDown:u=>u.stopPropagation(),children:[(0,kt.jsx)("div",{className:"ri-popoverHeader",children:(0,kt.jsx)("p",{className:"ri-popoverLabel",style:{marginBottom:0},children:"Material"})}),(0,kt.jsxs)("div",{className:"ri-materialBody",children:[t?(0,kt.jsx)("div",{className:"ri-previewFrame",children:(0,kt.jsx)("img",{src:t,alt:"texture preview",className:"ri-previewImage"})}):(0,kt.jsxs)("div",{className:"ri-emptyState",children:[(0,kt.jsx)("svg",{width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",children:(0,kt.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3 21h18M3 3h18"})}),(0,kt.jsx)("span",{style:{fontSize:12},children:"No texture applied"})]}),(0,kt.jsx)("button",{onClick:()=>n(e.objectId),className:"ri-uploadButton",children:t?"Replace image":"Upload image"}),t&&(0,kt.jsx)("button",{onClick:()=>i(e.objectId),className:"ri-removeButton",children:"Remove texture"}),(0,kt.jsx)("p",{className:"ri-formatHint",children:"JPG \xB7 PNG \xB7 WebP"}),t&&(s||l)&&(0,kt.jsxs)("div",{className:"ri-texturePosition",children:[(0,kt.jsx)("p",{className:"ri-texturePositionLabel",children:"Texture position"}),(0,kt.jsxs)("div",{className:"ri-texturePositionGrid",children:[(0,kt.jsxs)("label",{className:"ri-texturePositionField",children:[(0,kt.jsx)("span",{children:"Offset X"}),(0,kt.jsx)("input",{type:"number",step:.01,value:o?.[0]??0,onChange:u=>s?.(e.objectId,0,Number(u.target.value))})]}),(0,kt.jsxs)("label",{className:"ri-texturePositionField",children:[(0,kt.jsx)("span",{children:"Offset Y"}),(0,kt.jsx)("input",{type:"number",step:.01,value:o?.[1]??0,onChange:u=>s?.(e.objectId,1,Number(u.target.value))})]})]}),(0,kt.jsxs)("label",{className:"ri-texturePositionField ri-texturePositionField--full",children:[(0,kt.jsx)("span",{children:"Rotation"}),(0,kt.jsxs)("div",{className:"ri-texturePositionSliderRow",children:[(0,kt.jsx)("input",{type:"range",min:0,max:360,step:1,value:a??0,onChange:u=>l?.(e.objectId,Number(u.target.value))}),(0,kt.jsx)("input",{type:"number",min:0,max:360,step:1,value:Math.round(a??0),onChange:u=>l?.(e.objectId,Number(u.target.value))})]})]}),c?(0,kt.jsx)("button",{type:"button",className:"ri-uploadButton",onClick:p,title:"Confirm this texture position and exit positioning mode",children:"Done positioning"}):(0,kt.jsx)("p",{className:"ri-texturePositionHint",children:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically."})]})]})]});var ci=require("react");var Nt=require("react/jsx-runtime");function V0({entries:e}){return(0,Nt.jsx)(Nt.Fragment,{children:e.map(([t,n])=>{let i=n!==null&&typeof n=="object",r=i?Object.entries(n):[];return i&&r.length>0?(0,Nt.jsxs)("div",{className:"left-panel__data-group",children:[(0,Nt.jsx)("span",{className:"left-panel__data-key",children:t}),(0,Nt.jsx)("div",{className:"left-panel__data-children",children:(0,Nt.jsx)(V0,{entries:r})})]},t):(0,Nt.jsxs)("div",{className:"left-panel__data-row",children:[(0,Nt.jsx)("span",{className:"left-panel__data-key",children:t}),(0,Nt.jsx)("span",{className:`left-panel__data-value left-panel__data-value--${typeof n}`,children:i?Array.isArray(n)?"[]":"{}":String(n)})]},t)})})}function f2({content:e}){let t=e!=null,[n,i]=(0,ci.useState)(t),[r,o]=(0,ci.useState)(t),a=(0,ci.useRef)(e);return t&&(a.current=e),(0,ci.useEffect)(()=>{if(t){i(!0);return}if(n){o(!1);let s=setTimeout(()=>i(!1),300);return()=>clearTimeout(s)}},[t,n]),(0,ci.useEffect)(()=>{if(n&&t){let s=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(s)}},[n,t]),n?(0,Nt.jsx)("div",{className:`left-panel__action-extra${r?" left-panel__action-extra--open":""}`,children:(0,Nt.jsx)("div",{className:"left-panel__action-extra-inner",children:e??a.current})}):null}function Qm({isOpen:e,selectedObject:t,currentAction:n,onClose:i,onAction:r,renderActionExtra:o}){let[a,s]=(0,ci.useState)(t);(0,ci.useEffect)(()=>{t&&s(t)},[t]);let l=t??a,c=l?Object.entries(l).filter(([p])=>p!=="actions"&&p!=="decals"):[];return(0,Nt.jsx)("div",{className:`left-panel ${e?"left-panel--open":"left-panel--closed"}`,children:l&&(0,Nt.jsxs)(Nt.Fragment,{children:[(0,Nt.jsxs)("div",{className:"left-panel__header",children:[(0,Nt.jsx)("p",{className:"left-panel__title",children:l.label}),(0,Nt.jsx)("button",{onClick:i,className:"left-panel__close-btn","aria-label":"Close panel",children:"\u2715"})]}),c.length>0&&(0,Nt.jsx)("div",{className:"left-panel__data",children:(0,Nt.jsx)(V0,{entries:c})}),(0,Nt.jsx)("hr",{className:"left-panel__divider"}),l.actions&&l.actions.length>0&&(0,Nt.jsxs)(Nt.Fragment,{children:[(0,Nt.jsx)("div",{className:"left-panel__actions-label",children:"Actions"}),(0,Nt.jsx)("div",{className:"left-panel__actions-list",children:l.actions.map((p,u)=>{let d=n?.action.id===p.id&&(n.binding===l||n.binding?.id===l.id||n.binding?.modelObjectId===l.modelObjectId||n.objectId===l.id||n.objectId===l.modelObjectId),m=o?.(p.id);return(0,Nt.jsxs)(ci.Fragment,{children:[(0,Nt.jsx)("button",{onClick:g=>r({objectId:l.modelObjectId||l.id||"",action:p,binding:l,screenX:g.clientX,screenY:g.clientY}),className:["left-panel__action-btn",`left-panel__action-btn--${p.id}`,d?"left-panel__action-btn--active":""].filter(Boolean).join(" "),"data-action-id":p.id,"data-label":p.label,children:p.label}),(0,Nt.jsx)(f2,{content:m})]},u)})})]})]})})}var Cc=require("react"),Yu=require("lucide-react");var j0=require("react");var er=require("react/jsx-runtime");function H0({openButtonLabel:e,openButtonAriaLabel:t,eyebrow:n,title:i,searchValue:r,onSearchChange:o,searchPlaceholder:a,children:s,isOpen:l,onToggle:c,openButtonIcon:p,closeButtonIcon:u,closeButtonAriaLabel:d}){let[m,g]=(0,j0.useState)(!1),v=l!==void 0?l:m,M=w=>{l===void 0&&g(w),c?.(w)};return(0,er.jsxs)("div",{className:`ri-sidepanel-wrap ${v?"ri-sidepanel-wrap--open":"ri-sidepanel-wrap--closed"}`,children:[!v&&(0,er.jsxs)("button",{type:"button",className:"ri-sidepanel__open-btn",onClick:()=>M(!0),"aria-label":t,title:"Open panel",children:[p,e?(0,er.jsx)("span",{children:e}):null]}),(0,er.jsxs)("div",{className:`ri-sidepanel ${v?"ri-sidepanel--open":"ri-sidepanel--closed"}`,"aria-hidden":!v,children:[(0,er.jsxs)("div",{className:"ri-sidepanel__header",children:[(0,er.jsxs)("div",{className:"ri-sidepanel__header-top",children:[(0,er.jsx)("span",{className:"ri-sidepanel__eyebrow",children:n}),(0,er.jsx)("button",{type:"button",className:"ri-sidepanel__close-btn",onClick:()=>M(!1),"aria-label":d,title:"Close",children:u??(0,er.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,er.jsx)("path",{d:"M1 1L11 11M11 1L1 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})})]}),(0,er.jsx)("p",{className:"ri-sidepanel__title",children:i})]}),(0,er.jsx)("div",{className:"ri-sidepanel__search-wrap",children:(0,er.jsx)("input",{className:"ri-sidepanel__search",type:"text",placeholder:a,value:r,onChange:w=>o(w.target.value)})}),(0,er.jsx)("div",{className:"ri-sidepanel__list",children:s})]})]})}var di=require("react/jsx-runtime");function ef({objectBindings:e,onAction:t,onFocus:n,onHover:i,isOpen:r,onToggle:o,isolatedKeys:a=null,onIsolate:s}){let[l,c]=(0,Cc.useState)(null),[p,u]=(0,Cc.useState)(""),d=(0,Cc.useMemo)(()=>Object.entries(e).filter(([m,g])=>{let v=p.toLowerCase();return m.toLowerCase().includes(v)||(g.label??"").toLowerCase().includes(v)}),[e,p]);return(0,di.jsx)(H0,{openButtonLabel:"",openButtonAriaLabel:"Open scene objects panel",openButtonIcon:(0,di.jsx)(Yu.Boxes,{width:16,height:16,"aria-hidden":"true"}),eyebrow:"SCENE OBJECTS",title:`${d.length} visible entries`,searchValue:p,onSearchChange:u,searchPlaceholder:"Search nodes, labels",isOpen:r,onToggle:o,closeButtonAriaLabel:"Close scene objects panel",children:d.map(([m,g])=>{let v=g.visible!==!1,M=l===m,w=a?.has(m)??!1;return(0,di.jsxs)("div",{onClick:()=>n(g),onMouseEnter:()=>{c(m),i?.(g)},onMouseLeave:()=>{c(null),i?.(null)},className:`ri-sidepanel__row${M?" ri-sidepanel__row--hovered":""}${a!==null&&!w?" ri-sidepanel__row--setAside":""}`,children:[(0,di.jsx)("span",{className:`ri-sidepanel__label${M?" ri-sidepanel__label--hovered":""}`,children:g.label??m}),s?(0,di.jsx)("button",{type:"button",onClick:S=>{S.stopPropagation(),s(g)},className:`ri-sidepanel__isolate-btn${w?" ri-sidepanel__isolate-btn--active":""}`,title:w?"Show all":"Isolate","aria-label":`${w?"Show all":"Isolate"} ${g.label??m}`,"aria-pressed":w,children:(0,di.jsx)(Yu.Focus,{width:14,height:14,"aria-hidden":"true"})}):null,(0,di.jsx)("button",{type:"button",onClick:S=>{S.stopPropagation(),t?.({objectId:m,action:{id:"toggle-visibility",label:"Toggle Visibility",type:"command"},binding:g})},className:"ri-sidepanel__vis-btn",title:v?"Hide":"Show",children:(0,di.jsx)("span",{className:`ri-sidepanel__checkbox${v?" ri-sidepanel__checkbox--checked":""}`,children:v&&(0,di.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",children:(0,di.jsx)("path",{d:"M1.5 5L4 7.5L8.5 2.5",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})})]},m)})})}var Se=require("lucide-react");var Ku=require("react"),tf=(0,Ku.createContext)({isInsideEditor:!1,activeTab:"object",activeSubTab:"General",tier:"free"});var Sr=()=>(0,Ku.useContext)(tf);var Jo=require("react/jsx-runtime");function Zu({visible:e,message:t,tone:n="default",progress:i}){if(!e)return null;let r=typeof i=="number"&&Number.isFinite(i),o=r?Math.min(Math.max(i,0),100):0,a=Math.round(o);return(0,Jo.jsxs)("div",{className:"bb-loadingOverlay",role:"status","aria-live":"polite",children:[r&&(0,Jo.jsxs)("div",{className:"bb-loadingProgressRow",children:[(0,Jo.jsx)("div",{className:"bb-loadingProgress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,children:(0,Jo.jsx)("div",{className:"bb-loadingProgress__bar",style:{width:`${a}%`}})}),(0,Jo.jsxs)("span",{className:"bb-loadingProgress__label",children:[a,"%"]})]}),(0,Jo.jsx)("span",{className:`bb-loadingMessage bb-status--${n}`,children:t})]})}function g2(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function nf(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function b2(e){let t=e.toLowerCase();return t.includes("light")?"light":t.includes("wheel")||t.includes("rim")||t.includes("tire")?"wheel":t.includes("glass")||t.includes("window")||t.includes("windshield")||t.includes("sunroof")?"glass":t.includes("seat")||t.includes("dashboard")||t.includes("console")||t.includes("doorpanel")?"interior":t.includes("floor")?"floor":t.includes("wall")?"wall":t.includes("door")?"door":t.includes("chair")||t.includes("table")||t.includes("sofa")||t.includes("bed")?"furniture":"other"}function G0(e){return e==="light"||e.endsWith("light")?[{id:"toggle-light",label:"Toggle Light",type:"command"},{id:"change-light-color",label:"Change Light Color",type:"command"},{id:"set-brightness",label:"Set Brightness",type:"command"}]:[{id:"change-color",label:"Change Color",type:"command"},{id:"change-material",label:"Change Material",type:"command"},{id:"toggle-visibility",label:"Toggle Visibility",type:"command"}]}function W0(e){let t=b2(e);return{id:g2(e),modelObjectId:e,type:t,label:nf(e),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:G0(t),metrics:{},metadata:{}}}function Ju(e){return Object.fromEntries(e.map(t=>[t,W0(t)]))}function X0(e){let t=new Set,n={};for(let i of e){let r=W0(i),o=r.id||"object",a=o;for(let l=2;t.has(a);l++)a=`${o}-${l}`;t.add(a),r.id=a;let s=(r.actions??[]).filter(l=>Ul.includes(l.id));r.actions=s.length>0?s:G0("other"),n[i]=r}return n}function Tc(e){let{nodesById:t}=Fo(e),n=[];for(let[i,r]of Object.entries(t)){let o=r;o.isMesh&&o.geometry&&r.name&&n.push(i)}return n.sort((i,r)=>i.localeCompare(r))}var Be=require("react"),np=require("@react-three/fiber"),rp=require("@react-three/drei"),yt=require("three");var q0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N15mFxllfjx76nqTmclewJJSEIWsgBh3xcNi0mqExHUjMO46wwz/lSYcQHFJTqKqCgoKu4CMipBBQzpEAJE9kWQnSydzr7va3d6qTq/P97ukD1Vdd9b997q83mefgKm6r1Huuq+577LecEYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wx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";var $0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAACXBIWXMAAC4gAAAuIAHVHB4bAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAIABJREFUeJzt3Xd4HOXVBfBzZ1eSe6djYqoNwloZDJgaJ0AgIZ2IAJINIcS00D5CCASCCaQBAULHAWIsyQYEhEAILQ6mmRI3ych0MGCae5VVdud+f0gQbFyk3Zm5U87veXgSZM3MAaSZszPzvq+AiBJD761IYVjxN+DK4RDZFnBbAXkb6jwk5ZNmW+cjouCIdQAiCobWj9kPcO8ApHQj3/IYnOw4GX73B4EGIyITLABECaD1Y74O6CMAum3mWxchp6Nlr9p5QeQiIjssAEQxp40VA5AteQPAwE5u8jbWtAyXA+rW+pmLiGw51gGIyGe5bmej8xd/ANgZPYpP9ysOEYUDCwBR3Kn+sMvbiHOcD0mIKERYAIhiTBUCYGgeW5Z2bEtEMcUCQBRnDWN6ACjKY8tuHdsSUUyxABDFWbo5/0/xhWxLRKHHAkBERJRALABEREQJxAJARESUQCwARERECcQCQERElEAsAERERAnEAkBERJRALABEREQJxAJARESUQCwARERECcQCQERElEAsAERERAnEAkBERJRALABEREQJxAJARESUQCwARERECcQCQERElEAsAERERAnEAkBERJRALABEREQJxAJARESUQCwARERECcQCQERElEAsAERERAmUtg5A9rSxohjZ4uMAORaCDFRKIPo2VP8NOH+VTPW71hmJqGu04fidoHIyRA6Dys4QbYFiDoC7kW65W0rrWq0zki2xDkC2dO6xg6Hp+6HYZyPf0gLgtyir+YMINMhsVDhtrOiFbMmqvDZOt/SW0rrVHkcin6lCUF91MQS/BlCy4e+SlwH3aMnULgg0HIUKHwEkmDZWDICbfnITF3+g/QTyOzRU3hxULiIqQH3VrRD8Fhu9+AOA7gvIE9pwfP/AclHosAAkWVvJ1QCGdu6b5VSdU3mSr3mIqCA6p/IkCMZ18tt3hzpX+hqIQo0FIKG0vnJ7CMZ2aSNxrtJ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OzlhlDrLXrEQawnX58UCLGs2traGICT5/5JS111gQc4QyU4ZiPTCQvm4mJgLsZQJtjGWiU47Gk/ElW3g87mdkoOedwXnA4CIllDFQBCiGqTrC5UIH8/YxIcPKJyO2WpovDCiV5oZDT2fjyeWDv2FXusIdT6Za3+EsTaqAJACFFtMtWFLVu2uAvlaJniQAW4VAqwUnBWwcHLAFbKgHKM/XO+q6OVOhY6GVgZGMrUtIPmQBQcfQqUYS7zUUlREpIsy1JKZolEyhVH4vxIagNMsoYSAEJITpxLFtrO/ZNR2uoCQ4DzC3ovWKq6wIACMBSIEAAbYIMIwA64AafT/s6RupbzI2kKgGQNJQCEEEPIztoFNrZeQWEzrLJ2we10rHU67GcSydQMMKoAkOyxTAZNCCETMXt1YSAysv9ES8dmMP61hub2B/WOh1gDVQAIIZZn9upCoLBgpSAKUUVWqAJAssZQWS4hhJjNJdUFhoDCUcnAZ2SzunCmq/+NjjPdP64PtT+d3b8ByVeUABBCiEb+9vbbndEiqVhldWEW/n87d2yDIBQGAfi5A8SpHIAFKByO1gEeLYWhI5pYQU9iyfvtmMAEY75vgrvuqktpfyuMiNdwf1zH6Xk7sAJ/xAAA+FFtc6lKKXVE1NupnNf53Xc5L0fnAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4ug8WQhGFNH5HGgAAAABJRU5ErkJggg==";var Ye=require("react/jsx-runtime"),rf=-100,of=100,r1=.03,w2=.03,S2=.03,K0=.5,_2=q0,M2=$0,C2=Y0,T2=Math.PI/4,Z0=.4,Zs=64,J0=r1*3,af="#4d7dff",Q0="#ffcc00",e1=.02,P2=new yt.Vector3(0,1,0),Qu=32,t1="#ff9d3d",ep=4;function sf(e){let t=new Float32Array((Zs+1)*3);for(let n=0;n<=Zs;n++){let i=n/Zs*Math.PI*2,r=Math.cos(i)*Z0,o=Math.sin(i)*Z0,a=0,s=0,l=0;e==="x"?(s=r,l=o):e==="y"?(a=r,l=o):(a=r,s=o),t[n*3]=a,t[n*3+1]=s,t[n*3+2]=l}return t}function A2(e){let t=Math.abs(e.y)<.99?new yt.Vector3(0,1,0):new yt.Vector3(1,0,0),n=new yt.Vector3().crossVectors(e,t).normalize(),i=new yt.Vector3().crossVectors(e,n).normalize();return[n,i]}function n1(e,t,n=1e-5){return Math.abs(e[0]-t[0])<n&&Math.abs(e[1]-t[1])<n&&Math.abs(e[2]-t[2])<n}var Js=null,lf=new Set;function Pc(e){Js!==e&&(Js=e,lf.forEach(t=>t()))}function cf(e){return lf.add(e),()=>lf.delete(e)}function tp(){return Js}function i1({light:e,position:t,rotation:n=[0,0,0],color:i,intensity:r,visible:o,onPositionChange:a,onRotationChange:s,onDraggingChange:l}){let{activeTab:c,activeSubTab:p,setActiveTab:u,setActiveSubTab:d}=Sr(),{camera:m,gl:g,raycaster:v,invalidate:M}=(0,np.useThree)(),w=(0,Be.useRef)(null),x=(0,Be.useRef)(null),S=(0,Be.useRef)(null),k=(0,Be.useRef)(null),b=(0,Be.useRef)(null),_=(0,Be.useRef)(null),y=(0,Be.useRef)(null),h=(0,Be.useRef)(null),P=(0,Be.useRef)(null),A=(0,Be.useRef)(null),C=(0,Be.useRef)(null),D=(0,Be.useMemo)(()=>new yt.Matrix4,[]),B=(0,Be.useMemo)(()=>new yt.Quaternion,[]),j=(0,Be.useMemo)(()=>new yt.Vector3(1,1,1),[]),W=(0,Be.useRef)([0,0,0]),U=(0,Be.useRef)([0,0,0]),te=(0,Be.useRef)(!1),O=(0,Be.useRef)(null),$=(0,Be.useRef)(null),le=(0,Be.useRef)(null),tt=(0,Be.useRef)(l);(0,Be.useEffect)(()=>{tt.current=l},[l]);let xe=(0,Be.useMemo)(()=>new yt.Vector3(t[0],t[1],t[2]),[t]),nt=(0,Be.useMemo)(()=>new yt.Euler(n[0],n[1],n[2]),[n]),ce=(0,Be.useMemo)(()=>new Float32Array(6),[]),Le=(0,Be.useMemo)(()=>sf("x"),[]),he=(0,Be.useMemo)(()=>sf("y"),[]),pt=(0,Be.useMemo)(()=>sf("z"),[]),Bt=(0,Be.useMemo)(()=>new Float32Array((Qu+1)*3),[]),un=(0,Be.useMemo)(()=>new Float32Array(ep*2*3),[]),Ie=e?.type==="point",bt=e?.type==="spot",Ot=Ie?M2:bt?C2:_2,dr=Ie?w2:bt?S2:r1,de=(0,Be.useMemo)(()=>new yt.TextureLoader().load(Ot),[Ot]),Cr=(0,Be.useSyncExternalStore)(cf,tp,tp),Xt=!!e&&Cr===e.id,Et=(0,Be.useRef)(new yt.Vector3),rt=(0,Be.useRef)(new yt.Euler);(0,Be.useEffect)(()=>{te.current||(Et.current.copy(xe),rt.current.copy(nt),M())},[xe,nt,M]),(0,Be.useEffect)(()=>{e&&Js===e.id&&!o&&Pc(null)},[e?.id,o]),(0,Be.useEffect)(()=>()=>{e&&Js===e.id&&Pc(null),le.current!==null&&(cancelAnimationFrame(le.current),le.current=null)},[e?.id]);let bn=(0,Be.useCallback)(()=>{if(te.current||!Xt)return;let fe=Et.current,We=new yt.Quaternion().setFromEuler(rt.current);D.compose(fe,We,j)},[D,j,Xt]);(0,np.useFrame)(()=>{if(w.current&&w.current.position.copy(Et.current),bn(),S.current){S.current.lookAt(m.position);let fe=m,We;fe.isOrthographicCamera?We=dr/fe.zoom:We=m.position.distanceTo(Et.current)*dr,S.current.scale.setScalar(We)}if(y.current){let fe=m,We;fe.isOrthographicCamera?We=J0/fe.zoom:We=m.position.distanceTo(Et.current)*J0,y.current.scale.setScalar(We)}if(b.current){let fe=b.current.getAttribute("position"),We=fe.array;We[0]=0,We[1]=0,We[2]=0,We[3]=Et.current.x,We[4]=Et.current.y,We[5]=Et.current.z,fe.needsUpdate=!0,b.current.computeBoundingSphere()}if(_.current){let fe=Et.current,We=fe.length();_.current.visible=We>K0,We>1e-6&&(_.current.position.copy(fe).multiplyScalar(.5),_.current.scale.set(1,We,1),_.current.quaternion.setFromUnitVectors(P2,fe.clone().normalize()))}if(k.current&&(k.current.visible=Et.current.length()>K0),bt&&h.current&&P.current&&A.current){let fe=Et.current,We=fe.length();if(We>1e-6){h.current.visible=!0;let xn=fe.clone().negate().normalize(),It=We,zt=e?.angle??Math.PI/6,oe=It*Math.tan(zt),ye=fe.clone().add(xn.clone().multiplyScalar(It)),[Ae,ct]=A2(xn),ht=P.current.getAttribute("position"),Ke=ht.array;for(let qe=0;qe<=Qu;qe++){let dt=qe/Qu*Math.PI*2,pn=ye.x+(Ae.x*Math.cos(dt)+ct.x*Math.sin(dt))*oe,ur=ye.y+(Ae.y*Math.cos(dt)+ct.y*Math.sin(dt))*oe,en=ye.z+(Ae.z*Math.cos(dt)+ct.z*Math.sin(dt))*oe;Ke[qe*3]=pn,Ke[qe*3+1]=ur,Ke[qe*3+2]=en}ht.needsUpdate=!0,P.current.computeBoundingSphere();let wt=A.current.getAttribute("position"),_e=wt.array;for(let qe=0;qe<ep;qe++){let dt=qe/ep*Math.PI*2,pn=ye.x+(Ae.x*Math.cos(dt)+ct.x*Math.sin(dt))*oe,ur=ye.y+(Ae.y*Math.cos(dt)+ct.y*Math.sin(dt))*oe,en=ye.z+(Ae.z*Math.cos(dt)+ct.z*Math.sin(dt))*oe,Hn=qe*6;_e[Hn]=fe.x,_e[Hn+1]=fe.y,_e[Hn+2]=fe.z,_e[Hn+3]=pn,_e[Hn+4]=ur,_e[Hn+5]=en}wt.needsUpdate=!0,A.current.computeBoundingSphere()}else h.current.visible=!1}});let Tr=(0,Be.useCallback)(()=>{le.current!==null&&(cancelAnimationFrame(le.current),le.current=null),W.current=t,U.current=[n[0],n[1],n[2]],te.current=!0,O.current=null,$.current=null,tt.current?.(!0)},[t,n]),Tn=(0,Be.useCallback)((fe,We,xn,It)=>{let zt=new yt.Vector3(W.current[0],W.current[1],W.current[2]),oe=new yt.Vector3,ye=new yt.Quaternion,Ae=new yt.Vector3;It.decompose(oe,ye,Ae);let ct=zt.clone().applyMatrix4(It),ht=[Math.min(Math.max(ct.x,rf),of),Math.min(Math.max(ct.y,rf),of),Math.min(Math.max(ct.z,rf),of)],Ke=new yt.Quaternion().setFromEuler(new yt.Euler(U.current[0],U.current[1],U.current[2],"XYZ")),wt=new yt.Quaternion().copy(ye).multiply(Ke),_e=new yt.Euler().setFromQuaternion(wt,"XYZ"),qe=[_e.x,_e.y,_e.z];Et.current.set(ht[0],ht[1],ht[2]),rt.current.set(qe[0],qe[1],qe[2]),O.current=ht,$.current=qe;let dt=new yt.Quaternion().setFromEuler(rt.current);D.compose(Et.current,dt,j),M()},[D,j,M]),Kt=(0,Be.useCallback)(()=>{te.current=!1;let fe=O.current,We=$.current;O.current=null,$.current=null;let xn=fe&&!n1(fe,W.current),It=We&&!n1(We,U.current);xn&&a&&a(fe),It&&s&&s(We),xn||It?le.current=requestAnimationFrame(()=>{le.current=null,tt.current?.(!1)}):tt.current?.(!1)},[a,s]);return(0,Be.useEffect)(()=>{let fe=It=>{let zt=g.domElement.getBoundingClientRect();return new yt.Vector2((It.clientX-zt.left)/zt.width*2-1,-((It.clientY-zt.top)/zt.height)*2+1)},We=It=>!!It.target.closest?.("button, input, textarea, .ri-annotationPopup, .ri-colorPicker, .ri-materialPicker"),xn=It=>{if(We(It))return;let zt=fe(It);v.setFromCamera(zt,m);let oe=[];if(x.current&&oe.push(x.current),S.current&&oe.push(S.current),oe.length===0)return;if(v.intersectObjects(oe,!1).length>0){let Ae=e?.id??null;Js!==Ae&&(Pc(Ae),u?.("scene"),d?.("Lighting")),It.preventDefault(),It.stopPropagation()}};return g.domElement.addEventListener("pointerdown",xn),()=>{g.domElement.removeEventListener("pointerdown",xn)}},[m,v,g,e,u,d]),c!=="scene"||p!=="Lighting"||!e||!o||e.type==="none"||e.type==="hemisphere"?null:(0,Ye.jsxs)("group",{ref:fe=>{fe&&xd(fe)},children:[(0,Ye.jsxs)("group",{ref:w,children:[(0,Ye.jsx)("sprite",{ref:S,children:(0,Ye.jsx)("spriteMaterial",{map:de,transparent:!0,opacity:.9,blending:yt.AdditiveBlending,depthWrite:!1,rotation:bt?T2:0},Ot)}),(0,Ye.jsx)(rp.Sphere,{ref:x,args:[.25,16,16],children:(0,Ye.jsx)("meshBasicMaterial",{transparent:!0,opacity:.01})}),Ie&&(0,Ye.jsxs)("group",{ref:y,children:[(0,Ye.jsxs)("lineLoop",{renderOrder:999,children:[(0,Ye.jsx)("bufferGeometry",{children:(0,Ye.jsx)("bufferAttribute",{attach:"attributes-position",args:[Le,3],count:Zs+1})}),(0,Ye.jsx)("lineBasicMaterial",{color:af,transparent:!0,opacity:.6,depthTest:!1,depthWrite:!1})]}),(0,Ye.jsxs)("lineLoop",{renderOrder:999,children:[(0,Ye.jsx)("bufferGeometry",{children:(0,Ye.jsx)("bufferAttribute",{attach:"attributes-position",args:[he,3],count:Zs+1})}),(0,Ye.jsx)("lineBasicMaterial",{color:af,transparent:!0,opacity:.6,depthTest:!1,depthWrite:!1})]}),(0,Ye.jsxs)("lineLoop",{renderOrder:999,children:[(0,Ye.jsx)("bufferGeometry",{children:(0,Ye.jsx)("bufferAttribute",{attach:"attributes-position",args:[pt,3],count:Zs+1})}),(0,Ye.jsx)("lineBasicMaterial",{color:af,transparent:!0,opacity:.6,depthTest:!1,depthWrite:!1})]})]})]}),!Ie&&!bt&&(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)("mesh",{ref:_,children:[(0,Ye.jsx)("cylinderGeometry",{args:[e1,e1,1,8,1,!0]}),(0,Ye.jsx)("meshBasicMaterial",{color:Q0,transparent:!0,opacity:.05,blending:yt.AdditiveBlending,depthWrite:!1,depthTest:!1})]}),(0,Ye.jsxs)("line",{ref:k,children:[(0,Ye.jsx)("bufferGeometry",{ref:b,children:(0,Ye.jsx)("bufferAttribute",{attach:"attributes-position",args:[ce,3],count:2})}),(0,Ye.jsx)("lineBasicMaterial",{color:Q0,transparent:!0,opacity:.7,blending:yt.AdditiveBlending})]})]}),bt&&(0,Ye.jsxs)("group",{ref:h,children:[(0,Ye.jsxs)("lineLoop",{renderOrder:999,children:[(0,Ye.jsx)("bufferGeometry",{ref:P,children:(0,Ye.jsx)("bufferAttribute",{attach:"attributes-position",args:[Bt,3],count:Qu+1})}),(0,Ye.jsx)("lineBasicMaterial",{color:t1,transparent:!0,opacity:.85,depthTest:!1,depthWrite:!1})]}),(0,Ye.jsxs)("lineSegments",{renderOrder:999,children:[(0,Ye.jsx)("bufferGeometry",{ref:A,children:(0,Ye.jsx)("bufferAttribute",{attach:"attributes-position",args:[un,3],count:ep*2})}),(0,Ye.jsx)("lineBasicMaterial",{color:t1,transparent:!0,opacity:.5,depthTest:!1,depthWrite:!1})]})]}),Xt&&a&&(0,Ye.jsx)(rp.PivotControls,{ref:C,matrix:D,autoTransform:!1,fixed:!0,scale:90,lineWidth:3,axisColors:["#ff2d6f","#64dfa6","#2f8fe8"],hoveredColor:"#ffd84d",opacity:.95,depthTest:!1,disableScaling:!0,onDragStart:Tr,onDrag:Tn,onDragEnd:Kt})]})}var Gt=require("react"),s1=require("@react-three/drei"),op=require("@react-three/fiber"),Bn=require("three");var Nn=require("three");function ip(e){e.updateWorldMatrix(!0,!0);let t=new Nn.Matrix4().copy(e.matrixWorld).invert(),n=new Nn.Box3,i=new Nn.Box3,r=!1;return e.traverse(o=>{let a=o;if(!a.isMesh||!a.geometry||(a.geometry.boundingBox||a.geometry.computeBoundingBox(),!a.geometry.boundingBox))return;let s=new Nn.Matrix4().multiplyMatrices(t,o.matrixWorld);i.copy(a.geometry.boundingBox).applyMatrix4(s),n.union(i),r=!0}),r?n.getCenter(new Nn.Vector3):new Nn.Vector3}function o1(e,t="XYZ"){return new Nn.Quaternion().setFromEuler(new Nn.Euler(e[0],e[1],e[2],t))}function E2(e,t,n,i,r="XYZ"){let a=new Nn.Vector3(...i).multiply(new Nn.Vector3(...n)).applyQuaternion(o1(t,r)).add(new Nn.Vector3(...e));return[a.x,a.y,a.z]}function a1(e,t,n,i,r,o="XYZ"){let a=new Nn.Vector3(...E2(e,t,i,r,o)),s=new Nn.Vector3(...r).multiply(new Nn.Vector3(...i)).applyQuaternion(o1(n,o)),l=a.sub(s);return[l.x,l.y,l.z]}var df=require("react/jsx-runtime");function uf({node:e,space:t,onTransformChange:n,onDraggingChange:i}){let r=(0,op.useThree)(C=>C.invalidate),o=(0,Gt.useMemo)(()=>ip(e),[e]),a=(0,Gt.useMemo)(()=>new Bn.Matrix4,[]),s=(0,Gt.useRef)(!1),l=(0,Gt.useRef)(new Bn.Matrix4),c=(0,Gt.useRef)(new Bn.Matrix4),p=(0,Gt.useRef)(null),u=(0,Gt.useRef)(0),d=(0,Gt.useRef)([]),m=(0,Gt.useRef)(null),g=(0,Gt.useRef)(i);g.current=i;let v=(0,Gt.useMemo)(()=>new Bn.Vector3,[]),M=(0,Gt.useMemo)(()=>new Bn.Quaternion,[]),w=(0,Gt.useMemo)(()=>new Bn.Vector3,[]),x=(0,Gt.useMemo)(()=>new Bn.Quaternion,[]),S=(0,Gt.useMemo)(()=>new Bn.Vector3(1,1,1),[]),k=(0,Gt.useMemo)(()=>new Bn.Quaternion,[]),b=(0,Gt.useMemo)(()=>new Bn.Vector3,[]),_=(0,Gt.useMemo)(()=>new Bn.Vector3,[]),y=(0,Gt.useRef)([0,0,0]),h=(0,Gt.useCallback)(()=>{s.current||(e.updateWorldMatrix(!0,!1),v.copy(o).applyMatrix4(e.matrixWorld),e.getWorldQuaternion(M),x.copy(M),t==="world"&&x.identity(),a.compose(v,x,S))},[v,a,x,S,e,o,t,M]);(0,Gt.useLayoutEffect)(()=>(h(),()=>{let C=m.current!==null;C&&(cancelAnimationFrame(m.current),m.current=null),(s.current||C)&&(s.current=!1,g.current(!1));for(let D of d.current)ks(D);d.current=[]}),[h]),(0,op.useFrame)(()=>h());let P=(0,Gt.useCallback)(()=>{m.current!==null&&(cancelAnimationFrame(m.current),m.current=null),e.updateWorldMatrix(!0,!0),d.current=[];for(let C of Rs(e))ov(C)||(Ed(C,C.matrixWorld),d.current.push(C));e.updateWorldMatrix(!0,!1),v.copy(o).applyMatrix4(e.matrixWorld),e.getWorldQuaternion(M),e.getWorldScale(w),l.current.compose(v,M,w),c.current.copy(a),y.current=[e.rotation.x,e.rotation.y,e.rotation.z],p.current=null,s.current=!0,i(!0)},[v,a,e,i,o,M,w]),A=(0,Gt.useCallback)((C,D)=>{let B=l.current.clone().premultiply(D),j=c.current.clone().premultiply(D);B.decompose(b,M,_);let W=b.clone();j.decompose(v,x,S),t==="world"&&x.identity(),a.compose(v,x,S),C.decompose(b,k,_);let U=new Bn.Euler().setFromQuaternion(k,e.rotation.order),[te,O,$]=y.current,le=[te+U.x,O+U.y,$+U.z],tt=new Bn.Quaternion().setFromEuler(new Bn.Euler(le[0],le[1],le[2],e.rotation.order)),nt=(e.parent?.matrixWorld||new Bn.Matrix4).clone().invert(),ce=W.clone().applyMatrix4(nt),Le=o.clone().multiply(e.scale).applyQuaternion(tt),he=ce.clone().sub(Le),pt=[he.x,he.y,he.z];e.position.set(pt[0],pt[1],pt[2]),e.rotation.set(le[0],le[1],le[2],e.rotation.order),e.updateMatrixWorld(!0),r(),p.current={position:pt,rotation:le}},[v,k,a,x,S,r,e,o,b,_,t,M]);return(0,df.jsx)("group",{children:(0,df.jsx)(s1.PivotControls,{matrix:a,autoTransform:!1,fixed:!0,scale:90,lineWidth:3,axisColors:["#ff2d6f","#64dfa6","#2f8fe8"],hoveredColor:"#ffd84d",opacity:.95,depthTest:!1,disableScaling:!0,onDragStart:P,onDrag:(C,D,B,j)=>A(D,j),onDragEnd:()=>{s.current=!1;let C=p.current;if(p.current=null,C)n(C),m.current=requestAnimationFrame(()=>{m.current=null,i(!1)});else if(d.current.length>0){for(let D of d.current)ks(D);e.updateMatrixWorld(!0),r(),i(!1)}else i(!1);d.current=[]}})})}var L=require("react/jsx-runtime");function R2(e){let t=e.object;if(!t.isSkinnedMesh||!e.face||!t.skeleton)return null;let n=t.geometry,i=n.getAttribute("skinIndex"),r=n.getAttribute("skinWeight"),o=n.getAttribute("position");if(!i||!r||!o)return null;let a=t.worldToLocal(e.point.clone()),s=[e.face.a,e.face.b,e.face.c],l=new Tt.Vector3,c=s[0],p=1/0;for(let m of s){l.fromBufferAttribute(o,m);let g=l.distanceToSquared(a);g<p&&(p=g,c=m)}let u=i.getComponent(c,0),d=r.getComponent(c,0);for(let m=1;m<4;m++){let g=r.getComponent(c,m);g>d&&(d=g,u=i.getComponent(c,m))}return t.skeleton.bones[u]??null}function k2(e){let t=R2(e)??e.object,n=Kl(t);if(!n)return null;t.updateWorldMatrix(!0,!1);let i=t.worldToLocal(e.point.clone());return{anchorNodeName:n,anchorLocalPosition:[i.x,i.y,i.z]}}function L2(e,t,n){if(!e.anchorNodeName||!e.anchorLocalPosition)return!1;let i=Xi(t,e.anchorNodeName);return i?(i.updateWorldMatrix(!0,!1),n.set(...e.anchorLocalPosition).applyMatrix4(i.matrixWorld),!0):!1}function D2({annotation:e,enabled:t,controlsRef:n,offsetRef:i}){let r=(0,Qs.useThree)(d=>d.scene),o=(0,E.useRef)(null),a=(0,E.useRef)(!1),s=(0,E.useMemo)(()=>new Tt.Vector3,[]),l=(0,E.useMemo)(()=>new Tt.Vector3,[]),c=(0,E.useMemo)(()=>new Tt.Vector3,[]),p=e?.anchorNodeName,u=e?.anchorLocalPosition;return(0,E.useEffect)(()=>{o.current=null,a.current=!1},[p,e?.id]),(0,Qs.useFrame)(()=>{let d=n.current,m=i.current;if(!t||!d||!m||!p||!u){a.current=!1;return}let g=o.current;if((!g||!g.parent)&&(g=Xi(r,p),o.current=g),!g){a.current=!1;return}g.updateWorldMatrix(!0,!1),s.set(u[0],u[1],u[2]).applyMatrix4(g.matrixWorld),!(a.current&&s.distanceToSquared(l)<1e-8)&&(l.copy(s),a.current=!0,c.copy(s).add(m),d.setLookAt(c.x,c.y,c.z,s.x,s.y,s.z,!0))}),null}function N2(e){let t={total:0,missing:0};return e.traverse(n=>{let i=n;!i.isMesh||!i.geometry||(t.total+=1,i.geometry.getAttribute("uv")||(t.missing+=1))}),t}var B2=.2,l1=Object.freeze({});function O2({enabled:e,speed:t,controlsRef:n}){let i=(0,Qs.useThree)(r=>r.invalidate);return(0,Qs.useFrame)((r,o)=>{!e||!n.current||(n.current.rotate(o*B2*t,0,!1),i())}),null}function I2(e,t,n){let i=t?.camera;if(!(i instanceof Tt.PerspectiveCamera))return null;let o=(e instanceof Tt.Box3?e:new Tt.Box3().setFromObject(e)).getSize(new Tt.Vector3).length();return!Number.isFinite(o)||o<=0?null:(i.near=o/100,i.far=o*100,i.updateProjectionMatrix(),t&&n===void 0&&(t.maxDistance=o*10),o)}function z2(e,t){let n=e.camera;if(!(n instanceof Tt.PerspectiveCamera)||!(t>0))return;let i=Math.min(Math.max(e.distance/200,t/1e5),t/100);Math.abs(i-n.near)<=n.near*.01||(n.near=i,n.updateProjectionMatrix())}async function c1(e,t,n=.6){let i=e.smoothTime;e.smoothTime=n;try{return await t()}finally{e.smoothTime=i}}function Ac(e){let t=pb(),n=fb(e);return(0,L.jsx)(U2,{...Bb(e),contextRecovery:t,engagement:n},t.generation)}function U2({contextRecovery:e,engagement:t,modelUrl:n,tilesetUrl:i,tilesErrorTarget:r=8,tilesCacheSize:o=800,onObjectCatalog:a,modelFormat:s,licenseKey:l,licenseValidationUrl:c,objectBindings:p="auto",selectedObject:u,panelHoveredObject:d,onObjectBindingsChange:m,onObjectSelect:g,onObjectHover:v,onObjectDoubleClick:M,onObjectContextMenu:w,decalMove:x,onObjectEditLeaseChange:S,onSceneLoaded:k,onModelLoaded:b,onLoadError:_,onProgress:y,onCameraControllerChange:h,cameraControllerType:P,onAction:A,onHiddenObjectsChange:C,onCameraChange:D,onViewerReady:B,onTextureUpload:j,onAnimationsReady:W,onAnnotationsChange:U,activeAnnotation:te,onActiveAnnotationChange:O,camera:$,cameraLimits:le,backgroundColor:tt,shadows:xe=!0,showObjectBindingDataPanel:nt=!0,customObjectBindingDataPanel:ce,customSceneObjectsPanel:Le,showSceneObjectsPanel:he=!0,showDownloadButton:pt=!0,downloadFilename:Bt="model",showResetButton:un=!0,showFullscreenButton:Ie=!1,showLoadingOverlay:bt=!0,showMouseController:Ot=!1,mouseControllerPosition:dr="center-bottom",mouseControllerOpacity:de=1,moveSensitivity:Cr=.08,zoomSensitivity:Xt=1,sceneConfig:Et,onSceneConfigChange:rt,disableZoom:bn=!1,zoomOnSelected:Tr=!0,highlightOnHover:Tn=!0,enableCameraControls:Kt=!0,onAutoFit:fe,refitOnResize:We=!0,renderMode:xn="demand",maxDpr:It=2,preserveDrawingBuffer:zt=!1,performanceProfile:oe="auto",dracoDecoderPath:ye,ktx2TranscoderPath:Ae,meshopt:ct=!0,showMeasureTools:ht=!1,showUvCheckerButton:Ke=!1,showExplodeControls:wt=!1,showMaterialVariants:_e=!0,showSectionTools:qe=!1,isolation:dt,onIsolationChange:pn,showIsolateControls:ur=!1,cinematic:en,measurementUnit:Hn="m",enableXR:Xr=!1,usdzUrl:pr,arScaleMode:to="normalized",mobileHandoffUrl:aa,showAnnotationNavigation:tn=!0,showAnnotationOnHover:Pr=!1,moveModeEnabled:F=!1,objectTransformSpace:H="world",enableKeyboardNavigation:q=!1,showViewGizmo:ie=!1,overlay:ae,unsafe_sceneChildren:we,autoRotate:Pe,autoRotateSpeed:at,onTexturePositioningChange:De,endTexturePositioningRef:Rt,texturePositioning:vt}){(0,E.useEffect)(()=>()=>t.interrupt(),[t]);let qt=(0,E.useRef)(t);qt.current=t;let Me=p==="auto",Ve=Me?l1:p,{isInsideEditor:hn,activeTab:On,activeSubTab:hr}=Sr(),$n=hn&&On==="scene"&&hr==="Lighting",Pn=Gu(l,c),[mi,Mp]=(0,E.useState)({}),[sa,Mo]=(0,E.useState)(void 0),[Ka,Vc]=(0,E.useState)(void 0),ze=(0,E.useMemo)(()=>{let f=xh(Et??Aa,mi);return sa!==void 0&&(f={...f,model:{...f.model,materialVariant:sa}}),Ka!==void 0&&(f={...f,section:{...Pa,...f.section,...Ka}}),f},[Et,mi,sa,Ka]),Ar=(0,E.useRef)(ze);Ar.current=ze,(0,E.useEffect)(()=>{t.setMaterialVariant(ze.model.materialVariant??null)},[ze.model.materialVariant,t]);let fi=Et?.model.materialVariant;(0,E.useEffect)(()=>{Mo(void 0)},[fi,n]);let jc=JSON.stringify(Et?.section??null);(0,E.useEffect)(()=>{Vc(void 0)},[jc,n]);let Co=(0,E.useCallback)(f=>{if(rt){let T=Ar.current;rt({...T,section:{...Pa,...T.section,...f}});return}Vc(T=>({...T,...f}))},[rt]),[cl,To]=(0,E.useState)(!1),Za=(0,E.useCallback)(f=>{if(t.chooseVariant(f,Ar.current.model.materialVariant??null),rt){let T=Ar.current;rt({...T,model:{...T.model,materialVariant:f}});return}Mo(f)},[rt,t]),no=(0,E.useCallback)(f=>{if(rt){rt(xh(Ar.current,f));return}Mp(T=>{let N={...T};for(let[V,z]of Object.entries(f))N[V]={...T[V],...z};return N})},[rt]),[gi,mn]=(0,E.useState)(null),[Yn,mr]=(0,E.useState)(null),[Ja,In]=(0,E.useState)(null),qr=(0,E.useRef)(0),[Er,nr]=(0,E.useState)(null),[nn,dl]=(0,E.useState)(null),Po=ze.model.renderer==="uv-checker",ro=Ke?nn??Po:Po,$r=(0,E.useMemo)(()=>{let f=ro?"uv-checker":Po?"pbr":ze.model.renderer;return f===ze.model.renderer?ze:{...ze,model:{...ze.model,renderer:f}}},[Po,ze,ro]);(0,E.useEffect)(()=>{dl(null)},[n,ze.model.renderer,Ke,i]);let Cp=(0,E.useMemo)(()=>{if(tt)return tt;let f=ze.background;return f.enabled&&f.type==="color"?f.color:"#1c1c1d"},[tt,ze]),Hc=(0,E.useMemo)(()=>({dracoDecoderPath:ye,ktx2TranscoderPath:Ae,meshopt:ct}),[ye,Ae,ct]),Tp=(0,E.useMemo)(()=>Bv(oe),[oe]),Ze=(0,E.useRef)(null),[cn,ul]=(0,E.useState)("orbit"),[Ii,Gc]=(0,E.useState)(!1),zi=P!==void 0?P:cn,bi=(0,E.useCallback)(f=>{Gc(!1),f!==zi&&(ul(f),h?.(f))},[zi,h]),[Ao,Rr]=(0,E.useState)(!1),[Fe,la]=(0,E.useState)(null),Eo=!!(vt||De||Rt),kr=(0,E.useRef)(De);kr.current=De,(0,E.useEffect)(()=>{kr.current?.(Fe)},[Fe]),(0,E.useEffect)(()=>{if(Rt)return Rt.current=()=>la(null),()=>{Rt.current=null}},[]),(0,E.useEffect)(()=>{Ze.current&&(Ze.current.dollySpeed=Math.max(Xt,0))},[Xt]),(0,E.useEffect)(()=>{Ze.current&&(Ze.current.enabled=Kt&&!Ao&&!cl&&!Fe)},[Kt,Ao,cl,Fe]);let pl=(0,E.useRef)(null),rr=(0,E.useRef)(new Map),Qa=(0,E.useRef)(null),Wc=(0,E.useRef)(null),fr=(0,E.useRef)(null),Ui=(0,E.useRef)({});(0,E.useEffect)(()=>()=>{for(let f of Object.values(Ui.current))URL.revokeObjectURL(f)},[]);let An=(0,E.useRef)({}),[,Pp]=(0,E.useState)(0),Xc=(0,E.useCallback)(()=>{Pp(f=>f+1)},[]),es=(0,E.useRef)({}),qc=(0,E.useRef)(null),Lr=db(Ie),vi=(0,E.useRef)(null),[xi,Ap]=(0,E.useState)(null),Ep=(0,E.useCallback)(f=>{vi.current=f,Ap(f)},[]),ts=(0,E.useRef)(new Set),io=(0,E.useRef)(null);(0,E.useEffect)(()=>{let f=xi;if(!f||!q||!Kt||F)return;let T=new Set(["w","a","s","d"," ","c"]),N=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]),V=0,z=Te=>Te.code==="Space"?" ":Te.key.toLowerCase(),se=()=>{ts.current.clear(),V=0,io.current!==null&&(cancelAnimationFrame(io.current),io.current=null)},pe=Te=>{let Qe=Ze.current,et=ts.current;if(!Qe||et.size===0){io.current=null,V=0;return}let vn=V?Math.min((Te-V)/1e3,.05):1/60;V=Te;let wn=Math.max(Qe.distance*.75,.01)*vn;et.has("w")&&Qe.forward(wn,!1),et.has("s")&&Qe.forward(-wn,!1),et.has("a")&&Qe.truck(-wn,0,!1),et.has("d")&&Qe.truck(wn,0,!1),et.has(" ")&&Qe.truck(0,wn,!1),et.has("c")&&Qe.truck(0,-wn,!1),io.current=requestAnimationFrame(pe)},He=Te=>{if(Te.target!==f){se();return}if(N.has(Te.key)){let et=Ze.current;if(!et)return;Te.preventDefault();let vn=Math.PI/90,wn=Math.max(et.distance*.05,.01);Te.key==="ArrowUp"?Te.shiftKey?et.forward(wn,!0):et.rotate(0,-vn,!0):Te.key==="ArrowDown"?Te.shiftKey?et.forward(-wn,!0):et.rotate(0,vn,!0):Te.key==="ArrowLeft"?et.rotate(-vn,0,!0):et.rotate(vn,0,!0);return}let Qe=z(Te);T.has(Qe)&&(Te.preventDefault(),ts.current.add(Qe),io.current===null&&(io.current=requestAnimationFrame(pe)))},it=Te=>{ts.current.delete(z(Te))};return f.addEventListener("keydown",He),f.addEventListener("keyup",it),f.addEventListener("blur",se),()=>{f.removeEventListener("keydown",He),f.removeEventListener("keyup",it),f.removeEventListener("blur",se),se()}},[xi,Kt,q,F]);let ns=(0,E.useRef)(null),[Rp,$c]=(0,E.useState)(Ve),[Ro,rs]=(0,E.useState)({}),[Yc,hl]=(0,E.useState)(null),[ml,Kc]=(0,E.useState)(null),[kp,Zc]=(0,E.useState)(null),[Lp,Dp]=(0,E.useState)(null),[Dr,Jc]=(0,E.useState)(null),[Np,Qc]=(0,E.useState)({}),En=(0,E.useRef)(null),is=(0,E.useRef)(null),fl=(0,E.useRef)(0),ed=(0,E.useRef)(null),[Bp,Op]=(0,E.useState)(0),Fi=(0,E.useRef)(!1),ca=(0,E.useRef)(!1),gl=(0,E.useRef)(!!$);gl.current=!!$;let Yr=(0,E.useRef)(null),[Kr,da]=(0,E.useState)(!!n),[Vi,ua]=(0,E.useState)(!n||!!fe||!!$),[Nr,R]=(0,E.useState)(!1),[I,Z]=(0,E.useState)([]),[ee,ue]=(0,E.useState)(!1),[Ee,Je]=(0,E.useState)(null),[Ce,St]=(0,E.useState)(!1),[Kn,os]=(0,E.useState)(0),bl=(0,E.useRef)(""),jf=(0,E.useRef)(""),[Hf,Gf]=(0,E.useState)(!1),[Wf,jw]=(0,E.useState)(null),[Hw,Xf]=(0,E.useState)(!1),[vl,qf]=(0,E.useState)({total:0,missing:0}),[Gw,$f]=(0,E.useState)("Loading model..."),[Ww,Ip]=(0,E.useState)(null),Zn=(0,E.useRef)({}),xl=(0,E.useCallback)(()=>{let f=Ze.current;if(!f||Yr.current)return;let T=f.getPosition(new Tt.Vector3),N=f.getTarget(new Tt.Vector3);Yr.current={position:[T.x,T.y,T.z],target:[N.x,N.y,N.z]}},[]),[yl,td]=(0,E.useState)(!1),[nd,Yf]=(0,E.useState)(0),[zp,Kf]=(0,E.useState)(!1);(0,E.useEffect)(()=>{Yf(0),Kf(!1)},[n,i]);let pa=(0,E.useMemo)(()=>{let f=ze.cinematic,T=f?.enabled?{waypoints:f.waypoints,duration:f.duration,loop:f.loop,autoPlay:f.autoPlay}:null;return en===void 0?T&&(T.waypoints?.length??0)>=2?T:null:en===!1?null:en===!0?T??{}:{...T??{},...en}},[en,ze]),[ha,Br]=(0,E.useState)(!1),[Xw,ma]=(0,E.useState)(!1),Up=(0,E.useRef)(!1);(0,E.useEffect)(()=>{Br(!1),ma(!1),Up.current=!1},[n,i]),(0,E.useEffect)(()=>{!pa?.autoPlay||Up.current||Nr&&Vi&&!Kr&&(Up.current=!0,Br(!0),ma(!1))},[pa,Nr,Vi,Kr]);let qw=(0,E.useCallback)(()=>{Br(!1),ma(!0)},[]),{captureVideo:Fp,cancelVideo:Vp,isRecording:Zf,recording:yn,progress:$w,onProgress:Yw}=cb({rendererCaptureRef:fr,controlsRef:Ze,cinematicConfig:pa,ready:e.status==="ready"&&Nr&&Vi&&!Kr,modelUrl:`${n}|${i??""}`,onCaptureStart:qw});(0,E.useEffect)(()=>{e.status==="lost"&&(t.interrupt(),Vp(),Br(!1),Ze.current?.stop())},[e.status,Vp,t]);let{xrStore:fa,presenterRef:Kw,arSupported:jp,vrSupported:Jf,quickLookSupported:Qf,resolvedMobileHandoffUrl:rd,isMobileHandoffOpen:eg,arOverlay:Zw,openMobileHandoff:Jw,closeMobileHandoff:tg,openQuickLook:Qw,handleARStateChange:eS}=Fv({enableXR:Xr,usdzUrl:pr,mobileHandoffUrl:aa,engagement:t}),[ji,ng]=(0,E.useState)(()=>Et?.annotations??[]);(0,E.useEffect)(()=>{if(ji.length>0){let f=ji.reduce((T,N)=>Math.max(T,N.id),0);ad.current=f}else ad.current=0},[ji]);let[gr,id]=(0,E.useState)(null),[ko,od]=(0,E.useState)({title:"",description:""}),ad=(0,E.useRef)(0),[tS,rg]=(0,E.useState)(null),[Zr,as]=(0,E.useState)(-1),[ig,sd]=(0,E.useState)(!1),ss=(0,E.useRef)(null),fn=(0,E.useMemo)(()=>[...ji].sort((f,T)=>f.id-T.id),[ji]),yi=ze.section??Pa,og=_e&&Nr&&I.length>1,ag=un||pt||Ie&&Lr.supported||tn&&fn.length>0,ld=(0,E.useMemo)(()=>Zr<0||Zr>=fn.length?null:fn[Zr],[Zr,fn]),Hi=(0,E.useCallback)(f=>{if(te!==void 0){O?.(f);return}rg(f?{annotation:f}:null)},[te,O]),ls=(0,E.useCallback)(f=>{let T=Ze.current,N=En.current;if(!T)return;let V=new Tt.Vector3,z=rr.current.get(f.id);z?V.copy(z):N&&L2(f,N,V)||V.set(f.worldPosition[0],f.worldPosition[1],f.worldPosition[2]),pl.current=null;let se=T.smoothTime;T.smoothTime=.6;let pe=f.worldNormal;if(N){let He=new Tt.Box3().setFromObject(N),it=new Tt.Vector3;He.getCenter(it);let Te=new Tt.Vector3;He.getSize(Te);let Qe=Te.length()*.2,et;pe?et=new Tt.Vector3(pe[0],pe[1],pe[2]):et=V.clone().sub(it),et.lengthSq()<1e-6&&et.set(0,0,1),et.normalize();let vn=Math.max(Qe*.6,.3),wn=V.clone().add(et.multiplyScalar(vn));T.setPosition(wn.x,wn.y,wn.z,!0),f.anchorNodeName&&f.anchorLocalPosition&&(pl.current=wn.clone().sub(V))}T.setTarget(V.x,V.y,V.z,!0),ss.current&&clearTimeout(ss.current),ss.current=setTimeout(()=>{T.smoothTime=se,ss.current=null},800),Hi(f)},[Hi]),nS=(0,E.useCallback)(()=>{fn.length!==0&&(t.startTour(fn.length),td(!0),as(0),ls(fn[0]))},[fn,ls,t]),rS=(0,E.useCallback)(()=>{if(fn.length===0||Zr<0)return;sd(!0);let f=(Zr-1+fn.length)%fn.length;as(f),ls(fn[f]),setTimeout(()=>sd(!1),500)},[Zr,fn,ls]),iS=(0,E.useCallback)(()=>{if(fn.length===0||Zr<0)return;if(Zr===fn.length-1){if(t.completeTour(),td(!1),as(-1),Hi(null),Ze.current&&Yr.current){let T=Yr.current;Ze.current.setLookAt(T.position[0],T.position[1],T.position[2],T.target[0],T.target[1],T.target[2],!0)}return}sd(!0);let f=Zr+1;as(f),ls(fn[f]),setTimeout(()=>sd(!1),500)},[Zr,fn,ls,Hi,t]),oS=(0,E.useCallback)(()=>{if(t.stopTour(),td(!1),as(-1),Hi(null),Ze.current&&Yr.current){let f=Yr.current;Ze.current.setLookAt(f.position[0],f.position[1],f.position[2],f.target[0],f.target[1],f.target[2],!0)}},[Hi,t]);(0,E.useEffect)(()=>{qt.current.stopTour("annotations-changed"),as(-1),td(!1)},[fn.length]),(0,E.useEffect)(()=>()=>{ss.current&&clearTimeout(ss.current)},[]),(0,E.useEffect)(()=>{ld&&yl&&Hi(ld)},[ld,Hi,yl]),(0,E.useEffect)(()=>{if(Et?.annotations===void 0)return;let f=Et.annotations.map(T=>({...T,localPosition:T.localPosition??T.worldPosition}));ng(f)},[Et?.annotations]);let wl=(0,E.useCallback)(()=>{if(te!==void 0){O?.(null);return}rg(null)},[te,O]),Sl=te!==void 0?te:tS?.annotation??null,_l=(0,E.useMemo)(()=>Sl?ji.find(T=>T.id===Sl.id)??null:null,[Sl,ji]);(0,E.useEffect)(()=>{Sl&&!_l&&wl()},[Sl,_l,wl]);let Ml=!Me&&m!==void 0,je=Ml?Ve:Rp;Zn.current=je,(0,E.useEffect)(()=>{if(!Fe)return;let f=je[Fe.objectKey]?.style?.material?.[Fe.textureKey]?.path;(!Eo||!f)&&la(null)},[je,Eo,Fe]);let Hp=(0,E.useRef)({}),[cd,aS]=(0,E.useState)({});(0,E.useEffect)(()=>{let f={...cd},T=!1,N=new Set;for(let[V,z]of Object.entries(je)){N.add(V);let se=z.style?.material,pe=Hp.current[V]??{},He={};for(let Te of Wi){let Qe=se?.[Te]?.path;Qe&&(He[Te]=Qe,Qe!==pe[Te]&&(f[V]!==Te&&(T=!0),f[V]=Te))}let it=f[V];if(it&&!He[it]){let Te=Wi.find(Qe=>!!He[Qe]);Te?f[V]=Te:delete f[V],T=!0}Hp.current[V]=He}for(let V of Object.keys(f))N.has(V)||(delete f[V],delete Hp.current[V],T=!0);T&&aS(f)},[je]);let sS=(0,E.useMemo)(()=>Object.entries(je).map(([f,T])=>JSON.stringify([f,T.modelObjectId,T.transform??null])).sort().join(""),[je]),{measureMode:cs,measureModeRef:sg,measurePoints:lg,measurementTool:cg,areaClosed:dg,measurementError:lS,selectMeasurementTool:cS,undoMeasurementPoint:dS,finishMeasureArea:uS,snapMode:pS,setSnapMode:hS,snapPreview:mS,handleMeasurePointerMove:fS,clearSnapPreview:ug,showDimensions:pg,measureBox:Gp,modelBounds:gS,refreshBounds:hg,clearMeasurements:bS,toggleMeasureMode:vS,toggleDimensions:xS,handleMeasurePointerDown:yS,handleMeasureClick:wS}=Lv({canvasAreaRef:vi,controlsRef:Ze,sceneRef:En,modelUrl:`${n}|${i??""}`,modelRotation:ze.model.rotation,bindingTransformSignature:sS,modelLoaded:Nr,enabled:ht&&!yn}),[SS,_S]=(0,E.useState)(34),{isDownloading:Wp,downloadMenuOpen:MS,uvExportError:mg,toggleDownloadMenu:CS,handleDownloadMesh:TS,handleDownloadScreenshot:PS,handleDownloadUvLayout:AS,handleDownloadVideo:fg,videoFormat:Xp,setVideoFormat:ES,videoExportError:gg}=Pv({sceneRef:En,materialRefs:es,rendererCaptureRef:fr,objectBindings:je,downloadFilename:Bt,captureVideo:Fp}),bg=(0,E.useMemo)(()=>Object.fromEntries(Object.entries(je).filter(([,f])=>f.visible===!1).map(([f])=>[f,!0])),[je]),oo=(0,E.useMemo)(()=>{let f=new WeakMap,T=new Map,N=new Map;for(let[V,z]of Object.entries(je))f.set(z,V),T.has(z.id)||T.set(z.id,V),N.has(z.modelObjectId)||N.set(z.modelObjectId,V);return{byReference:f,byId:T,byModelObjectId:N}},[je]),Or=(0,E.useCallback)(f=>f?oo.byReference.get(f)??oo.byModelObjectId.get(f.modelObjectId)??oo.byId.get(f.id)??null:null,[oo]),qp=u!==void 0,Cl=qp?u??null:Lp,ir=Or(Cl);(0,E.useEffect)(()=>{t.setSelectedPart(ir)},[ir,t]);let $p=ir?An.current[ir]??null:null,RS=ir?cd[ir]:void 0,vg=Or(Tn?d??ml??kp:null),kS=vg?An.current[vg]??null:null,xg=(0,E.useCallback)(f=>{Zc(f),v?.(f)},[v]),yg=nt&&Cl!==null&&ir!==null,Tl=(ir?je[ir]:null)??Cl,Pl=Tl&&(Tl.modelObjectId||Tl.id)||null,ds=Pl?Np[Pl]??null:null;(0,E.useEffect)(()=>{Ml||$c(Ve)},[Ml,Ve]),(0,E.useEffect)(()=>{C?.(bg)},[bg,C]);let us=(0,E.useCallback)((f,T)=>{if(zi==="pointerLock"){bi("orbit");return}f&&T?t.viewPart({objectId:f.id,objectKey:Or(f)??(f.modelObjectId||f.id),label:f.label,source:T}):f||t.setSelectedPart(null),qp||Dp(f),g?.(f)},[zi,bi,qp,g,Or,t]),Jr=(0,E.useCallback)(f=>{Ml||$c(f),m?.(f)},[Ml,m]),wg=(0,E.useRef)(null),dd=(0,E.useCallback)(f=>{if(!Me)return;let T=`${n}
|
|
3689
|
-
${i??""}`,N=wg.current===T?Zn.current:l1;wg.current=T;let V=X0(f);for(let z of Object.keys(V))N[z]&&(V[z]=N[z]);Jr(V)},[Me,n,i,Jr]),ud=(0,E.useRef)({}),ps=(0,E.useCallback)(f=>{let T=Fb(An.current[f]),N=Zn.current[f]?.style?.material,V=N?.emissive??T.color,z=N?.emissiveIntensity??T.intensity;return{color:V,intensity:z,on:V!=="#000000"&&z>0}},[]),Al=(0,E.useCallback)((f,T)=>{let N=Zn.current,V=N[f];V&&Jr({...N,[f]:{...V,style:{...V.style,material:{...V.style?.material,...T}}}})},[Jr]),Yp=f=>f==="#000000"?"#ffffff":f,LS=(0,E.useCallback)(f=>{let T=ir;if(!T||!f)return;let N=Zn.current[T];N&&Jr({...Zn.current,[T]:{...N,transform:{...N.transform,...f}}})},[Jr,ir]),wi=(0,E.useCallback)((f,T)=>je[f]?f:T?Or(T):oo.byId.get(f)??oo.byModelObjectId.get(f)??null,[je,Or,oo]),or=(0,E.useCallback)((f,T)=>{let N=wi(f),V=N?je[N]:void 0;!N||!V||Jr({...je,[N]:{...V,style:T(V.style)}})},[wi,je,Jr]),Ir=(0,E.useCallback)(()=>{if(Dr){let f=Ro[Dr.objectId]?.hex;f!==void 0&&(or(Dr.objectId,T=>({...T,material:{...T?.material,baseColor:f}})),rs(T=>({...T,[Dr.objectId]:{}})))}Jc(null)},[Dr,Ro,or]),Sg=(0,E.useCallback)(()=>{us(null),hl(null),Ir()},[us,Ir]),Kp=(0,E.useCallback)((f,T,N,V,z)=>{let se=qc.current,pe=vi.current,He=Ze.current?.camera;if(!se)return{objectId:f,x:24,y:24};let it=se.getBoundingClientRect(),Te=12,Qe=it.width-T-Te,et=it.height-N-Te,vn=Math.max(Te,(it.width-T)/2),wn=Math.max(Te,(it.height-N)/2),ys=wi(f,V),Rl=ys?An.current[ys]:null,Gi=(ws,xa)=>xa<=Te?Te:Math.min(Math.max(ws,Te),xa);if(pe&&He&&Rl){let ws=pe.getBoundingClientRect(),xa=new Tt.Vector3;new Tt.Box3().setFromObject(Rl).getCenter(xa),xa.project(He);let a_=(xa.x+1)/2*ws.width+(ws.left-it.left),s_=(1-xa.y)/2*ws.height+(ws.top-it.top);return{objectId:f,x:Gi(a_+24,Qe),y:Gi(s_-N/2,et)}}let sh=typeof z?.screenX=="number"?z.screenX-it.left:vn,lh=typeof z?.screenY=="number"?z.screenY-it.top:wn;return{objectId:f,x:Gi(sh,Qe),y:Gi(lh,et)}},[wi]),pd=(0,E.useCallback)(f=>{let{objectId:T,action:N,binding:V}=f;switch(hl(f),N.id){case"toggle-visibility":{let z=T;V?.modelObjectId&&(z=oo.byModelObjectId.get(V.modelObjectId)??z);let se=je[z],pe=se?.visible===!1;se&&Jr({...je,[z]:{...se,visible:pe}});break}case"change-color":Ir(),Qc(z=>{if(!(T in z))return z;let se={...z};return delete se[T],se}),rs(z=>{let se=wi(T,V)??T,pe=z[T]?.hex,He=je[se]?.style?.material?.baseColor;return{...z,[T]:{...z[T],hex:pe??He??"#ffffff"}}}),Jc(Kp(T,225,250,V,f));break;case"change-material":Ir(),Qc(z=>{if(T in z){let se={...z};return delete se[T],se}return{...z,[T]:Kp(T,300,320,V,f)}});break;case"add-text":case"add-image":{Ir();let z=N.id;qr.current++,In(null),nr(null),mr(se=>se?.objectId===T&&se.kind===z?null:{objectId:T,kind:z,activeId:null});break}case"toggle-light":case"change-light-color":case"set-brightness":{let z=wi(T,V);if(!z)break;let se=Ub(Ar.current,je,z);if(N.id==="toggle-light"){if(se.length>0){let Te=!se.some(Qe=>Qe.visible);no(Object.fromEntries(se.map(Qe=>[Qe.id,{visible:Te}])));break}let it=ps(z);it.on?(ud.current[z]=it.intensity,Al(z,{emissiveIntensity:0})):Al(z,{emissive:Yp(it.color),emissiveIntensity:ud.current[z]??1});break}let pe=N.id,He=se.length>0?null:ps(z);mn(it=>it?.objectId===T&&it.kind===pe?null:{objectId:T,kind:pe,target:He?{type:"glow",objectKey:z,baseIntensity:He.on?He.intensity:ud.current[z]??1}:{type:"lights",lightIds:se.map(Te=>Te.id),baseIntensity:Object.fromEntries(se.map(Te=>[Te.id,Te.intensity]))},percent:He&&!He.on?0:100});break}default:break}A?.(f)},[Jr,Al,no,ps,je,Kp,A,Ir,wi,oo]);(0,E.useEffect)(()=>{if(Dr)return window.addEventListener("pointerdown",Ir),()=>window.removeEventListener("pointerdown",Ir)},[Dr,Ir]),(0,E.useEffect)(()=>{if(!_l)return;let f=T=>{if(ns.current&&!ns.current.contains(T.target)){if(T.target.closest?.(".ri-annotationMarker"))return;wl()}};return document.addEventListener("mousedown",f),document.addEventListener("touchstart",f),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("touchstart",f)}},[_l,wl]),(0,E.useEffect)(()=>{if(!gr)return;let f=T=>{let N=T.target;if(N.closest?.(".ri-annotationPopup")||N.closest?.("button, input, textarea, .ri-measureTools, .ri-xrTools, .ri-buttonContainer"))return;let V=vi.current;!V||!V.contains(N)||(id(null),od({title:"",description:""}))};return document.addEventListener("mousedown",f,!0),document.addEventListener("touchstart",f,!0),()=>{document.removeEventListener("mousedown",f,!0),document.removeEventListener("touchstart",f,!0)}},[gr]);let _g=(0,E.useCallback)((f,T)=>{let N=Ui.current[f];N&&URL.revokeObjectURL(N),T.startsWith("blob:")?Ui.current[f]=T:delete Ui.current[f],or(f,V=>({...V,material:{...V?.material,texture:{path:T}}}))},[or]),DS=f=>{let T=f.target.files?.[0],N=Wc.current;if(!T||!N)return;let V=wi(N);V&&(j?j(T,V).then(z=>_g(V,z),z=>console.error("onTextureUpload failed:",z)):_g(V,URL.createObjectURL(T)),f.target.value="")},Mg=f=>{Wc.current=f,Qa.current?.click()},Cg=f=>{let T=wi(f);if(!T)return;or(T,V=>V?.material?.texture?{...V,material:{...V.material,texture:void 0}}:V);let N=Ui.current[T];N&&(URL.revokeObjectURL(N),delete Ui.current[T])},hs=!!vt,Si=typeof vt=="object"?vt:void 0,NS=(0,E.useCallback)((f,T,N)=>{if(Si?.onOffsetChange){Si.onOffsetChange(f,T,N);return}or(f,V=>{let z=V?.material?.texture;if(!z?.path)return V;let se=z.offset??[0,0],pe=[se[0],se[1]];return pe[T]=N,{...V,material:{...V?.material,texture:{...z,offset:pe}}}})},[or,Si]),BS=(0,E.useCallback)((f,T)=>{if(Si?.onRotationChange){Si.onRotationChange(f,T);return}or(f,N=>{let V=N?.material?.texture;if(!V?.path)return N;let z=(T%360+360)%360;return{...N,material:{...N?.material,texture:{...V,rotation:z*Math.PI/180}}}})},[or,Si]),OS=(0,E.useCallback)(()=>{la(null),Si?.onEndPositioning?.()},[Si]),Zp=(0,E.useRef)(B);Zp.current=B;let _i=(0,E.useCallback)(()=>{let f=Ze.current;!f||!Zp.current||Zp.current({objectBindings:Zn.current,homeCameraState:Yr.current,captureImage:T=>Zf()?Promise.reject(new Error("Wait for video export to finish before capturing an image.")):wd(fr.current,T),captureVideo:Fp,invalidate:()=>fr.current?.invalidate(),raw:{controls:f,scene:En.current,nodes:An.current}})},[Fp,Zf]),ms=(0,E.useCallback)(async(f=!1)=>{let T=Ze.current,N=is.current??En.current;if(!T||!N)return!1;try{if(f){let V=(N instanceof Tt.Box3?N:new Tt.Box3().setFromObject(N)).getBoundingSphere(new Tt.Sphere),z=V.center.clone(),pe=T.getPosition(new Tt.Vector3).clone().sub(T.getTarget(new Tt.Vector3));pe.lengthSq()<1e-6&&pe.set(0,0,1),pe.normalize();let He=Math.max(V.radius*10,20),it=z.clone().add(pe.multiplyScalar(He));await T.setLookAt(it.x,it.y,it.z,z.x,z.y,z.z,!1)}return ua(!0),await c1(T,()=>T.fitToBox(N,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),await new Promise(V=>{let z=performance.now(),se=()=>{T.active===!1||performance.now()-z>8e3?(T.dispatchEvent({type:"update"}),fr.current?.invalidate(),V()):(fr.current?.invalidate(),setTimeout(se,100))};setTimeout(se,100)}),Fi.current=!0,xl(),_i(),!0}catch(V){return console.error("Fit scene error:",V),!1}},[xl,_i]);(0,E.useEffect)(()=>{if(Fi.current=!1,ca.current=!1,Yr.current=null,En.current=null,is.current=null,R(!1),Z([]),ue(!1),Je(null),St(!1),bl.current="",qf({total:0,missing:0}),$f("Loading model..."),Ip(null),!n){da(!1),ua(!0);return}da(!0),ua(!!fe||gl.current);let f=!1,T=null,N=z=>{T=setTimeout(V,z)},V=()=>{if(f||Fi.current||ca.current)return;let z=is.current??En.current;if(!Ze.current||!z){N(100);return}if(fl.current=I2(z,Ze.current,le?.maxDistance)??fl.current,_0(Ze.current)){Fi.current=!0,xl(),_i(),da(!1),ua(!0),fr.current?.invalidate();return}ca.current=!0,(fe?fe():gl.current?Promise.resolve(!0):ms(!0)).then(pe=>{Fi.current=pe!==!1,Fi.current?(xl(),_i(),da(!1)):f||N(100)}).catch(()=>{Fi.current=!1,f||N(100)}).finally(()=>{ca.current=!1})};return N(50),()=>{f=!0,T&&clearTimeout(T)}},[xl,le?.maxDistance,ms,n,_i,fe,i]),(0,E.useEffect)(()=>{if(!We)return;let f=xi;if(!f)return;let T=null,N=new ResizeObserver(()=>{!Fi.current||ca.current||(T&&clearTimeout(T),T=setTimeout(()=>{ms()},150))});return N.observe(f),()=>{N.disconnect(),T&&clearTimeout(T)}},[xi,ms,We]);let Tg=(0,E.useCallback)(f=>{if(sg.current||(Br(!1),Ir(),hl(null),us(f,"canvas"),bn||!Tr))return;let T=Ze.current,N=Or(f),V=N?An.current[N]:null;T&&f.cameraState?.position&&f.cameraState?.target?(T.setPosition(f.cameraState.position[0],f.cameraState.position[1],f.cameraState.position[2],!0),T.setTarget(f.cameraState.target[0],f.cameraState.target[1],f.cameraState.target[2],!0)):T&&V&&T.fitToBox(V,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{})},[us,Ir,Or,bn,Tr]),Pg=(0,E.useCallback)(f=>{if(!Eo)return!1;let T=Or(f);if(!T)return!1;let N=cd[T];return N?(bs.current=!1,va.current=null,la({objectKey:T,textureKey:N}),!0):!1},[Eo,Or,cd]),Jp=(0,E.useRef)(!1),ga=(0,E.useCallback)((f,T)=>{let N=Zn.current,V=N[f];if(!V)return;let z=T(V.decals??[]);Jr({...N,[f]:{...V,decals:z.length>0?z:void 0}})},[Jr,je]),IS=(0,E.useMemo)(()=>{if(!Er)return null;let{objectKey:f,decalId:T}=Er,N=je[f],V=N?.decals?.find(z=>z.id===T);return V?{objectId:N.modelObjectId??f,decal:V,onCancel:()=>nr(null),onCommit:z=>{ga(f,se=>se.map(pe=>pe.id===T?{...pe,...z}:pe)),nr(null)}}:null},[Er,je,ga]),fs=x??IS,Qp=(0,E.useCallback)((f,T)=>{qr.current++;let N=Zn.current[f],V=An.current[N?.modelObjectId??f],z=zd(V,Ze.current?.camera);if(!z)return In("Could not find a surface on this object for the decal."),!1;let se={...T,...z};return ga(f,pe=>[...pe,se]),In(null),mr(pe=>pe&&{...pe,activeId:se.id}),nr({objectKey:f,decalId:se.id}),!0},[ga]),hd=(0,E.useCallback)(f=>{let T=Zn.current[f],N=An.current[T?.modelObjectId??f]?.geometry;if(!N)return .2;N.boundingBox||N.computeBoundingBox();let V=N.boundingBox?.getSize(new Tt.Vector3),z=V?Math.max(V.x,V.y,V.z):0;return z>0&&Number.isFinite(z)?z/3:.2},[]),Ag=()=>`decal-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Eg=(0,E.useRef)([]);(0,E.useEffect)(()=>()=>{for(let f of Eg.current)URL.revokeObjectURL(f)},[]);let zS=(0,E.useCallback)(async(f,T,N)=>{let V=++qr.current;nr(null);let z;if(j){if(z=await j(N,f),V!==qr.current)return}else z=URL.createObjectURL(N),Eg.current.push(z);Qp(T,{id:Ag(),image:z,size:hd(T)})},[hd,j,Qp]);(0,E.useEffect)(()=>{qr.current++,In(null),nr(null)},[Pl,n]);let Rg=(0,E.useMemo)(()=>A0(je,$r.styleRules),[je,$r.styleRules]),[US,kg]=(0,E.useState)(null);(0,E.useEffect)(()=>{kg(null)},[n]);let gs=dt!==void 0?dt:US,eh=(0,E.useCallback)(f=>{dt===void 0&&kg(f),pn?.(f)},[dt,pn]),ba=(0,E.useMemo)(()=>R0(Rg,gs),[Rg,gs]),ao=(0,E.useMemo)(()=>ba.setAside.size>0?Wm(je,gs):null,[ba,je,gs]),FS=(0,E.useCallback)(f=>{let T=Or(f),N=T!==null&&ao?.size===1&&ao.has(T);eh(N?null:{...gs,target:f.id})},[eh,gs,ao]),{sourceOf:Lo}=ba,Lg=(0,E.useCallback)(f=>{let T=Lo(f);Tg(T)},[Tg,Lo]),Dg=(0,E.useCallback)(f=>xg(f&&Lo(f)),[xg,Lo]),Ng=(0,E.useCallback)((f,T)=>{let N=Lo(f);return M?.({binding:N,...T})===!0?(Jp.current=!0,!0):Pg(N)},[M,Pg,Lo]),Bg=(0,E.useMemo)(()=>w?(f,T)=>w({binding:Lo(f),...T}):void 0,[w,Lo]),Og=(0,E.useCallback)(f=>{if(us(f,"panel"),bn)return;let T=Ze.current,N=Or(f),V=N?An.current[N]:null;if(!T||!V)return;let z=f.cameraState;z?.position&&z?.target?(T.setPosition(z.position[0],z.position[1],z.position[2],!0),T.setTarget(z.target[0],z.target[1],z.target[2],!0)):T.fitToBox(V,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{})},[us,Or,bn]);(0,E.useEffect)(()=>{_i()},[_i,je]);let Ig=(0,E.useCallback)((f,T)=>{z2(T,fl.current),D?.(wo(f,T)),_i()},[_i,D]),VS=(0,E.useCallback)(f=>{ed.current=new Set(f.map(T=>T.name)),Op(T=>T+1),dd(f.map(T=>T.name)),a?.(f)},[dd,a]),jS=(0,E.useCallback)(f=>{is.current=f,fr.current?.invalidate()},[]),zg=(0,E.useCallback)(f=>{En.current=f,hg(f),qf(N2(f));let T=dh(f);jw(T>Dl?T:null),Xf(!1),Ip(null),T>Dl&&$f(`Preparing large model (${Math.round(T/1e6)}M triangles) \u2014 the first display can take a while on this device...`),R(!0),Z(zs(f)),ue(!1),Je(null),Gf(!1),i||(a&&a(i0(f)),dd(Tc(f))),k?.(f),b?.(T0(f)),_i()},[dd,_i,b,a,k,hg,i]),Ug=(0,E.useCallback)(f=>{da(!1),ua(!0),ue(!0),Je(f),_?.(f)},[_]),HS=(0,E.useCallback)(f=>{f.lengthComputable&&f.total>0&&Ip(f.loaded/f.total*100),y?.(f)},[y]),Fg=(0,E.useCallback)((f,T,N)=>{if(!rt)return;let V={...ze,lighting:{...ze.lighting,lights:ze.lighting.lights.map(z=>z.id===f?{...z,position:T,...N?{rotation:N}:{}}:z)}};rt(V)},[ze,rt]);(0,E.useEffect)(()=>{let f=En.current;if(!Nr||!f){St(!1);return}let T=Object.entries(je);if(T.length===0){St(!1);return}let N=i?ed.current:new Set(Object.keys(Fo(f).nodesById));if(!N||N.size===0){St(!1);return}let V=T.map(([se,pe])=>pe.modelObjectId??se).filter(se=>!N.has(se));St(V.length>0),os(V.length);let z=V.join(`
|
|
3690
|
-
|
|
3691
|
-
`);if(f.length>0&&T!==jf.current){let N=f.slice(0,10).join(", "),V=f.length>10?` and ${f.length-10} more`:"";console.warn(`[react-immersive] ${f.length} action button(s) do nothing because ModelViewer has no onAction handler: ${N}${V}. ModelViewer itself handles ${Ul.join(", ")}; handle other ids in onAction, or pass useViewerActions().handleAction to run their effects.`)}jf.current=T},[je,hn,A]);let th=(0,E.useCallback)(async()=>{if(fe){await fe();return}let f=Ze.current;if(!f)return;let T=Yr.current;try{T?await c1(f,()=>f.setLookAt(T.position[0],T.position[1],T.position[2],T.target[0],T.target[1],T.target[2],!0)):await ms()}catch(N){console.error("Reset camera error:",N)}},[fe,ms]),SP=(0,E.useCallback)(()=>{ma(!1),Br(!0)},[]),_P=(0,E.useCallback)(()=>{Br(!1)},[]),GS=(0,E.useCallback)(()=>{Br(!1),ma(!0),setTimeout(()=>{th()},100)},[th]),WS=(0,E.useCallback)((f,T)=>{Ig(f,T)},[Ig]),Vg=1,XS=4,qS=.0015,$S=.1,YS=8,va=(0,E.useRef)(null),bs=(0,E.useRef)(!1),nh=(0,E.useRef)([0,0]),md=(0,E.useRef)([0,0]),fd=(0,E.useRef)(1),Qr=(0,E.useRef)(null),gd=(0,E.useCallback)((f,T)=>{let N=Fe;if(!N)return;let V=Zn.current[N.objectKey]?.style?.material?.[N.textureKey],z=V?.path;if(!z)return;let se=V?.rotation??0,pe=Mi(N.textureKey),He=Gl(z,pe),it=es.current[N.objectKey],Te=Array.isArray(it)?it:it?[it]:[],Qe=Pd[N.textureKey];for(let et of Te){let vn=et;Qe in vn&&(vn[Qe]=Ld(vn.userData,N.textureKey,He,z,f,T,se))}fr.current?.invalidate()},[Fe]),KS=(0,E.useCallback)(f=>{if(!Fe)return;f.currentTarget.setPointerCapture?.(f.pointerId),va.current={x:f.clientX,y:f.clientY},bs.current=!1;let T=Zn.current[Fe.objectKey]?.style?.material?.[Fe.textureKey];if(nh.current=T?.offset??[0,0],md.current=nh.current,fd.current=T?.scale??1,Qr.current===null){let N=()=>{fr.current?.invalidate(),Qr.current=requestAnimationFrame(N)};Qr.current=requestAnimationFrame(N)}},[Fe]),rh=(0,E.useCallback)(f=>{if(!Fe||!va.current)return;let T=vi.current,N=T?.clientWidth||1,V=T?.clientHeight||1,z=f.clientX-va.current.x,se=f.clientY-va.current.y;if(!bs.current&&Math.hypot(z,se)<XS)return;bs.current=!0;let pe=-(z/N)*Vg,He=se/V*Vg,[it,Te]=nh.current,Qe=[it+pe,Te+He];md.current=Qe,gd(Qe,fd.current),or(Fe.objectKey,et=>({...et,material:{...et?.material,[Fe.textureKey]:{...et?.material?.[Fe.textureKey],path:Zn.current[Fe.objectKey]?.style?.material?.[Fe.textureKey]?.path,offset:Qe}}}))},[Fe,gd,or]),El=(0,E.useCallback)(f=>{if(!Fe)return;f.target?.releasePointerCapture?.(f.pointerId),Qr.current!==null&&(cancelAnimationFrame(Qr.current),Qr.current=null);let T=bs.current,N=Fe;if(T){or(N.objectKey,V=>({...V,material:{...V?.material,[N.textureKey]:{...V?.material?.[N.textureKey],path:Zn.current[N.objectKey]?.style?.material?.[N.textureKey]?.path,offset:md.current}}})),va.current=null,bs.current=!1;return}va.current=null,la(null)},[Fe,or]);(0,E.useEffect)(()=>{if(!Fe)return Qr.current!==null&&(cancelAnimationFrame(Qr.current),Qr.current=null),()=>{Qr.current!==null&&(cancelAnimationFrame(Qr.current),Qr.current=null)}},[Fe]),(0,E.useEffect)(()=>{let f=xi;if(!(!f||!Fe))return f.addEventListener("pointermove",rh),f.addEventListener("pointerup",El),f.addEventListener("pointercancel",El),()=>{f.removeEventListener("pointermove",rh),f.removeEventListener("pointerup",El),f.removeEventListener("pointercancel",El)}},[xi,Fe,rh,El]);let ih=(0,E.useCallback)(f=>{if(!Fe)return;f.preventDefault();let T=Fe,N=Math.exp(-f.deltaY*qS),V=Math.min(YS,Math.max($S,fd.current*N));fd.current=V,gd(md.current,V),or(T.objectKey,z=>({...z,material:{...z?.material,[T.textureKey]:{...z?.material?.[T.textureKey],path:Zn.current[T.objectKey]?.style?.material?.[T.textureKey]?.path,scale:V}}}))},[Fe,gd,or]);(0,E.useEffect)(()=>{let f=xi;if(!(!f||!Fe))return f.addEventListener("wheel",ih,{passive:!1}),()=>f.removeEventListener("wheel",ih)},[xi,Fe,ih]);let ZS=(0,E.useCallback)(f=>{if(sg.current)return;if(Jp.current){Jp.current=!1;return}let T=On==="scene"&&hr==="Annotations";if(f.target.closest("button, input, textarea, .ri-colorPicker, .ri-materialPicker, .ri-annotationPopup, .ri-annotationMarker, .ri-viewAnnotationPopup"))return;let V=vi.current,z=Ze.current,se=z?.camera,pe=En.current;if(!V||!z||!se||!pe||!T&&!z.enabled)return;let He=V.getBoundingClientRect(),it=(f.clientX-He.left)/He.width*2-1,Te=-((f.clientY-He.top)/He.height)*2+1,Qe=new Tt.Raycaster;Qe.setFromCamera(new Tt.Vector2(it,Te),se);let et=Qe.intersectObject(pe,!0);if(et.length===0)return;if(!T){let{x:Gi,y:sh,z:lh}=et[0].point;z.setOrbitPoint(Gi,sh,lh);return}let vn=et[0],wn=vn.point,ys=pe.worldToLocal(vn.point.clone()),Rl=[0,0,1];if(vn.face){let Gi=vn.face.normal.clone().transformDirection(vn.object.matrixWorld).normalize();Rl=[Gi.x,Gi.y,Gi.z]}id({worldPosition:[wn.x,wn.y,wn.z],localPosition:[ys.x,ys.y,ys.z],worldNormal:Rl,anchor:k2(vn),screenX:f.clientX-He.left,screenY:f.clientY-He.top}),od({title:"",description:""})},[On,hr]),jg=(0,E.useCallback)(()=>{if(!gr||!ko.title.trim())return;ad.current+=1;let T={id:ad.current,worldPosition:gr.worldPosition,localPosition:gr.localPosition,worldNormal:gr.worldNormal,anchorNodeName:gr.anchor?.anchorNodeName,anchorLocalPosition:gr.anchor?.anchorLocalPosition,title:ko.title.trim(),description:ko.description},N=[...ji,T];ng(N),U?.(N),id(null)},[gr,ko,ji,U]),oh=(0,E.useCallback)(()=>id(null),[]),JS=(0,E.useCallback)(f=>{Hi(f)},[Hi]);if(Pn.status==="checking")return(0,L.jsx)("div",{className:"ri-viewer ri-viewer--license-checking",children:(0,L.jsx)(ya,{title:"Verifying License",message:"Checking your license key..."})});if(Pn.status==="invalid")return(0,L.jsx)("div",{className:"ri-viewer ri-viewer--license-invalid",children:(0,L.jsx)(ya,{tone:"error",title:"Invalid License",message:Pn.isLocalDomain?Pn.reason??"License has been revoked or has expired":"Failed to load. Please contact the site administrator."})});let Do=ds?wi(ds.objectId):null,ah=Do?je[Do]?.style?.material?.texture?.path:void 0,Hg=ah?kd(ah)??ah:void 0,Gg=hs?Si?.offset??(Do?je[Do]?.style?.material?.texture?.offset:void 0):void 0,Wg=hs?Si?.rotationDegrees??(Do?((je[Do]?.style?.material?.texture?.rotation??0)*180/Math.PI%360+360)%360:0):0,Xg=hs?Si?.isPositioning??!!(Do&&Fe?.objectKey===Do&&Fe?.textureKey==="texture"):!1,qg=hs?NS:void 0,$g=hs?BS:void 0,Yg=hs?OS:void 0,QS=vi.current?.offsetWidth??600,e_=vi.current?.offsetHeight??400,t_=350,n_=290,r_=gr?Math.min(gr.screenX+12,QS-t_-8):0,i_=gr?Math.min(gr.screenY,e_-n_-8):0,o_=bt&&!!n&&!ee&&!Nr,vs=Xr&&(fa&&(jp||Jf)||Qf||!!rd),Kg=(vs?1:0)+(Ke?1:0),xs=f=>16+f*42+(ht&&f>Kg?Math.max(0,SS-34):0);return(0,L.jsxs)("div",{className:"ri-viewer",ref:Lr.rootRef,style:{background:Cp},children:[e.status!=="ready"&&(0,L.jsx)("div",{className:"ri-contextRecovery",role:"alert",children:(0,L.jsxs)("div",{className:"ri-contextRecovery__card",children:[(0,L.jsx)(Se.AlertTriangle,{size:24,"aria-hidden":"true"}),(0,L.jsx)("h2",{children:e.status==="rebuilding"?"Reloading viewer\u2026":"3D view interrupted"}),(0,L.jsx)("p",{children:e.status==="rebuilding"?"Rebuilding the 3D view. Please wait\u2026":"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now."}),(0,L.jsxs)("button",{type:"button",onClick:e.reload,disabled:e.status==="rebuilding",children:[(0,L.jsx)(Se.RotateCcw,{size:16,"aria-hidden":"true"}),"Reload viewer"]})]})}),(0,L.jsxs)("div",{className:"ri-viewerLeft",ref:qc,inert:e.status!=="ready",children:[ce?ce({isOpen:yg,selectedObject:Tl,currentAction:Yc,onClose:Sg,onAction:pd}):(0,L.jsx)(Qm,{isOpen:yg,selectedObject:Tl,currentAction:Yc,onClose:Sg,onAction:pd,renderActionExtra:f=>{if(f==="change-color"&&Dr)return(0,L.jsx)(Zm,{inline:!0,colorPicker:Dr,onClose:Ir,itemMaterials:Ro,setItemMaterials:rs});if((f==="change-light-color"||f==="set-brightness")&&gi?.kind===f&&gi.objectId===Pl){let T=gi,N=T.target,V=N.type==="lights"?ze.lighting.lights.find(z=>z.id===N.lightIds[0])?.color??"#ffffff":Yp(ps(N.objectKey).color);return(0,L.jsx)(jb,{kind:T.kind,color:V,brightness:T.percent,onColorChange:z=>{if(N.type==="lights"){no(Object.fromEntries(N.lightIds.map(pe=>[pe,{color:z}])));return}let se=ps(N.objectKey);Al(N.objectKey,{emissive:z,emissiveIntensity:se.intensity>0?se.intensity:ud.current[N.objectKey]??1})},onBrightnessChange:z=>{if(mn({...T,percent:z}),N.type==="lights"){no(Object.fromEntries(N.lightIds.map(se=>[se,{intensity:(N.baseIntensity[se]??0)*(z/100)}])));return}Al(N.objectKey,{emissive:Yp(ps(N.objectKey).color),emissiveIntensity:N.baseIntensity*(z/100)})},onClose:()=>mn(null)})}if((f==="add-text"||f==="add-image")&&Yn?.kind===f&&Yn.objectId===Pl){let T=Yn,N=wi(T.objectId);if(!N)return null;let V=f==="add-image";return(0,L.jsx)(Gb,{kind:f,decals:(je[N]?.decals??[]).filter(z=>!!z.image===V),activeId:T.activeId,error:Ja,moving:Er?.objectKey===N&&Er.decalId===T.activeId,defaultSize:hd(N),onSelect:z=>{qr.current++,In(null),nr(null),mr({...T,activeId:z})},onAddText:(z,se)=>Qp(N,{id:Ag(),text:z,color:se,size:hd(N)}),onAddImage:z=>{zS(T.objectId,N,z)},onChange:(z,se)=>ga(N,pe=>pe.map(He=>He.id===z?{...He,...se}:He)),onNudge:(z,se)=>{let pe=Zn.current[N],He=pe?.decals?.find(Qe=>Qe.id===z);if(!He)return;let it=An.current[pe.modelObjectId??N],Te=Ud(it,Ze.current?.camera,He,se);if(!Te){In("No visible surface in that direction. Try another arrow or rotate the view.");return}In(null),nr(null),ga(N,Qe=>Qe.map(et=>et.id===z?{...et,...Te}:et))},onMove:z=>{qr.current++,je[N]?.decals?.find(pe=>pe.id===z)&&(In(null),nr(pe=>pe?.objectKey===N&&pe.decalId===z?null:{objectKey:N,decalId:z}))},onRemove:z=>{nr(null),ga(N,se=>se.filter(pe=>pe.id!==z)),mr({...T,activeId:null})},onClose:()=>{qr.current++,In(null),nr(null),mr(null)}})}return f==="change-material"&&ds?(0,L.jsx)(Jm,{inline:!0,triggerFileUpload:Mg,materialPopup:ds,textureUrl:Hg,clearTexture:Cg,offset:Gg,rotationDegrees:Wg,onOffsetChange:qg,onRotationChange:$g,isPositioning:Xg,onEndPositioning:Yg}):null}}),(0,L.jsxs)("div",{className:`ri-canvasArea ${cs?"ri-canvasArea--measuring":""} ${Vi?"":"ri-canvasArea--positioning"} ${F?"ri-canvasArea--moveMode":""}`,ref:Ep,tabIndex:q?0:void 0,onDoubleClick:ZS,onPointerDown:f=>{if(q&&vi.current?.focus({preventScroll:!0}),Fe){KS(f);return}yS(f)},onClick:Fe?void 0:wS,onPointerMove:fS,onPointerLeave:ug,onWheel:ug,children:[Eo&&!i&&(Fe||RS)&&(0,L.jsx)("div",{className:"ri-moveZoomHint",role:"status",style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",zIndex:5,padding:"6px 12px",borderRadius:999,fontSize:12,fontWeight:500,color:"#fff",background:Fe?"rgba(37, 99, 235, 0.92)":"rgba(0, 0, 0, 0.6)",pointerEvents:"none",whiteSpace:"nowrap"},children:Fe?"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish":"Double-click to move or zoom"}),Ce&&!Hf&&(0,L.jsxs)("div",{className:"ri-bindingsMismatchBanner",children:[(0,L.jsx)(Se.AlertTriangle,{size:14,className:"ri-bindingsMismatchBanner__icon"}),(0,L.jsx)("span",{children:Kn===1?"1 object binding doesn't match this model":`${Kn} object bindings don't match this model`}),(0,L.jsx)("button",{type:"button",className:"ri-bindingsMismatchBanner__dismiss",onClick:f=>{f.stopPropagation(),Gf(!0)},"aria-label":"Dismiss",children:(0,L.jsx)(Se.X,{size:12})})]}),Wf!==null&&!Hw&&(0,L.jsxs)("div",{className:`ri-largeModelBanner ${Ce&&!Hf?"ri-largeModelBanner--offset":""}`,children:[(0,L.jsx)(Se.AlertTriangle,{size:14,className:"ri-largeModelBanner__icon"}),(0,L.jsxs)("span",{children:["Very large model (",Math.round(Wf/1e6),"M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts."]}),(0,L.jsx)("button",{type:"button",className:"ri-largeModelBanner__dismiss",onClick:f=>{f.stopPropagation(),Xf(!0)},"aria-label":"Dismiss",children:(0,L.jsx)(Se.X,{size:12})})]}),$r.model.renderer==="uv-checker"&&vl.missing>0&&(0,L.jsxs)("div",{className:"ri-uvCheckerBanner",role:"status",children:[(0,L.jsx)(Se.AlertTriangle,{size:14,className:"ri-uvCheckerBanner__icon"}),(0,L.jsxs)("span",{children:[vl.missing===vl.total?"UV Checker: this model has no UV0 coordinates.":`UV Checker: ${vl.missing} of ${vl.total} meshes have no UV0 coordinates.`," ","Missing UVs are shown in magenta."]})]}),(0,L.jsx)("input",{ref:Qa,type:"file",accept:"image/png,image/jpeg,image/webp",className:"ri-hiddenInput",onChange:DS}),(0,L.jsx)(Cs,{onError:e.fail,children:(0,L.jsxs)(Ih,{onRendererCreated:e.onRendererCreated,suspended:e.status!=="ready",camera:$,backgroundColor:tt,shadows:xe&&ze.shadows.enabled,sceneConfig:$r,selectedObjectRef:$p,hoveredObjectRef:kS,highlightOnHover:Tn,renderMode:xn,maxDpr:It,reduceGpuLoad:Tp,xrStore:fa,rendererCaptureRef:fr,preserveDrawingBuffer:zt,children:[(0,L.jsx)(Vh,{lightingConfig:ze.lighting,shadowConfig:ze.shadows,shadowsEnabled:xe,environmentRotation:ze.environment.rotation,environmentConfig:ze.environment,modelBounds:gS,objectBindings:je,nodeRefs:An}),$n&&ze.lighting.lights.map(f=>!f.visible||f.type==="none"||f.type==="hemisphere"||f.attachment?null:(0,L.jsx)(i1,{light:f,position:f.position,rotation:f.rotation,color:f.color,intensity:f.intensity,visible:f.visible,onPositionChange:T=>Fg(f.id,T,f.rotation),onRotationChange:T=>Fg(f.id,f.position,T),onDraggingChange:Rr},f.id)),(0,L.jsx)(qm,{setAside:ba.setAside,nodeRefs:An}),(0,L.jsx)(Km,{section:ze.section??Pa,box:Gp,modelRef:En,showHandle:qe,onPositionChange:f=>Co({position:f}),onDraggingChange:To}),(0,L.jsx)(Uh,{controlsRef:Ze,onCameraChange:WS,cameraLimits:le,controllerType:zi,onPointerLockExit:()=>bi("orbit")}),(0,L.jsx)(O2,{enabled:yn||cs||fs||zi==="pointerLock"?!1:Pe??ze.model.autoRotate??!1,speed:at??ze.model.autoRotateSpeed??1,controlsRef:Ze}),ie&&!yn&&(0,L.jsx)(ap.GizmoHelper,{alignment:"top-right",margin:[80,80],renderPriority:2,onUpdate:()=>{Ze.current?.update(0),fr.current?.invalidate()},children:(0,L.jsx)(ap.GizmoViewport,{axisColors:["#ff3653","#8adb00","#2c8fff"],labelColor:"white"})}),F&&$p&&ir&&(0,L.jsx)(uf,{node:$p,space:H,onTransformChange:LS,onDraggingChange:f=>{Rr(f),Cl&&S?.(Cl,f)}},ir),fs&&(0,L.jsx)(bv,{target:fs,nodes:An,controls:Ze}),(0,L.jsx)(vd,{onLoadError:Ug,children:(0,L.jsx)(E.Suspense,{fallback:null,children:(()=>{let f=(0,L.jsxs)(L.Fragment,{children:[i?(0,L.jsx)(km,{url:i,rotation:$r.model.rotation,errorTarget:r,cacheSize:o,decoderConfig:Hc,objectBindings:ba.bindings,itemMaterials:Ro,sceneConfig:$r,selectedItem:ir,panelHoveredItem:d??ml,highlightOnHover:Tn,onItemClick:Lg,onItemHover:Dg,onItemDoubleClick:Ng,onItemContextMenu:Bg,onObjectCatalog:VS,onTilesetBounds:jS,onModelLoaded:zg,onLoadError:Ug,nodeRefsOut:An,onNodeRefsChange:Xc,materialRefsOut:es,explodeFactor:nd,suspendBindingTransforms:Ao}):(0,L.jsx)($h,{url:n,modelFormat:s,objectBindings:ba.bindings,selectedItem:ir,itemMaterials:Ro,onItemClick:Lg,onItemDoubleClick:Ng,onItemContextMenu:Bg,onItemHover:Dg,onModelLoaded:zg,onAnimationsReady:W,nodeRefsOut:An,onNodeRefsChange:Xc,materialRefsOut:es,panelHoveredItem:d??ml,sceneConfig:$r,zoomOnSelected:Tr,highlightOnHover:Tn,decoderConfig:Hc,onLoadProgress:HS,explodeFactor:nd,suspendBindingTransforms:Ao,pulses:ba.pulses}),(0,L.jsx)(Dm,{annotations:ji,sceneConfig:ze,activeAnnotation:_l,popupRef:ns,canvasRootRef:vi,worldPositionsRef:rr,modelLoaded:Nr,onAnnotationClick:JS,onCloseAnnotation:wl,hideCloseButton:yl,showAnnotationOnHover:Pr}),(0,L.jsx)(D2,{annotation:ld,enabled:yl&&!yn,controlsRef:Ze,offsetRef:pl}),yn?(0,L.jsx)(_d,{controlsRef:Ze,sceneRef:En,config:yn.config,playing:!0,resetOnPlay:!0,playOnce:!0,startAtPath:!0,onStarted:yn.onStarted,onFinished:yn.onFinished,onProgress:Yw},"video-export"):pa&&(0,L.jsx)(_d,{controlsRef:Ze,sceneRef:En,config:pa,playing:ha&&!cs,resetOnPlay:Xw,onFinished:()=>{Br(!1),ma(!1)},onUserInteract:()=>{Br(!1)}},"cinematic-preview"),ht&&(0,L.jsx)(Nm,{points:lg,unit:Hn,box:Gp,showDimensions:pg,tool:cg,areaClosed:dg,snapPreview:cs?mS:null})]});return fa?(0,L.jsx)(p0,{ref:Kw,box:Gp,scaleMode:to,onARStateChange:eS,children:f}):f})()})},i??n),we&&(0,L.jsx)(E.Suspense,{fallback:null,children:we})]})}),ae&&(0,L.jsx)("div",{className:"ri-overlay",children:ae}),bt&&n&&ee&&(()=>{let f=Lb(Ee,i||n,i?void 0:s);return(0,L.jsx)("div",{className:"ri-loadError",role:"alert",children:(0,L.jsxs)("div",{className:"ri-loadError__card",children:[(0,L.jsxs)("div",{className:"ri-loadError__header",children:[(0,L.jsx)(Se.AlertTriangle,{size:16,"aria-hidden":"true"}),(0,L.jsx)("span",{className:"ri-loadError__title",children:f.title})]}),(0,L.jsx)("p",{className:"ri-loadError__detail",children:f.detail}),(0,L.jsx)("p",{className:"ri-loadError__source",children:i||n}),f.technical&&(0,L.jsx)("p",{className:"ri-loadError__technical",children:f.technical})]})})})(),(0,L.jsx)(Zu,{visible:o_,message:Gw,progress:Ww??void 0}),vs&&(0,L.jsxs)("div",{className:"ri-xrTools",style:{top:`${xs(0)}px`},children:[!jp&&Qf&&(0,L.jsxs)("button",{type:"button",className:"ri-xrButton",onClick:Qw,title:"View this model in AR with Apple Quick Look",children:[(0,L.jsx)(Se.Box,{size:16}),"View in AR"]}),rd&&(0,L.jsxs)("button",{type:"button",className:"ri-xrButton",onClick:Jw,title:"Open this experience on a phone for AR","aria-haspopup":"dialog","aria-expanded":eg,children:[(0,L.jsx)(Se.QrCode,{size:16}),(0,L.jsx)("span",{children:"Open on phone"})]}),fa&&jp&&(0,L.jsxs)("button",{type:"button",className:"ri-xrButton",onClick:()=>fa.enterAR().catch(f=>{console.error("Failed to enter AR session:",f)}),title:"View this model in your space",children:[(0,L.jsx)(Se.Smartphone,{size:16}),(0,L.jsx)("span",{className:"ri-xrButtonPrefix",children:"Enter"}),(0,L.jsx)("span",{children:"AR"})]}),fa&&Jf&&(0,L.jsxs)("button",{type:"button",className:"ri-xrButton",onClick:()=>fa.enterVR().catch(f=>{console.error("Failed to enter VR session:",f)}),title:"View this model in VR",children:[(0,L.jsx)(Se.RectangleGoggles,{size:16}),(0,L.jsx)("span",{className:"ri-xrButtonPrefix",children:"Enter"}),(0,L.jsx)("span",{children:"VR"})]})]}),Zw,eg&&rd&&(0,L.jsx)("div",{className:"ri-mobileHandoffBackdrop",onMouseDown:f=>{f.target===f.currentTarget&&tg()},children:(0,L.jsxs)("section",{className:"ri-mobileHandoffDialog",role:"dialog","aria-modal":"true","aria-labelledby":"ri-mobileHandoffTitle",children:[(0,L.jsx)("button",{type:"button",className:"ri-mobileHandoffClose",onClick:tg,"aria-label":"Close phone handoff",children:(0,L.jsx)(Se.X,{size:18})}),(0,L.jsx)(Se.Smartphone,{size:22,"aria-hidden":"true"}),(0,L.jsx)("h2",{id:"ri-mobileHandoffTitle",children:"View in AR"}),(0,L.jsx)("p",{children:"Scan the code and choose AR."}),(0,L.jsx)("div",{className:"ri-mobileHandoffQr",children:(0,L.jsx)(d1.QRCodeSVG,{value:rd,size:208,level:"M",marginSize:4,title:"QR code to open this model on a phone"})})]})}),Ke&&(0,L.jsx)("div",{className:"ri-uvCheckerTools",style:{top:`${xs(vs?1:0)}px`},children:(0,L.jsx)("button",{type:"button",className:`ri-measureButton ${ro?"ri-measureButton--active":""}`,onClick:()=>dl(f=>!(f??Po)),title:ro?"Disable UV checker":"Enable UV checker","aria-label":ro?"Disable UV checker":"Enable UV checker","aria-pressed":ro,children:(0,L.jsx)(Se.Grid3X3,{size:16})})}),ht&&(0,L.jsx)(Bm,{top:xs(Kg),active:cs,disabled:!!yn,tool:cg,snap:pS,pointCount:lg.length,areaClosed:dg,error:lS,showDimensions:pg,onToggle:()=>{Br(!1),vS()},onTool:cS,onSnap:hS,onUndo:dS,onClear:bS,onFinishArea:uS,onDimensions:xS,onHeight:_S}),wt&&(0,L.jsxs)("div",{className:"ri-explodeTools",style:{top:`${xs((vs?1:0)+(Ke?1:0)+(ht?1:0))}px`},children:[(0,L.jsx)("button",{type:"button",className:`ri-measureButton ${zp||nd>0?"ri-measureButton--active":""}`,onClick:()=>Kf(f=>!f),title:"Exploded view","aria-pressed":zp,children:(0,L.jsx)(Se.Expand,{size:16})}),zp&&(0,L.jsx)("div",{className:"ri-explodeSlider",onPointerDown:f=>f.stopPropagation(),children:(0,L.jsx)("input",{type:"range",min:0,max:100,value:Math.round(nd*100),onChange:f=>Yf(Number(f.target.value)/100),"aria-label":"Explode amount"})})]}),qe&&(0,L.jsxs)("div",{className:"ri-sectionTools",style:{top:`${xs((vs?1:0)+(Ke?1:0)+(ht?1:0)+(wt?1:0))}px`},children:[(0,L.jsx)("button",{type:"button",className:`ri-measureButton ${yi.enabled?"ri-measureButton--active":""}`,onClick:()=>Co({enabled:!yi.enabled}),title:yi.enabled?"Remove section cut":"Section cut","aria-label":"Section cut","aria-pressed":yi.enabled,children:(0,L.jsx)(Se.Slice,{size:16})}),yi.enabled&&(0,L.jsxs)("div",{className:"ri-sectionPanel",onPointerDown:f=>f.stopPropagation(),children:[(0,L.jsx)("div",{className:"ri-sectionAxes",role:"group","aria-label":"Section axis",children:Xd.map(f=>(0,L.jsx)("button",{type:"button",className:`ri-sectionAxis ${yi.axis===f?"ri-sectionAxis--active":""}`,"aria-pressed":yi.axis===f,onClick:()=>Co({axis:f}),children:f.toUpperCase()},f))}),(0,L.jsx)("input",{type:"range",min:0,max:100,value:Math.round(yi.position*100),onChange:f=>Co({position:Number(f.target.value)/100}),"aria-label":"Section position"}),(0,L.jsx)("button",{type:"button",className:`ri-sectionAxis ${yi.flip?"ri-sectionAxis--active":""}`,"aria-pressed":yi.flip,"aria-label":"Keep the other side",title:"Keep the other side",onClick:()=>Co({flip:!yi.flip}),children:(0,L.jsx)(Se.FlipVertical2,{size:14})})]})]}),pa&&(0,L.jsxs)("div",{className:"ri-cinematicTools",style:{top:`${xs((vs?1:0)+(Ke?1:0)+(ht?1:0)+(wt?1:0)+(qe?1:0))}px`},children:[(0,L.jsx)("button",{type:"button",className:`ri-measureButton ${ha?"ri-measureButton--active":""}`,disabled:!!yn||cs,onClick:()=>{ha?Br(!1):(ma(!1),Br(!0))},title:ha?"Pause cinematic":"Play cinematic","aria-pressed":ha,children:ha?(0,L.jsx)(Se.Pause,{size:16}):(0,L.jsx)(Se.Play,{size:16})}),ha&&(0,L.jsx)("button",{type:"button",className:"ri-measureButton ri-measureButton--stop",onClick:GS,title:"Stop cinematic and reset camera",children:(0,L.jsx)(Se.Square,{size:16})})]}),yn&&(0,L.jsx)("div",{className:"ri-recordingOverlay",onPointerDown:f=>f.stopPropagation(),children:(0,L.jsxs)("div",{className:"ri-isolationPill",role:"status","aria-live":"polite",children:[(0,L.jsxs)("span",{className:"ri-isolationPill__label",children:["Recording video \xB7 ",$w,"%"]}),(0,L.jsx)("button",{type:"button",className:"ri-isolationPill__button",onClick:Vp,children:"Cancel"})]})}),(og||fs||ur&&ao)&&(0,L.jsxs)("div",{className:`ri-bottomStack ${ag?"ri-bottomStack--aboveButtons":""}`,children:[fs&&(0,L.jsxs)("div",{className:"ri-isolationPill",role:"status",onPointerDown:f=>f.stopPropagation(),children:[(0,L.jsx)("span",{className:"ri-isolationPill__label",children:"Drag the decal on the object. Release to save; Escape to cancel."}),(0,L.jsx)("button",{type:"button",className:"ri-isolationPill__button",onClick:fs.onCancel,children:"Cancel"})]}),ur&&ao&&(0,L.jsxs)("div",{className:"ri-isolationPill",onPointerDown:f=>f.stopPropagation(),children:[(0,L.jsx)("span",{className:"ri-isolationPill__label",children:ao.size===1?`Isolated: ${(()=>{let[f]=ao;return je[f]?.label??f})()}`:`Isolated: ${ao.size} objects`}),(0,L.jsx)("button",{type:"button",className:"ri-isolationPill__button",onClick:()=>eh(null),children:"Show all"})]}),og&&(0,L.jsx)("div",{className:"ri-variantPicker",role:"group","aria-label":"Material variants",onPointerDown:f=>f.stopPropagation(),children:I.map(f=>{let T=ze.model.materialVariant===f;return(0,L.jsx)("button",{type:"button",className:`ri-variantPicker__option ${T?"ri-variantPicker__option--active":""}`,"aria-pressed":T,onClick:()=>Za(f),children:f},f)})})]}),ag&&(0,L.jsxs)("div",{className:"ri-buttonContainer",children:[(0,L.jsx)("div",{className:"ri-tourControls",children:tn&&fn.length>0&&(0,L.jsx)(L.Fragment,{children:yl?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("button",{className:"ri-tourButton",onClick:rS,disabled:ig||fn.length===0||Zr<=0,title:"Previous annotation",children:[(0,L.jsx)(Se.ChevronLeft,{size:16}),(0,L.jsx)("span",{children:"Prev"})]}),(0,L.jsx)("button",{className:"ri-tourButton ri-tourButton--stop",onClick:oS,title:"Stop guided tour",children:(0,L.jsx)(Se.Square,{size:16})}),(0,L.jsxs)("button",{className:"ri-tourButton ri-tourButton--next",onClick:iS,disabled:ig||fn.length===0,title:"Next annotation",children:[(0,L.jsx)("span",{children:"Next"}),(0,L.jsx)(Se.ChevronRight,{size:16})]})]}):(0,L.jsx)("button",{className:"ri-navButtonSingle",onClick:nS,disabled:fn.length===0,title:"Start guided tour",children:"Guided Tour"})})}),(0,L.jsxs)("div",{className:"mv-rightControls",children:[Ie&&Lr.supported&&(0,L.jsxs)("div",{className:"mv-fullscreenWrapper",children:[Lr.error&&(0,L.jsx)("div",{className:"mv-fullscreenError",role:"alert",children:Lr.error}),(0,L.jsx)("button",{type:"button",className:"mv-fullscreenButton",onClick:()=>{Lr.toggle()},disabled:Lr.pending||!!yn,title:Lr.active?"Exit fullscreen":"Enter fullscreen","aria-label":Lr.active?"Exit fullscreen":"Enter fullscreen","aria-pressed":Lr.active,children:Lr.active?(0,L.jsx)(Se.Minimize,{}):(0,L.jsx)(Se.Maximize,{})})]}),un&&(0,L.jsx)("button",{className:"mv-resetButton",onClick:th,disabled:!!yn,title:"Reset camera view",children:(0,L.jsx)(Se.RotateCcw,{})}),(0,L.jsxs)("div",{className:"mv-controllersWrapper",onPointerDown:f=>f.stopPropagation(),children:[Ii&&(0,L.jsxs)("div",{className:"mv-controllersMenu",children:[(0,L.jsx)("button",{type:"button",className:`mv-controllersMenuItem ${zi==="orbit"?"mv-controllersMenuItem--active":""}`,onClick:()=>bi("orbit"),children:"Orbit Control"}),(0,L.jsx)("button",{type:"button",className:`mv-controllersMenuItem ${zi==="pointerLock"?"mv-controllersMenuItem--active":""}`,onClick:()=>bi("pointerLock"),children:"Point Lock"})]}),(0,L.jsx)("button",{className:"mv-controllersButton",onClick:()=>Gc(f=>!f),title:"Camera controller","aria-label":"Camera controller settings",disabled:!!yn,children:(0,L.jsx)(Se.Orbit,{size:15})})]}),pt&&(0,L.jsxs)("div",{className:"mv-downloadWrapper",onPointerDown:f=>f.stopPropagation(),children:[MS&&(0,L.jsxs)("div",{className:"mv-downloadMenu",children:[(0,L.jsxs)("button",{className:"mv-downloadMenuItem",onClick:TS,disabled:Wp||!!yn||!En.current,children:[(0,L.jsx)(Se.Box,{size:14}),"Download GLB"]}),(0,L.jsx)("div",{className:"mv-downloadMenuDivider"}),zt&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("button",{className:"mv-downloadMenuItem",onClick:PS,disabled:!!yn||!En.current,children:[(0,L.jsx)(Se.Camera,{size:14}),"Download PNG"]}),(0,L.jsx)("div",{className:"mv-downloadMenuDivider"})]}),(0,L.jsxs)("button",{className:"mv-downloadMenuItem",onClick:AS,disabled:!!yn||!En.current,children:[(0,L.jsx)(Se.FileImage,{size:14}),"Download UV Layout"]}),(0,L.jsx)("div",{className:"mv-downloadMenuDivider"}),(0,L.jsxs)("label",{className:"mv-downloadMenuItem",children:["Video format",(0,L.jsxs)("select",{"aria-label":"Video format",value:Xp,onChange:f=>ES(f.target.value),children:[(0,L.jsx)("option",{value:"auto",children:"Auto"}),(0,L.jsx)("option",{value:"webm",disabled:!wa("webm"),children:"WebM"}),(0,L.jsx)("option",{value:"mp4",disabled:!wa("mp4"),children:"MP4"})]})]}),(0,L.jsxs)("button",{className:"mv-downloadMenuItem",onClick:()=>{fg("turntable")},disabled:!!yn||!Nr||!Vi||Kr||!wa(Xp),children:[(0,L.jsx)(Se.Play,{size:14}),"Record turntable video"]}),pa&&(0,L.jsxs)("button",{className:"mv-downloadMenuItem",onClick:()=>{fg("cinematic")},disabled:!!yn||!Nr||!Vi||Kr||!wa(Xp),children:[(0,L.jsx)(Se.Play,{size:14}),"Record cinematic video"]}),!wa()&&(0,L.jsx)("div",{className:"mv-downloadMenuNotice",role:"status",children:"Video recording is not supported in this browser."}),gg&&(0,L.jsx)("div",{className:"mv-downloadMenuNotice",role:"alert",children:gg}),mg&&(0,L.jsx)("div",{className:"mv-downloadMenuNotice",role:"status","aria-live":"polite",children:mg})]}),(0,L.jsx)("button",{className:"mv-downloadButton",onClick:CS,disabled:Wp||!!yn||!En.current,title:"Download options",children:Wp?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:"mv-downloadButton__spinner"}),"Exporting\u2026"]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Se.Download,{size:15}),"Download"]})})]})]})]}),gr&&(0,L.jsxs)("div",{className:"ri-annotationPopup",style:{left:r_,top:i_},onPointerDown:f=>f.stopPropagation(),onClick:f=>f.stopPropagation(),children:[(0,L.jsx)("input",{autoFocus:!0,className:"ri-annotationInput",placeholder:"Title *",value:ko.title,onChange:f=>od(T=>({...T,title:f.target.value})),onKeyDown:f=>{f.key==="Enter"&&jg(),f.key==="Escape"&&oh()}}),(0,L.jsx)("textarea",{className:"ri-annotationTextarea",placeholder:"Description",value:ko.description,onChange:f=>od(T=>({...T,description:f.target.value})),onKeyDown:f=>{f.key==="Escape"&&oh()},rows:5}),(0,L.jsxs)("div",{className:"ri-annotationActions",children:[(0,L.jsx)("button",{onClick:jg,className:`ri-annotationOkBtn ${ko.title.trim()?"":"disabled"}`,disabled:!ko.title.trim(),children:"OK"}),(0,L.jsx)("button",{onClick:oh,className:"ri-annotationCancelBtn",children:"Cancel"}),(0,L.jsx)("div",{className:"ri-annotationIcons"})]})]})]}),ce&&Dr&&(0,L.jsx)(Zm,{colorPicker:Dr,onClose:Ir,itemMaterials:Ro,setItemMaterials:rs}),ce&&ds&&(0,L.jsx)(Jm,{triggerFileUpload:Mg,materialPopup:ds,textureUrl:Hg,clearTexture:Cg,offset:Gg,rotationDegrees:Wg,onOffsetChange:qg,onRotationChange:$g,isPositioning:Xg,onEndPositioning:Yg})]}),he&&(0,L.jsx)("div",{className:"ri-viewerRight",inert:e.status!=="ready",children:Le?Le({objectBindings:je,onAction:pd,onFocus:Og,onHover:Kc}):(0,L.jsx)(ef,{objectBindings:je,onAction:pd,onFocus:Og,onHover:Kc,isolatedKeys:ao,onIsolate:ur?FS:void 0})}),Ot&&(0,L.jsx)(S0,{controlsRef:Ze,enabled:e.status==="ready",opacity:de,moveSensitivity:Cr,position:dr})]})}var Xn=require("react"),u1={currentClip:null,isPlaying:!1,speed:1,time:0,duration:0,active:[]};function p1(){let e=(0,Xn.useRef)(null),t=(0,Xn.useRef)(null),[n,i]=(0,Xn.useState)([]),[r,o]=(0,Xn.useState)([]),[a,s]=(0,Xn.useState)(u1);(0,Xn.useEffect)(()=>()=>{t.current?.()},[]);let l=(0,Xn.useCallback)(v=>{t.current?.(),e.current=v,i(v.clips),o(v.clipDetails??v.clips.map(M=>({sourceName:M,duration:0}))),s(v.getState?.()??u1),t.current=v.subscribe?.(s)??null},[]),c=(0,Xn.useCallback)(v=>{let M=e.current;M&&(v(M),!M.subscribe&&M.getState&&s(M.getState()))},[]),p=(0,Xn.useCallback)((v,M)=>c(w=>w.play(v,M)),[c]),u=(0,Xn.useCallback)(v=>c(M=>M.pause(v)),[c]),d=(0,Xn.useCallback)(v=>c(M=>M.stop(v)),[c]),m=(0,Xn.useCallback)((v,M)=>c(w=>w.setSpeed(v,M)),[c]),g=(0,Xn.useCallback)((v,M)=>c(w=>w.seek?.(v,M)),[c]);return{clips:n,clipDetails:r,...a,play:p,pause:u,stop:d,setSpeed:m,seek:g,handleAnimationsReady:l}}var F2="react-immersive:binding-builder";var el="session",Wa="model",tl="textures",Ec="current";var Ga=null;function lp(){return Ga||(Ga=new Promise((e,t)=>{if(typeof indexedDB>"u"){t(new Error("IndexedDB is not available in this environment."));return}let n=indexedDB.open(F2,2);n.onupgradeneeded=()=>{let i=n.result;i.objectStoreNames.contains(el)||i.createObjectStore(el),i.objectStoreNames.contains(Wa)||i.createObjectStore(Wa),i.objectStoreNames.contains(tl)||i.createObjectStore(tl)},n.onsuccess=()=>{let i=n.result;i.onversionchange=()=>{i.close(),Ga=null},e(i)},n.onerror=()=>t(n.error??new Error("Failed to open IndexedDB."))}),Ga.catch(()=>{Ga=null}),Ga)}function cp(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onerror=()=>n(e.error??new Error("IndexedDB transaction failed.")),e.onabort=()=>n(e.error??new Error("IndexedDB transaction aborted."))})}function pf(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error??new Error("IndexedDB request failed."))})}function sp(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function V2(e){if(!sp(e)||e.version!==1)return!1;let t=e.model;return typeof e.savedAt=="number"&&sp(e.bindings)&&sp(e.sceneConfig)&&sp(t)&&typeof t.name=="string"&&(t.kind==="file"&&typeof t.key=="string"||t.kind==="url"&&typeof t.url=="string")}async function h1(e,t){let n=await lp(),i={...e,version:1,savedAt:Date.now()},r=n.transaction([el,Wa],"readwrite"),o=cp(r);if(r.objectStore(el).put(i,Ec),i.model.kind==="file"&&t){let a={key:i.model.key,blob:t,name:t.name,type:t.type,lastModified:t.lastModified};r.objectStore(Wa).put(a,Ec)}else i.model.kind==="url"&&r.objectStore(Wa).delete(Ec);return await o,i}async function m1(){let t=(await lp()).transaction([el,Wa],"readonly"),n=cp(t),[i,r]=await Promise.all([pf(t.objectStore(el).get(Ec)),pf(t.objectStore(Wa).get(Ec))]);return await n,V2(i)?i.model.kind==="url"?{session:i,file:null}:!r||r.key!==i.model.key?null:{session:i,file:new File([r.blob],r.name,{type:r.type,lastModified:r.lastModified})}:null}async function hf(e,t){let i=(await lp()).transaction(tl,"readwrite"),r=cp(i),o={blob:t,name:t.name,type:t.type,savedAt:Date.now()};i.objectStore(tl).put(o,e),await r}async function Rc(e){let n=(await lp()).transaction(tl,"readonly"),i=cp(n),r=await pf(n.objectStore(tl).get(e));return await i,r?new File([r.blob],r.name,{type:r.type,lastModified:r.savedAt}):null}var bp=require("react");var M1=require("react"),ta=require("lucide-react"),pp=require("react-colorful");var Ni=require("react"),b1=require("react-dom"),dp=require("lucide-react"),up=require("react-colorful");function Qo(e){let t=e.replace("#","").match(/.{2}/g).map(i=>parseInt(i,16)/255).map(i=>i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4));return .2126*t[0]+.7152*t[1]+.0722*t[2]>.179?"#000":"#fff"}var f1=require("react");function g1(e,t,n){(0,f1.useEffect)(()=>{if(!n)return;let i=Array.isArray(e)?e:[e],r=o=>{let a=o.target;i.some(l=>l.current?.contains(a))||t()};return document.addEventListener("pointerdown",r,!0),()=>{document.removeEventListener("pointerdown",r,!0)}},[e,t,n])}var Re=require("react/jsx-runtime");function kc({anchorRef:e,onClose:t,children:n}){let i=(0,Ni.useRef)(null),[r,o]=(0,Ni.useState)(null);return g1([i,e],t,!0),(0,Ni.useLayoutEffect)(()=>{let a=e.current;if(!a)return;let s=a.getBoundingClientRect(),l=222,c=8,p=Math.min(Math.max(s.right-l,c),window.innerWidth-l-c),u=Math.min(s.bottom+6,window.innerHeight-200);o({top:u,left:p})},[e]),r?(0,b1.createPortal)((0,Re.jsx)("div",{ref:i,className:"se-colorPickerPopover",style:{position:"fixed",top:r.top,left:r.left},children:n}),document.body):null}function j2(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function So({title:e,children:t}){return(0,Re.jsxs)("section",{className:"se-section",children:[(0,Re.jsx)("h3",{className:"se-sectionTitle",children:e}),(0,Re.jsx)("div",{className:"se-sectionBody",children:t})]})}function Ct({title:e,open:t,onToggle:n,trailing:i,children:r,disabled:o,tooltip:a}){let s=a?`${a}`:e;return(0,Re.jsxs)("section",{className:"se-panel",children:[(0,Re.jsxs)("button",{type:"button",className:"se-panelHeader",onClick:n,"aria-expanded":t,title:s,children:[(0,Re.jsxs)("span",{className:"se-panelHeaderMain",children:[(0,Re.jsx)(dp.ChevronDown,{size:16,className:`se-panelChevron ${t?"se-panelChevron--open":""}`}),(0,Re.jsx)("span",{className:"se-panelTitle",children:e}),a?(0,Re.jsx)("span",{className:"se-panelHelp",title:s,"aria-label":s,role:"img",onClick:l=>l.stopPropagation(),children:(0,Re.jsx)(dp.Info,{size:13})}):null]}),i?(0,Re.jsx)("span",{className:"se-panelTrailing",onClick:l=>l.stopPropagation(),children:i}):null]}),t?(0,Re.jsx)("div",{className:"se-panelBody",style:o?{opacity:.45,pointerEvents:"none"}:void 0,children:r}):null]})}function Lt({checked:e,onChange:t,label:n}){return(0,Re.jsxs)("label",{className:"se-switch","aria-label":n,children:[(0,Re.jsx)("input",{type:"checkbox",checked:e,onChange:i=>t(i.target.checked)}),(0,Re.jsx)("span",{className:"se-switchTrack",children:(0,Re.jsx)("span",{className:"se-switchThumb"})})]})}function J({label:e,value:t,min:n,max:i,step:r,formatValue:o,onChange:a,disabled:s=!1}){return(0,Re.jsxs)("label",{className:`se-field ${s?"se-field--disabled":""}`,children:[(0,Re.jsxs)("span",{className:"se-fieldLabel",children:[e,(0,Re.jsx)("span",{className:"se-fieldValue",children:o?o(t):t})]}),(0,Re.jsx)("input",{className:"se-slider",type:"range",min:n,max:i,step:r,value:t,onChange:l=>a(Number(l.target.value)),disabled:s})]})}function Pt({label:e,checked:t,onChange:n}){return(0,Re.jsxs)("label",{className:"se-field se-fieldInline",children:[(0,Re.jsx)("span",{className:"se-fieldLabel",children:e}),(0,Re.jsx)("input",{type:"checkbox",className:"se-checkbox",checked:t,onChange:i=>n(i.target.checked)})]})}function Hr({label:e,value:t,options:n,onChange:i}){return(0,Re.jsxs)("label",{className:"se-field se-fieldInline",children:[(0,Re.jsx)("span",{className:"se-fieldLabel",children:e}),(0,Re.jsx)("select",{className:"se-select",value:t,onChange:r=>i(r.target.value),children:n.map(r=>(0,Re.jsx)("option",{value:r,children:j2(r)},r))})]})}function _r({label:e,value:t,onChange:n}){let[i,r]=(0,Ni.useState)(!1),o=(0,Ni.useRef)(null);return(0,Re.jsxs)("div",{className:"se-field",children:[(0,Re.jsxs)("div",{className:"se-fieldInline",children:[(0,Re.jsx)("span",{className:"se-fieldLabel",children:e}),(0,Re.jsx)("span",{ref:o,style:{display:"inline-flex"},children:(0,Re.jsx)(up.HexColorInput,{prefixed:!0,className:"se-swatch",onClick:()=>r(a=>!a),style:{background:t,color:Qo(t)},color:t,onChange:n})})]}),i?(0,Re.jsx)(kc,{anchorRef:o,onClose:()=>r(!1),children:(0,Re.jsx)(up.HexColorPicker,{color:t,onChange:n})}):null]})}function v1({value:e,min:t,max:n,step:i,onChange:r}){let[o,a]=(0,Ni.useState)(String(e)),s=(0,Ni.useRef)(!1);return(0,Ni.useLayoutEffect)(()=>{s.current||a(String(e))},[e]),(0,Re.jsx)("input",{type:"number",className:"se-numberInput",min:t,max:n,step:i,value:o,onFocus:()=>{s.current=!0},onChange:l=>{let c=l.target.value;a(c),c!==""&&c!=="-"&&!Number.isNaN(Number(c))&&r(Number(c))},onBlur:()=>{s.current=!1,a(String(e))}})}function ea({label:e,value:t,min:n,max:i,step:r,onChange:o}){return(0,Re.jsxs)("div",{className:"se-field",children:[(0,Re.jsx)("span",{className:"se-fieldLabel",children:e}),(0,Re.jsx)("div",{className:"se-vectorRow",children:["X","Y","Z"].map((s,l)=>(0,Re.jsxs)("label",{className:"se-vectorAxis",children:[(0,Re.jsx)("span",{children:s}),(0,Re.jsx)(v1,{value:t[l],min:n,max:i,step:r,onChange:c=>{let p=[...t];p[l]=c,o(p)}})]},s))})]})}function Xa({label:e,value:t,min:n,max:i,step:r,onChange:o}){return(0,Re.jsxs)("div",{className:"se-field",children:[(0,Re.jsx)("span",{className:"se-fieldLabel",children:e}),(0,Re.jsx)("div",{className:"se-vectorRow",children:["X","Y"].map((s,l)=>(0,Re.jsxs)("label",{className:"se-vectorAxis",children:[(0,Re.jsx)("span",{children:s}),(0,Re.jsx)(v1,{value:t[l],min:n,max:i,step:r,onChange:c=>{let p=[...t];p[l]=c,o(p)}})]},s))})]})}var x1={free:0,starter:1,growth:2};function y1(e){return e==="starter"||e==="growth"||e==="scale"?e==="scale"?"growth":e:"free"}function Bi(e,t){return x1[e]>=x1[t]}var w1={free:"Free",starter:"Starter",growth:"Growth"};var S1=require("lucide-react");var Lc=require("react/jsx-runtime");function qn({requiredTier:e,feature:t}){return(0,Lc.jsxs)("div",{className:"bb-tierLock",children:[(0,Lc.jsx)(S1.Lock,{size:16}),(0,Lc.jsxs)("p",{className:"bb-tierLockMessage",children:[t," requires the ",w1[e]," plan or higher."]})]})}var Q=require("react/jsx-runtime"),H2=["lit","unlit","normals"],G2=["color","image","environment"];function _1(e){let t=e%360;return t<0?t+360:t}function nl({title:e,open:t,onToggle:n,children:i,trailing:r}){return(0,Q.jsxs)("section",{className:"se-panel",children:[(0,Q.jsxs)("button",{type:"button",className:"se-panelHeader",onClick:n,"aria-expanded":t,children:[(0,Q.jsxs)("span",{className:"se-panelHeaderMain",children:[(0,Q.jsx)(ta.ChevronDown,{size:16,className:`se-panelChevron ${t?"se-panelChevron--open":""}`}),(0,Q.jsx)("span",{className:"se-panelTitle",children:e})]}),r?(0,Q.jsx)("span",{className:"se-panelTrailing",onClick:o=>o.stopPropagation(),children:r}):null]}),t?(0,Q.jsx)("div",{className:"se-panelBody",children:i}):null]})}function mf({config:e,onChange:t,materialVariants:n=[]}){let{model:i,camera:r,wireframe:o,background:a,environment:s}=e,{tier:l}=Sr(),c=Bi(l,"starter"),[p,u]=(0,M1.useState)({general:!0,camera:!0,autoRotate:!1,section:!1,wireframe:!1,background:!1}),d=b=>u(_=>({..._,[b]:!_[b]})),m=b=>t({...e,model:b}),g=b=>t({...e,camera:b}),v=e.section??Pa,M=b=>t({...e,section:{...v,...b}}),w=b=>t({...e,wireframe:b}),x=b=>t({...e,background:b}),S=b=>t({...e,environment:b}),k=b=>{S({...s,source:"preset",preset:b})};return(0,Q.jsxs)("div",{className:"se-generalContent",children:[(0,Q.jsxs)(nl,{title:"General",open:p.general,onToggle:()=>d("general"),children:[(0,Q.jsxs)("div",{className:"se-field",children:[(0,Q.jsxs)("div",{className:"se-fieldLabel",children:[(0,Q.jsx)("span",{children:"Straighten model"}),(0,Q.jsx)("button",{type:"button",className:"se-iconButton",onClick:()=>m({...i,rotation:[0,0,0]}),"aria-label":"Reset model rotation",children:(0,Q.jsx)(ta.RotateCcw,{size:16})})]}),(0,Q.jsx)("div",{className:"se-axisStepperGrid",children:["X","Y","Z"].map((b,_)=>(0,Q.jsxs)("div",{className:"se-axisStepper",children:[(0,Q.jsx)("button",{type:"button",className:"se-axisStepperButton",onClick:()=>{let y=[...i.rotation];y[_]=_1(y[_]-90),m({...i,rotation:y})},"aria-label":`Rotate ${b} axis backward`,children:(0,Q.jsx)(ta.ChevronLeft,{size:16})}),(0,Q.jsx)("span",{className:"se-axisStepperLabel",children:b}),(0,Q.jsx)("button",{type:"button",className:"se-axisStepperButton",onClick:()=>{let y=[...i.rotation];y[_]=_1(y[_]+90),m({...i,rotation:y})},"aria-label":`Rotate ${b} axis forward`,children:(0,Q.jsx)(ta.ChevronRight,{size:16})})]},b))})]}),(0,Q.jsx)(ea,{label:"Rotation",value:i.rotation,min:0,max:360,step:1,onChange:b=>m({...i,rotation:b})}),(0,Q.jsxs)("div",{className:"se-field",children:[(0,Q.jsx)("span",{className:"se-fieldLabel",children:"Renderer"}),(0,Q.jsx)("div",{className:"se-segmentedControl se-segmentedControl--renderer",children:jv.map(b=>(0,Q.jsx)("button",{type:"button",className:`se-segmentedOption ${i.renderer===b?"se-segmentedOption--active":""}`,onClick:()=>m({...i,renderer:b}),children:b==="uv-checker"?"UV CHECKER":b.toUpperCase()},b))})]}),(0,Q.jsx)(Hr,{label:"Shading",value:i.shading,options:H2,onChange:b=>m({...i,shading:b})}),n.length>0?(0,Q.jsxs)("label",{className:"se-field se-fieldInline",children:[(0,Q.jsx)("span",{className:"se-fieldLabel",children:"Material variant"}),(0,Q.jsxs)("select",{className:"se-select",value:i.materialVariant??"",onChange:b=>m({...i,materialVariant:b.target.value||null}),children:[(0,Q.jsx)("option",{value:"",children:"Model default"}),n.map(b=>(0,Q.jsx)("option",{value:b,children:b},b)),i.materialVariant&&!n.includes(i.materialVariant)?(0,Q.jsxs)("option",{value:i.materialVariant,children:[i.materialVariant," (not in this model)"]}):null]})]}):null]}),(0,Q.jsx)(nl,{title:"Camera",open:p.camera,onToggle:()=>d("camera"),children:(0,Q.jsx)(J,{label:"Field Of View",value:r.fieldOfView,min:20,max:100,step:.1,formatValue:b=>`${b.toFixed(3)}\xB0`,onChange:b=>g({...r,fieldOfView:b})})}),(0,Q.jsx)(nl,{title:"Auto Rotate",open:p.autoRotate,onToggle:()=>d("autoRotate"),trailing:(0,Q.jsxs)("label",{className:"se-switch","aria-label":"Toggle auto rotate",children:[(0,Q.jsx)("input",{type:"checkbox",checked:i.autoRotate??!1,onChange:b=>m({...i,autoRotate:b.target.checked})}),(0,Q.jsx)("span",{className:"se-switchTrack",children:(0,Q.jsx)("span",{className:"se-switchThumb"})})]}),children:i.autoRotate?(0,Q.jsx)(J,{label:"Rotation Speed",value:i.autoRotateSpeed??1,min:.1,max:3,step:.1,formatValue:b=>`${b.toFixed(1)}x`,onChange:b=>m({...i,autoRotateSpeed:b})}):(0,Q.jsx)("div",{className:"se-placeholder",children:"Enable auto rotate to adjust its speed."})}),(0,Q.jsx)(nl,{title:"Section Cut",open:p.section,onToggle:()=>d("section"),trailing:(0,Q.jsxs)("label",{className:"se-switch","aria-label":"Toggle section cut",children:[(0,Q.jsx)("input",{type:"checkbox",checked:v.enabled,onChange:b=>M({enabled:b.target.checked})}),(0,Q.jsx)("span",{className:"se-switchTrack",children:(0,Q.jsx)("span",{className:"se-switchThumb"})})]}),children:v.enabled?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"se-field",children:[(0,Q.jsx)("span",{className:"se-fieldLabel",children:"Cut across"}),(0,Q.jsx)("div",{className:"se-segmentedControl",children:Xd.map(b=>(0,Q.jsx)("button",{type:"button",className:`se-segmentedOption ${v.axis===b?"se-segmentedOption--active":""}`,onClick:()=>M({axis:b}),children:b.toUpperCase()},b))})]}),(0,Q.jsx)(J,{label:"Position",value:v.position,min:0,max:1,step:.01,formatValue:b=>`${Math.round(b*100)}%`,onChange:b=>M({position:b})}),(0,Q.jsx)(Pt,{label:"Keep the other side",checked:v.flip,onChange:b=>M({flip:b})})]}):(0,Q.jsx)("div",{className:"se-placeholder",children:"Cut the model open to see inside. Drag the plane in the preview, or set it here."})}),(0,Q.jsx)(nl,{title:"Wireframe",open:p.wireframe,onToggle:()=>d("wireframe"),trailing:(0,Q.jsxs)("label",{className:"se-switch","aria-label":"Toggle wireframe preview",children:[(0,Q.jsx)("input",{type:"checkbox",checked:c&&o.enabled,disabled:!c,onChange:b=>w({...o,enabled:b.target.checked})}),(0,Q.jsx)("span",{className:"se-switchTrack",children:(0,Q.jsx)("span",{className:"se-switchThumb"})})]}),children:c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{label:"Opacity",value:o.opacity,min:0,max:1,step:.01,onChange:b=>w({...o,opacity:b})}),(0,Q.jsx)(_r,{label:"Wire color",value:o.color,onChange:b=>w({...o,color:b})})]}):(0,Q.jsx)(qn,{requiredTier:"starter",feature:"Wireframe preview"})}),(0,Q.jsx)(nl,{title:"Background",open:p.background,onToggle:()=>d("background"),trailing:(0,Q.jsxs)("label",{className:"se-switch","aria-label":"Toggle scene background",children:[(0,Q.jsx)("input",{type:"checkbox",checked:a.enabled,onChange:b=>x({...a,enabled:b.target.checked})}),(0,Q.jsx)("span",{className:"se-switchTrack",children:(0,Q.jsx)("span",{className:"se-switchThumb"})})]}),children:a.enabled?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"se-field",children:[(0,Q.jsx)("span",{className:"se-fieldLabel",children:"Background type"}),(0,Q.jsx)("div",{className:"se-segmentedControl",children:G2.map(b=>(0,Q.jsx)("button",{type:"button",className:`se-segmentedOption ${a.type===b?"se-segmentedOption--active":""}`,onClick:()=>x({...a,type:b}),children:b},b))})]}),a.type==="environment"?c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"se-field",children:[(0,Q.jsx)("span",{className:"se-fieldLabel",children:"Environment source"}),(0,Q.jsxs)("div",{className:"se-segmentedControl",children:[(0,Q.jsx)("button",{type:"button",className:`se-segmentedOption ${s.source==="preset"?"se-segmentedOption--active":""}`,onClick:()=>S({...s,source:"preset"}),children:"PRESET"}),(0,Q.jsx)("button",{type:"button",className:`se-segmentedOption ${s.source==="custom"?"se-segmentedOption--active":""}`,onClick:()=>S({...s,source:"custom"}),children:"CUSTOM"})]})]}),s.source==="preset"?(0,Q.jsx)(Hr,{label:"Environment preset",value:s.preset,options:Hv,onChange:k}):(0,Q.jsxs)("label",{className:"se-field",children:[(0,Q.jsx)("span",{className:"se-fieldLabel",children:"Custom environment URL"}),(0,Q.jsx)("input",{type:"text",className:"se-textInput",placeholder:"https://example.com/environment.hdr",value:s.customEnvironmentUrl,onChange:b=>S({...s,customEnvironmentUrl:b.target.value})}),(0,Q.jsx)("span",{className:"bb-note",children:"Enter a HDR, EXR, JPG, JPEG, PNG, or WEBP URL."}),s.customEnvironmentUrl.trim()&&!Wd(s.customEnvironmentUrl)?(0,Q.jsx)("span",{className:"bb-note",style:{color:"#fca5a5"},children:"Invalid image/HDRI URL."}):null]}),(0,Q.jsx)(J,{label:"Environment intensity",value:s.intensity,min:0,max:3,step:.05,onChange:b=>S({...s,intensity:b})})]}):(0,Q.jsx)(qn,{requiredTier:"starter",feature:"Environment backgrounds"}):null,a.type==="image"?(0,Q.jsxs)("label",{className:"se-field",children:[(0,Q.jsx)("span",{className:"se-fieldLabel",children:"Background image URL"}),(0,Q.jsx)("input",{type:"text",className:"se-textInput",placeholder:"https://example.com/background.jpg",value:a.imageUrl,onChange:b=>x({...a,imageUrl:b.target.value})})]}):null,a.type==="color"?(0,Q.jsxs)("div",{className:"se-field",children:[(0,Q.jsx)("span",{className:"se-fieldLabel",children:"Background color"}),(0,Q.jsx)("div",{className:"se-inlineColorPicker",children:(0,Q.jsx)(pp.HexColorPicker,{color:a.color,onChange:b=>x({...a,color:b})})}),(0,Q.jsx)("div",{className:"se-fieldInline",children:(0,Q.jsx)(pp.HexColorInput,{prefixed:!0,className:"se-swatch",style:{background:a.color,color:Qo(a.color)},color:a.color,onChange:b=>x({...a,color:b})})})]}):null]}):(0,Q.jsx)("div",{className:"se-placeholder",children:"Background rendering is disabled for this scene preset."})})]})}var $1=require("react");var be=require("react/jsx-runtime");function C1({pp:e,set:t,open:n,toggle:i}){let{ssao:r}=e;return(0,be.jsxs)(Ct,{title:"SSAO",tooltip:"Adds soft contact shadows in corners, creases, and tight spaces.",open:n.ssao,onToggle:()=>i("ssao"),disabled:!r.enabled,trailing:(0,be.jsx)(Lt,{checked:r.enabled,onChange:o=>t("ssao",{...r,enabled:o}),label:"Toggle SSAO"}),children:[(0,be.jsx)(J,{label:"Samples",value:r.samples,min:1,max:64,step:1,onChange:o=>t("ssao",{...r,samples:o})}),(0,be.jsx)(J,{label:"Rings",value:r.rings,min:1,max:12,step:1,onChange:o=>t("ssao",{...r,rings:o})}),(0,be.jsx)(J,{label:"Intensity",value:r.intensity,min:0,max:20,step:.5,onChange:o=>t("ssao",{...r,intensity:o})}),(0,be.jsx)(J,{label:"Radius",value:r.radius,min:.01,max:1,step:.01,onChange:o=>t("ssao",{...r,radius:o})}),(0,be.jsx)(J,{label:"Bias",value:r.bias,min:0,max:.1,step:.001,onChange:o=>t("ssao",{...r,bias:o})}),(0,be.jsx)(J,{label:"Luminance Influence",value:r.luminanceInfluence,min:0,max:1,step:.01,onChange:o=>t("ssao",{...r,luminanceInfluence:o})}),(0,be.jsx)(J,{label:"Fade",value:r.fade,min:0,max:.1,step:.001,onChange:o=>t("ssao",{...r,fade:o})}),(0,be.jsx)(J,{label:"Min Radius Scale",value:r.minRadiusScale,min:0,max:1,step:.01,onChange:o=>t("ssao",{...r,minRadiusScale:o})}),(0,be.jsx)(J,{label:"World Distance Threshold",value:r.worldDistanceThreshold,min:0,max:100,step:.1,onChange:o=>t("ssao",{...r,worldDistanceThreshold:o})}),(0,be.jsx)(J,{label:"World Distance Falloff",value:r.worldDistanceFalloff,min:0,max:20,step:.1,onChange:o=>t("ssao",{...r,worldDistanceFalloff:o})}),(0,be.jsx)(J,{label:"World Proximity Threshold",value:r.worldProximityThreshold,min:0,max:100,step:.1,onChange:o=>t("ssao",{...r,worldProximityThreshold:o})}),(0,be.jsx)(J,{label:"World Proximity Falloff",value:r.worldProximityFalloff,min:0,max:20,step:.1,onChange:o=>t("ssao",{...r,worldProximityFalloff:o})})]})}function T1({pp:e,set:t,open:n,toggle:i}){let{autofocus:r}=e;return(0,be.jsxs)(Ct,{title:"Auto focus",tooltip:"Keeps the focus plane tracking a subject so the image stays sharp where you want it.",open:n.autofocus,onToggle:()=>i("autofocus"),disabled:!r.enabled,trailing:(0,be.jsx)(Lt,{checked:r.enabled,onChange:o=>t("autofocus",{...r,enabled:o}),label:"Toggle Autofocus"}),children:[(0,be.jsx)(J,{label:"Focus Distance",value:r.focusDistance,min:0,max:50,step:.1,onChange:o=>t("autofocus",{...r,focusDistance:o})}),(0,be.jsx)(J,{label:"Focus Range",value:r.focusRange,min:.1,max:50,step:.1,onChange:o=>t("autofocus",{...r,focusRange:o})}),(0,be.jsx)(J,{label:"Focal Length",value:r.focalLength,min:0,max:1,step:.01,onChange:o=>t("autofocus",{...r,focalLength:o})}),(0,be.jsx)(J,{label:"Bokeh Scale",value:r.bokehScale,min:0,max:20,step:.1,onChange:o=>t("autofocus",{...r,bokehScale:o})}),(0,be.jsx)(ea,{label:"Target",value:r.target,min:-100,max:100,step:.1,onChange:o=>t("autofocus",{...r,target:o})}),(0,be.jsx)(Pt,{label:"Mouse Follow",checked:r.mouse,onChange:o=>t("autofocus",{...r,mouse:o})}),(0,be.jsx)(Pt,{label:"Manual Update",checked:r.manual,onChange:o=>t("autofocus",{...r,manual:o})}),(0,be.jsx)(J,{label:"Debug",value:r.debug,min:0,max:1,step:.01,onChange:o=>t("autofocus",{...r,debug:o})}),(0,be.jsx)(J,{label:"Smooth Time",value:r.smoothTime,min:0,max:2,step:.01,onChange:o=>t("autofocus",{...r,smoothTime:o})})]})}function P1({pp:e,set:t,open:n,toggle:i}){let{godRays:r}=e;return(0,be.jsxs)(Ct,{title:"God Rays",tooltip:"Creates light shafts that streak outward from a bright sun or light source.",open:n.godRays,onToggle:()=>i("godRays"),disabled:!r.enabled,trailing:(0,be.jsx)(Lt,{checked:r.enabled,onChange:o=>t("godRays",{...r,enabled:o}),label:"Toggle GodRays"}),children:[(0,be.jsx)(ea,{label:"Sun Position",value:r.sunPosition,min:-100,max:100,step:.1,onChange:o=>t("godRays",{...r,sunPosition:o})}),(0,be.jsx)(J,{label:"Samples",value:r.samples,min:1,max:128,step:1,onChange:o=>t("godRays",{...r,samples:o})}),(0,be.jsx)(J,{label:"Density",value:r.density,min:0,max:2,step:.01,onChange:o=>t("godRays",{...r,density:o})}),(0,be.jsx)(J,{label:"Decay",value:r.decay,min:0,max:1,step:.01,onChange:o=>t("godRays",{...r,decay:o})}),(0,be.jsx)(J,{label:"Weight",value:r.weight,min:0,max:2,step:.01,onChange:o=>t("godRays",{...r,weight:o})}),(0,be.jsx)(J,{label:"Exposure",value:r.exposure,min:0,max:2,step:.01,onChange:o=>t("godRays",{...r,exposure:o})}),(0,be.jsx)(J,{label:"Clamp Max",value:r.clampMax,min:0,max:2,step:.01,onChange:o=>t("godRays",{...r,clampMax:o})}),(0,be.jsx)(Pt,{label:"Blur",checked:r.blur,onChange:o=>t("godRays",{...r,blur:o})}),(0,be.jsx)(Hr,{label:"Kernel Size",value:r.kernelSize,options:ql,onChange:o=>t("godRays",{...r,kernelSize:o})})]})}function A1({pp:e,set:t,open:n,toggle:i}){let{lensflare:r}=e;return(0,be.jsxs)(Ct,{title:"Lens Flare",tooltip:"Adds camera flare artifacts and glow from a bright light source.",open:n.lensflare,onToggle:()=>i("lensflare"),disabled:!r.enabled,trailing:(0,be.jsx)(Lt,{checked:r.enabled,onChange:o=>t("lensflare",{...r,enabled:o}),label:"Toggle Lensflare"}),children:[(0,be.jsx)(ea,{label:"Lens Position",value:r.lensPosition,min:-100,max:100,step:.1,onChange:o=>t("lensflare",{...r,lensPosition:o})}),(0,be.jsx)(J,{label:"Smooth Time",value:r.smoothTime,min:0,max:1,step:.01,onChange:o=>t("lensflare",{...r,smoothTime:o})}),(0,be.jsx)(J,{label:"Glare Size",value:r.glareSize,min:0,max:1,step:.01,onChange:o=>t("lensflare",{...r,glareSize:o})}),(0,be.jsx)(J,{label:"Flare Size",value:r.flareSize,min:0,max:.1,step:.001,onChange:o=>t("lensflare",{...r,flareSize:o})}),(0,be.jsx)(J,{label:"Flare Speed",value:r.flareSpeed,min:0,max:.2,step:.001,onChange:o=>t("lensflare",{...r,flareSpeed:o})}),(0,be.jsx)(J,{label:"Flare Shape",value:r.flareShape,min:0,max:.2,step:.001,onChange:o=>t("lensflare",{...r,flareShape:o})}),(0,be.jsx)(Pt,{label:"Animated",checked:r.animated,onChange:o=>t("lensflare",{...r,animated:o})}),(0,be.jsx)(Pt,{label:"Anamorphic",checked:r.anamorphic,onChange:o=>t("lensflare",{...r,anamorphic:o})}),(0,be.jsx)(_r,{label:"Color Gain",value:r.colorGain,onChange:o=>t("lensflare",{...r,colorGain:o})}),(0,be.jsx)(J,{label:"Halo Scale",value:r.haloScale,min:0,max:2,step:.01,onChange:o=>t("lensflare",{...r,haloScale:o})}),(0,be.jsx)(Pt,{label:"Secondary Ghosts",checked:r.secondaryGhosts,onChange:o=>t("lensflare",{...r,secondaryGhosts:o})}),(0,be.jsx)(Pt,{label:"Additional Streaks",checked:r.aditionalStreaks,onChange:o=>t("lensflare",{...r,aditionalStreaks:o})}),(0,be.jsx)(J,{label:"Ghost Scale",value:r.ghostScale,min:0,max:1,step:.01,onChange:o=>t("lensflare",{...r,ghostScale:o})}),(0,be.jsx)(J,{label:"Opacity",value:r.opacity,min:0,max:1,step:.01,onChange:o=>t("lensflare",{...r,opacity:o})}),(0,be.jsx)(Pt,{label:"Star Burst",checked:r.starBurst,onChange:o=>t("lensflare",{...r,starBurst:o})})]})}function E1({pp:e,set:t,open:n,toggle:i}){let{depthOfField:r}=e;return(0,be.jsxs)(Ct,{title:"Depth Of Field",tooltip:"Blurs areas that sit away from the focal plane for a camera-like look.",open:n.depthOfField,onToggle:()=>i("depthOfField"),disabled:!r.enabled,trailing:(0,be.jsx)(Lt,{checked:r.enabled,onChange:o=>t("depthOfField",{...r,enabled:o}),label:"Toggle DepthOfField"}),children:[(0,be.jsx)(J,{label:"Focus Distance",value:r.focusDistance,min:0,max:50,step:.1,onChange:o=>t("depthOfField",{...r,focusDistance:o})}),(0,be.jsx)(J,{label:"Focus Range",value:r.focusRange,min:.1,max:50,step:.1,onChange:o=>t("depthOfField",{...r,focusRange:o})}),(0,be.jsx)(J,{label:"Focal Length",value:r.focalLength,min:0,max:1,step:.01,onChange:o=>t("depthOfField",{...r,focalLength:o})}),(0,be.jsx)(J,{label:"Bokeh Scale",value:r.bokehScale,min:0,max:20,step:.1,onChange:o=>t("depthOfField",{...r,bokehScale:o})})]})}var Xe=require("react/jsx-runtime"),W2=["linear","reinhard","aces"];function R1({pp:e,set:t,open:n,toggle:i}){let{colorAverage:r}=e;return(0,Xe.jsx)(Ct,{title:"Color Average",tooltip:"Blends the frame toward a single average color for a washed-out stylized look.",open:n.colorAverage,onToggle:()=>i("colorAverage"),disabled:!r.enabled,trailing:(0,Xe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("colorAverage",{...r,enabled:o}),label:"Toggle ColorAverage"}),children:(0,Xe.jsx)("div",{className:"se-placeholder",children:"Averages the frame color using the docs default blend mode."})})}function k1({pp:e,set:t,open:n,toggle:i}){let{brightnessContrast:r}=e;return(0,Xe.jsxs)(Ct,{title:"Brightness Contrast",tooltip:"Raises or lowers overall brightness and contrast across the scene.",open:n.brightnessContrast,onToggle:()=>i("brightnessContrast"),disabled:!r.enabled,trailing:(0,Xe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("brightnessContrast",{...r,enabled:o}),label:"Toggle BrightnessContrast"}),children:[(0,Xe.jsx)(J,{label:"Brightness",value:r.brightness,min:-1,max:1,step:.01,onChange:o=>t("brightnessContrast",{...r,brightness:o})}),(0,Xe.jsx)(J,{label:"Contrast",value:r.contrast,min:-1,max:1,step:.01,onChange:o=>t("brightnessContrast",{...r,contrast:o})})]})}function L1({pp:e,set:t,open:n,toggle:i}){let{hueSaturation:r}=e;return(0,Xe.jsxs)(Ct,{title:"Hue Saturation",tooltip:"Shifts the hue and saturation to tint the whole image.",open:n.hueSaturation,onToggle:()=>i("hueSaturation"),disabled:!r.enabled,trailing:(0,Xe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("hueSaturation",{...r,enabled:o}),label:"Toggle HueSaturation"}),children:[(0,Xe.jsx)(J,{label:"Hue",value:r.hue,min:-Math.PI,max:Math.PI,step:.01,formatValue:o=>`${o.toFixed(2)} rad`,onChange:o=>t("hueSaturation",{...r,hue:o})}),(0,Xe.jsx)(J,{label:"Saturation",value:r.saturation,min:-1,max:1,step:.01,onChange:o=>t("hueSaturation",{...r,saturation:o})})]})}function D1({pp:e,set:t,open:n,toggle:i}){let{vignette:r}=e;return(0,Xe.jsxs)(Ct,{title:"Vignette",tooltip:"Darkens the edges of the screen so the center feels more focused.",open:n.vignette,onToggle:()=>i("vignette"),disabled:!r.enabled,trailing:(0,Xe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("vignette",{...r,enabled:o}),label:"Toggle Vignette"}),children:[(0,Xe.jsx)(J,{label:"Offset",value:r.offset,min:0,max:1,step:.01,onChange:o=>t("vignette",{...r,offset:o})}),(0,Xe.jsx)(J,{label:"Darkness",value:r.darkness,min:0,max:1,step:.01,onChange:o=>t("vignette",{...r,darkness:o})}),(0,Xe.jsx)(Pt,{label:"Eskil",checked:r.eskil,onChange:o=>t("vignette",{...r,eskil:o})})]})}function N1({pp:e,set:t,open:n,toggle:i}){let{bloom:r}=e;return(0,Xe.jsxs)(Ct,{title:"Bloom",tooltip:"Makes bright areas glow and bleed softly into nearby pixels.",open:n.bloom,onToggle:()=>i("bloom"),disabled:!r.enabled,trailing:(0,Xe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("bloom",{...r,enabled:o}),label:"Toggle Bloom"}),children:[(0,Xe.jsx)(J,{label:"Threshold",value:r.luminanceThreshold,min:0,max:1,step:.01,onChange:o=>t("bloom",{...r,luminanceThreshold:o})}),(0,Xe.jsx)(J,{label:"Smoothing",value:r.luminanceSmoothing,min:0,max:1,step:.01,onChange:o=>t("bloom",{...r,luminanceSmoothing:o})}),(0,Xe.jsx)(J,{label:"Intensity",value:r.intensity,min:0,max:3,step:.05,onChange:o=>t("bloom",{...r,intensity:o})}),(0,Xe.jsx)(Pt,{label:"Mipmap Blur",checked:r.mipmapBlur,onChange:o=>t("bloom",{...r,mipmapBlur:o})}),(0,Xe.jsx)(J,{label:"Radius",value:r.radius,min:0,max:1,step:.01,onChange:o=>t("bloom",{...r,radius:o})}),(0,Xe.jsx)(J,{label:"Levels",value:r.levels,min:1,max:16,step:1,onChange:o=>t("bloom",{...r,levels:o})})]})}function B1({pp:e,set:t,open:n,toggle:i}){let{toneMapping:r}=e;return(0,Xe.jsxs)(Ct,{title:"Tone Mapping",tooltip:"Remaps HDR lighting to screen output and controls exposure style.",open:n.toneMapping,onToggle:()=>i("toneMapping"),disabled:!r.enabled,trailing:(0,Xe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("toneMapping",{...r,enabled:o}),label:"Toggle ToneMapping"}),children:[(0,Xe.jsxs)("div",{className:"se-field",children:[(0,Xe.jsx)("span",{className:"se-fieldLabel",children:"Mode"}),(0,Xe.jsx)("div",{className:"se-segmentedControl",children:W2.map(o=>(0,Xe.jsx)("button",{type:"button",className:`se-segmentedOption ${r.mode===o?"se-segmentedOption--active":""}`,onClick:()=>t("toneMapping",{...r,mode:o}),children:o==="aces"?"Filmic":o.charAt(0).toUpperCase()+o.slice(1)},o))})]}),(0,Xe.jsx)(J,{label:"Resolution",value:r.resolution,min:64,max:4096,step:64,onChange:o=>t("toneMapping",{...r,resolution:o})}),(0,Xe.jsx)(J,{label:"White Point",value:r.whitePoint,min:0,max:16,step:.01,onChange:o=>t("toneMapping",{...r,whitePoint:o})}),(0,Xe.jsx)(J,{label:"Middle Grey",value:r.middleGrey,min:0,max:1,step:.01,onChange:o=>t("toneMapping",{...r,middleGrey:o})}),(0,Xe.jsx)(J,{label:"Min Luminance",value:r.minLuminance,min:0,max:1,step:.01,onChange:o=>t("toneMapping",{...r,minLuminance:o})}),(0,Xe.jsx)(J,{label:"Average Luminance",value:r.averageLuminance,min:0,max:4,step:.01,onChange:o=>t("toneMapping",{...r,averageLuminance:o})}),(0,Xe.jsx)(J,{label:"Adaptation Rate",value:r.adaptationRate,min:0,max:10,step:.01,onChange:o=>t("toneMapping",{...r,adaptationRate:o})}),(0,Xe.jsx)(J,{label:"Exposure",value:r.exposure,min:0,max:3,step:.01,onChange:o=>t("toneMapping",{...r,exposure:o})})]})}function O1({pp:e,set:t,open:n,toggle:i}){let{sepia:r}=e;return(0,Xe.jsx)(Ct,{title:"Sepia",tooltip:"Adds a warm vintage brown tint to the entire image.",open:n.sepia,onToggle:()=>i("sepia"),disabled:!r.enabled,trailing:(0,Xe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("sepia",{...r,enabled:o}),label:"Toggle Sepia"}),children:(0,Xe.jsx)(J,{label:"Intensity",value:r.intensity,min:0,max:1,step:.01,onChange:o=>t("sepia",{...r,intensity:o})})})}var Oe=require("react/jsx-runtime");function I1({pp:e,set:t,open:n,toggle:i}){let{dotScreen:r}=e;return(0,Oe.jsxs)(Ct,{title:"Dot Screen",tooltip:"Overlays a halftone dot pattern for a printed or retro look.",open:n.dotScreen,onToggle:()=>i("dotScreen"),disabled:!r.enabled,trailing:(0,Oe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("dotScreen",{...r,enabled:o}),label:"Toggle DotScreen"}),children:[(0,Oe.jsx)(J,{label:"Angle",value:r.angle,min:0,max:Math.PI*2,step:.01,formatValue:o=>`${o.toFixed(2)} rad`,onChange:o=>t("dotScreen",{...r,angle:o})}),(0,Oe.jsx)(J,{label:"Scale",value:r.scale,min:.1,max:10,step:.05,onChange:o=>t("dotScreen",{...r,scale:o})})]})}function z1({pp:e,set:t,open:n,toggle:i}){let{glitch:r}=e;return(0,Oe.jsxs)(Ct,{title:"Glitch",tooltip:"Introduces digital distortion, tearing, and scan noise.",open:n.glitch,onToggle:()=>i("glitch"),disabled:!r.enabled,trailing:(0,Oe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("glitch",{...r,enabled:o}),label:"Toggle Glitch"}),children:[(0,Oe.jsx)(Hr,{label:"Mode",value:r.mode,options:Gv,onChange:o=>t("glitch",{...r,mode:o})}),(0,Oe.jsx)(Xa,{label:"Delay",value:r.delay,min:0,max:10,step:.01,onChange:o=>t("glitch",{...r,delay:o})}),(0,Oe.jsx)(Xa,{label:"Duration",value:r.duration,min:0,max:5,step:.01,onChange:o=>t("glitch",{...r,duration:o})}),(0,Oe.jsx)(Xa,{label:"Strength",value:r.strength,min:0,max:2,step:.01,onChange:o=>t("glitch",{...r,strength:o})}),(0,Oe.jsx)(Xa,{label:"Chromatic Aberration Offset",value:r.chromaticAberrationOffset,min:0,max:.02,step:1e-4,onChange:o=>t("glitch",{...r,chromaticAberrationOffset:o})}),(0,Oe.jsx)(J,{label:"Columns",value:r.columns,min:0,max:.5,step:.001,onChange:o=>t("glitch",{...r,columns:o})}),(0,Oe.jsx)(J,{label:"Ratio",value:r.ratio,min:0,max:1,step:.01,onChange:o=>t("glitch",{...r,ratio:o})})]})}function U1({pp:e,set:t,open:n,toggle:i}){let{grid:r}=e;return(0,Oe.jsxs)(Ct,{title:"Grid",tooltip:"Adds a visual grid overlay that feels retro or debug-like.",open:n.grid,onToggle:()=>i("grid"),disabled:!r.enabled,trailing:(0,Oe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("grid",{...r,enabled:o}),label:"Toggle Grid"}),children:[(0,Oe.jsx)(J,{label:"Scale",value:r.scale,min:.1,max:10,step:.05,onChange:o=>t("grid",{...r,scale:o})}),(0,Oe.jsx)(J,{label:"Line Width",value:r.lineWidth,min:0,max:1,step:.01,onChange:o=>t("grid",{...r,lineWidth:o})})]})}function F1({pp:e,set:t,open:n,toggle:i}){let{chromaticAberration:r}=e;return(0,Oe.jsxs)(Ct,{title:"Chromatic Aberration",tooltip:"Separates color channels slightly to mimic lens fringing.",open:n.chromaticAberration,onToggle:()=>i("chromaticAberration"),disabled:!r.enabled,trailing:(0,Oe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("chromaticAberration",{...r,enabled:o}),label:"Toggle ChromaticAberration"}),children:[(0,Oe.jsx)(J,{label:"Offset X",value:r.offsetX,min:0,max:.02,step:1e-4,onChange:o=>t("chromaticAberration",{...r,offsetX:o})}),(0,Oe.jsx)(J,{label:"Offset Y",value:r.offsetY,min:0,max:.02,step:1e-4,onChange:o=>t("chromaticAberration",{...r,offsetY:o})}),(0,Oe.jsx)(Pt,{label:"Radial Modulation",checked:r.radialModulation,onChange:o=>t("chromaticAberration",{...r,radialModulation:o})}),(0,Oe.jsx)(J,{label:"Modulation Offset",value:r.modulationOffset,min:0,max:1,step:.01,onChange:o=>t("chromaticAberration",{...r,modulationOffset:o})})]})}function V1({pp:e,set:t,open:n,toggle:i}){let{noise:r}=e;return(0,Oe.jsxs)(Ct,{title:"Noise",tooltip:"Adds film grain or static noise to the rendered image.",open:n.noise,onToggle:()=>i("noise"),disabled:!r.enabled,trailing:(0,Oe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("noise",{...r,enabled:o}),label:"Toggle Noise"}),children:[(0,Oe.jsx)(J,{label:"Amount",value:r.opacity,min:0,max:1,step:.01,onChange:o=>t("noise",{...r,opacity:o})}),(0,Oe.jsx)(Pt,{label:"Premultiply",checked:r.premultiply,onChange:o=>t("noise",{...r,premultiply:o})})]})}function j1({pp:e,set:t,open:n,toggle:i}){let{scanline:r}=e;return(0,Oe.jsx)(Ct,{title:"Scan Line",tooltip:"Draws horizontal CRT-style scan lines over the frame.",open:n.scanline,onToggle:()=>i("scanline"),disabled:!r.enabled,trailing:(0,Oe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("scanline",{...r,enabled:o}),label:"Toggle Scanline"}),children:(0,Oe.jsx)(J,{label:"Density",value:r.density,min:0,max:10,step:.25,onChange:o=>t("scanline",{...r,density:o})})})}function H1({pp:e,set:t,open:n,toggle:i}){let{pixelation:r}=e;return(0,Oe.jsx)(Ct,{title:"Pixelation",tooltip:"Reduces detail into larger pixels for a blocky stylized effect.",open:n.pixelation,onToggle:()=>i("pixelation"),disabled:!r.enabled,trailing:(0,Oe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("pixelation",{...r,enabled:o}),label:"Toggle Pixelation"}),children:(0,Oe.jsx)(J,{label:"Granularity",value:r.granularity,min:0,max:20,step:1,onChange:o=>t("pixelation",{...r,granularity:o})})})}function G1({pp:e,set:t,open:n,toggle:i}){let{ramp:r}=e;return(0,Oe.jsxs)(Ct,{title:"Ramp",tooltip:"Adds a screen-space color gradient, or masks effects earlier in the stack.",open:n.ramp,onToggle:()=>i("ramp"),disabled:!r.enabled,trailing:(0,Oe.jsx)(Lt,{checked:r.enabled,onChange:o=>t("ramp",{...r,enabled:o}),label:"Toggle Ramp"}),children:[(0,Oe.jsx)(Hr,{label:"Ramp Type",value:r.rampType,options:Wv,onChange:o=>t("ramp",{...r,rampType:o})}),(0,Oe.jsx)(Xa,{label:"Ramp Start",value:r.rampStart,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,rampStart:o})}),(0,Oe.jsx)(Xa,{label:"Ramp End",value:r.rampEnd,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,rampEnd:o})}),(0,Oe.jsx)(_r,{label:"Start Color",value:r.startColor,onChange:o=>t("ramp",{...r,startColor:o})}),(0,Oe.jsx)(_r,{label:"End Color",value:r.endColor,onChange:o=>t("ramp",{...r,endColor:o})}),!r.rampMask&&(0,Oe.jsx)(J,{label:"Gradient Opacity",value:r.opacity??.5,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,opacity:o})}),(0,Oe.jsx)(J,{label:"Bias",value:r.rampBias,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,rampBias:o})}),(0,Oe.jsx)(J,{label:"Gain",value:r.rampGain,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,rampGain:o})}),(0,Oe.jsx)(Pt,{label:"Mask Earlier Effects",checked:r.rampMask,onChange:o=>t("ramp",{...r,rampMask:o})}),(0,Oe.jsx)(Pt,{label:"Invert",checked:r.rampInvert,onChange:o=>t("ramp",{...r,rampInvert:o})})]})}var Wt=require("react/jsx-runtime");function W1({pp:e,set:t,open:n,toggle:i}){let{outline:r}=e;return(0,Wt.jsxs)(Ct,{title:"Outline",tooltip:"Draws a visible edge around the selected object binding.",open:n.outline,onToggle:()=>i("outline"),disabled:!r.enabled,trailing:(0,Wt.jsx)(Lt,{checked:r.enabled,onChange:o=>t("outline",{...r,enabled:o}),label:"Toggle Outline"}),children:[(0,Wt.jsx)("div",{className:"se-placeholder",children:"Outlines the currently selected object binding in the model editor."}),(0,Wt.jsx)(J,{label:"Selection Layer",value:r.selectionLayer,min:0,max:20,step:1,onChange:o=>t("outline",{...r,selectionLayer:o})}),(0,Wt.jsx)(J,{label:"Edge Strength",value:r.edgeStrength,min:0,max:10,step:.1,onChange:o=>t("outline",{...r,edgeStrength:o})}),(0,Wt.jsx)(J,{label:"Pulse Speed",value:r.pulseSpeed,min:0,max:10,step:.1,onChange:o=>t("outline",{...r,pulseSpeed:o})}),(0,Wt.jsx)(_r,{label:"Visible Edge Color",value:r.visibleEdgeColor,onChange:o=>t("outline",{...r,visibleEdgeColor:o})}),(0,Wt.jsx)(_r,{label:"Hidden Edge Color",value:r.hiddenEdgeColor,onChange:o=>t("outline",{...r,hiddenEdgeColor:o})}),(0,Wt.jsx)(Hr,{label:"Kernel Size",value:r.kernelSize,options:ql,onChange:o=>t("outline",{...r,kernelSize:o})}),(0,Wt.jsx)(Pt,{label:"Blur",checked:r.blur,onChange:o=>t("outline",{...r,blur:o})}),(0,Wt.jsx)(Pt,{label:"X-Ray",checked:r.xRay,onChange:o=>t("outline",{...r,xRay:o})})]})}function X1({pp:e,set:t,open:n,toggle:i}){let{selectiveBloom:r}=e;return(0,Wt.jsxs)(Ct,{title:"Selective Bloom",tooltip:"Applies bloom only to objects assigned to the selected layer.",open:n.selectiveBloom,onToggle:()=>i("selectiveBloom"),disabled:!r.enabled,trailing:(0,Wt.jsx)(Lt,{checked:r.enabled,onChange:o=>t("selectiveBloom",{...r,enabled:o}),label:"Toggle SelectiveBloom"}),children:[(0,Wt.jsx)("div",{className:"se-placeholder",children:"Applies bloom to the currently selected object binding."}),(0,Wt.jsx)(J,{label:"Selection Layer",value:r.selectionLayer,min:0,max:20,step:1,onChange:o=>t("selectiveBloom",{...r,selectionLayer:o})}),(0,Wt.jsx)(J,{label:"Intensity",value:r.intensity,min:0,max:5,step:.05,onChange:o=>t("selectiveBloom",{...r,intensity:o})}),(0,Wt.jsx)(J,{label:"Threshold",value:r.luminanceThreshold,min:0,max:1,step:.01,onChange:o=>t("selectiveBloom",{...r,luminanceThreshold:o})}),(0,Wt.jsx)(J,{label:"Smoothing",value:r.luminanceSmoothing,min:0,max:1,step:.01,onChange:o=>t("selectiveBloom",{...r,luminanceSmoothing:o})}),(0,Wt.jsx)(Hr,{label:"Kernel Size",value:r.kernelSize,options:ql,onChange:o=>t("selectiveBloom",{...r,kernelSize:o})}),(0,Wt.jsx)(Pt,{label:"Mipmap Blur",checked:r.mipmapBlur,onChange:o=>t("selectiveBloom",{...r,mipmapBlur:o})}),(0,Wt.jsx)(Pt,{label:"Inverted",checked:r.inverted,onChange:o=>t("selectiveBloom",{...r,inverted:o})}),(0,Wt.jsx)(Pt,{label:"Ignore Background",checked:r.ignoreBackground,onChange:o=>t("selectiveBloom",{...r,ignoreBackground:o})})]})}function q1({pp:e,set:t,open:n,toggle:i}){let{smaa:r}=e;return(0,Wt.jsx)(Ct,{title:"SMAA",tooltip:"Reduces jagged edges with subpixel anti-aliasing.",open:n.smaa,onToggle:()=>i("smaa"),trailing:(0,Wt.jsx)(Lt,{checked:r.enabled,onChange:o=>t("smaa",{...r,enabled:o}),label:"Toggle SMAA"}),children:(0,Wt.jsx)("div",{className:"se-placeholder",children:"Subpixel Morphological Anti-Aliasing smooths jagged edges in post-process."})})}var Yt=require("react/jsx-runtime");function ff({config:e,onChange:t}){let[n,i]=(0,$1.useState)({autofocus:!1,colorAverage:!1,dotScreen:!1,glitch:!1,godRays:!1,grid:!1,lensflare:!1,outline:!1,selectiveBloom:!1,ramp:!1,ssao:!1,brightnessContrast:!1,hueSaturation:!1,depthOfField:!1,chromaticAberration:!1,vignette:!1,bloom:!1,toneMapping:!1,noise:!1,sepia:!1,scanline:!1,pixelation:!1,smaa:!1}),r=l=>i(c=>({...c,[l]:!c[l]})),o=e.postProcessing,s={pp:o,set:(l,c)=>t({...e,postProcessing:{...o,[l]:c}}),open:n,toggle:r};return(0,Yt.jsxs)("div",{className:"se-generalContent",children:[(0,Yt.jsx)(C1,{...s}),(0,Yt.jsx)(T1,{...s}),(0,Yt.jsx)(R1,{...s}),(0,Yt.jsx)(I1,{...s}),(0,Yt.jsx)(z1,{...s}),(0,Yt.jsx)(P1,{...s}),(0,Yt.jsx)(U1,{...s}),(0,Yt.jsx)(A1,{...s}),(0,Yt.jsx)(W1,{...s}),(0,Yt.jsx)(X1,{...s}),(0,Yt.jsx)(k1,{...s}),(0,Yt.jsx)(L1,{...s}),(0,Yt.jsx)(E1,{...s}),(0,Yt.jsx)(F1,{...s}),(0,Yt.jsx)(D1,{...s}),(0,Yt.jsx)(N1,{...s}),(0,Yt.jsx)(B1,{...s}),(0,Yt.jsx)(V1,{...s}),(0,Yt.jsx)(O1,{...s}),(0,Yt.jsx)(j1,{...s}),(0,Yt.jsx)(H1,{...s}),(0,Yt.jsx)(G1,{...s}),(0,Yt.jsx)(q1,{...s})]})}var Dc=require("react"),na=require("lucide-react");var ve=require("react/jsx-runtime"),X2=["512","1024","2048","4096"],Y1={none:"None",directional:"Direction",point:"Point",spot:"Spot",hemisphere:"Hemi"};function q2({index:e,light:t,selected:n,onSelect:i,onToggleVisible:r}){return(0,ve.jsxs)("div",{className:`se-lightRow ${n?"se-lightRow--active":""}`,onClick:i,children:[(0,ve.jsxs)("span",{className:"se-lightRowLabel",children:[e+1,": ",Y1[t.type]]}),(0,ve.jsx)("button",{type:"button",className:"se-iconButton","aria-label":t.visible?"Hide light":"Show light",onClick:o=>{o.stopPropagation(),r()},children:t.visible?(0,ve.jsx)(na.Eye,{size:14}):(0,ve.jsx)(na.EyeOff,{size:14})})]})}function $2(){return{id:crypto.randomUUID(),type:"directional",color:"#ffffff",intensity:1,position:[5,10,5],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}}function gf({config:e,onChange:t}){let[n,i]=(0,Dc.useState)({lights:!0,shadows:!1,groundShadows:!1,environment:!1,envShadow:!1}),r=(0,Dc.useSyncExternalStore)(cf,tp),[o,a]=(0,Dc.useState)(e.lighting.lights[0]?.id??null),s=r??o,l=h=>{a(h),Pc(h)},c=h=>i(P=>({...P,[h]:!P[h]})),{tier:p}=Sr(),u=Bi(p,"starter"),{lighting:d,shadows:m,groundShadows:g,environment:v}=e,M=h=>t({...e,lighting:h}),w=h=>t({...e,shadows:h}),x=h=>t({...e,groundShadows:h}),S=h=>t({...e,environment:h}),k=(h,P)=>{M({...d,lights:d.lights.map(A=>A.id===h?{...A,...P}:A)})},b=d.lights.find(h=>h.id===s)??null,_=()=>{let h=$2();M({...d,lights:[...d.lights,h]}),l(h.id)},y=()=>{if(!b)return;let h=d.lights.filter(P=>P.id!==b.id);M({...d,lights:h}),l(h[0]?.id??null)};return(0,ve.jsxs)("div",{className:"se-generalContent",children:[(0,ve.jsxs)(Ct,{title:"Lights",open:n.lights,onToggle:()=>c("lights"),children:[(0,ve.jsx)("div",{className:"se-lightList",children:d.lights.map((h,P)=>(0,ve.jsx)(q2,{index:P,light:h,selected:h.id===s,onSelect:()=>l(h.id),onToggleVisible:()=>k(h.id,{visible:!h.visible})},h.id))}),(0,ve.jsxs)("div",{className:"se-lightActions",children:[(0,ve.jsx)("button",{type:"button",className:"se-iconButton",onClick:_,title:"Add light",children:(0,ve.jsx)(na.Plus,{size:14})}),b&&d.lights.length>1&&(0,ve.jsx)("button",{type:"button",className:"se-iconButton",onClick:y,title:"Remove selected light",children:(0,ve.jsx)(na.Trash2,{size:14})})]}),b?(0,ve.jsxs)("div",{className:"se-lightProps",children:[(0,ve.jsxs)("div",{className:"se-field",children:[(0,ve.jsx)("span",{className:"se-fieldLabel",children:"Type"}),(0,ve.jsx)("div",{className:"se-segmentedControl",style:{gridAutoColumns:"1fr"},children:Vv.map(h=>(0,ve.jsx)("button",{type:"button",className:`se-segmentedOption ${b.type===h?"se-segmentedOption--active":""}`,onClick:()=>k(b.id,{type:h}),children:Y1[h]},h))})]}),(0,ve.jsx)(_r,{label:"Color",value:b.color,onChange:h=>k(b.id,{color:h})}),(0,ve.jsx)(J,{label:"Intensity",value:b.intensity,min:0,max:10,step:.1,onChange:h=>k(b.id,{intensity:h})}),b.type!=="hemisphere"&&b.type!=="none"&&(0,ve.jsx)(ea,{label:"Position",value:b.position,min:-100,max:100,step:.05,onChange:h=>k(b.id,{position:h})}),b.type==="spot"&&(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(J,{label:"Angle",value:b.angle??Math.PI/6,min:0,max:Math.PI/2,step:.01,formatValue:h=>`${Math.round(h*180/Math.PI)}\xB0`,onChange:h=>k(b.id,{angle:h})}),(0,ve.jsx)(J,{label:"Penumbra",value:b.penumbra??.2,min:0,max:1,step:.01,onChange:h=>k(b.id,{penumbra:h})}),(0,ve.jsx)(J,{label:"Distance",value:b.distance??0,min:0,max:100,step:.5,onChange:h=>k(b.id,{distance:h})}),(0,ve.jsx)(J,{label:"Decay",value:b.decay??2,min:0,max:4,step:.1,onChange:h=>k(b.id,{decay:h})})]}),(0,ve.jsx)(Pt,{label:"Attached to camera",checked:b.attachedToCamera,onChange:h=>k(b.id,{attachedToCamera:h})}),(0,ve.jsx)(Pt,{label:"Cast shadows",checked:b.castShadow,onChange:h=>k(b.id,{castShadow:h})}),(0,ve.jsx)(J,{label:"Shadow bias",value:b.shadowBias,min:-.01,max:.01,step:1e-4,onChange:h=>k(b.id,{shadowBias:h})})]}):null]}),(0,ve.jsxs)(Ct,{title:"Shadows",open:n.shadows,onToggle:()=>c("shadows"),disabled:!m.enabled,trailing:(0,ve.jsx)(Lt,{checked:m.enabled,onChange:h=>w({...m,enabled:h}),label:"Toggle shadows"}),children:[(0,ve.jsx)(Hr,{label:"Map size",value:String(m.mapSize),options:X2,onChange:h=>w({...m,mapSize:Number(h)})}),(0,ve.jsx)(J,{label:"Bias",value:m.bias,min:-.01,max:.01,step:1e-4,onChange:h=>w({...m,bias:h})}),(0,ve.jsx)(J,{label:"Normal bias",value:m.normalBias,min:0,max:.2,step:.01,onChange:h=>w({...m,normalBias:h})}),(0,ve.jsx)(J,{label:"Radius (softness)",value:m.radius,min:0,max:20,step:.5,onChange:h=>w({...m,radius:h})})]}),(0,ve.jsxs)(Ct,{title:"Ground Shadows",open:n.groundShadows,onToggle:()=>c("groundShadows"),disabled:!g.enabled,trailing:(0,ve.jsx)(Lt,{checked:g.enabled,onChange:h=>x({...g,enabled:h}),label:"Toggle ground shadows"}),children:[(0,ve.jsxs)("div",{className:"se-field",children:[(0,ve.jsx)("span",{className:"se-fieldLabel",children:"Mode"}),(0,ve.jsx)("div",{className:"se-segmentedControl",style:{gridAutoColumns:"1fr"},children:["shadowCatcher"].map(h=>(0,ve.jsx)("button",{type:"button",className:`se-segmentedOption ${g.mode===h?"se-segmentedOption--active":""}`,onClick:()=>x({...g,mode:h}),children:h==="shadowCatcher"?"Shadow Catcher":"Baked AO"},h))})]}),g.mode==="bakedAO"&&(0,ve.jsx)("div",{className:"se-placeholder",children:"Requires pre-baked AO textures \u2014 not yet available."}),(0,ve.jsx)(J,{label:"Intensity",value:g.intensity,min:0,max:1,step:.01,onChange:h=>x({...g,intensity:h})}),(0,ve.jsx)(J,{label:"Border fade",value:g.borderFade,min:0,max:10,step:.1,onChange:h=>x({...g,borderFade:h})}),(0,ve.jsx)(J,{label:"Height",value:g.height,min:-5,max:5,step:.1,onChange:h=>x({...g,height:h})}),(0,ve.jsx)(J,{label:"Size",value:g.size,min:1,max:50,step:.5,onChange:h=>x({...g,size:h})})]}),(0,ve.jsx)(Ct,{title:"Environment",open:n.environment,onToggle:()=>c("environment"),children:u?(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(J,{label:"Orientation",value:v.rotation,min:0,max:360,step:1,formatValue:h=>`${h}\xB0`,onChange:h=>S({...v,rotation:h})}),(0,ve.jsx)(J,{label:"Brightness",value:v.intensity,min:0,max:3,step:.05,onChange:h=>S({...v,intensity:h})}),(0,ve.jsxs)(Ct,{title:"Shadow",open:n.envShadow,onToggle:()=>c("envShadow"),trailing:(0,ve.jsx)(Lt,{checked:v.shadowLight.enabled,onChange:h=>S({...v,shadowLight:{...v.shadowLight,enabled:h}}),label:"Toggle environment shadow light"}),disabled:!v.shadowLight.enabled,children:[(0,ve.jsx)(J,{label:"Light intensity",value:v.shadowLight.intensity,min:0,max:20,step:.1,onChange:h=>S({...v,shadowLight:{...v.shadowLight,intensity:h}})}),(0,ve.jsx)(J,{label:"Shadow bias",value:v.shadowLight.bias,min:-.01,max:.01,step:1e-4,onChange:h=>S({...v,shadowLight:{...v.shadowLight,bias:h}})})]})]}):(0,ve.jsx)(qn,{requiredTier:"starter",feature:"Environment lighting"})})]})}var hp=require("react"),Gr=require("lucide-react");var ge=require("react/jsx-runtime"),Y2={playing:"Playing",paused:"Paused",finished:"Finished"},K1={repeat:"Looping",once:"Play once","ping-pong":"Ping-pong"};function K2(e){if(!Number.isFinite(e)||e<=0)return"Unknown duration";let t=Math.round(e*10)/10;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),i=(t%60).toFixed(1).padStart(4,"0");return`${n}:${i}`}function Z1(e){let t=Number.isFinite(e)&&e>0?e:0;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),i=(t%60).toFixed(1).padStart(4,"0");return`${n}:${i}`}function Z2(e){return Number.isFinite(e)?Math.min(3,Math.max(.1,Number(e.toFixed(2)))):1}function bf({config:e,onChange:t,clipDetails:n,active:i,play:r,pause:o,stop:a,setSpeed:s,seek:l}){let[c,p]=(0,hp.useState)(!1),u=(0,hp.useMemo)(()=>new Map(n.map(_=>[_.sourceName,_.duration])),[n]),d=e.animations.clips.filter(_=>!_.hidden),m=e.animations.clips.filter(_=>_.hidden),g=(_,y=e.animations.autoplayClip)=>{t({...e,animations:{clips:_(e.animations.clips),autoplayClip:y}})},v=(_,y)=>{g(h=>h.map(P=>P.sourceName===_?y(P):P))},M=(_,y)=>{v(_,h=>({...h,loopMode:y}))},w=(_,y)=>{let h=Z2(y);v(_,P=>({...P,speed:h})),i.some(P=>P.clip===_)&&s(h,_)},x=(_,y)=>{v(_,h=>({...h,displayName:y}))},S=_=>{let y=e.animations.autoplayClip===_?null:_;t({...e,animations:{...e.animations,autoplayClip:y}})},k=_=>{g(y=>y.map(h=>h.sourceName===_?{...h,hidden:!0}:h),e.animations.autoplayClip===_?null:e.animations.autoplayClip),i.some(y=>y.clip===_)&&a(_)},b=_=>{g(y=>y.map(h=>h.sourceName===_?{...h,hidden:!1}:h))};return e.animations.clips.length===0?(0,ge.jsx)(So,{title:"Animations",children:(0,ge.jsx)("div",{className:"se-helperCard",children:"Upload a model with embedded animations to manage playback, naming, autoplay, and per-clip speed here."})}):(0,ge.jsxs)(So,{title:"Animations",children:[d.length===0&&(0,ge.jsx)("div",{className:"se-helperCard",children:(0,ge.jsx)("span",{children:"Preview clips directly in the viewer (several can play at once), choose one optional autoplay animation, and use soft delete to hide clips without modifying the GLB."})}),d.length===0?(0,ge.jsx)("div",{className:"se-placeholder",children:"All animations are currently removed. Restore a clip below to make it available again."}):(0,ge.jsx)("div",{className:"se-animationList",children:d.map(_=>{let y=i.find(D=>D.clip===_.sourceName),h=y?.status==="playing",P=y?.time??0,A=u.get(_.sourceName)??0,C=y?Y2[y.status]:"Ready";return(0,ge.jsxs)("article",{className:`se-animationCard ${y?"se-animationCard--active":""}`,children:[(0,ge.jsxs)("div",{className:"se-animationHeader",children:[(0,ge.jsxs)("div",{className:"se-animationHeading",children:[(0,ge.jsxs)("div",{className:"se-animationTitleRow",children:[(0,ge.jsx)("span",{className:"se-animationStatus",children:C}),e.animations.autoplayClip===_.sourceName?(0,ge.jsx)("span",{className:"se-animationBadge",children:"Autoplay"}):null]}),(0,ge.jsx)("div",{className:"se-animationSource",children:_.sourceName})]}),(0,ge.jsx)("button",{type:"button",className:"se-animationDangerButton",onClick:()=>k(_.sourceName),title:"Remove animation",children:(0,ge.jsx)(Gr.Trash2,{size:16})})]}),(0,ge.jsxs)("div",{className:"se-field",children:[(0,ge.jsx)("span",{className:"se-fieldLabel",children:"Display name"}),(0,ge.jsx)("input",{className:"se-textInput",value:_.displayName,onChange:D=>x(_.sourceName,D.target.value),placeholder:"Animation name"})]}),(0,ge.jsxs)("div",{className:"se-animationMeta",children:[(0,ge.jsx)("span",{children:K2(A)}),(0,ge.jsx)("span",{children:K1[_.loopMode]??K1.repeat}),(0,ge.jsxs)("span",{children:[_.speed.toFixed(2),"x"]})]}),(0,ge.jsxs)("div",{className:"se-animationButtonRow",children:[(0,ge.jsx)("button",{type:"button",className:"se-animationButton se-animationButton--icon",onClick:()=>h&&!y?.reverse?o(_.sourceName):r(_.sourceName,{alongside:!0}),"aria-label":h&&!y?.reverse?"Pause":"Play",title:h&&!y?.reverse?"Pause":"Play",children:h&&!y?.reverse?(0,ge.jsx)(Gr.Pause,{size:16}):(0,ge.jsx)(Gr.Play,{size:16})}),(0,ge.jsx)("button",{type:"button",className:"se-animationButton se-animationButton--icon",onClick:()=>h&&y?.reverse?o(_.sourceName):r(_.sourceName,{alongside:!0,reverse:!0}),"aria-label":h&&y?.reverse?"Pause":"Play backwards",title:h&&y?.reverse?"Pause":"Play backwards",children:h&&y?.reverse?(0,ge.jsx)(Gr.Pause,{size:16}):(0,ge.jsx)(Gr.Rewind,{size:16})}),(0,ge.jsx)("button",{type:"button",className:"se-animationButton se-animationButton--icon",onClick:()=>a(_.sourceName),disabled:!y,"aria-label":"Stop",title:"Stop",children:(0,ge.jsx)(Gr.Square,{size:16})})]}),(0,ge.jsxs)("div",{className:"se-animationSeekRow",children:[(0,ge.jsx)("input",{className:"se-slider se-animationSeek",type:"range",min:0,max:Math.max(A,.001),step:.01,value:Math.min(P,A),disabled:!y||A<=0,onChange:D=>l(Number(D.target.value),_.sourceName),"aria-label":"Seek"}),(0,ge.jsxs)("span",{className:"se-animationSeekTime",children:[Z1(Math.min(P,A))," / ",Z1(A)]})]}),(0,ge.jsxs)("div",{className:"se-animationGrid",children:[(0,ge.jsxs)("label",{className:"se-field",children:[(0,ge.jsx)("span",{className:"se-fieldLabel",children:"Loop mode"}),(0,ge.jsxs)("select",{className:"se-select",value:_.loopMode,onChange:D=>M(_.sourceName,D.target.value),children:[(0,ge.jsx)("option",{value:"repeat",children:"Loop"}),(0,ge.jsx)("option",{value:"once",children:"Play Once"}),(0,ge.jsx)("option",{value:"ping-pong",children:"Ping-Pong"})]})]}),(0,ge.jsxs)("label",{className:"se-field",children:[(0,ge.jsxs)("span",{className:"se-fieldLabel",children:["Speed",(0,ge.jsxs)("span",{className:"se-fieldValue",children:[_.speed.toFixed(2),"x"]})]}),(0,ge.jsxs)("div",{className:"se-animationSpeedRow",children:[(0,ge.jsx)("input",{className:"se-slider",type:"range",min:.1,max:3,step:.1,value:_.speed,onChange:D=>w(_.sourceName,Number(D.target.value))}),(0,ge.jsx)("input",{className:"se-numberInput se-animationSpeedInput",type:"number",min:.1,max:3,step:.1,value:_.speed,onChange:D=>w(_.sourceName,Number(D.target.value))})]})]})]}),(0,ge.jsx)("button",{type:"button",className:`se-animationAutoplayButton ${e.animations.autoplayClip===_.sourceName?"se-animationAutoplayButton--active":""}`,onClick:()=>S(_.sourceName),children:e.animations.autoplayClip===_.sourceName?"Disable autoplay":"Set as autoplay"})]},_.sourceName)})}),m.length>0?(0,ge.jsxs)("section",{className:"se-removedAnimations",children:[(0,ge.jsx)("button",{type:"button",className:"se-panelHeader",onClick:()=>p(_=>!_),children:(0,ge.jsxs)("span",{className:"se-panelHeaderMain",children:[(0,ge.jsx)(Gr.ChevronDown,{size:16,className:`se-panelChevron ${c?"se-panelChevron--open":""}`}),(0,ge.jsxs)("span",{className:"se-panelTitle",children:["Removed Animations (",m.length,")"]})]})}),c?(0,ge.jsx)("div",{className:"se-removedAnimationList",children:m.map(_=>(0,ge.jsxs)("div",{className:"se-removedAnimationRow",children:[(0,ge.jsxs)("div",{children:[(0,ge.jsx)("div",{className:"se-removedAnimationName",children:_.displayName||_.sourceName}),(0,ge.jsx)("div",{className:"se-animationSource",children:_.sourceName})]}),(0,ge.jsx)("button",{type:"button",className:"se-animationButton",onClick:()=>b(_.sourceName),children:"Restore"})]},_.sourceName))}):null]}):null]})}var vf=require("react"),mp=require("lucide-react");var At=require("react/jsx-runtime");function xf({config:e,onChange:t}){let[n,i]=(0,vf.useState)(null),[r,o]=(0,vf.useState)({title:"",description:""}),a=e.annotations,s=u=>{i(u),o({title:u.title,description:u.description||""})},l=()=>{if(!n||!r.title.trim())return;let u=a.map(d=>d.id===n.id?{...d,title:r.title.trim(),description:r.description||""}:d);t({...e,annotations:u}),i(null),o({title:"",description:""})},c=u=>{if(window.confirm("Delete this annotation?")){let m=a.filter(g=>g.id!==u).map((g,v)=>({...g,id:v+1}));t({...e,annotations:m}),i(null),o({title:"",description:""})}},p=()=>{i(null),o({title:"",description:""})};return(0,At.jsxs)(So,{title:"Annotations",children:[e.annotations.length===0?(0,At.jsx)("div",{className:"bb-emptyAnnotations",children:"No annotations yet. Double-click on the model to add one."}):(0,At.jsx)("div",{className:"bb-annotationsList",children:e.annotations.map(u=>(0,At.jsxs)("div",{className:"bb-annotationCard",children:[(0,At.jsxs)("div",{className:"bb-annotationHeader",children:[(0,At.jsxs)("div",{className:"bb-annotationBadge",children:["#",u.id]}),(0,At.jsxs)("div",{className:"bb-annotationActions",children:[(0,At.jsx)("button",{className:"bb-annotationAction bb-annotationAction--edit",onClick:()=>s(u),title:"Edit annotation",children:(0,At.jsx)(mp.Pencil,{size:16})}),(0,At.jsx)("button",{className:"bb-annotationAction bb-annotationAction--delete",onClick:()=>c(u.id),title:"Delete annotation",children:(0,At.jsx)(mp.Trash2,{size:16})})]})]}),(0,At.jsx)("div",{className:"bb-annotationTitle",children:u.title}),u.description&&(0,At.jsx)("div",{className:"bb-annotationDescription",children:u.description}),(0,At.jsxs)("div",{className:"bb-annotationPosition",children:["Position: [",u.worldPosition[0].toFixed(2),","," ",u.worldPosition[1].toFixed(2),","," ",u.worldPosition[2].toFixed(2),"]"]})]},u.id))}),n&&(0,At.jsx)("div",{className:"bb-editAnnotationOverlay",onClick:p,children:(0,At.jsxs)("div",{className:"bb-editAnnotationPopup",onClick:u=>u.stopPropagation(),children:[(0,At.jsxs)("div",{className:"bb-editAnnotationHeader",children:[(0,At.jsx)("h3",{className:"bb-editAnnotationTitle",children:"Edit Annotation"}),(0,At.jsx)("button",{className:"bb-editAnnotationClose",onClick:p,children:"\xD7"})]}),(0,At.jsxs)("div",{className:"bb-editAnnotationBody",children:[(0,At.jsxs)("div",{className:"bb-field",children:[(0,At.jsx)("label",{className:"bb-label",children:"Title"}),(0,At.jsx)("input",{className:"bb-input",value:r.title,onChange:u=>o({...r,title:u.target.value}),placeholder:"Enter annotation title"})]}),(0,At.jsxs)("div",{className:"bb-field",children:[(0,At.jsx)("label",{className:"bb-label",children:"Description"}),(0,At.jsx)("textarea",{className:"bb-textarea",value:r.description,onChange:u=>o({...r,description:u.target.value}),placeholder:"Enter annotation description",rows:3})]}),(0,At.jsxs)("div",{className:"bb-editAnnotationActions",children:[(0,At.jsx)("button",{className:"bb-button",onClick:p,children:"Cancel"}),(0,At.jsx)("button",{className:"bb-button bb-button--primary",onClick:l,disabled:!r.title.trim(),children:"Save"}),(0,At.jsx)("button",{className:"bb-button bb-button--danger",onClick:()=>c(n.id),children:"Delete"})]})]})]})})]})}var Ji=require("react"),ui=require("lucide-react");var ke=require("react/jsx-runtime"),J2={enabled:!0,waypoints:[],loop:!0,autoPlay:!1},qa=3.5;function yf({config:e,onChange:t,cameraState:n,onPreviewWaypoint:i}){let r=e.cinematic??J2,{waypoints:o}=r,a=(0,Ji.useCallback)((w,x)=>{if(w.length<2)return 0;let S=0;for(let k=0;k<w.length-1;k++){let b=w[k].segmentDuration??qa;S+=b}return x&&w.length>1&&(S+=w[w.length-1].segmentDuration??qa),Math.max(S,0)},[]),s=(0,Ji.useCallback)(w=>{t({...e,cinematic:{...r,...w}})},[e,r,t]),l=(0,Ji.useCallback)(()=>{if(!n)return;let w={position:[...n.position],target:[...n.target],...n.azimuthAngle!=null?{azimuthAngle:n.azimuthAngle}:{},...n.polarAngle!=null?{polarAngle:n.polarAngle}:{},segmentDuration:qa},x=[...o,w],S=a(x,r.loop);s({waypoints:x,duration:S})},[n,o,r.loop,a,s]),c=(0,Ji.useCallback)(w=>{let x=o.filter((k,b)=>b!==w),S=a(x,r.loop);s({waypoints:x,duration:S})},[o,r.loop,a,s]),p=(0,Ji.useCallback)((w,x)=>{let S=w+x;if(S<0||S>=o.length)return;let k=[...o];[k[w],k[S]]=[k[S],k[w]];let b=a(k,r.loop);s({waypoints:k,duration:b})},[o,r.loop,a,s]),u=(0,Ji.useCallback)((w,x)=>{let S=o.map((b,_)=>_===w?{...b,...x}:b),k=a(S,r.loop);s({waypoints:S,duration:k})},[o,r.loop,a,s]),[d,m]=(0,Ji.useState)(!1),g=o.some(w=>w.segmentDuration!==void 0),v=(0,Ji.useCallback)(w=>w>=o.length-1?qa:o[w]?.segmentDuration??qa,[o]),M=o.length>=2;return(0,ke.jsxs)(So,{title:"Cinematic Camera",children:[(0,ke.jsx)("p",{className:"se-cinematicHint",children:"Frame the model in the viewer, then capture it as a waypoint. The camera glides through the waypoints in order \u2014 enable and press play in the viewer to preview."}),(0,ke.jsxs)("button",{type:"button",className:"bb-button bb-button--primary se-cinematicAdd",onClick:l,disabled:!n,title:"Capture the current camera view as a waypoint",children:[(0,ke.jsx)(ui.Plus,{size:15}),"Add waypoint from current view"]}),(0,ke.jsxs)("div",{className:"se-customizeToggle",children:[(0,ke.jsxs)("label",{className:"se-toggleLabel",children:[(0,ke.jsx)("input",{type:"checkbox",checked:d,onChange:w=>m(w.target.checked)}),(0,ke.jsx)(ui.Settings,{size:14}),(0,ke.jsx)("span",{children:"Customize durations between waypoints"})]}),d&&(0,ke.jsxs)("span",{className:"se-toggleHint",children:["Set duration for each segment between waypoints: 1\u21922, 2\u21923, etc. Default: ",qa,"s"]})]}),o.length===0?(0,ke.jsx)("div",{className:"bb-emptyAnnotations",children:"No waypoints yet. Position the camera and add your first one."}):(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)("div",{className:"se-waypointList",children:o.map((w,x)=>{let S=v(x),k=x===o.length-1,b=w.segmentDuration!==void 0&&w.segmentDuration!==qa;return(0,ke.jsxs)("div",{children:[(0,ke.jsxs)("div",{className:"se-waypointCard",children:[(0,ke.jsx)("div",{className:"se-waypointBadge",children:x+1}),(0,ke.jsxs)("div",{className:"se-waypointBody",children:[(0,ke.jsxs)("div",{className:"se-waypointCoords",children:["pos [",w.position.map(_=>_.toFixed(1)).join(", "),"]"]}),(0,ke.jsxs)("div",{className:"se-waypointCoords",children:["look [",w.target.map(_=>_.toFixed(1)).join(", "),"]"]}),d&&!k&&(0,ke.jsxs)("div",{className:`se-customBadge ${b?"se-customBadge--custom":"se-customBadge--default"}`,children:[S.toFixed(1),"s",!b&&" (default)"]})]}),(0,ke.jsxs)("div",{className:"se-waypointActions",children:[(0,ke.jsx)("button",{className:"se-waypointAction",onClick:()=>i?.(w),title:"Fly camera to this waypoint",disabled:!i,children:(0,ke.jsx)(ui.MapPin,{size:15})}),(0,ke.jsx)("button",{className:"se-waypointAction",onClick:()=>p(x,-1),title:"Move up",disabled:x===0,children:(0,ke.jsx)(ui.ArrowUp,{size:15})}),(0,ke.jsx)("button",{className:"se-waypointAction",onClick:()=>p(x,1),title:"Move down",disabled:k,children:(0,ke.jsx)(ui.ArrowDown,{size:15})}),(0,ke.jsx)("button",{className:"se-waypointAction se-waypointAction--delete",onClick:()=>c(x),title:"Delete waypoint",children:(0,ke.jsx)(ui.Trash2,{size:15})})]})]}),d&&!k&&(0,ke.jsxs)("div",{className:"se-segmentBetween",children:[(0,ke.jsxs)("div",{className:"se-segmentLabel",children:[x+1," \u2192 ",x+2,!w.segmentDuration&&" (default)"]}),(0,ke.jsxs)("div",{className:"se-segmentControls",children:[(0,ke.jsx)("span",{className:"se-durationLabel",children:"Duration:"}),(0,ke.jsx)("input",{type:"range",className:"se-segmentSlider",min:1,max:20,step:.5,value:S,onChange:_=>{let y=parseFloat(_.target.value);u(x,{segmentDuration:y})}}),(0,ke.jsxs)("span",{className:"se-segmentValue",children:[S.toFixed(1),"s"]}),(0,ke.jsxs)("div",{className:"se-presetButtons",children:[[2,4,6,8].map(_=>(0,ke.jsxs)("button",{className:"se-presetButton",onClick:()=>u(x,{segmentDuration:_}),children:[_,"s"]},`preset-${x}-${_}`)),(0,ke.jsx)("button",{className:"se-presetButton se-presetButton--default",onClick:()=>{let _=o.map((h,P)=>{if(P===x){let{segmentDuration:A,...C}=h;return C}return h}),y=a(_,r.loop);s({waypoints:_,duration:y})},children:"Reset"})]})]})]})]},`waypoint-wrapper-${x}`)})}),(0,ke.jsxs)("div",{className:"se-totalDuration",children:[(0,ke.jsx)("span",{className:"se-totalLabel",children:"Total duration:"}),(0,ke.jsx)("span",{className:"se-totalValue",children:M?(r.duration??a(o,r.loop)).toFixed(1)+"s":"-"}),!M&&(0,ke.jsx)("span",{className:"se-totalHint",children:"(need at least 2 waypoints)"})]})]}),(0,ke.jsx)(Pt,{label:"Enable cinematic camera",checked:r.enabled,onChange:w=>s({enabled:w})}),(0,ke.jsx)(Pt,{label:"Loop",checked:r.loop,onChange:w=>{let x=w,S=a(o,x);s({loop:x,duration:S})}}),(0,ke.jsx)(Pt,{label:"Auto-play on load",checked:r.autoPlay,onChange:w=>s({autoPlay:w})}),!d&&M&&(0,ke.jsx)(J,{label:"Duration",value:r.duration??a(o,r.loop),min:4,max:120,step:1,formatValue:w=>`${w}s`,onChange:w=>s({duration:w})})]})}var $a=require("react"),gp=require("react-colorful"),cr=require("lucide-react");var J1=["other","body","light","wheel","glass","interior","floor","wall","door","furniture","decor","electronics","seat","table","chair","window","sofa","bed","engine","headlight"],fp=["normal","hidden","selected","disabled"];var ne=require("react/jsx-runtime"),wf={all:"All objects",group:"Group",tag:"Tag",type:"Type",object:"One object"},Q1={metric:"Metric",status:"Status",metadata:"Metadata"},Q2={metric:"",stops:[[0,"#3b82f6"],[100,"#ef4444"]]};function eP(e){return e===void 0?"all":typeof e=="string"||Array.isArray(e)?"object":"group"in e?"group":"tag"in e?"tag":"type"}function Nc(e){return e===void 0?"":typeof e=="string"?e:Array.isArray(e)?e[0]??"":"group"in e?e.group:"tag"in e?e.tag:e.type}function ew(e,t){if(e!=="all")return e==="object"?t:e==="group"?{group:t}:e==="tag"?{tag:t}:{type:t}}function tP(e){return"metric"in e?"metric":"status"in e?"status":"metadata"}function tw(e){return e==="metric"?{metric:""}:e==="status"?{status:["disabled"]}:{metadata:"",equals:""}}function nP(e){let t=e.trim();return t==="true"?!0:t==="false"?!1:t==="null"?null:t!==""&&Number.isFinite(Number(t))?Number(t):e}function Sf(e){return e.trim()===""||!Number.isFinite(Number(e))?void 0:Number(e)}function nw(e,t="",n=0){return typeof e!="object"||e===null||Array.isArray(e)?t?[t]:[]:n>2?t?[t]:[]:Object.entries(e).flatMap(([i,r])=>nw(r,t?`${t}.${i}`:i,n+1))}var Bc=e=>[...new Set(e.filter(t=>!!t))].sort((t,n)=>t.localeCompare(n));function Qi({label:e,children:t}){return(0,ne.jsxs)("label",{className:"se-field",children:[(0,ne.jsx)("span",{className:"se-fieldLabel",children:e}),t]})}function Oc({label:e,checked:t,color:n,onToggle:i,onColorChange:r}){let[o,a]=(0,$a.useState)(!1),s=(0,$a.useRef)(null);return(0,ne.jsxs)("div",{className:"se-field se-fieldInline",children:[(0,ne.jsxs)("label",{className:"se-ruleLook",children:[(0,ne.jsx)("input",{type:"checkbox",className:"se-checkbox",checked:t,onChange:l=>i(l.target.checked)}),e]}),t&&n!==void 0&&r?(0,ne.jsx)("span",{ref:s,style:{display:"inline-flex"},children:(0,ne.jsx)(gp.HexColorInput,{prefixed:!0,className:"se-swatch","aria-label":`${e} value`,onClick:()=>a(l=>!l),style:{background:n,color:Qo(n)},color:n,onChange:r})}):null,o?(0,ne.jsx)(kc,{anchorRef:s,onClose:()=>a(!1),children:(0,ne.jsx)(gp.HexColorPicker,{color:n,onChange:r})}):null]})}function rP({title:e,open:t,onToggle:n,actions:i,children:r}){return(0,ne.jsxs)("section",{className:"se-panel",children:[(0,ne.jsxs)("div",{className:"se-ruleHeader",children:[(0,ne.jsx)("button",{type:"button",className:"se-panelHeader",onClick:n,"aria-expanded":t,children:(0,ne.jsxs)("span",{className:"se-panelHeaderMain",children:[(0,ne.jsx)(cr.ChevronDown,{size:16,className:`se-panelChevron ${t?"se-panelChevron--open":""}`}),(0,ne.jsx)("span",{className:"se-panelTitle",children:e})]})}),(0,ne.jsx)("span",{className:"se-ruleActions",children:i})]}),t?(0,ne.jsx)("div",{className:"se-panelBody",children:r}):null]})}function _f({config:e,onChange:t,objectBindings:n}){let i=e.styleRules??[],[r,o]=(0,$a.useState)(i[0]?.id??null),a=(0,$a.useMemo)(()=>{let d=Object.values(n);return{groups:Bc(d.map(m=>m.group)),tags:Bc(d.flatMap(m=>m.tags??[])),types:Bc(d.map(m=>m.type??"other")),objects:d.map(m=>({id:m.id,label:m.label||m.id})).sort((m,g)=>m.label.localeCompare(g.label)),metrics:Bc(d.flatMap(m=>Object.keys(m.metrics??{}))),metadata:Bc(d.flatMap(m=>nw(m.metadata)))}},[n]),s=d=>t({...e,styleRules:d}),l=(d,m)=>s(i.map(g=>g.id===d?m(g):g)),c=()=>{let d=crypto.randomUUID();s([...i,{id:d,label:`Rule ${i.length+1}`,when:[{status:["disabled"]}],material:{baseColor:"#9ca3af"}}]),o(d)},p=(d,m)=>{let g=[...i],[v]=g.splice(d,1);g.splice(d+m,0,v),s(g)},u=d=>{let m=d.target?Va(n,d.target):Object.keys(n),g=d.when?Array.isArray(d.when)?d.when:[d.when]:[];return m.filter(v=>g.every(M=>Gm(n[v],M))).length};return(0,ne.jsxs)(So,{title:"Style rules",children:[(0,ne.jsx)("div",{className:"se-helperCard se-ruleIntro",children:"Restyle objects from their data while the app runs: a colour from a metric, grey when disabled, a pulse for an alarm. Set an object's metrics, status, and metadata in the Object tab to try a rule here. Later rules win over earlier ones."}),(0,ne.jsx)("datalist",{id:"se-ruleMetrics",children:a.metrics.map(d=>(0,ne.jsx)("option",{value:d},d))}),(0,ne.jsx)("datalist",{id:"se-ruleMetadata",children:a.metadata.map(d=>(0,ne.jsx)("option",{value:d},d))}),i.map((d,m)=>{let g=d.when?Array.isArray(d.when)?d.when:[d.when]:[],v=eP(d.target),M=d.material??{},w=d.pulse===!0?{}:d.pulse||void 0,x=d.target?Va(n,d.target).length:Object.keys(n).length,S=h=>l(d.id,P=>({...P,when:h.length>0?h:void 0})),k=(h,P)=>S(g.map((A,C)=>C===h?P:A)),b=h=>l(d.id,P=>{let A={...P.material,...h};for(let C of Object.keys(A))A[C]===void 0&&delete A[C];return{...P,material:Object.keys(A).length>0?A:void 0}}),_=h=>l(d.id,P=>({...P,colorScale:h})),y=v==="group"?a.groups:v==="tag"?a.tags:v==="type"?a.types:[];return(0,ne.jsxs)(rP,{title:d.label||`Rule ${m+1}`,open:r===d.id,onToggle:()=>o(h=>h===d.id?null:d.id),actions:(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)("button",{type:"button",className:"se-iconButton",onClick:()=>p(m,-1),disabled:m===0,"aria-label":"Move rule up",title:"Move up",children:(0,ne.jsx)(cr.ArrowUp,{size:14})}),(0,ne.jsx)("button",{type:"button",className:"se-iconButton",onClick:()=>p(m,1),disabled:m===i.length-1,"aria-label":"Move rule down",title:"Move down",children:(0,ne.jsx)(cr.ArrowDown,{size:14})}),(0,ne.jsx)("button",{type:"button",className:"se-iconButton",onClick:()=>s(i.filter(h=>h.id!==d.id)),"aria-label":"Delete rule",title:"Delete rule",children:(0,ne.jsx)(cr.Trash2,{size:14})})]}),children:[(0,ne.jsx)(Qi,{label:"Name",children:(0,ne.jsx)("input",{className:"se-textInput",value:d.label??"",placeholder:`Rule ${m+1}`,onChange:h=>l(d.id,P=>({...P,label:h.target.value}))})}),(0,ne.jsxs)("div",{className:"se-ruleGrid",children:[(0,ne.jsx)(Qi,{label:"Applies to",children:(0,ne.jsx)("select",{className:"se-select",value:v,onChange:h=>{let P=h.target.value,A=P==="object"?a.objects[0]?.id:P==="group"?a.groups[0]:P==="tag"?a.tags[0]:P==="type"?a.types[0]:"";l(d.id,C=>({...C,target:ew(P,A??"")}))},children:Object.keys(wf).map(h=>(0,ne.jsx)("option",{value:h,children:wf[h]},h))})}),v!=="all"?(0,ne.jsx)(Qi,{label:wf[v],children:(0,ne.jsxs)("select",{className:"se-select",value:Nc(d.target),onChange:h=>l(d.id,P=>({...P,target:ew(v,h.target.value)})),children:[v==="object"?a.objects.map(h=>(0,ne.jsx)("option",{value:h.id,children:h.label},h.id)):y.map(h=>(0,ne.jsx)("option",{value:h,children:h},h)),(v==="object"?a.objects.some(h=>h.id===Nc(d.target)):y.includes(Nc(d.target)))?null:(0,ne.jsx)("option",{value:Nc(d.target),children:Nc(d.target)||"None in this model"})]})}):null]}),(0,ne.jsx)("div",{className:"se-fieldLabel",children:"When"}),g.length===0?(0,ne.jsx)("div",{className:"se-ruleHint",children:"Always applies."}):null,g.map((h,P)=>{let A=tP(h);return(0,ne.jsxs)("div",{className:"se-ruleCondition",children:[(0,ne.jsxs)("div",{className:"se-ruleConditionHeader",children:[(0,ne.jsx)("select",{className:"se-select","aria-label":"Condition type",value:A,onChange:C=>k(P,tw(C.target.value)),children:Object.keys(Q1).map(C=>(0,ne.jsx)("option",{value:C,children:Q1[C]},C))}),(0,ne.jsx)("button",{type:"button",className:"se-iconButton","aria-label":"Remove condition",title:"Remove condition",onClick:()=>S(g.filter((C,D)=>D!==P)),children:(0,ne.jsx)(cr.X,{size:14})})]}),"metric"in h?(0,ne.jsxs)("div",{className:"se-ruleGrid se-ruleGrid--three",children:[(0,ne.jsx)(Qi,{label:"Metric",children:(0,ne.jsx)("input",{className:"se-textInput",list:"se-ruleMetrics",value:h.metric,placeholder:"temperature",onChange:C=>k(P,{...h,metric:C.target.value})})}),(0,ne.jsx)(Qi,{label:"Above",children:(0,ne.jsx)("input",{className:"se-numberInput",type:"number",value:h.above??"",placeholder:"any",onChange:C=>k(P,{...h,above:Sf(C.target.value)})})}),(0,ne.jsx)(Qi,{label:"Below",children:(0,ne.jsx)("input",{className:"se-numberInput",type:"number",value:h.below??"",placeholder:"any",onChange:C=>k(P,{...h,below:Sf(C.target.value)})})})]}):"status"in h?(0,ne.jsx)("div",{className:"se-ruleStatuses",children:fp.map(C=>{let D=[].concat(h.status).includes(C);return(0,ne.jsxs)("label",{className:"se-ruleStatus",children:[(0,ne.jsx)("input",{type:"checkbox",className:"se-checkbox",checked:D,onChange:()=>{let B=[].concat(h.status),j=D?B.filter(W=>W!==C):[...B,C];k(P,{status:j})}}),C]},C)})}):(0,ne.jsxs)("div",{className:"se-ruleGrid",children:[(0,ne.jsx)(Qi,{label:"Key",children:(0,ne.jsx)("input",{className:"se-textInput",list:"se-ruleMetadata",value:h.metadata,placeholder:"alarm.state",onChange:C=>k(P,{...h,metadata:C.target.value})})}),(0,ne.jsx)(Qi,{label:"Equals",children:(0,ne.jsx)("input",{className:"se-textInput",value:h.equals===null?"null":String(h.equals),placeholder:"fault",onChange:C=>k(P,{...h,equals:nP(C.target.value)})})})]})]},P)}),(0,ne.jsxs)("button",{type:"button",className:"se-animationButton",onClick:()=>S([...g,tw("metric")]),children:[(0,ne.jsx)(cr.Plus,{size:14})," Add condition"]}),(0,ne.jsx)("div",{className:"se-fieldLabel",children:"Look"}),(0,ne.jsx)(Oc,{label:"Colour",checked:M.baseColor!==void 0,color:M.baseColor,onToggle:h=>b({baseColor:h?"#9ca3af":void 0}),onColorChange:h=>b({baseColor:h})}),(0,ne.jsx)(Oc,{label:"Opacity",checked:M.opacity!==void 0,onToggle:h=>b({opacity:h?.4:void 0})}),M.opacity!==void 0?(0,ne.jsx)(J,{label:"Opacity",value:M.opacity,min:0,max:1,step:.05,formatValue:h=>`${Math.round(h*100)}%`,onChange:h=>b({opacity:h})}):null,(0,ne.jsx)(Oc,{label:"Glow",checked:M.emissive!==void 0,color:M.emissive,onToggle:h=>b({emissive:h?"#ff3b30":void 0,emissiveIntensity:h?M.emissiveIntensity??1:void 0}),onColorChange:h=>b({emissive:h})}),(0,ne.jsx)(Oc,{label:"Colour from a metric",checked:d.colorScale!==void 0,onToggle:h=>_(h?{...Q2,metric:a.metrics[0]??""}:void 0)}),d.colorScale?(0,ne.jsxs)("div",{className:"se-ruleCondition",children:[(0,ne.jsxs)("div",{className:"se-ruleGrid",children:[(0,ne.jsx)(Qi,{label:"Metric",children:(0,ne.jsx)("input",{className:"se-textInput",list:"se-ruleMetrics",value:d.colorScale.metric,placeholder:"temperature",onChange:h=>_({...d.colorScale,metric:h.target.value})})}),(0,ne.jsx)(Qi,{label:"Sets",children:(0,ne.jsxs)("select",{className:"se-select",value:d.colorScale.channel??"baseColor",onChange:h=>_({...d.colorScale,channel:h.target.value}),children:[(0,ne.jsx)("option",{value:"baseColor",children:"Colour"}),(0,ne.jsx)("option",{value:"emissive",children:"Glow colour"})]})})]}),d.colorScale.stops.map(([h,P],A)=>{let C=D=>_({...d.colorScale,stops:d.colorScale.stops.map((B,j)=>j===A?D:B)});return(0,ne.jsxs)("div",{className:"se-ruleStop",children:[(0,ne.jsx)("input",{className:"se-numberInput",type:"number","aria-label":"Stop value",value:h,onChange:D=>C([Sf(D.target.value)??0,P])}),(0,ne.jsx)(_r,{label:`At ${h}`,value:P,onChange:D=>C([h,D])}),(0,ne.jsx)("button",{type:"button",className:"se-iconButton","aria-label":"Remove stop",title:"Remove stop",disabled:d.colorScale.stops.length<=1,onClick:()=>_({...d.colorScale,stops:d.colorScale.stops.filter((D,B)=>B!==A)}),children:(0,ne.jsx)(cr.X,{size:14})})]},A)}),(0,ne.jsxs)("button",{type:"button",className:"se-animationButton",onClick:()=>{let h=d.colorScale.stops,P=h[h.length-1];_({...d.colorScale,stops:[...h,[(P?.[0]??0)+10,P?.[1]??"#ffffff"]]})},children:[(0,ne.jsx)(cr.Plus,{size:14})," Add stop"]})]}):null,(0,ne.jsx)(Oc,{label:"Pulse",checked:w!==void 0,color:w?.color??"#ff3b30",onToggle:h=>l(d.id,P=>({...P,pulse:h?{color:"#ff3b30",speed:1}:void 0})),onColorChange:h=>l(d.id,P=>({...P,pulse:{...w,color:h}}))}),w?(0,ne.jsx)(ne.Fragment,{children:(0,ne.jsx)(J,{label:"Pulses per second",value:w.speed??1,min:.2,max:4,step:.1,formatValue:h=>h.toFixed(1),onChange:h=>l(d.id,P=>({...P,pulse:{...w,speed:h}}))})}):null,(0,ne.jsxs)("div",{className:"se-ruleHint se-ruleMatches",children:["Matches ",u(d)," of ",x," ",x===1?"object":"objects"," right now."]})]},d.id)}),(0,ne.jsxs)("button",{type:"button",className:"se-animationButton",onClick:c,children:[(0,ne.jsx)(cr.Plus,{size:14})," Add rule"]})]})}var Mr=require("lucide-react");var sn=require("react/jsx-runtime"),iP=[{label:"General",icon:(0,sn.jsx)(Mr.Box,{})},{label:"Lighting",icon:(0,sn.jsx)(Mr.Spotlight,{})},{label:"Animations",icon:(0,sn.jsx)(Mr.Clapperboard,{})},{label:"Post Processing",icon:(0,sn.jsx)(Mr.Sparkles,{})},{label:"Annotations",icon:(0,sn.jsx)(Mr.MessageSquareText,{})},{label:"Cinematic",icon:(0,sn.jsx)(Mr.Video,{})},{label:"Rules",icon:(0,sn.jsx)(Mr.Palette,{})}],rw={active:[],play:()=>{},pause:()=>{},stop:()=>{},setSpeed:()=>{},seek:()=>{}},oP=[],aP={};function Mf({config:e,onChange:t,activeSubTab:n,onActiveSubTabChange:i,cameraState:r=null,onPreviewWaypoint:o,animationClipDetails:a=[],materialVariants:s=oP,objectBindings:l=aP,animationPlayback:c=rw}){let[p,u]=(0,bp.useState)("General"),d=n??p,m=c??rw,{tier:g}=Sr(),v=Bi(g,"starter"),M=Bi(g,"growth");(0,bp.useEffect)(()=>{n!==void 0&&u(n)},[n]);let w=x=>{n===void 0&&u(x),i?.(x)};return(0,sn.jsxs)("div",{className:"se-tabContent",children:[(0,sn.jsx)("div",{className:"se-subTabRow",children:iP.map(x=>(0,sn.jsx)("button",{type:"button",title:x.label,"aria-label":x.label,"aria-pressed":d===x.label,className:`se-subTab ${d===x.label?"se-subTab--active":""}`,onClick:()=>w(x.label),children:x.icon},x.label))}),d==="General"&&(0,sn.jsx)(mf,{config:e,onChange:t,materialVariants:s}),d==="Lighting"&&(0,sn.jsx)(gf,{config:e,onChange:t}),d==="Animations"&&(v?(0,sn.jsx)(bf,{config:e,onChange:t,clipDetails:a,active:m.active,play:m.play,pause:m.pause,stop:m.stop,setSpeed:m.setSpeed,seek:m.seek}):(0,sn.jsx)(qn,{requiredTier:"starter",feature:"Animation configuration"})),d==="Post Processing"&&(M?(0,sn.jsx)(ff,{config:e,onChange:t}):(0,sn.jsx)(qn,{requiredTier:"growth",feature:"Post-processing effects"})),d==="Annotations"&&(v?(0,sn.jsx)(xf,{config:e,onChange:t}):(0,sn.jsx)(qn,{requiredTier:"starter",feature:"Annotations"})),d==="Cinematic"&&(v?(0,sn.jsx)(yf,{config:e,onChange:t,cameraState:r,onPreviewWaypoint:o}):(0,sn.jsx)(qn,{requiredTier:"starter",feature:"Cinematic camera"})),d==="Rules"&&(v?(0,sn.jsx)(_f,{config:e,onChange:t,objectBindings:l}):(0,sn.jsx)(qn,{requiredTier:"starter",feature:"Style rules"}))]})}var rl=require("lucide-react"),ln=require("react/jsx-runtime");function iw({title:e,trailing:t,children:n,disabled:i,open:r,onToggle:o,tooltip:a}){let s=a?`${a}`:e;return(0,ln.jsxs)("div",{className:"bb-materialPanel",children:[(0,ln.jsxs)("button",{type:"button",className:"bb-materialPanelHeader",onClick:o,"aria-expanded":r,title:s,children:[(0,ln.jsxs)("div",{className:"bb-materialPanelTitleWrap",children:[(0,ln.jsx)(rl.ChevronDown,{size:14,className:`bb-materialPanelChevron ${r?"bb-materialPanelChevron--open":""}`}),(0,ln.jsx)("span",{className:"bb-materialPanelTitle",children:e}),a?(0,ln.jsx)("span",{className:"bb-materialPanelHelp",title:s,"aria-label":s,role:"img",onClick:l=>l.stopPropagation(),children:(0,ln.jsx)(rl.Info,{size:12})}):null]}),t?(0,ln.jsx)("div",{onClick:l=>l.stopPropagation(),children:t}):null]}),r?(0,ln.jsx)("div",{className:"bb-materialPanelBody",style:i?{opacity:.45,pointerEvents:"none"}:void 0,children:n}):null]})}function tr({title:e,open:t,onToggle:n,trailing:i,children:r,tooltip:o}){let a=o?`${e}: ${o}`:e;return(0,ln.jsxs)("div",{className:"bb-section",children:[(0,ln.jsxs)("button",{type:"button",className:"bb-sectionHeaderButton",onClick:n,"aria-expanded":t,title:a,children:[(0,ln.jsxs)("span",{className:"bb-sectionHeaderMain",children:[(0,ln.jsx)(rl.ChevronDown,{size:15,className:`bb-sectionChevron ${t?"bb-sectionChevron--open":""}`}),(0,ln.jsx)("h2",{className:"bb-sectionTitle",children:e}),o?(0,ln.jsx)("span",{className:"bb-sectionHelp",title:a,"aria-label":a,role:"img",onClick:s=>s.stopPropagation(),children:(0,ln.jsx)(rl.Info,{size:13})}):null]}),i?(0,ln.jsx)("span",{onClick:s=>s.stopPropagation(),children:i}):null]}),t?(0,ln.jsx)("div",{className:"bb-sectionBody",children:r}):null]})}function ow({checked:e,onChange:t,label:n}){return(0,ln.jsxs)("label",{className:"se-switch","aria-label":n,children:[(0,ln.jsx)("input",{type:"checkbox",checked:e,onChange:i=>t(i.target.checked)}),(0,ln.jsx)("span",{className:"se-switchTrack",children:(0,ln.jsx)("span",{className:"se-switchThumb"})})]})}var Tf=require("react"),cw=require("lucide-react");var aw=["front","back","double"],sw=["normal","additive"];var vp=require("react/jsx-runtime");function Wr({panelKey:e,title:t,tooltip:n,toggleLabel:i,controls:r,children:o,requiredTier:a}){let{openMaterialPanels:s,materialPanelEnabled:l,onToggleMaterialPanel:c,onSetMaterialPanelState:p}=r,u=a?.locked??!1;return(0,vp.jsx)(iw,{title:t,tooltip:n,disabled:u||!l[e],open:s[e],onToggle:()=>c(e),trailing:(0,vp.jsx)(ow,{checked:!u&&l[e],onChange:u?()=>{}:d=>p(e,d),label:i??`Toggle ${t}`}),children:u&&a?(0,vp.jsx)(qn,{requiredTier:a.tier,feature:t}):o})}var Ic=require("react"),xp=require("react-colorful"),il=require("lucide-react");var st=require("react/jsx-runtime");function Mn({label:e,value:t,placeholder:n,onChange:i}){let r=(0,Ic.useRef)(null);return(0,st.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,st.jsx)("label",{className:"bb-label",children:e}),(0,st.jsxs)("div",{className:"bb-fileField",children:[(0,st.jsx)("input",{className:"bb-input bb-fileField-input",placeholder:n,value:t,onChange:o=>{let a=o.target.value;!a&&t&&Hl(t),i(a)}}),(0,st.jsx)("button",{type:"button",className:"bb-fileFieldButton",onClick:()=>r.current?.click(),"aria-label":`Select file for ${e}`,title:`Select file for ${e}`,children:(0,st.jsx)(il.FileUp,{size:20})}),(0,st.jsx)("input",{ref:r,type:"file",accept:"image/png,image/jpeg,image/webp,image/avif",className:"bb-hiddenInput",onChange:o=>{let a=o.target.files?.[0];if(!a)return;let s=Rd(a);t&&t!==s&&Hl(t),Ma(s,URL.createObjectURL(a)),i(s),o.target.value=""}})]})]})}function _o({label:e,value:t,fallback:n="#ffffff",variant:i="swatch",onChange:r}){let[o,a]=(0,Ic.useState)(!1),s=t||n,l=(0,Ic.useRef)(null);return(0,st.jsxs)("div",{className:"bb-field",children:[(0,st.jsx)("span",{className:"bb-label",children:e}),(0,st.jsx)("div",{className:"se-fieldInline",children:(0,st.jsx)("span",{ref:l,className:i==="input"?"bb-colorFieldAnchor":void 0,style:i==="swatch"?{display:"inline-flex"}:void 0,children:(0,st.jsx)(xp.HexColorInput,{prefixed:!0,className:i==="input"?"bb-input bb-colorInput":"se-swatch","aria-label":e,onClick:()=>a(c=>!c),style:{background:s,color:Qo(s)},color:s,onChange:r})})}),o?(0,st.jsx)(kc,{anchorRef:l,onClose:()=>a(!1),children:(0,st.jsx)(xp.HexColorPicker,{color:s,onChange:r})}):null]})}function zc({label:e,checked:t,onChange:n}){return(0,st.jsxs)("label",{className:"bb-checkbox",children:[(0,st.jsx)("input",{type:"checkbox",checked:t,onChange:i=>n(i.target.checked)}),e]})}function lw({label:e,value:t,min:n,max:i,step:r,placeholder:o,disabled:a,onChange:s}){return(0,st.jsxs)("div",{className:"bb-field",children:[(0,st.jsx)("label",{className:"bb-label",children:e}),(0,st.jsx)("input",{className:"bb-input",type:"number",min:n,max:i,step:r,placeholder:o,disabled:a,value:t??"",onChange:l=>s(l.target.value===""?void 0:Number(l.target.value))})]})}function sP(e,t){let n=t<1?Math.ceil(-Math.log10(t)):0,i=10**Math.max(n,0);return Math.round(e*i)/i}function Cf({label:e,value:t,min:n,max:i,step:r=.01,disabled:o,onChange:a}){let s=t??0,l=p=>{let u=p;return n!==void 0&&(u=Math.max(n,u)),i!==void 0&&(u=Math.min(i,u)),u},c=p=>{a(l(sP(s+p*r,r)))};return(0,st.jsxs)("div",{className:"bb-field",children:[(0,st.jsx)("label",{className:"bb-label",children:e}),(0,st.jsxs)("div",{className:"bb-numberStepper",children:[(0,st.jsx)("button",{type:"button",className:"bb-numberStepper-btn",disabled:o,onClick:()=>c(-1),"aria-label":`Decrease ${e}`,title:`Decrease ${e}`,children:(0,st.jsx)(il.Minus,{size:12})}),(0,st.jsx)("input",{className:"bb-input bb-numberStepper-input",type:"number",min:n,max:i,step:r,disabled:o,value:s,onChange:p=>{p.target.value!==""&&a(l(Number(p.target.value)))}}),(0,st.jsx)("button",{type:"button",className:"bb-numberStepper-btn",disabled:o,onClick:()=>c(1),"aria-label":`Increase ${e}`,title:`Increase ${e}`,children:(0,st.jsx)(il.Plus,{size:12})})]})]})}function ol({label:e,value:t,options:n,onChange:i}){return(0,st.jsxs)("div",{className:"bb-field",children:[(0,st.jsx)("label",{className:"bb-label",children:e}),(0,st.jsx)("select",{className:"bb-select",value:t,onChange:r=>i(r.target.value),children:n.map(r=>(0,st.jsx)("option",{value:r,children:r},r))})]})}function Ft({label:e,value:t,min:n,max:i,step:r,onChange:o}){return(0,st.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,st.jsx)("label",{className:"bb-label",children:e}),(0,st.jsxs)("div",{className:"bb-sliderField",children:[(0,st.jsx)("input",{className:`bb-slider ${t===void 0?"bb-slider--unset":""}`,type:"range",min:n,max:i,step:r,value:t??n,onChange:s=>o(Number(s.target.value))}),(0,st.jsx)("input",{className:"bb-input bb-input--compact",type:"number",min:n,max:i,step:r,value:t??"",onChange:s=>o(s.target.value===""?void 0:Number(s.target.value))})]})]})}var Y=require("react/jsx-runtime");function dw({selectedItem:e,selectedMaterial:t,pbrWorkflow:n,onPbrWorkflowChange:i,openMaterialPanels:r,materialPanelEnabled:o,onToggleMaterialPanel:a,onSetMaterialPanelState:s,updateSelectedMaterial:l,setSelectedTexturePath:c,isTexturePositioningEnabled:p,onConfirmTexturePosition:u}){let d={openMaterialPanels:r,materialPanelEnabled:o,onToggleMaterialPanel:a,onSetMaterialPanelState:s},{tier:m}=Sr(),g=Bi(m,"starter"),v={tier:"starter",locked:!g},[M,w]=(0,Tf.useState)("roughness"),[x,S]=(0,Tf.useState)("factor"),k=(y,h)=>{l(e,P=>{if(!P?.texture?.path)return P??{};let A=P.texture.offset??[0,0],C=[A[0],A[1]];return C[y]=h,{...P,texture:{...P.texture,offset:C}}})},b=y=>{l(e,h=>{if(!h?.texture?.path)return h??{};let P=(y%360+360)%360;return{...h,texture:{...h.texture,rotation:P*Math.PI/180}}})},_=()=>{c(e,"texture","")};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Wr,{panelKey:"pbr",title:"PBR Maps",tooltip:"Controls the base color and workflow used for physically based shading.",controls:d,children:g?(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(ol,{label:"Workflow",value:n,options:["metalness","specular"],onChange:i}),(0,Y.jsx)("div",{className:"bb-field bb-field--full",children:(0,Y.jsx)("p",{className:"bb-note",style:{margin:0},children:n==="metalness"?"Metalness workflow maps directly to the underlying physical material.":"Specular workflow exposes the same physical material with non-metal specular controls; it does not switch to a separate spec/gloss shader."})}),(0,Y.jsx)(Mn,{label:n==="specular"?"Albedo texture path":"Base color texture path",placeholder:"materials/oak-wood.jpg",value:t?.texture?.path??"",onChange:y=>c(e,"texture",y)}),t?.texture?.path?(0,Y.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,Y.jsxs)("div",{className:"bb-fieldLabel",style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,Y.jsx)("span",{className:"bb-label",children:"Texture position"}),(0,Y.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:_,title:"Remove the base color texture and its position offset",children:[(0,Y.jsx)(cw.Trash2,{size:14,style:{marginRight:4,verticalAlign:"-2px"}}),"Remove texture"]})]}),(0,Y.jsxs)("div",{className:"bb-grid",style:{marginTop:6},children:[(0,Y.jsx)(Cf,{label:"Offset X",value:t?.texture?.offset?.[0]??0,step:.01,onChange:y=>k(0,y)}),(0,Y.jsx)(Cf,{label:"Offset Y",value:t?.texture?.offset?.[1]??0,step:.01,onChange:y=>k(1,y)})]}),(0,Y.jsx)(Ft,{label:"Rotation",value:((t?.texture?.rotation??0)*180/Math.PI%360+360)%360,min:0,max:360,step:1,onChange:y=>b(y??0)}),p?(0,Y.jsx)("button",{type:"button",className:"bb-button bb-button--primary",style:{marginTop:8},onClick:u,title:"Confirm this texture position and exit positioning mode",children:"Done positioning"}):(0,Y.jsx)("p",{className:"bb-note",style:{margin:"6px 0 0"},children:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically once positioning."})]}):null,(0,Y.jsx)(_o,{label:n==="specular"?"Albedo color":"Base color",value:t?.baseColor??"#ffffff",onChange:y=>l(e,h=>({...h,baseColor:y}))}),n==="metalness"?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ft,{label:"Metalness",value:t?.metalness,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,metalness:y}))}),(0,Y.jsx)(Mn,{label:"Metalness map path",placeholder:"materials/body-metalness.jpg",value:t?.metalnessMap?.path??"",onChange:y=>c(e,"metalnessMap",y)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ft,{label:"Specular intensity",value:t?.specularIntensity,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,specularIntensity:y}))}),(0,Y.jsx)(_o,{label:"Specular color",value:t?.specularColor??"#ffffff",onChange:y=>l(e,h=>({...h,specularColor:y}))}),(0,Y.jsx)(Mn,{label:"Specular intensity map path",placeholder:"materials/body-specular-intensity.jpg",value:t?.specularIntensityMap?.path??"",onChange:y=>c(e,"specularIntensityMap",y)}),(0,Y.jsx)(Mn,{label:"Specular color map path",placeholder:"materials/body-specular-color.jpg",value:t?.specularColorMap?.path??"",onChange:y=>c(e,"specularColorMap",y)})]}),(0,Y.jsx)(Ft,{label:"Specular F0 / reflectivity",value:t?.reflectivity,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,reflectivity:y}))})]}):(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(_o,{label:"Base color",value:t?.baseColor??"#ffffff",onChange:y=>l(e,h=>({...h,baseColor:y}))}),(0,Y.jsx)(Ft,{label:"Metalness",value:t?.metalness,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,metalness:y}))}),(0,Y.jsx)("div",{className:"bb-field bb-field--full",children:(0,Y.jsx)(qn,{requiredTier:"starter",feature:"Texture maps, the specular workflow, and reflectivity"})})]})}),(0,Y.jsx)(Wr,{panelKey:"roughness",requiredTier:v,title:"Roughness / Glossiness",tooltip:"Adjusts how matte or shiny the surface appears.",toggleLabel:"Toggle Roughness and Glossiness",controls:d,children:(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(ol,{label:"Mode",value:M,options:["roughness","glossiness"],onChange:w}),(0,Y.jsx)("div",{className:"bb-field bb-field--full",children:(0,Y.jsx)("p",{className:"bb-note",style:{margin:0},children:M==="roughness"?"Roughness: 0 is glossy, 1 is matte.":"Glossiness is the inverse of roughness (glossiness = 1 \u2212 roughness)"})}),M==="roughness"?(0,Y.jsx)(Ft,{label:"Roughness",value:t?.roughness,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,roughness:y}))}):(0,Y.jsx)(Ft,{label:"Glossiness",value:t?.roughness===void 0?void 0:1-t.roughness,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,roughness:y===void 0?void 0:1-y}))}),(0,Y.jsx)(Mn,{label:M==="glossiness"?"Glossiness map path (applied as roughness)":"Roughness map path",placeholder:"materials/body-roughness.jpg",value:t?.roughnessMap?.path??"",onChange:y=>c(e,"roughnessMap",y)})]})}),(0,Y.jsx)(Wr,{panelKey:"emission",requiredTier:v,title:"Emission",tooltip:"Makes the material self-illuminated with emissive color and intensity.",controls:d,children:(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(_o,{label:"Emissive color",value:t?.emissive??"#000000",fallback:"#000000",onChange:y=>l(e,h=>({...h,emissive:y}))}),(0,Y.jsx)(Ft,{label:"Emissive intensity",value:t?.emissiveIntensity,min:0,max:10,step:.1,onChange:y=>l(e,h=>({...h,emissiveIntensity:y}))}),(0,Y.jsx)(Mn,{label:"Emissive map path",placeholder:"materials/body-emissive.jpg",value:t?.emissiveMap?.path??"",onChange:y=>c(e,"emissiveMap",y)})]})}),(0,Y.jsx)(Wr,{panelKey:"opacity",requiredTier:v,title:"Opacity",tooltip:"Controls transparency, alpha testing, and blending behavior.",controls:d,children:(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(Ft,{label:"Opacity",value:t?.opacity,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,opacity:y}))}),(0,Y.jsx)(Ft,{label:"Alpha test",value:t?.alphaTest,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,alphaTest:y}))}),(0,Y.jsx)(Mn,{label:"Alpha map path",placeholder:"materials/body-alpha.png",value:t?.alphaMap?.path??"",onChange:y=>c(e,"alphaMap",y)}),(0,Y.jsx)(ol,{label:"Blending mode",value:t?.blendingMode??"normal",options:sw,onChange:y=>l(e,h=>({...h,blendingMode:y}))}),(0,Y.jsxs)("div",{className:"bb-field",children:[(0,Y.jsx)("label",{className:"bb-label",children:"Alpha hash"}),(0,Y.jsx)("div",{className:"bb-checkboxRow",children:(0,Y.jsx)(zc,{label:"Use alpha hash",checked:t?.alphaHash??!1,onChange:y=>l(e,h=>({...h,alphaHash:y}))})})]}),(0,Y.jsxs)("div",{className:"bb-field",children:[(0,Y.jsx)("label",{className:"bb-label",children:"Dithering"}),(0,Y.jsx)("div",{className:"bb-checkboxRow",children:(0,Y.jsx)(zc,{label:"Use dithering",checked:t?.dithering??!1,onChange:y=>l(e,h=>({...h,dithering:y}))})})]})]})}),(0,Y.jsxs)(Wr,{panelKey:"normalBump",requiredTier:v,title:"Normal & Bump",tooltip:"Adds surface detail without changing the actual mesh shape.",toggleLabel:"Toggle Normal and Bump",controls:d,children:[(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(Mn,{label:"Normal map path",placeholder:"materials/body-normal.jpg",value:t?.normalMap?.path??"",onChange:y=>c(e,"normalMap",y)}),(0,Y.jsx)(Ft,{label:"Normal scale",value:t?.normalScale,min:0,max:5,step:.01,onChange:y=>l(e,h=>({...h,normalScale:y}))}),(0,Y.jsx)(Mn,{label:"Bump map path",placeholder:"materials/body-bump.jpg",value:t?.bumpMap?.path??"",onChange:y=>c(e,"bumpMap",y)}),(0,Y.jsx)(Ft,{label:"Bump scale",value:t?.bumpScale,min:0,max:5,step:.01,onChange:y=>l(e,h=>({...h,bumpScale:y}))})]}),(0,Y.jsx)("div",{className:"bb-checkboxRow",style:{marginTop:12},children:(0,Y.jsx)(zc,{label:"Flip normal Y",checked:t?.flipNormalY??!1,onChange:y=>l(e,h=>({...h,flipNormalY:y}))})})]}),(0,Y.jsx)(Wr,{panelKey:"displacement",requiredTier:v,title:"Displacement",tooltip:"Offsets geometry using a texture to create real surface height.",controls:d,children:(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(Mn,{label:"Displacement map path",placeholder:"materials/body-displacement.jpg",value:t?.displacementMap?.path??"",onChange:y=>c(e,"displacementMap",y)}),(0,Y.jsx)(Ft,{label:"Displacement scale",value:t?.displacementScale,min:-5,max:5,step:.01,onChange:y=>l(e,h=>({...h,displacementScale:y}))}),(0,Y.jsx)(Ft,{label:"Displacement bias",value:t?.displacementBias,min:-5,max:5,step:.01,onChange:y=>l(e,h=>({...h,displacementBias:y}))})]})}),(0,Y.jsx)(Wr,{panelKey:"ao",requiredTier:v,title:"Ambient Occlusion",tooltip:"Darkens creases and contact areas to add depth.",controls:d,children:(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(Mn,{label:"AO map path",placeholder:"materials/body-ao.jpg",value:t?.aoMap?.path??"",onChange:y=>c(e,"aoMap",y)}),(0,Y.jsx)(Ft,{label:"AO intensity",value:t?.aoMapIntensity,min:0,max:5,step:.01,onChange:y=>l(e,h=>({...h,aoMapIntensity:y}))})]})}),(0,Y.jsxs)(Wr,{panelKey:"clearcoat",requiredTier:v,title:"Clearcoat",tooltip:"Adds a glossy protective layer on top of the base material.",controls:d,children:[(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(Mn,{label:"Clearcoat map path",placeholder:"materials/body-clearcoat.jpg",value:t?.clearcoatMap?.path??"",onChange:y=>c(e,"clearcoatMap",y)}),(0,Y.jsx)(Ft,{label:"Clearcoat",value:t?.clearcoat,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,clearcoat:y}))}),(0,Y.jsx)(Mn,{label:"Clearcoat roughness map path",placeholder:"materials/body-clearcoat-roughness.jpg",value:t?.clearcoatRoughnessMap?.path??"",onChange:y=>c(e,"clearcoatRoughnessMap",y)}),(0,Y.jsx)(Ft,{label:"Clearcoat roughness",value:t?.clearcoatRoughness,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,clearcoatRoughness:y}))}),(0,Y.jsx)(Mn,{label:"Clearcoat normal map path",placeholder:"materials/body-clearcoat-normal.jpg",value:t?.clearcoatNormalMap?.path??"",onChange:y=>c(e,"clearcoatNormalMap",y)}),(0,Y.jsx)(Ft,{label:"Clearcoat normal scale",value:t?.clearcoatNormalScale,min:0,max:5,step:.01,onChange:y=>l(e,h=>({...h,clearcoatNormalScale:y}))})]}),(0,Y.jsx)("div",{className:"bb-checkboxRow",style:{marginTop:12},children:(0,Y.jsx)(zc,{label:"Flip clearcoat normal Y",checked:t?.flipClearcoatNormalY??!1,onChange:y=>l(e,h=>({...h,flipClearcoatNormalY:y}))})})]}),(0,Y.jsx)(Wr,{panelKey:"sheen",requiredTier:v,title:"Sheen",tooltip:"Adds a soft fabric-like sheen on grazing angles.",controls:d,children:(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(Ft,{label:"Sheen",value:t?.sheen,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,sheen:y}))}),(0,Y.jsx)(_o,{label:"Sheen color",value:t?.sheenColor??"#ffffff",onChange:y=>l(e,h=>({...h,sheenColor:y}))}),(0,Y.jsx)(Mn,{label:"Sheen color map path",placeholder:"materials/body-sheen-color.jpg",value:t?.sheenColorMap?.path??"",onChange:y=>c(e,"sheenColorMap",y)}),(0,Y.jsx)(Ft,{label:"Sheen roughness",value:t?.sheenRoughness,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,sheenRoughness:y}))}),(0,Y.jsx)(Mn,{label:"Sheen roughness map path",placeholder:"materials/body-sheen-roughness.jpg",value:t?.sheenRoughnessMap?.path??"",onChange:y=>c(e,"sheenRoughnessMap",y)})]})}),(0,Y.jsx)(Wr,{panelKey:"anisotropy",requiredTier:v,title:"Anisotropy",tooltip:"Stretches reflections in one direction for brushed or fiber-like surfaces.",controls:d,children:(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(Ft,{label:"Intensity",value:t?.anisotropy,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,anisotropy:y}))}),(0,Y.jsx)(ol,{label:"Tilt direction",value:x,options:["factor","texture"],onChange:S}),x==="factor"?(0,Y.jsx)(Ft,{label:"Rotation (rad)",value:t?.anisotropyRotation,min:0,max:6.28,step:.01,onChange:y=>l(e,h=>({...h,anisotropyRotation:y}))}):(0,Y.jsx)(Mn,{label:"Anisotropy map path",placeholder:"materials/body-anisotropy.jpg",value:t?.anisotropyMap?.path??"",onChange:y=>c(e,"anisotropyMap",y)})]})}),(0,Y.jsx)(Wr,{panelKey:"transmission",requiredTier:v,title:"Transmission & Volume",tooltip:"Controls glass-like transmission and how light travels through volume.",toggleLabel:"Toggle Transmission and Volume",controls:d,children:(0,Y.jsxs)("div",{className:"bb-grid",children:[(0,Y.jsx)(Ft,{label:"Transmission",value:t?.transmission,min:0,max:1,step:.01,onChange:y=>l(e,h=>({...h,transmission:y}))}),(0,Y.jsx)(Mn,{label:"Transmission map path",placeholder:"materials/body-transmission.jpg",value:t?.transmissionMap?.path??"",onChange:y=>c(e,"transmissionMap",y)}),(0,Y.jsx)(Ft,{label:"Thickness",value:t?.thickness,min:0,max:5,step:.01,onChange:y=>l(e,h=>({...h,thickness:y}))}),(0,Y.jsx)(Mn,{label:"Thickness map path",placeholder:"materials/body-thickness.jpg",value:t?.thicknessMap?.path??"",onChange:y=>c(e,"thicknessMap",y)}),(0,Y.jsx)(_o,{label:"Volume tint",value:t?.attenuationColor??"#ffffff",onChange:y=>l(e,h=>({...h,attenuationColor:y}))}),(0,Y.jsx)(lw,{label:"Attenuation distance",value:t?.attenuationDistance,min:0,step:.01,placeholder:"Infinity when unset",onChange:y=>l(e,h=>({...h,attenuationDistance:y}))})]})}),(0,Y.jsx)(Wr,{panelKey:"faces",requiredTier:v,title:"Faces Rendering",tooltip:"Chooses which side of the mesh renders and how backfaces are handled.",controls:d,children:(0,Y.jsx)("div",{className:"bb-grid",children:(0,Y.jsx)(ol,{label:"Side",value:t?.side??"front",options:aw,onChange:y=>l(e,h=>({...h,side:y}))})})})]})}var uw=[{id:"wood",label:"Wood",swatch:"#8b5a2b",material:{baseColor:"#8b5a2b",metalness:0,roughness:.75,reflectivity:.04}},{id:"brushed-metal",label:"Brushed Metal",swatch:"linear-gradient(135deg, #cfcfcf, #8a8a8a)",material:{baseColor:"#c8c8c8",metalness:1,roughness:.35}},{id:"chrome",label:"Polished Chrome",swatch:"linear-gradient(135deg, #ffffff, #9aa0a6)",material:{baseColor:"#e8e8e8",metalness:1,roughness:.05}},{id:"gold",label:"Gold",swatch:"linear-gradient(135deg, #ffe9a8, #c89b2c)",material:{baseColor:"#e6b325",metalness:1,roughness:.2}},{id:"copper",label:"Copper",swatch:"linear-gradient(135deg, #e3a576, #8a4a26)",material:{baseColor:"#b87333",metalness:1,roughness:.3}},{id:"glass",label:"Glass",swatch:"linear-gradient(135deg, rgba(255,255,255,0.9), rgba(180,210,230,0.4))",material:{baseColor:"#ffffff",metalness:0,roughness:.02,reflectivity:.5,opacity:1,transmission:1,thickness:.5,attenuationColor:"#ffffff",attenuationDistance:1}},{id:"frosted-glass",label:"Frosted Glass",swatch:"linear-gradient(135deg, rgba(255,255,255,0.85), rgba(210,225,235,0.6))",material:{baseColor:"#ffffff",metalness:0,roughness:.4,reflectivity:.3,opacity:1,transmission:.9,thickness:.5}},{id:"plastic-glossy",label:"Glossy Plastic",swatch:"#dadada",material:{baseColor:"#dadada",metalness:0,roughness:.25,reflectivity:.5,clearcoat:.3,clearcoatRoughness:.1}},{id:"plastic-matte",label:"Matte Plastic",swatch:"#9a9a9a",material:{baseColor:"#9a9a9a",metalness:0,roughness:.85,reflectivity:.04}},{id:"rubber",label:"Rubber",swatch:"#1a1a1a",material:{baseColor:"#1a1a1a",metalness:0,roughness:.9,reflectivity:.02}},{id:"fabric",label:"Fabric",swatch:"#9c8a6b",material:{baseColor:"#9c8a6b",metalness:0,roughness:.95,sheen:.4,sheenColor:"#ffffff",sheenRoughness:.6}},{id:"ceramic",label:"Ceramic",swatch:"#f5f5f0",material:{baseColor:"#f5f5f0",metalness:0,roughness:.15,clearcoat:.6,clearcoatRoughness:.1}},{id:"concrete",label:"Concrete",swatch:"#9b9b93",material:{baseColor:"#9b9b93",metalness:0,roughness:.95,reflectivity:.03}}];var al=require("react/jsx-runtime");function pw({disabled:e,onApply:t}){return(0,al.jsx)("div",{className:"bb-presetGallery",children:uw.map(n=>(0,al.jsxs)("button",{type:"button",className:"bb-presetSwatch",disabled:e,title:`Apply ${n.label} preset`,onClick:()=>t(n.material),children:[(0,al.jsx)("span",{className:"bb-presetSwatchColor",style:{background:n.swatch}}),(0,al.jsx)("span",{className:"bb-presetSwatchLabel",children:n.label})]},n.id))})}var sl=require("react"),ra=require("lucide-react"),Oi=require("react/jsx-runtime");function Pf({disabled:e,exporting:t,onExportJson:n,onExportTs:i}){let[r,o]=(0,sl.useState)(!1),a=(0,sl.useRef)(null);return(0,sl.useEffect)(()=>{if(!r)return;let s=l=>{a.current?.contains(l.target)||o(!1)};return window.addEventListener("pointerdown",s),()=>window.removeEventListener("pointerdown",s)},[r]),(0,Oi.jsxs)("div",{className:"bb-exportMenuWrapper",ref:a,children:[(0,Oi.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",disabled:e||t,onClick:()=>o(s=>!s),title:"Export",children:[(0,Oi.jsx)(ra.Download,{size:14}),t?"Exporting\u2026":"Export",(0,Oi.jsx)(ra.ChevronDown,{size:12})]}),r&&(0,Oi.jsxs)("div",{className:"bb-exportMenu",children:[(0,Oi.jsxs)("button",{type:"button",className:"bb-exportMenuItem",onClick:()=>{o(!1),n()},children:[(0,Oi.jsx)(ra.FileJson,{size:14}),"JSON"]}),(0,Oi.jsxs)("button",{type:"button",className:"bb-exportMenuItem",onClick:()=>{o(!1),i()},children:[(0,Oi.jsx)(ra.FileCode2,{size:14}),"TypeScript"]})]})]})}var pi=require("react/jsx-runtime");function hw({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r,idError:o}){return(0,pi.jsx)(tr,{title:"Identity",open:n,onToggle:i,children:(0,pi.jsxs)("div",{className:"bb-grid",children:[(0,pi.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,pi.jsx)("label",{className:"bb-label",children:"Model Node ID"}),(0,pi.jsx)("span",{className:"bb-note",children:"This is the exact mesh name from the imported model and stays locked."}),(0,pi.jsx)("input",{className:"bb-input bb-readonly",value:t.modelObjectId,readOnly:!0})]}),(0,pi.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,pi.jsx)("label",{className:"bb-label",children:"ID"}),(0,pi.jsx)("input",{className:`bb-input ${o?"bb-input--error":""}`,value:t.id,onChange:a=>r(e,s=>({...s,id:a.target.value}))}),o?(0,pi.jsx)("span",{className:"bb-status bb-status--error",children:o}):null]})]})})}var Uc=require("react");var Vt=require("react/jsx-runtime");function mw({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r}){let[o,a]=(0,Uc.useState)(t.group??""),[s,l]=(0,Uc.useState)(t.tags?.join(", ")??"");(0,Uc.useEffect)(()=>{a(t.group??""),l(t.tags?.join(", ")??"")},[e,t.group,t.tags]);let c=()=>{r(e,u=>({...u,group:o.trim()||void 0}))},p=()=>{let u=[...new Set(s.split(",").map(d=>d.trim()).filter(Boolean))];r(e,d=>({...d,tags:u.length>0?u:void 0}))};return(0,Vt.jsxs)(tr,{title:"Basics",open:n,onToggle:i,children:[(0,Vt.jsxs)("div",{className:"bb-grid",children:[(0,Vt.jsxs)("div",{className:"bb-field",children:[(0,Vt.jsx)("label",{className:"bb-label",children:"Label"}),(0,Vt.jsx)("input",{className:"bb-input",value:t.label??"",onChange:u=>r(e,d=>({...d,label:u.target.value}))})]}),(0,Vt.jsxs)("div",{className:"bb-field",children:[(0,Vt.jsx)("label",{className:"bb-label",children:"Type"}),(0,Vt.jsx)("input",{className:"bb-input",list:"binding-type-suggestions",value:t.type??"other",onChange:u=>r(e,d=>({...d,type:u.target.value}))}),(0,Vt.jsx)("datalist",{id:"binding-type-suggestions",children:J1.map(u=>(0,Vt.jsx)("option",{value:u},u))})]}),(0,Vt.jsxs)("div",{className:"bb-field",children:[(0,Vt.jsx)("label",{className:"bb-label",children:"Status"}),(0,Vt.jsx)("select",{className:"bb-select",value:t.status??"normal",onChange:u=>r(e,d=>({...d,status:u.target.value})),children:fp.map(u=>(0,Vt.jsx)("option",{value:u,children:u},u))})]}),(0,Vt.jsxs)("div",{className:"bb-field",children:[(0,Vt.jsx)("label",{className:"bb-label",children:"Group"}),(0,Vt.jsx)("input",{className:"bb-input",placeholder:"paint",value:o,onChange:u=>a(u.target.value),onBlur:c,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()}})]}),(0,Vt.jsxs)("div",{className:"bb-field",children:[(0,Vt.jsx)("label",{className:"bb-label",children:"Tags"}),(0,Vt.jsx)("input",{className:"bb-input",placeholder:"exterior, configurable",value:s,onChange:u=>l(u.target.value),onBlur:p,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()}})]})]}),(0,Vt.jsxs)("div",{className:"bb-checkboxRow",style:{marginTop:12},children:[(0,Vt.jsxs)("label",{className:"bb-checkbox",children:[(0,Vt.jsx)("input",{type:"checkbox",checked:t.selectable??!1,onChange:u=>r(e,d=>({...d,selectable:u.target.checked}))}),"selectable"]}),(0,Vt.jsxs)("label",{className:"bb-checkbox",children:[(0,Vt.jsx)("input",{type:"checkbox",checked:t.hoverable??!1,onChange:u=>r(e,d=>({...d,hoverable:u.target.checked}))}),"hoverable"]}),(0,Vt.jsxs)("label",{className:"bb-checkbox",children:[(0,Vt.jsx)("input",{type:"checkbox",checked:t.visible??!1,onChange:u=>r(e,d=>({...d,visible:u.target.checked}))}),"visible"]})]})]})}var yp=require("react");var gt=require("react/jsx-runtime"),fw=Sa.filter(e=>e.handling==="viewer"),lP=Sa.filter(e=>e.handling==="host");function gw({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r}){let[o,a]=(0,yp.useState)(new Set);(0,yp.useEffect)(()=>{a(new Set)},[e]);let s=t.actions??[],l=(u,d)=>r(e,m=>({...m,actions:(m.actions??[]).map((g,v)=>v===u?d(g):g)})),c=u=>{r(e,d=>({...d,actions:(d.actions??[]).filter((m,g)=>g!==u)})),a(d=>{let m=new Set;return d.forEach(g=>{g<u?m.add(g):g>u&&m.add(g-1)}),m})},p=(u,d)=>a(m=>{let g=new Set(m);return d?g.add(u):g.delete(u),g});return(0,gt.jsxs)(tr,{title:"Actions",open:n,onToggle:i,children:[(0,gt.jsx)("div",{className:"bb-actionList",children:s.map((u,d)=>{let m=zl(u.id),g=o.has(d)||!m,v=u.id.trim(),M=m?null:Ib(u.id),w=v.length>0&&s.some((x,S)=>S!==d&&x.id.trim()===v);return(0,gt.jsxs)("div",{className:"bb-actionCard",children:[(0,gt.jsxs)("div",{className:"bb-actionCardHeader",children:[(0,gt.jsxs)("div",{className:"bb-actionCardTitle",children:["Action ",d+1]}),(0,gt.jsx)("div",{className:"bb-actionCardMeta",children:u.type})]}),(0,gt.jsxs)("div",{className:"bb-actionGrid",children:[(0,gt.jsxs)("div",{className:"bb-field",children:[(0,gt.jsx)("label",{className:"bb-label",children:"Action ID"}),(0,gt.jsxs)("select",{className:"bb-select",value:g?Md:u.id,onChange:x=>{let S=x.target.value;if(S===Md){p(d,!0);return}p(d,!1);let k=zl(S);l(d,b=>({...b,id:S,label:k&&vh(b.label)?k.label:b.label}))},children:[(0,gt.jsx)("optgroup",{label:"Handled by the viewer",children:fw.map(x=>(0,gt.jsx)("option",{value:x.id,children:x.id},x.id))}),(0,gt.jsx)("optgroup",{label:"Handled by your app",children:lP.map(x=>(0,gt.jsx)("option",{value:x.id,children:x.id},x.id))}),(0,gt.jsx)("option",{value:Md,children:"Custom\u2026"})]})]}),g?(0,gt.jsxs)("div",{className:"bb-field",children:[(0,gt.jsx)("label",{className:"bb-label",children:"Custom action ID"}),(0,gt.jsx)("input",{className:"bb-input",value:u.id,placeholder:"open-datasheet",onChange:x=>{p(d,!0),l(d,S=>({...S,id:x.target.value}))}})]}):null,(0,gt.jsxs)("div",{className:"bb-field",children:[(0,gt.jsx)("label",{className:"bb-label",children:"Label"}),(0,gt.jsx)("input",{className:"bb-input",value:u.label,onChange:x=>l(d,S=>({...S,label:x.target.value}))})]}),m?(0,gt.jsx)("span",{className:"bb-note",children:m.description}):v.length===0?(0,gt.jsx)("span",{className:"bb-note",style:{color:"#fca5a5"},children:"An action ID is required, the button renders but can never be identified in onAction."}):(0,gt.jsxs)("span",{className:"bb-note",style:{color:"#fcd34d"},children:["Unrecognised ID, the viewer has no built-in behavior for it. Add declarative effects and execute them with useViewerActions, or handle it in onAction.",M?(0,gt.jsxs)(gt.Fragment,{children:[" Did you mean ",(0,gt.jsx)("button",{type:"button",className:"bb-linkButton",onClick:()=>{p(d,!1);let x=zl(M);l(d,S=>({...S,id:M,label:x&&vh(S.label)?x.label:S.label}))},children:M}),"?"]}):null]}),u.effects?.length?(0,gt.jsxs)("span",{className:"bb-note",children:[u.effects.length," declarative effect",u.effects.length===1?"":"s",", execute with useViewerActions."]}):null,w?(0,gt.jsx)("span",{className:"bb-note",style:{color:"#fcd34d"},children:"Another action on this binding uses the same ID, they will render as two identical buttons."}):null]}),(0,gt.jsx)("div",{className:"bb-actionFooter",children:(0,gt.jsx)("button",{type:"button",className:"bb-button bb-button--ghost bb-actionRemove",onClick:()=>c(d),children:"Remove Action"})})]},d)})}),(0,gt.jsx)("div",{style:{marginTop:10},children:(0,gt.jsx)("button",{type:"button",className:"bb-button",onClick:()=>{let u=fw.find(d=>!s.some(m=>m.id===d.id));r(e,d=>({...d,actions:[...d.actions??[],{id:u?.id??"",label:u?.label??"New Action",type:"command"}]})),u||p(s.length,!0)},children:"Add Action"})})]})}var vw=require("react"),ia=require("lucide-react");var lt=require("react/jsx-runtime"),bw=()=>`decal-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function xw({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r,placement:o,onPlacementChange:a,defaultSize:s,onImageFile:l,onNudge:c}){let{tier:p}=Sr(),u=(0,vw.useRef)(null),d=t.decals??[],m=o?.nodeKey===e?o:null,g=w=>r(e,x=>({...x,decals:w.length>0?w:void 0})),v=(w,x)=>g(d.map(S=>S.id===w?{...S,...x}:S)),M=w=>{w.image&&Hl(w.image),m?.decal.id===w.id&&a(null),g(d.filter(x=>x.id!==w.id))};return(0,lt.jsx)(tr,{title:"Decals",open:n,onToggle:i,tooltip:"Print a logo, image, or text on the selected object's surface.",children:Bi(p,"starter")?(0,lt.jsxs)(lt.Fragment,{children:[(0,lt.jsxs)("div",{className:"bb-decalActions",children:[(0,lt.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:()=>u.current?.click(),children:[(0,lt.jsx)(ia.ImagePlus,{size:15})," Add image"]}),(0,lt.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:()=>a({nodeKey:e,decal:{id:bw(),text:"Your text",color:"#ffffff",size:s}}),children:[(0,lt.jsx)(ia.Type,{size:15})," Add text"]}),(0,lt.jsx)("input",{ref:u,type:"file",accept:"image/png,image/jpeg,image/webp,image/avif,image/svg+xml",className:"bb-hiddenInput",onChange:w=>{let x=w.target.files?.[0];if(w.target.value="",!x)return;let S=Rd(x);Ma(S,URL.createObjectURL(x)),l?.(S,x),a({nodeKey:e,decal:{id:bw(),image:S,size:s}})}})]}),d.length===0&&!m?(0,lt.jsx)("div",{className:"bb-decalEmpty",children:"No decals on this object yet."}):null,d.map(w=>(0,lt.jsxs)("div",{className:"bb-decalCard",children:[(0,lt.jsxs)("div",{className:"bb-decalCardHeader",children:[(0,lt.jsx)("span",{className:"bb-decalKind",children:w.image?"Image":"Text"}),(0,lt.jsx)("span",{className:"bb-decalName",title:w.image??w.text,children:w.image??w.text}),(0,lt.jsx)("button",{type:"button",className:"bb-iconButton",title:"Move: drag the decal in the preview","aria-label":"Move decal","aria-pressed":m?.decal.id===w.id,onClick:()=>{let{position:x,normal:S,...k}=w;a(m?.decal.id===w.id?null:{nodeKey:e,decal:k,moving:!0})},children:(0,lt.jsx)(ia.Move,{size:15})}),(0,lt.jsx)("button",{type:"button",className:"bb-iconButton bb-iconButton--danger",title:"Delete decal","aria-label":"Delete decal",onClick:()=>M(w),children:(0,lt.jsx)(ia.Trash2,{size:15})})]}),(0,lt.jsx)(Cd,{onNudge:x=>c(w.id,x)}),(0,lt.jsxs)("div",{className:"bb-grid",children:[w.image?null:(0,lt.jsxs)(lt.Fragment,{children:[(0,lt.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,lt.jsx)("label",{className:"bb-label",children:"Text"}),(0,lt.jsx)("input",{className:"bb-input",value:w.text??"",onChange:x=>v(w.id,{text:x.target.value})})]}),(0,lt.jsx)(_o,{label:"Colour",variant:"input",value:w.color??"#ffffff",onChange:x=>v(w.id,{color:x})}),(0,lt.jsxs)("div",{className:"bb-field",children:[(0,lt.jsx)("label",{className:"bb-label",children:"Weight"}),(0,lt.jsxs)("select",{className:"bb-input bb-decalWeight",value:w.fontWeight??"bold",onChange:x=>v(w.id,{fontWeight:x.target.value}),children:[(0,lt.jsx)("option",{value:"bold",children:"Bold"}),(0,lt.jsx)("option",{value:"normal",children:"Regular"})]})]})]}),(0,lt.jsx)(Ft,{label:"Size",value:Number(w.size.toFixed(4)),min:Number((s/20).toPrecision(2)),max:Number((s*6).toPrecision(2)),step:Number((s/50).toPrecision(1)),onChange:x=>x!==void 0&&x>0&&v(w.id,{size:x})}),(0,lt.jsx)(Ft,{label:"Rotation (\xB0)",value:Math.round((w.rotation??0)*180/Math.PI),min:-180,max:180,step:1,onChange:x=>v(w.id,{rotation:(x??0)*Math.PI/180})}),(0,lt.jsx)(Ft,{label:"Opacity",value:w.opacity??1,min:0,max:1,step:.05,onChange:x=>v(w.id,{opacity:x??1})})]})]},w.id))]}):(0,lt.jsx)(qn,{requiredTier:"starter",feature:"Decals"})})}var wp=require("lucide-react");var jt=require("react/jsx-runtime");function yw({selectedBinding:e,open:t,onToggle:n,cameraState:i,formattedCameraState:r,savedCameraPosition:o,onSaveCameraPosition:a,onGoToSavedCamera:s,onClearSavedCamera:l,onResetView:c,onFitScene:p}){return(0,jt.jsxs)(tr,{title:"Camera Position",open:t,onToggle:n,children:[(0,jt.jsxs)("div",{className:"se-waypointCard bb-cameraWaypoint",children:[(0,jt.jsx)("span",{className:"bb-cameraLiveBadge",children:"LIVE"}),(0,jt.jsxs)("div",{className:"se-waypointBody",children:[(0,jt.jsx)("div",{className:"bb-cameraWaypointLabel",children:"Current view"}),i?(0,jt.jsxs)(jt.Fragment,{children:[(0,jt.jsxs)("div",{className:"se-waypointCoords",children:["pos ",r?.position]}),(0,jt.jsxs)("div",{className:"se-waypointCoords",children:["look ",r?.target]})]}):(0,jt.jsx)("div",{className:"se-waypointCoords",children:"Move the camera to see live position"})]})]}),(0,jt.jsxs)("div",{className:"bb-cameraControls bb-cameraControls--centered",children:[(0,jt.jsx)("button",{type:"button",className:"bb-button bb-button--primary",onClick:a,disabled:!i,children:"Save"}),(0,jt.jsx)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:c,children:"Reset View"}),(0,jt.jsx)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:p,children:"Fit Scene"})]}),o?.position&&o?.target&&(0,jt.jsxs)("div",{className:"se-waypointCard bb-cameraWaypoint",children:[(0,jt.jsx)("span",{className:"bb-cameraSavedBadge",children:"SAVED"}),(0,jt.jsxs)("div",{className:"se-waypointBody",children:[(0,jt.jsxs)("div",{className:"bb-cameraWaypointLabel",children:["For ",e.label]}),(0,jt.jsxs)("div",{className:"se-waypointCoords",children:["pos [",o.position.map(u=>u.toFixed(1)).join(", "),"]"]}),(0,jt.jsxs)("div",{className:"se-waypointCoords",children:["look [",o.target.map(u=>u.toFixed(1)).join(", "),"]"]})]}),(0,jt.jsxs)("div",{className:"se-waypointActions",children:[(0,jt.jsx)("button",{className:"se-waypointAction",onClick:s,title:"Fly camera to the saved position",children:(0,jt.jsx)(wp.MapPin,{size:15})}),(0,jt.jsx)("button",{className:"se-waypointAction se-waypointAction--delete",onClick:l,title:"Delete saved position",children:(0,jt.jsx)(wp.Trash2,{size:15})})]})]}),(0,jt.jsx)("span",{className:"bb-note",children:'Tip: Position the camera how you want, then click "Save" to store this position for the selected object. The camera position updates in real-time as you navigate.'})]})}var ll=require("react"),Sp=require("lucide-react");var ut=require("react/jsx-runtime"),ww=["X","Y","Z"];var cP=.1;function Af(e){let t=e%360;return t<0?t+360:t}function Sw(e){return Af(e*180/Math.PI)}function _w(e){return e*Math.PI/180}function dP(e,t,n){let i=[...e],r=Sw(e[t]);return i[t]=_w(Af(r+n)),i}function Mw({value:e,min:t=-1/0,max:n=1/0,step:i=.1,disabled:r=!1,onChange:o,formatValue:a=c=>Number(c.toFixed(3)),ariaLabel:s,className:l}){let c=a(e),[p,u]=(0,ll.useState)(String(c)),d=(0,ll.useRef)(!1);return(0,ll.useLayoutEffect)(()=>{d.current||u(String(c))},[c]),(0,ut.jsx)("input",{type:"number",className:l,step:i,min:t===-1/0?void 0:t,max:n===1/0?void 0:n,value:p,disabled:r,"aria-label":s,onFocus:()=>{d.current=!0},onChange:m=>{let g=m.target.value;if(u(g),g===""||g==="-")return;let v=Number(g);if(Number.isFinite(v)){let M=Math.max(t,Math.min(n,v));o(M)}},onBlur:()=>{d.current=!1,u(String(a(e)))}})}function uP({value:e,min:t=-1/0,max:n=1/0,step:i=.1,disabled:r=!1,onChange:o,formatValue:a=l=>Number(l.toFixed(3)),label:s}){return(0,ut.jsx)("div",{className:"bb-transformAxesGrid",children:ww.map((l,c)=>(0,ut.jsxs)("div",{className:"bb-transformAxis",children:[(0,ut.jsx)("span",{className:"se-axisStepperLabel bb-transformAxisLabel",children:l}),(0,ut.jsx)("div",{className:"bb-transformAxisControl",children:(0,ut.jsx)(Mw,{className:"se-numberInput bb-transformNumberInput",step:i,min:t,max:n,value:e[c],disabled:r,formatValue:a,ariaLabel:`${l} ${s?.toLowerCase()||""}`,onChange:p=>{let u=[...e];u[c]=p,o(u)}})})]},l))})}function Cw({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r,moveModeEnabled:o,onToggleMoveMode:a,transformSpace:s,onTransformSpaceChange:l,originalTransform:c}){let p=t.transform?.rotation??c?.rotation??[0,0,0],u=t.transform?.position??c?.position??[0,0,0],d=(x,S)=>{let k=x.transform?.rotation??c?.rotation??[0,0,0],b=x.transform?.position??c?.position??[0,0,0],_=x.transform?.scale??c?.scale??[1,1,1],y=c?.pivotLocal??[0,0,0],h=a1(b,k,S,_,y,c?.rotationOrder??"XYZ");return{...x,transform:{...x.transform,position:h,rotation:S}}},m=(x,S)=>{e&&r(e,k=>{let b=k.transform?.rotation??c?.rotation??[0,0,0],_=dP(b,x,S);return d(k,_)})},g=(x,S)=>{e&&r(e,k=>{let _=[...k.transform?.rotation??c?.rotation??[0,0,0]];return _[x]=_w(Af(S)),d(k,_)})},v=(x,S)=>{e&&r(e,k=>{let _=[...k.transform?.position??c?.position??[0,0,0]];return _[x]=S,{...k,transform:{...k.transform,position:_}}})},M=(x,S)=>{e&&v(x,u[x]+S)},w=()=>{!e||!c||r(e,x=>{let S={...x.transform};return delete S.position,delete S.rotation,{...x,transform:Object.keys(S).length>0?S:void 0}})};return(0,ut.jsxs)(tr,{title:"Move & Rotate",open:n,onToggle:i,tooltip:"Enable the transform gizmo to move or rotate the selected mesh on any axis. Rotation uses the object's visible center while exported position and rotation remain local GLTF transforms.",children:[(0,ut.jsxs)("div",{className:"se-field",children:[(0,ut.jsxs)("div",{className:"se-fieldLabel",children:[(0,ut.jsxs)("span",{children:[(0,ut.jsx)(Sp.Move3d,{size:14,style:{marginRight:6,verticalAlign:"-2px"}}),"Transform gizmo"]}),(0,ut.jsxs)("label",{className:"se-switch","aria-label":"Toggle move mode",children:[(0,ut.jsx)("input",{type:"checkbox",checked:o,onChange:x=>a(x.target.checked)}),(0,ut.jsx)("span",{className:"se-switchTrack",children:(0,ut.jsx)("span",{className:"se-switchThumb"})})]})]}),(0,ut.jsx)("span",{className:"bb-note",children:"Select a mesh \xB7 drag the colored arrows or planes to move"})]}),(0,ut.jsxs)("div",{className:"se-field",style:{marginTop:10},children:[(0,ut.jsx)("div",{className:"se-fieldLabel",children:(0,ut.jsx)("span",{children:"Axis space"})}),(0,ut.jsx)("div",{className:"se-segmentedControl",children:["world","local"].map(x=>(0,ut.jsx)("button",{type:"button",className:`se-segmentedOption ${s===x?"se-segmentedOption--active":""}`,onClick:()=>l(x),children:x},x))})]}),(0,ut.jsxs)("div",{className:"se-field",style:{marginTop:10},children:[(0,ut.jsx)("div",{className:"se-fieldLabel",children:(0,ut.jsx)("span",{children:"Rotation (degrees)"})}),(0,ut.jsx)("div",{className:"bb-transformAxesGrid",children:ww.map((x,S)=>{let k=Math.round(Sw(p[S]));return(0,ut.jsxs)("div",{className:"bb-transformAxis",children:[(0,ut.jsx)("span",{className:"se-axisStepperLabel bb-transformAxisLabel",children:x}),(0,ut.jsx)("div",{className:"bb-transformAxisControl",children:(0,ut.jsx)(Mw,{className:"se-numberInput bb-transformNumberInput",step:1,min:0,max:359,value:k,disabled:!e,formatValue:b=>Math.round(b),ariaLabel:`${x} rotation in degrees`,onChange:b=>g(S,b)})})]},x)})})]}),(0,ut.jsxs)("div",{className:"se-field",style:{marginTop:10},children:[(0,ut.jsx)("div",{className:"se-fieldLabel",children:(0,ut.jsx)("span",{children:"Position"})}),(0,ut.jsx)(uP,{value:u,min:-1/0,max:1/0,step:cP,disabled:!e,label:"position",onChange:x=>{e&&r(e,S=>({...S,transform:{...S.transform,position:x}}))}})]}),(0,ut.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",style:{marginTop:10,display:"inline-flex",alignItems:"center",gap:6},disabled:!e||!c,onClick:w,title:"Restore this node's position and rotation to what they were in the original model",children:[(0,ut.jsx)(Sp.RotateCcw,{size:14}),"Restore original position & rotation"]})]})}var Ya=require("react"),Tw=require("lucide-react");var gn=require("react/jsx-runtime"),Pw=(0,Ya.memo)(pP);function pP({bindings:e,selectedItem:t,onSelect:n,onHover:i,isOpen:r=!0,onToggle:o,isolatedItem:a=null,onIsolate:s}){let[l,c]=(0,Ya.useState)(""),p=(0,Ya.useMemo)(()=>Object.keys(e),[e]),u=(0,Ya.useMemo)(()=>{let d=l.trim().toLowerCase();return d?p.filter(m=>{let g=e[m];return m.toLowerCase().includes(d)||g.label?.toLowerCase().includes(d)||(g.type??"other").toLowerCase().includes(d)}):p},[e,p,l]);return(0,gn.jsxs)("aside",{className:`bb-sidebar bb-sidebar--right ${r?"":"bb-sidebar--collapsed"}`,children:[(0,gn.jsxs)("div",{className:"bb-header bb-header--sidebar",children:[!r&&(0,gn.jsx)("button",{type:"button",className:"bb-sidebarToggle",onClick:()=>o?.(!0),"aria-label":"Open scene nodes sidebar",title:"Open scene nodes",children:"\u2190"}),r&&(0,gn.jsxs)(gn.Fragment,{children:[(0,gn.jsxs)("div",{children:[(0,gn.jsx)("div",{className:"bb-sectionKicker",children:"Scene Nodes"}),(0,gn.jsxs)("div",{className:"bb-sectionHeading",children:[u.length," visible entries"]})]}),(0,gn.jsx)("button",{type:"button",className:"bb-sidebarToggle",onClick:()=>o?.(!1),"aria-label":"Close scene nodes sidebar",title:"Close scene nodes",children:"\u2192"})]})]}),r&&(0,gn.jsxs)("section",{className:"bb-nodeList",children:[(0,gn.jsx)("div",{className:"bb-search",children:(0,gn.jsx)("input",{className:"bb-input",placeholder:"Search nodes, labels, or types",value:l,onChange:d=>c(d.target.value)})}),(0,gn.jsx)("div",{className:"bb-nodeItems",children:u.map(d=>{let m=e[d],g=d===t,v=d===a;return(0,gn.jsxs)("div",{className:`bb-nodeRow ${a&&!v?"bb-nodeRow--setAside":""}`,children:[(0,gn.jsxs)("button",{type:"button",className:`bb-nodeButton ${g?"bb-nodeButton--active":""}`,onClick:()=>n(d),onMouseEnter:()=>i?.(d),onMouseLeave:()=>i?.(null),children:[(0,gn.jsx)("span",{className:"bb-nodeName",children:d}),(0,gn.jsxs)("span",{className:"bb-nodeMeta",children:[m.type??"other",m.label===nf(d)?"":m.label||"\xB7 Untitled"]})]}),s?(0,gn.jsx)("button",{type:"button",className:`bb-nodeIsolate ${v?"bb-nodeIsolate--active":""}`,onClick:()=>s(v?null:d),title:v?"Show all":"Isolate in the preview","aria-label":`${v?"Show all":"Isolate"} ${d}`,"aria-pressed":v,children:(0,gn.jsx)(Tw.Focus,{size:14,"aria-hidden":"true"})}):null]},d)})})]})]})}var oa=require("react/jsx-runtime");function Ef({title:e,label:t,open:n,onToggle:i,draft:r,error:o,example:a,onDraftChange:s,onCommit:l}){return(0,oa.jsx)(tr,{title:e,open:n,onToggle:i,children:(0,oa.jsxs)("div",{className:"bb-field",children:[(0,oa.jsx)("label",{className:"bb-label",children:t}),(0,oa.jsx)("textarea",{className:"bb-textarea",value:r,onChange:c=>s(c.target.value),onBlur:l}),o?(0,oa.jsx)("span",{className:"bb-status bb-status--error",children:o}):(0,oa.jsxs)("span",{className:"bb-note",children:["Use a JSON object like ",a,"."]})]})})}function Aw(e,t){let n=new Map(e.animations.clips.map(o=>[o.sourceName,o])),i=t.map(({sourceName:o})=>n.get(o)??{sourceName:o,displayName:o,hidden:!1,loopMode:"repeat",speed:1}),r=e.animations.autoplayClip&&i.some(o=>o.sourceName===e.animations.autoplayClip&&!o.hidden)?e.animations.autoplayClip:null;return{clips:i,autoplayClip:r}}var eo=require("react"),hP=100;function mP(e,t){switch(t.type){case"set":{let n=typeof t.updater=="function"?t.updater(e.present):t.updater;if(n===e.present)return e;let i=t.track?e.edits+1:e.edits;return t.coalesce?{...e,present:n,future:[],edits:i}:{past:[...e.past,e.present].slice(-hP),present:n,future:[],edits:i}}case"undo":{if(e.past.length===0)return e;let n=e.past[e.past.length-1];return{past:e.past.slice(0,-1),present:n,future:[e.present,...e.future],edits:e.edits+1}}case"redo":{if(e.future.length===0)return e;let[n,...i]=e.future;return{past:[...e.past,e.present],present:n,future:i,edits:e.edits+1}}case"reset":return{past:[],present:t.value,future:[],edits:t.track?e.edits+1:0}}}function Rf(e,t=600){let[n,i]=(0,eo.useReducer)(mP,{past:[],present:e,future:[],edits:0}),r=(0,eo.useRef)(0),o=(0,eo.useCallback)(p=>{let u=Date.now(),d=u-r.current<t;r.current=u,i({type:"set",updater:p,coalesce:d,track:!0})},[t]),a=(0,eo.useCallback)(p=>{let u=Date.now()-r.current<t;i({type:"set",updater:p,coalesce:u,track:!1})},[t]),s=(0,eo.useCallback)(()=>{r.current=0,i({type:"undo"})},[]),l=(0,eo.useCallback)(()=>{r.current=0,i({type:"redo"})},[]),c=(0,eo.useCallback)((p,u)=>{r.current=0,i({type:"reset",value:p,track:u?.asEdit??!1})},[]);return{value:n.present,setValue:o,setValueUntracked:a,undo:s,redo:l,reset:c,canUndo:n.past.length>0,canRedo:n.future.length>0,edits:n.edits}}var Dw=require("fflate");function Ew(e){return JSON.stringify(e,null,2)}function Rw(e){return['import { defineObjectBindings } from "@liveroom-tech/react-immersive/utils";',"",`export const objectBindings = defineObjectBindings(${JSON.stringify(e,null,2)});`,""].join(`
|
|
3692
|
-
`)
|
|
3693
|
-
`)}function Fc(e,t,n){ho(new Blob([t],{type:n}),e)}function kf(e){return JSON.stringify(e??{},null,2)}function Lf(e){return`[${e[0].toFixed(3)}, ${e[1].toFixed(3)}, ${e[2].toFixed(3)}]`}function fP(e){return(e.decals??[]).map(t=>t.image).filter(t=>!!t?.trim())}function gP(e){let t=e.style?.material;return t?Object.values(t).filter(n=>!!n&&typeof n=="object"&&typeof n.path=="string"&&n.path.trim().length>0).map(n=>n.path):[]}async function Nw(e){let t=new Set;for(let r of Object.values(e)){for(let o of gP(r))t.add(o);for(let o of fP(r))t.add(o)}let n=[],i=[];return await Promise.all(Array.from(t).map(async r=>{let o=kd(r);if(o)try{let a=await fetch(o);if(!a.ok)throw new Error(String(a.status));n.push({path:r,blob:await a.blob()});return}catch{i.push(r);return}try{let a=await Rc(r);a&&n.push({path:r,blob:a})}catch{}})),{assets:n,failedPaths:i}}async function Df(e,t,n,i,r){if(r.length===0){Fc(e,t,n);return}let o={[e]:(0,Dw.strToU8)(t)};for(let s of r)o[s.path]=new Uint8Array(await s.blob.arrayBuffer());let a=await Fd(o);ho(new Blob([a],{type:"application/zip"}),i)}var Nf={pbr:["texture","baseColor","metalness","metalnessMap","specularIntensity","specularIntensityMap","specularColor","specularColorMap","reflectivity"],roughness:["roughness","roughnessMap"],emission:["emissive","emissiveIntensity","emissiveMap"],opacity:["opacity","alphaMap","alphaTest","alphaHash","dithering","blendingMode"],normalBump:["normalMap","normalScale","flipNormalY","bumpMap","bumpScale"],displacement:["displacementMap","displacementScale","displacementBias"],ao:["aoMap","aoMapIntensity"],clearcoat:["clearcoat","clearcoatMap","clearcoatRoughness","clearcoatRoughnessMap","clearcoatNormalMap","clearcoatNormalScale","flipClearcoatNormalY"],sheen:["sheen","sheenColor","sheenColorMap","sheenRoughness","sheenRoughnessMap"],anisotropy:["anisotropy","anisotropyRotation","anisotropyMap"],transmission:["transmission","transmissionMap","thickness","thicknessMap","attenuationColor","attenuationDistance"],faces:["side"]},Bw=Object.keys(Nf);function Ow(e){if(e==null)return!1;if(typeof e=="string")return e.trim().length>0;if(typeof e=="number")return Number.isFinite(e);if(typeof e=="boolean")return e;if(typeof e=="object"&&"path"in e){let t=e.path;return typeof t=="string"&&t.trim().length>0}return!1}function Bf(e){if(e)return Object.values(e).some(Ow)?e:void 0}function hi(e,t){return e?Nf[t].some(n=>Ow(e[n])):!1}function Of(e){return{pbr:hi(e,"pbr"),roughness:hi(e,"roughness"),emission:hi(e,"emission"),opacity:hi(e,"opacity"),normalBump:hi(e,"normalBump"),displacement:hi(e,"displacement"),ao:hi(e,"ao"),clearcoat:hi(e,"clearcoat"),sheen:hi(e,"sheen"),anisotropy:hi(e,"anisotropy"),transmission:hi(e,"transmission"),faces:hi(e,"faces")}}function If(e,t){if(t)return{...e,style:{...e.style,material:t}};if(!e.style)return e;let{material:n,...i}=e.style;return{...e,style:Object.keys(i).length>0?i:void 0}}function Iw(e,t){if(!e)return;let n={...e};for(let i of Nf[t])delete n[i];return n}var G=require("react/jsx-runtime"),zw="/room.glb",bP=500;function vP(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function Uw(e){return`Couldn't reload ${e} from your last session. It's still saved in this browser.`}function xP(e){let t=new Date(e);return t.toDateString()===new Date().toDateString()?`today at ${t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}`:t.toLocaleString([],{dateStyle:"medium",timeStyle:"short"})}function _p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function zf(e,t){if(!_p(e)||!_p(t))return t??e;let n={...e};for(let[i,r]of Object.entries(t)){let o=n[i];n[i]=_p(o)&&_p(r)?zf(o,r):r}return n}function Uf({licenseKey:e,licenseValidationUrl:t,dracoDecoderPath:n,ktx2TranscoderPath:i,meshopt:r,project:o,onProjectChange:a,projectChangeDebounceMs:s=350,onModelUpload:l,onTextureUpload:c,onEditLeaseChange:p,allowModelChange:u=!0}){let d=(0,K.useRef)(null),m=(0,K.useRef)(null),g=(0,K.useRef)(null),[v,M]=(0,K.useState)(o?.model.url??null),[w,x]=(0,K.useState)(o?.model.name??""),[S,k]=(0,K.useState)(o?.model??null),[b,_]=(0,K.useState)(null),y=Rf(o?.objectBindings??{}),h=y.value,P=y.setValue,[A,C]=(0,K.useState)(!1),[D,B]=(0,K.useState)(null),j=(0,K.useMemo)(()=>D?{target:D}:null,[D]),[W,U]=(0,K.useState)(null);(0,K.useEffect)(()=>U(null),[b,v]);let[te,O]=(0,K.useState)([]),[$,le]=(0,K.useState)(null),[tt,xe]=(0,K.useState)(!1),[nt,ce]=(0,K.useState)("Load the demo model or upload a GLB, GLTF, OBJ, FBX, or USDZ model to generate bindings."),[Le,he]=(0,K.useState)("default"),[pt,Bt]=(0,K.useState)(!1),[un,Ie]=(0,K.useState)("{}"),[bt,Ot]=(0,K.useState)("{}"),[dr,de]=(0,K.useState)(null),[Cr,Xt]=(0,K.useState)(null),[Et,rt]=(0,K.useState)(!1),[bn,Tr]=(0,K.useState)(!1),[Tn,Kt]=(0,K.useState)(!1),[fe,We]=(0,K.useState)({identity:!0,basics:!0,material:!1,decals:!1,actions:!1,camera:!1,transform:!1,metrics:!1,metadata:!1}),[xn,It]=(0,K.useState)({pbr:!1,roughness:!1,emission:!1,opacity:!1,normalBump:!1,displacement:!1,ao:!1,clearcoat:!1,sheen:!1,anisotropy:!1,transmission:!1,faces:!1}),zt=R=>We(I=>({...I,[R]:!I[R]})),oe=R=>It(I=>({...I,[R]:!I[R]})),[ye,Ae]=(0,K.useState)("object"),[ct,ht]=(0,K.useState)("General"),[Ke,wt]=(0,K.useState)("metalness"),[_e,qe]=(0,K.useState)(Of()),dt=(0,K.useRef)(null),[pn,ur]=(0,K.useState)(!1),[en,Hn]=(0,K.useState)(!0),[Xr,pr]=(0,K.useState)(!0),[to,aa]=(0,K.useState)(!1),[tn,Pr]=(0,K.useState)(null),[F,H]=(0,K.useState)(null),[q,ie]=(0,K.useState)(!1),[ae,we]=(0,K.useState)("world"),Pe=(0,K.useRef)({}),at=Rf(o?.sceneConfig??Aa),De=at.value,Rt=at.setValue,vt=at.setValueUntracked,[qt,Me]=(0,K.useState)("orbit"),Ve=qt==="pointerLock",[hn,On]=(0,K.useState)(null),hr=(0,K.useRef)(null),$n=hn?.objectKey===b&&hn?.textureKey==="texture",[Pn,mi]=(0,K.useState)(null),[Mp,sa]=(0,K.useState)(null),Mo=Gu(e,t),Ka=y1(Mo.tier),Vc=(0,K.useMemo)(()=>({isInsideEditor:!0,activeTab:ye,activeSubTab:ct,tier:Ka,setActiveTab:Ae,setActiveSubTab:ht}),[ye,ct,Ka]),ze=(0,K.useRef)(null),Ar=(0,K.useRef)(0),fi=(0,K.useRef)(0),jc=(0,K.useRef)(o?`${o.id}:${o.revision}`:null),Co=(0,K.useRef)(null),cl=(0,K.useRef)(!1),To=(0,K.useRef)(!1),Za=(0,K.useRef)(o?{modelUrl:o.model.url,bindings:o.objectBindings,sceneConfig:o.sceneConfig}:null),no=(0,K.useRef)(void 0),gi=(0,K.useRef)(0),mn=(0,K.useRef)(null),Yn=(0,K.useRef)(o?{requestId:0,modelName:o.model.name??"model",modelUrl:o.model.url,storedBindings:o.objectBindings,streaming:!!o.model.tilesetUrl}:null),mr=(0,K.useRef)(null),Ja=(0,K.useRef)(null),In=(0,K.useRef)(null),qr=(0,K.useRef)(!1),Er=(0,K.useRef)(null),nr=(0,K.useRef)(null),{cameraState:nn,resetView:dl,focusObject:Po,fitScene:ro,setCameraState:$r,handleCameraChange:Cp,handleViewerReady:Hc}=C0(),Tp=(0,K.useCallback)(R=>{Ve||$r({position:R.position,target:R.target,fov:nn?.fov??null,zoom:nn?.zoom??1,azimuthAngle:R.azimuthAngle,polarAngle:R.polarAngle},!0)},[Ve,$r,nn]),Ze=p1(),cn=b?h[b]??null:null,ul=cn?.style?.material,Ii=cn?.cameraState,Gc=nn?{position:Lf(nn.position),target:Lf(nn.target)}:null,Vf=(0,K.useCallback)(R=>{Rt(I=>{let Z=I.annotations.map(ue=>ue.id).join(","),ee=R.map(ue=>ue.id).join(",");return Z===ee?I:{...I,annotations:R}})},[]),zi=(0,K.useCallback)(R=>{mi(R?{annotation:R}:null)},[]);(0,K.useEffect)(()=>{if(!cn){Ie("{}"),Ot("{}"),de(null),Xt(null);return}Ie(kf(cn.metrics)),Ot(kf(cn.metadata)),de(null),Xt(null)},[cn]),(0,K.useEffect)(()=>{let R=Of(ul);if(dt.current!==b){dt.current=b,qe(R);return}qe(I=>{let Z=!1,ee={...I};for(let ue of Bw)R[ue]&&!I[ue]&&(ee[ue]=!0,Z=!0);return Z?ee:I})},[b,ul]),(0,K.useEffect)(()=>()=>{ze.current?.cleanup(),mn.current&&clearTimeout(mn.current)},[]);let bi=(0,K.useCallback)((R,I)=>{let Z=Ju(R);if(I){let ee=new Map(Object.values(I).map(ue=>[ue.modelObjectId,ue]));for(let ue of R){let Ee=ee.get(ue);Ee&&(Z[ue]=Ee)}}return Z},[]);(0,K.useEffect)(()=>{if(!o)return;let R=`${o.id}:${o.revision}`;if(jc.current===R)return;jc.current=R;let I=v!==o.model.url||S?.tilesetUrl!==o.model.tilesetUrl||S?.assetVersion!==o.model.assetVersion,Z=h!==o.objectBindings,ee=De!==o.sceneConfig;(I||Z||ee)&&(To.current=!0),k(o.model),x(o.model.name??"model");let ue=o.objectBindings;if(Z){let Ee=Co.current;ue=Ee?bi(Ee,o.objectBindings):o.objectBindings,y.reset(ue)}if(ee&&at.reset(o.sceneConfig),I){let Ee=++fi.current;Yn.current={requestId:Ee,modelName:o.model.name??"model",modelUrl:o.model.url,storedBindings:o.objectBindings,streaming:!!o.model.tilesetUrl},Er.current=null,_(null),C(!0),M(o.model.url)}Za.current={modelUrl:o.model.url,bindings:ue,sceneConfig:o.sceneConfig}},[h,bi,o,v,De,S,y,at]);let Ao=(0,K.useRef)(a);Ao.current=a,(0,K.useEffect)(()=>{if(!o||!Ao.current||!v)return;if(!cl.current){cl.current=!0;return}let R=Za.current;if(v===o.model.url&&h===o.objectBindings&&De===o.sceneConfig||R!==null&&v===R.modelUrl&&h===R.bindings&&De===R.sceneConfig){To.current=!1;return}if(Yn.current)return;if(To.current){To.current=!1;return}let I=window.setTimeout(()=>{Ao.current?.({projectId:o.id,baseRevision:o.revision,model:{...S??o.model,url:v,name:w||o.model.name},objectBindings:h,sceneConfig:De},"local")},s);return()=>window.clearTimeout(I)},[h,w,v,o,s,S,De]),(0,K.useEffect)(()=>{let R=I=>{if(I.key.toLowerCase()!=="z"||!(I.metaKey||I.ctrlKey))return;let Z=I.target,ee=Z?.tagName;if(ee==="INPUT"||ee==="TEXTAREA"||Z?.isContentEditable)return;I.preventDefault();let ue=ye==="scene"?at:y;I.shiftKey?ue.redo():ue.undo()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[ye,y,at]);let Rr=!o&&u,Fe=y.edits>0||at.edits>0,la=(0,K.useCallback)(async(R,I)=>{if(c)return c(R,I);let Z=URL.createObjectURL(R);if(Rr)try{await hf(Z,R)}catch(ee){console.warn("[BindingBuilder] Could not store texture file for autosave:",ee)}return Z},[c,Rr]),Eo=(0,K.useCallback)(async R=>(await Promise.all(Object.entries(R).map(async([I,Z])=>{for(let ue of Z.decals??[])if(ue.image)try{let Ee=await Rc(ue.image);Ee&&Ma(ue.image,URL.createObjectURL(Ee))}catch(Ee){console.warn(`[BindingBuilder] Could not rehydrate a decal image on "${I}":`,Ee)}let ee=Z.style?.material;if(ee)for(let ue of Wi){let Je=ee[ue]?.path;if(Je)try{let Ce=await Rc(Je);if(!Ce){console.warn(`[BindingBuilder] No stored texture found for "${I}"'s ${ue} ("${Je}"). If this is meant to be an uploaded file rather than a hosted URL, it was uploaded before texture autosave existed (or this browser's storage was cleared) \u2014 re-upload it once so it's stored for future restores.`);continue}let St=URL.createObjectURL(Ce);Ma(Je,St)}catch(Ce){console.warn(`[BindingBuilder] Could not rehydrate "${I}"'s ${ue}:`,Ce)}}})),R),[]);(0,K.useEffect)(()=>{if(!Rr||!Fe||!v)return;let R=mr.current;if(!R)return;let I=()=>{if(In.current===I&&(In.current=null),Yn.current)return;let{model:ee,file:ue}=R,Ee=ee.kind==="file"&&Ja.current!==ee.key?ue:void 0;h1({model:ee,bindings:h,sceneConfig:De},Ee).then(()=>{Ja.current=ee.kind==="file"?ee.key:null,qr.current=!1}).catch(Je=>{console.warn("[BindingBuilder] Autosave failed:",Je),!qr.current&&(qr.current=!0,ce("Couldn't autosave this session \u2014 the browser refused to store it, possibly for lack of space. Export your work to keep it."),he("error"))})};In.current=I;let Z=window.setTimeout(I,bP);return()=>window.clearTimeout(Z)},[Rr,Fe,v,h,De]),(0,K.useEffect)(()=>{if(!Rr)return;let R=()=>In.current?.(),I=()=>{document.visibilityState==="hidden"&&R()};return window.addEventListener("pagehide",R),document.addEventListener("visibilitychange",I),()=>{window.removeEventListener("pagehide",R),document.removeEventListener("visibilitychange",I),R()}},[Rr]),(0,K.useEffect)(()=>{if(!Rr||!v||!Fe)return;let R=I=>{In.current?.(),I.preventDefault(),I.returnValue=""};return window.addEventListener("beforeunload",R),()=>window.removeEventListener("beforeunload",R)},[Rr,v,Fe]),(0,K.useEffect)(()=>{if(A||Le==="default"||Le==="success")return;Bt(!0);let R=window.setTimeout(()=>Bt(!1),4e3);return()=>window.clearTimeout(R)},[nt,Le,A]);let kr=(0,K.useMemo)(()=>Object.keys(h),[h]),pl=(0,K.useMemo)(()=>!b||!cn?null:cn.id.trim()?Object.entries(h).some(([Z,ee])=>Z!==b&&ee.id===cn.id)?"Another binding already uses this ID.":null:"ID is required.",[h,b,cn]),rr=(R,I)=>{P(Z=>({...Z,[R]:I(Z[R])}))},Qa=(R,I)=>{rr(R,Z=>{let ee=Bf(I(Z.style?.material));return If(Z,ee)})},Wc=(R,I,Z)=>{Qa(R,ee=>({...ee,[I]:Z?{path:Z}:void 0}))},fr=(R,I)=>{qe(Z=>({...Z,[R]:I})),!I&&b&&rr(b,Z=>{let ee=Bf(Iw(Z.style?.material,R));return If(Z,ee)})},Ui=(0,K.useCallback)((R,I,Z)=>{let ee=Tc(R),ue=Ju(ee);if(Z){let Je=new Map(Object.values(Z).map(Ce=>[Ce.modelObjectId,Ce]));for(let Ce of ee){let St=Je.get(Ce);St&&(ue[Ce]=St)}}R.updateMatrixWorld(!0);let Ee={};for(let Je of ee){let Ce=Xi(R,Je);if(!Ce){Ee[Je]={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivotLocal:[0,0,0],rotationOrder:"XYZ"};continue}let St=ip(Ce);Ee[Je]={position:[Ce.position.x,Ce.position.y,Ce.position.z],rotation:[Ce.rotation.x,Ce.rotation.y,Ce.rotation.z],scale:[Ce.scale.x,Ce.scale.y,Ce.scale.z],pivotLocal:[St.x,St.y,St.z],rotationOrder:Ce.rotation.order}}Pe.current=Ee,y.reset(ue),_(ee[0]??null),Z||vt(Je=>({...Je,annotations:[]})),ce(`Generated ${ee.length} bindings from ${I}.`),he("success"),gi.current=100,le(100),mn.current&&clearTimeout(mn.current),mn.current=setTimeout(()=>{mn.current=null,C(!1),le(null)},400)},[y,vt]),An=(R,I,Z,ee)=>{In.current?.();let ue=++fi.current;C(!0),le(null),gi.current=0,mn.current&&(clearTimeout(mn.current),mn.current=null),no.current=Z;let Ee=Z?Z/1048576:0;ce(Ee>=100?`Reading ${I} (${Math.round(Ee)}MB \u2014 large file, this can take a while)...`:`Reading ${I} and generating starter bindings...`),he("default"),x(I),k(ee??{url:R,name:I}),mi(null);let Je=Er.current;if(R===v&&Je?.url===R){Yn.current=null,Ui(Je.scene,I);return}Yn.current={requestId:ue,modelName:I,modelUrl:R,streaming:!!ee?.tilesetUrl},M(R),y.reset({}),_(null)},Pp=(0,K.useCallback)(R=>{let I=Yn.current;if(!(!I||I.requestId!==fi.current)){if(Yn.current=null,Er.current={url:I.modelUrl,scene:R},U(null),O(zs(R)),B(null),I.streaming){ce(`Streaming ${I.modelName}.`),he("success"),C(!1);return}I.storedBindings&&(To.current=!0),Ui(R,I.modelName,I.storedBindings),I.restoring&&ce(`Restored your last session with ${I.modelName}.`)}},[Ui]),Xc=(0,K.useCallback)(R=>{let I=R.map(ee=>ee.name);if(I.length===0)return;Co.current=I,To.current=!0;let Z=bi(I,o?.objectBindings);if(y.reset(Z),o){let ee=Za.current;Za.current={modelUrl:ee?.modelUrl??o.model.url,bindings:Z,sceneConfig:ee?.sceneConfig??o.sceneConfig}}_(ee=>ee??I[0]??null),ce(`Streaming ${I.length} bindable objects.`),he("success"),C(!1)},[bi,y,o]),es=(0,K.useCallback)(R=>{let I=Yn.current;!I||I.requestId!==fi.current||(Yn.current=null,console.error(R),I.restoring?(mr.current=null,M(null),ce(Uw(I.modelName))):ce(`Could not read ${I.modelName}. Make sure the file is a valid GLB, GLTF, OBJ, FBX, or USDZ asset.`),he("error"),mn.current&&(clearTimeout(mn.current),mn.current=null),gi.current=0,C(!1),le(null))},[]),qc=(0,K.useCallback)(R=>{let I=null;if(R.lengthComputable&&R.total>0)I=R.loaded/R.total*100;else{let ee=no.current;ee&&ee>0&&(I=R.loaded/ee*100)}if(I===null)return;let Z=Math.min(90,Math.floor(I/10)*10);Z>gi.current&&(gi.current=Z,le(Z)),I>=99.5&&ce(ee=>ee.startsWith("Finalizing")?ee:"Finalizing model \u2014 parsing geometry and textures (large files can take a moment here)...")},[]),Lr=(0,K.useCallback)(R=>{Ze.handleAnimationsReady(R);let I=R.clipDetails??R.clips.map(Z=>({sourceName:Z,duration:0}));vt(Z=>({...Z,animations:Aw(Z,I)}))},[Ze,vt]),vi=async()=>{ze.current?.cleanup(),ze.current=null,mr.current={model:{kind:"url",url:zw,name:"room.glb"}},await An(zw,"room.glb")},xi=async R=>{if(!u)return;if(l){try{C(!0),ce(`Uploading ${R.name}...`),he("default");let Z=await l(R);mr.current={model:{kind:"url",url:Z.url,name:Z.name??R.name}},await An(Z.url,Z.name??R.name,R.size,Z)}catch(Z){C(!1),ce(Z instanceof Error?Z.message:`Could not upload ${R.name}.`),he("error")}return}let I;try{I=await fh(R)}catch(Z){ce(Z instanceof Error?Z.message:"Could not read model file. Upload a .glb, .gltf, .obj, .fbx, .usdz, or .zip asset."),he("error");return}ze.current?.cleanup(),ze.current=I,mr.current={model:{kind:"file",key:vP(),name:I.name},file:R},await An(I.url,I.name,R.size,{url:I.url,name:I.name})},Ap=async R=>{let I=R.target.files?.[0];I&&(await xi(I),R.target.value="")},Ep=()=>{In.current?.(),ze.current?.cleanup(),ze.current=null,Er.current=null,Yn.current=null,mr.current=null,Pe.current={},Ar.current=0,rt(!1),mn.current&&(clearTimeout(mn.current),mn.current=null),gi.current=0,le(null),no.current=void 0,M(null),x(""),k(null),_(null),mi(null),y.reset({}),Ie("{}"),Ot("{}"),de(null),Xt(null),sa(null),ie(!1),vt(R=>({...R,animations:Aa.animations,annotations:[]})),ce("Load the demo model or upload a GLB, GLTF, OBJ, FBX, or USDZ model to generate bindings."),he("default")},ts=()=>{d.current?.click()},io=()=>{m.current?.click()},ns=async R=>{xe(!0);try{let{assets:I,failedPaths:Z}=await Nw(h);R==="json"?await Df("objectBindings.json",Ew(h),"application/json","objectBindings.zip",I):await Df("objectBindings.ts",Rw(h),"text/typescript","objectBindings-ts.zip",I),Z.length>0?(ce(`Exported, but ${Z.length} uploaded image${Z.length===1?"":"s"} couldn't be bundled: ${Z.join(", ")}.`),he("error")):I.length>0&&(ce(`Exported with ${I.length} uploaded image${I.length===1?"":"s"} bundled into the zip.`),he("success"))}catch(I){let Z=I instanceof Error?I.message:"Unknown export error.";ce(`Failed to export bindings: ${Z}`),he("error")}finally{xe(!1)}},Rp=async R=>{if(!kr.length){ce("Load a model before importing bindings."),he("error");return}let I;try{I=JSON.parse(await R.text())}catch{ce(`${R.name} is not valid JSON.`),he("error");return}if(I===null||typeof I!="object"||Array.isArray(I)){ce("Expected a JSON object mapping object IDs to bindings."),he("error");return}let Z=new Map;for(let St of Object.values(I))if(St!==null&&typeof St=="object"&&typeof St.id=="string"&&typeof St.type=="string"&&typeof St.modelObjectId=="string"){let Kn=St;Z.set(Kn.modelObjectId,Kn)}if(Z.size===0){ce(`${R.name} doesn't look like an exported bindings file.`),he("error");return}let ee={...h},ue={},Ee=0;for(let St of Object.keys(ee)){let Kn=Z.get(St);Kn&&(ee[St]=Kn,ue[St]=Kn,Ee++)}if(Ee===0){ce(`None of the object IDs in ${R.name} match this model \u2014 nothing imported.`),he("error");return}let Je=await Eo(ue);Object.assign(ee,Je),P(ee);let Ce=Z.size-Ee;ce(Ce>0?`Imported ${Ee} binding${Ee===1?"":"s"} from ${R.name} (${Ce} skipped \u2014 not in this model).`:`Imported ${Ee} binding${Ee===1?"":"s"} from ${R.name}.`),he("success")},$c=async R=>{let I=R.target.files?.[0];I&&(await Rp(I),R.target.value="")},Ro=()=>{g.current?.click()},rs=async R=>{let I;try{I=JSON.parse(await R.text())}catch{ce(`${R.name} is not valid JSON.`),he("error");return}if(I===null||typeof I!="object"||Array.isArray(I)){ce("Expected a JSON object with scene config sections."),he("error");return}let Z=["model","camera","lighting","wireframe","shadows","environment","background","groundShadows","postProcessing","animations","annotations","cinematic","styleRules","section"],ee=I,ue=Z.filter(Ee=>ee[Ee]!==void 0);if(ue.length===0){ce(`${R.name} doesn't look like an exported scene config file.`),he("error");return}Rt(Ee=>{let Je={...Ee};for(let Ce of ue)Je[Ce]=zf(Ee[Ce],ee[Ce]);return Je}),ce(`Imported ${ue.length} section${ue.length===1?"":"s"} from ${R.name}.`),he("success")},Yc=async R=>{let I=R.target.files?.[0];I&&(await rs(I),R.target.value="")},hl=R=>{R.preventDefault(),R.stopPropagation(),!(A||v)&&(Ar.current+=1,rt(!0))},ml=R=>{R.preventDefault(),R.stopPropagation(),!(A||v)&&(R.dataTransfer.dropEffect="copy",rt(!0))},Kc=R=>{R.preventDefault(),R.stopPropagation(),!(A||v)&&(Ar.current=Math.max(0,Ar.current-1),Ar.current===0&&rt(!1))},kp=async R=>{if(R.preventDefault(),R.stopPropagation(),Ar.current=0,rt(!1),A||v)return;let I=R.dataTransfer.files?.[0];I&&await xi(I)},Zc=(R,I,Z)=>{if(!b)return;let ee;try{ee=JSON.parse(I)}catch{Z("Invalid JSON");return}if(ee===null||typeof ee!="object"||Array.isArray(ee)){Z("Expected a JSON object");return}if(R==="metrics"&&Object.values(ee).some(Ee=>typeof Ee!="number"||!Number.isFinite(Ee))){Z("Metrics values must be numbers");return}rr(b,ue=>({...ue,[R]:ee})),Z(null)},Lp=(0,K.useCallback)((R,I)=>{Rr&&hf(R,I).catch(Z=>console.warn("[BindingBuilder] Could not store decal image for autosave:",Z))},[Rr]),Dp=(0,K.useMemo)(()=>{let R=Er.current?.scene,Z=(R&&b?Xi(R,b):null)?.geometry;if(!Z)return .2;Z.boundingBox||Z.computeBoundingBox();let ee=Z.boundingBox?.getSize(new Fw.Vector3),ue=ee?Math.max(ee.x,ee.y,ee.z):0;return ue>0&&Number.isFinite(ue)?ue/3:.2},[b,v,A]),Dr=(0,K.useMemo)(()=>{if(!W?.moving)return null;let{nodeKey:R,decal:I}=W,Z=h[R],ee=Z?.decals?.find(ue=>ue.id===I.id);return ee?{objectId:Z.modelObjectId??R,decal:ee,onCancel:()=>U(null),onCommit:ue=>{P(Ee=>{let Je=Ee[R];return Je?{...Ee,[R]:{...Je,decals:Je.decals?.map(Ce=>Ce.id===ee.id?{...Ce,...ue}:Ce)}}:Ee}),U(null)}}:null},[h,W,P]),Jc=(0,K.useCallback)((R,I)=>{if(!b)return;let Z=h[b],ee=Z?.decals?.find(Ce=>Ce.id===R);if(!ee)return;let ue=nr.current,Ee=ue?.raw.nodes[Z.modelObjectId??b],Je=Ud(Ee,ue?.raw.controls.camera,ee,I);if(!Je){ce("No visible surface in that direction. Try another arrow or rotate the view."),he("error"),Bt(!0);return}U(null),Bt(!1),rr(b,Ce=>({...Ce,decals:Ce.decals?.map(St=>St.id===R?{...St,...Je}:St)}))},[h,b,rr]),Np=(0,K.useCallback)(R=>{if(!R||R.moving){U(R);return}let I=nr.current,Z=h[R.nodeKey],ee=I?.raw.nodes[Z?.modelObjectId??R.nodeKey],ue=zd(ee,I?.raw.controls.camera);if(!ue){ce("Could not find a surface on this object for the decal."),he("error"),Bt(!0);return}let Ee={...R.decal,...ue};P(Je=>{let Ce=Je[R.nodeKey];if(!Ce)return Je;let St=(Ce.decals??[]).filter(Kn=>Kn.id!==Ee.id);return{...Je,[R.nodeKey]:{...Ce,decals:[...St,Ee]}}}),U({...R,moving:!0})},[h,P]),Qc=(0,K.useCallback)(R=>{if(Ve){Me("orbit");return}if(!R){_(null);return}let I=Object.entries(h).find(([Z,ee])=>ee===R||Z===R.modelObjectId||ee.modelObjectId===R.modelObjectId)?.[0]??null;_(I)},[Ve,h]),En=(0,K.useCallback)(async R=>{if(Ve){Me("orbit");return}_(R),sa(null),await Po(R)},[Ve,Po]),is=(0,K.useCallback)(R=>{sa(R?h[R]??null:null)},[h]),fl=(0,K.useCallback)(R=>Kt(!R),[]),ed=(0,K.useCallback)(()=>{if(Ve){ce("Camera positions aren't available while Pointer Lock is the active camera controller."),he("error");return}if(!b||!nn)return;let R={position:nn.position,target:nn.target,...nn.fov!=null?{fov:nn.fov}:{},zoom:nn.zoom};rr(b,I=>({...I,cameraState:R}))},[Ve,b,nn]),Bp=(0,K.useCallback)(()=>{if(Ve){ce("Camera positions aren't available while Pointer Lock is the active camera controller."),he("error");return}!Ii?.position||!Ii?.target||$r({position:Ii.position,target:Ii.target,fov:Ii.fov??nn?.fov??null,zoom:Ii.zoom??nn?.zoom??1},!0)},[Ve,Ii,$r,nn]),Op=(0,K.useCallback)(()=>{Ve||b&&rr(b,R=>({...R,cameraState:void 0}))},[Ve,b]),Fi=(0,K.useCallback)(async()=>{if(Ve){ce("Reset View isn't available while Pointer Lock is the active camera controller."),he("error");return}await dl()},[Ve,dl]),ca=(0,K.useCallback)(async()=>{if(Ve){ce("Fit Scene isn't available while Pointer Lock is the active camera controller."),he("error");return}await ro()},[Ve,ro]),gl=(0,K.useCallback)(()=>{ce("Texture position saved."),he("success"),hr.current?.()},[]),Yr=(0,K.useCallback)(R=>{Pr(R),aa(!0)},[]),Kr=(0,K.useCallback)(()=>{aa(!1),Pr(null)},[]),da=(0,K.useCallback)(()=>{if(tn==="bindings"){if(!kr.length){Kr();return}let R=Ju(kr);y.reset(R,{asEdit:!0}),_(kr[0]??null),ce("Object bindings reset to default values."),he("success")}else tn==="scene"&&(at.reset(Aa,{asEdit:!0}),ce("Scene config reset to default values."),he("success"));Kr()},[tn,kr,y,at,Kr]),Vi=(0,K.useCallback)(()=>{H(null)},[]),ua=async()=>{let R;try{R=await m1()}catch(I){console.warn("[BindingBuilder] Could not read the saved session:",I),ce("Couldn't read the saved session from this browser."),he("error");return}if(!R){ce("No saved session in this browser yet \u2014 one is saved as soon as you edit a model."),he("error");return}H(R)},Nr=async()=>{let R=F;if(H(null),!R)return;let{session:I,file:Z}=R,{model:ee}=I;In.current=null;let ue=zf(Aa,I.sceneConfig),Ee=fi.current,Je=await Eo(I.bindings);if(fi.current!==Ee)return;let Ce;if(ee.kind==="file"){if(!Z)return;let Kn=fi.current,os;try{os=await fh(Z)}catch(bl){console.warn("[BindingBuilder] Could not read the saved model:",bl),ce(Uw(ee.name)),he("error");return}if(fi.current!==Kn){os.cleanup();return}ze.current?.cleanup(),ze.current=os,Ce=os.url}else{Ce=ee.url;let Kn=Er.current;if(Ce===v&&Kn?.url===Ce&&!Yn.current){mr.current={model:ee},Ja.current=null,y.reset(bi(Tc(Kn.scene),Je)),at.reset(ue),ce(`Restored your last session with ${ee.name}.`),he("success");return}ze.current?.cleanup(),ze.current=null}mr.current={model:ee,file:Z??void 0},Ja.current=ee.kind==="file"?ee.key:null;let St=++fi.current;C(!0),le(null),gi.current=0,mn.current&&(clearTimeout(mn.current),mn.current=null),no.current=Z?.size,ce(`Restoring your last session with ${ee.name}...`),he("default"),x(ee.name),k({url:Ce,name:ee.name}),mi(null),_(null),Er.current=null,y.reset({}),at.reset(ue),Yn.current={requestId:St,modelName:ee.name,modelUrl:Ce,storedBindings:Je,restoring:!0},M(Ce)};return Mo.status==="checking"?(0,G.jsx)("div",{className:"bb-root bb-root--licenseChecking",children:(0,G.jsx)(ya,{title:"Verifying License",message:"Checking your license key..."})}):Mo.status==="invalid"?(0,G.jsx)("div",{className:"bb-root bb-root--licenseInvalid",children:(0,G.jsx)(ya,{tone:"error",title:"Invalid License",message:Mo.isLocalDomain?Mo.reason??"License has been revoked or has expired":"Failed to load. Please contact the site administrator."})}):(0,G.jsxs)(tf.Provider,{value:Vc,children:[(0,G.jsxs)("div",{className:"bb-root",children:[(0,G.jsx)("input",{ref:d,type:"file",accept:Tb,className:"bb-hiddenInput",onChange:Ap,disabled:A}),(0,G.jsx)("input",{ref:m,type:"file",accept:".json,application/json",className:"bb-hiddenInput",onChange:$c,disabled:A}),(0,G.jsx)("input",{ref:g,type:"file",accept:".json,application/json",className:"bb-hiddenInput",onChange:Yc,disabled:A}),(0,G.jsxs)("aside",{className:`bb-sidebar bb-sidebar--left ${bn?"bb-sidebar--collapsed":""}`,children:[(0,G.jsxs)("div",{className:"bb-header bb-header--sidebar",children:[!bn&&(0,G.jsx)("h1",{className:"bb-title",children:"Binding Builder"}),(0,G.jsx)("button",{type:"button",className:"bb-sidebarToggle",onClick:()=>Tr(R=>!R),"aria-label":bn?"Open editor sidebar":"Collapse editor sidebar",title:bn?"Open editor":"Collapse editor",children:bn?"\u2192":"\u2190"})]}),!bn&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"bb-tabRow",children:[(0,G.jsx)("button",{type:"button",className:`bb-tab ${ye==="object"?"bb-tab--active":""}`,onClick:()=>Ae("object"),children:"Object"}),(0,G.jsx)("button",{type:"button",className:`bb-tab ${ye==="scene"?"bb-tab--active":""}`,onClick:()=>Ae("scene"),children:"Scene"})]}),(0,G.jsx)("section",{className:"bb-editor",children:ye==="scene"?(0,G.jsx)(G.Fragment,{children:v?(0,G.jsx)(Mf,{config:De,onChange:Rt,activeSubTab:ct,onActiveSubTabChange:ht,cameraState:ct==="Cinematic"&&nn?{position:nn.position,target:nn.target,azimuthAngle:nn.azimuthAngle,polarAngle:nn.polarAngle}:null,onPreviewWaypoint:Tp,animationClipDetails:Ze.clipDetails,animationPlayback:Ze,materialVariants:te,objectBindings:h}):(0,G.jsx)("div",{className:"bb-emptyEditor",children:"Upload a model to edit its scene settings."})}):!cn||!b?(0,G.jsx)("div",{className:"bb-emptyEditor",children:"Select a generated node binding to edit its values."}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)("div",{className:"bb-editorHeader",children:(0,G.jsxs)("div",{children:[(0,G.jsx)("div",{className:"bb-sectionKicker",children:"Editing Binding"}),(0,G.jsx)("h2",{className:"bb-editorTitle",children:cn.label||b}),(0,G.jsxs)("div",{className:"bb-editorMeta",children:[(0,G.jsx)("span",{children:cn.type}),(0,G.jsx)("span",{children:cn.modelObjectId})]})]})}),(0,G.jsx)(hw,{selectedItem:b,selectedBinding:cn,open:fe.identity,onToggle:()=>zt("identity"),updateBinding:rr,idError:pl}),(0,G.jsx)(mw,{selectedItem:b,selectedBinding:cn,open:fe.basics,onToggle:()=>zt("basics"),updateBinding:rr}),(0,G.jsxs)(tr,{title:"Material",open:fe.material,onToggle:()=>zt("material"),tooltip:"Edit the selected object's base material, textures, and surface properties.",children:[(0,G.jsx)(pw,{disabled:!b,onApply:R=>b&&Qa(b,I=>({...I,...R}))}),(0,G.jsx)(dw,{selectedItem:b,selectedMaterial:ul,pbrWorkflow:Ke,onPbrWorkflowChange:wt,openMaterialPanels:xn,materialPanelEnabled:_e,onToggleMaterialPanel:oe,onSetMaterialPanelState:fr,updateSelectedMaterial:Qa,setSelectedTexturePath:Wc,isTexturePositioningEnabled:$n,onConfirmTexturePosition:gl})]}),(0,G.jsx)(xw,{selectedItem:b,selectedBinding:cn,open:fe.decals,onToggle:()=>zt("decals"),updateBinding:rr,placement:W,onPlacementChange:Np,defaultSize:Dp,onImageFile:Lp,onNudge:Jc}),(0,G.jsx)(gw,{selectedItem:b,selectedBinding:cn,open:fe.actions,onToggle:()=>zt("actions"),updateBinding:rr}),(0,G.jsx)(yw,{selectedBinding:cn,open:fe.camera,onToggle:()=>zt("camera"),cameraState:nn,formattedCameraState:Gc,savedCameraPosition:Ii,onSaveCameraPosition:ed,onGoToSavedCamera:Bp,onClearSavedCamera:Op,onResetView:Fi,onFitScene:ca}),(0,G.jsx)(Cw,{selectedItem:b,selectedBinding:cn,open:fe.transform,onToggle:()=>zt("transform"),updateBinding:rr,moveModeEnabled:q,onToggleMoveMode:ie,transformSpace:ae,onTransformSpaceChange:we,originalTransform:Pe.current[b]??null}),(0,G.jsx)(Ef,{title:"Metrics",label:"Metrics JSON",open:fe.metrics,onToggle:()=>zt("metrics"),draft:un,error:dr,example:'{"area": 42}',onDraftChange:Ie,onCommit:()=>Zc("metrics",un,de)}),(0,G.jsx)(Ef,{title:"Metadata",label:"Metadata JSON",open:fe.metadata,onToggle:()=>zt("metadata"),draft:bt,error:Cr,example:'{"room": "kitchen"}',onDraftChange:Ot,onCommit:()=>Zc("metadata",bt,Xt)})]})}),ye==="object"&&(0,G.jsxs)("div",{className:"bb-toolbar",children:[(0,G.jsxs)("div",{className:"bb-toolbarGroup",children:[(0,G.jsx)("button",{type:"button",className:"bb-iconButton",disabled:!y.canUndo,onClick:y.undo,title:"Undo (Cmd/Ctrl+Z)",children:(0,G.jsx)(Cn.Undo2,{size:16})}),(0,G.jsx)("button",{type:"button",className:"bb-iconButton",disabled:!kr.length,onClick:()=>Yr("bindings"),title:"Reset object bindings to default",children:(0,G.jsx)(Cn.ListRestart,{size:16})}),(0,G.jsx)("button",{type:"button",className:"bb-iconButton",disabled:!y.canRedo,onClick:y.redo,title:"Redo (Cmd/Ctrl+Shift+Z)",children:(0,G.jsx)(Cn.Redo2,{size:16})})]}),(0,G.jsx)("div",{className:"bb-toolbarDivider"}),(0,G.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",disabled:!kr.length||A,onClick:io,title:"Re-apply a previously exported objectBindings.json onto this model",children:[(0,G.jsx)(Cn.Upload,{size:14}),"Import"]}),(0,G.jsx)("div",{className:"bb-toolbarDivider"}),(0,G.jsx)(Pf,{disabled:!kr.length||tt,exporting:tt,onExportJson:()=>ns("json"),onExportTs:()=>ns("ts")})]}),ye==="scene"&&(0,G.jsxs)("div",{className:"bb-toolbar",children:[(0,G.jsxs)("div",{className:"bb-toolbarGroup",children:[(0,G.jsx)("button",{type:"button",className:"bb-iconButton",disabled:!at.canUndo,onClick:at.undo,title:"Undo (Cmd/Ctrl+Z)",children:(0,G.jsx)(Cn.Undo2,{size:16})}),(0,G.jsx)("button",{type:"button",className:"bb-iconButton",onClick:()=>Yr("scene"),title:"Reset scene config to default",children:(0,G.jsx)(Cn.ListRestart,{size:16})}),(0,G.jsx)("button",{type:"button",className:"bb-iconButton",disabled:!at.canRedo,onClick:at.redo,title:"Redo (Cmd/Ctrl+Shift+Z)",children:(0,G.jsx)(Cn.Redo2,{size:16})})]}),(0,G.jsx)("div",{className:"bb-toolbarDivider"}),(0,G.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",disabled:!kr.length||A,onClick:Ro,title:"Re-apply a previously exported sceneConfig.json",children:[(0,G.jsx)(Cn.Upload,{size:14}),"Import"]}),(0,G.jsx)("div",{className:"bb-toolbarDivider"}),(0,G.jsx)(Pf,{disabled:!kr.length||A,onExportJson:()=>Fc("sceneConfig.json",kw(De),"application/json"),onExportTs:()=>Fc("sceneConfig.ts",Lw(De),"text/typescript")})]})]})]}),(0,G.jsxs)("main",{className:"bb-previewShell",children:[(0,G.jsxs)("div",{className:"bb-previewHeader",children:[(0,G.jsxs)("div",{className:"bb-previewToggles",children:[(0,G.jsxs)("label",{className:"bb-checkbox bb-checkbox--compact",style:{color:"black"},children:[(0,G.jsx)("input",{type:"checkbox",checked:pn,onChange:R=>ur(R.target.checked)}),"Zoom on selected"]}),(0,G.jsxs)("label",{className:"bb-checkbox bb-checkbox--compact",style:{color:"black"},children:[(0,G.jsx)("input",{type:"checkbox",checked:en,onChange:R=>Hn(R.target.checked)}),"Highlight on hover"]}),(0,G.jsxs)("label",{className:"bb-checkbox bb-checkbox--compact",style:{color:"black"},children:[(0,G.jsx)("input",{type:"checkbox",checked:Xr,onChange:R=>pr(R.target.checked)}),"Camera controller"]})]}),(0,G.jsxs)("div",{className:"bb-previewControlsColumn",children:[(0,G.jsxs)("div",{className:"bb-previewControls",children:[(0,G.jsx)("div",{className:"bb-previewMeta",children:(0,G.jsx)("span",{children:b?`Focused: ${b}`:"Select a node to inspect it"})}),u&&!o&&(0,G.jsx)("button",{type:"button",className:"bb-restoreSessionButton",disabled:A,onClick:ua,title:"Restore your last session \u2014 the model, its object bindings, and scene settings saved in this browser","aria-label":"Restore last session",children:(0,G.jsx)(Cn.History,{size:14})}),v&&u&&!o&&(0,G.jsx)("button",{type:"button",className:"bb-button bb-button--ghost bb-removeModelButton",onClick:Ep,children:"Remove model"})]}),v&&(0,G.jsx)("div",{className:"bb-moveHint",children:Ve?(0,G.jsx)(G.Fragment,{children:"Click the preview to look around \xB7 Esc to release"}):q?(0,G.jsx)(G.Fragment,{children:"Select a mesh \xB7 drag the colored arrows, planes, or rings"}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)("kbd",{children:"W"}),(0,G.jsx)("kbd",{children:"A"}),(0,G.jsx)("kbd",{children:"S"}),(0,G.jsx)("kbd",{children:"D"})," move \xB7 ",(0,G.jsx)("kbd",{children:"Space"}),"/",(0,G.jsx)("kbd",{children:"C"})," up \xB7 down \xB7 drag to look"]})})]})]}),(0,G.jsxs)("div",{className:"bb-preview",children:[(0,G.jsx)(Zu,{visible:A||pt,message:nt,tone:Le,progress:$??void 0}),v?(0,G.jsx)(Ac,{modelUrl:v,tilesetUrl:S?.tilesetUrl,objectBindings:h,selectedObject:cn,onObjectSelect:Qc,onObjectBindingsChange:P,onTextureUpload:la,onObjectEditLeaseChange:(R,I)=>p?.(R.modelObjectId||R.id,I),showObjectBindingDataPanel:!1,showSceneObjectsPanel:!1,onCameraChange:Cp,onViewerReady:R=>{nr.current=R,Hc(R)},onAnnotationsChange:Vf,activeAnnotation:Pn?.annotation??null,onActiveAnnotationChange:zi,onAnimationsReady:Lr,onSceneLoaded:Pp,onLoadError:es,onObjectCatalog:S?.tilesetUrl?Xc:void 0,onProgress:qc,onCameraControllerChange:Me,cameraControllerType:qt,onTexturePositioningChange:On,endTexturePositioningRef:hr,licenseKey:e,licenseValidationUrl:t,dracoDecoderPath:n,ktx2TranscoderPath:i,meshopt:r,sceneConfig:De,onSceneConfigChange:Rt,preserveDrawingBuffer:!0,disableZoom:!1,zoomOnSelected:pn,highlightOnHover:en,enableCameraControls:Xr,moveModeEnabled:q,objectTransformSpace:ae,enableKeyboardNavigation:!0,showViewGizmo:!0,showSectionTools:De.section?.enabled??!1,isolation:j,onIsolationChange:()=>B(null),showIsolateControls:!0,decalMove:Dr,panelHoveredObject:en?Mp:null,showLoadingOverlay:!1,autoRotate:Ve?!1:De.model.autoRotate??!1,autoRotateSpeed:De.model.autoRotateSpeed??1}):(0,G.jsx)("div",{className:`bb-previewPlaceholder ${Et?"bb-previewPlaceholder--dragActive":""}`,onDragEnter:hl,onDragOver:ml,onDragLeave:Kc,onDrop:kp,children:(0,G.jsxs)("div",{children:[(0,G.jsx)("div",{children:"Upload a GLB, GLTF, OBJ, FBX, or USDZ model, or drag a supported model/ZIP bundle here to generate editable object bindings."}),u?(0,G.jsx)("button",{type:"button",className:"bb-previewPlaceholderButton",onClick:ts,disabled:A,children:"Upload"}):null]})})]})]}),(0,G.jsx)(Pw,{bindings:h,selectedItem:b,onSelect:En,onHover:is,isOpen:!Tn,onToggle:fl,isolatedItem:D,onIsolate:B})]}),to&&(0,G.jsx)("div",{className:"bb-reset-overlay",onClick:Kr,children:(0,G.jsxs)("div",{className:"bb-reset-dialog",onClick:R=>R.stopPropagation(),children:[(0,G.jsxs)("div",{className:"bb-reset-header",children:[(0,G.jsxs)("h3",{className:"bb-reset-title",children:[(0,G.jsx)(Cn.AlertTriangle,{size:20,className:"bb-icon-warning"}),"Confirm Reset"]}),(0,G.jsx)("button",{className:"bb-reset-close",onClick:Kr,children:(0,G.jsx)(Cn.X,{size:20})})]}),(0,G.jsxs)("div",{className:"bb-reset-body",children:[(0,G.jsxs)("p",{className:"bb-reset-message",children:["Are you sure you want to reset"," ",(0,G.jsx)("strong",{children:tn==="bindings"?"Object Bindings":"Scene Config"}),"?"]}),(0,G.jsx)("p",{className:"bb-reset-details",children:tn==="bindings"?"This will remove all your custom changes to object properties, groups, tags, transforms, materials, actions, camera positions, metrics, and metadata.":"This will restore all scene settings (camera, lighting, environment, background, animations, annotations, etc.) to their default values."}),(0,G.jsx)("p",{className:"bb-reset-warning",children:"This action cannot be undone!"})]}),(0,G.jsxs)("div",{className:"bb-reset-footer",children:[(0,G.jsx)("button",{className:"bb-reset-btn",onClick:Kr,children:"Cancel"}),(0,G.jsx)("button",{className:"bb-reset-btn-danger",onClick:da,children:"Reset"})]})]})}),F&&(0,G.jsx)("div",{className:"bb-reset-overlay",onClick:Vi,children:(0,G.jsxs)("div",{className:"bb-reset-dialog",onClick:R=>R.stopPropagation(),children:[(0,G.jsxs)("div",{className:"bb-reset-header",children:[(0,G.jsxs)("h3",{className:"bb-reset-title",children:[(0,G.jsx)(Cn.History,{size:20,className:"bb-icon-restore"}),"Restore Last Session"]}),(0,G.jsx)("button",{className:"bb-reset-close",onClick:Vi,children:(0,G.jsx)(Cn.X,{size:20})})]}),(0,G.jsxs)("div",{className:"bb-reset-body",children:[(0,G.jsxs)("p",{className:"bb-reset-message",children:["Restore ",(0,G.jsx)("strong",{children:F.session.model.name}),", saved ",xP(F.session.savedAt),"?"]}),(0,G.jsx)("p",{className:"bb-reset-details",children:"This reloads that model with its object bindings and scene settings, replacing what's in the editor now."})]}),(0,G.jsxs)("div",{className:"bb-reset-footer",children:[(0,G.jsx)("button",{className:"bb-reset-btn",onClick:Vi,children:"Cancel"}),(0,G.jsx)("button",{className:"bb-reset-btn-restore",onClick:Nr,children:"Restore"})]})]})})]})}var Vw=require("react/jsx-runtime");function Ff(e){return(0,Vw.jsx)(Ac,{...e})}0&&(module.exports={ProjectBindingBuilder,ProjectModelViewer});
|
|
3690
|
+
`}))}increaseSizeTo(e){this._target.setSize(Math.max(this._target.width,e),1)}readDataAsync(e){let{_renderer:t,_target:n}=this;return t.readRenderTargetPixelsAsync(n,0,0,e.length/4,1,e)}readData(e){let{_renderer:t,_target:n}=this;t.readRenderTargetPixels(n,0,0,e.length/4,1,e)}renderPixelToTarget(e,t,n){let{_renderer:i,_target:r}=this;qc.min.copy(t),qc.max.copy(t),qc.max.x+=1,qc.max.y+=1,i.initRenderTarget(r),i.copyTextureToTexture(e,r.texture,qc,n,0)}},Jo=new class{constructor(){let e=null;Object.getOwnPropertyNames(_1.prototype).forEach(t=>{t!=="constructor"&&(this[t]=(...n)=>(e||(e=new _1),e[t](...n)))})}},M1=new J.Vector2,C1=new J.Vector2,T1=new J.Vector2;function AA(e,t){return t===0?e.getAttribute("uv"):e.getAttribute(`uv${t}`)}function I1(e,t,n=[,,,]){let i=3*t,r=3*t+1,o=3*t+2;return e.index&&(i=e.index.getX(i),r=e.index.getX(r),o=e.index.getX(o)),n[0]=i,n[1]=r,n[2]=o,n}function z1(e,t,n,i,r){let[o,a,s]=i,l=AA(e,t);M1.fromBufferAttribute(l,o),C1.fromBufferAttribute(l,a),T1.fromBufferAttribute(l,s),r.set(0,0,0).addScaledVector(M1,n.x).addScaledVector(C1,n.y).addScaledVector(T1,n.z)}function U1(e,t,n,i){let r=e.x-Math.floor(e.x),o=e.y-Math.floor(e.y),a=Math.floor(r*t%t),s=Math.floor(o*n%n);return i.set(a,s),i}var P1=new J.Vector2,A1=new J.Vector2,E1=new J.Vector2,EA=class extends Ap{constructor(e,t,n=null){super(e,t,n),this.channels=$n(n,"channels",[0]),this.index=$n(n,"index",null),this.texCoord=$n(n,"texCoord",null),this.valueLength=parseInt(this.type.replace(/[^0-9]/g,""))||1}readDataFromBuffer(e,t,n=null){let i=this.type;if(i==="BOOLEAN"||i==="STRING")throw Error("PropertyTextureAccessor: BOOLEAN and STRING types not supported.");return B1(e,t*this.valueLength,i,n)}},RA=class extends jf{constructor(...e){super(...e),this.isPropertyTextureAccessor=!0,this._asyncRead=!1,this._initProperties(EA)}getData(e,t,n,i={}){let r=this.properties;Tp(r,i);let o=Object.keys(r),a=o.map(s=>i[s]);return this.getPropertyValuesAtTexel(o,e,t,n,a),o.forEach((s,l)=>i[s]=a[l]),i}async getDataAsync(e,t,n,i={}){let r=this.properties;Tp(r,i);let o=Object.keys(r),a=o.map(s=>i[s]);return await this.getPropertyValuesAtTexelAsync(o,e,t,n,a),o.forEach((s,l)=>i[s]=a[l]),i}getPropertyValuesAtTexelAsync(...e){this._asyncRead=!0;let t=this.getPropertyValuesAtTexel(...e);return this._asyncRead=!1,t}getPropertyValuesAtTexel(e,t,n,i,r=[]){for(;r.length<e.length;)r.push(null);r.length=e.length,Jo.increaseSizeTo(r.length);let o=this.data,a=this.definition.properties,s=this.properties,l=I1(i,t);for(let p=0,u=e.length;p<u;p++){let m=e[p];if(!a[m])continue;let f=s[m],g=o[f.index];z1(i,f.texCoord,n,l,P1),U1(P1,g.image.width,g.image.height,A1),E1.set(p,0),Jo.renderPixelToTarget(g,A1,E1)}let c=new Uint8Array(e.length*4);if(this._asyncRead)return Jo.readDataAsync(c).then(()=>(h.call(this),r));return Jo.readData(c),h.call(this),r;function h(){for(let p=0,u=e.length;p<u;p++){let m=e[p],f=s[m],g=f.type;if(r[p]=Ff(f,r[p]),!f)throw Error("PropertyTextureAccessor: Requested property does not exist.");if(!a[m]){r[p]=f.resolveDefault(r);continue}let b=f.valueLength*(f.count||1),x=f.channels.map(M=>c[4*p+M]),v=f.componentType,w=new(Yc(v,g))(b);if(new Uint8Array(w.buffer).set(x),f.array){let M=r[p];for(let _=0,y=M.length;_<y;_++)M[_]=f.readDataFromBuffer(w,_,M[_])}else r[p]=f.readDataFromBuffer(w,0,r[p]);r[p]=f.adjustValueScaleOffset(r[p]),r[p]=f.resolveEnumsToStrings(r[p]),r[p]=f.resolveNoData(r[p])}}}dispose(){this.data.forEach(e=>{e&&(e.dispose(),e.image instanceof ImageBitmap&&e.image.close())})}},zf=class{constructor(e,t,n,i=null,r=null){let{schema:o,propertyTables:a=[],propertyTextures:s=[],propertyAttributes:l=[]}=e,{enums:c,classes:h}=o,p=a.map(f=>new PA(f,h,c,n)),u=[],m=[];i&&(i.propertyTextures&&(u=i.propertyTextures.map(f=>new RA(s[f],h,c,t))),i.propertyAttributes&&(m=i.propertyAttributes.map(f=>new CA(l[f],h,c)))),this.schema=o,this.tableAccessors=p,this.textureAccessors=u,this.attributeAccessors=m,this.object=r,this.textures=t,this.nodeMetadata=i}getPropertyTableData(e,t,n=null){if(!Array.isArray(e))n||(n={}),n=this.tableAccessors[e].getData(t,n);else{n||(n=[]);let i=Math.min(e.length,t.length);n.length=i;for(let r=0;r<i;r++){let o=this.tableAccessors[e[r]];n[r]=o.getData(t[r],n[r])}}if(Array.isArray(e)!==Array.isArray(n)||Array.isArray(e)!==Array.isArray(t))throw Error("StructuralMetadata: Scalar and array inputs cannot be mixed.");return n}getPropertyTableInfo(e=null){if(e===null&&(e=this.tableAccessors.map((t,n)=>n)),Array.isArray(e))return e.map(t=>{let n=this.tableAccessors[t];return{name:n.name,className:n.definition.class}});{let t=this.tableAccessors[e];return{name:t.name,className:t.definition.class}}}getPropertyTextureData(e,t,n=[]){let i=this.textureAccessors;n.length=i.length;for(let r=0;r<i.length;r++)n[r]=i[r].getData(e,t,this.object.geometry,n[r]);return n}async getPropertyTextureDataAsync(e,t,n=[]){let i=this.textureAccessors;n.length=i.length;let r=[];for(let o=0;o<i.length;o++){let a=i[o].getDataAsync(e,t,this.object.geometry,n[o]).then(s=>{n[o]=s});r.push(a)}return await Promise.all(r),n}getPropertyTextureInfo(){return this.textureAccessors}getPropertyAttributeData(e,t=[]){let n=this.attributeAccessors;t.length=n.length;for(let i=0;i<n.length;i++)t[i]=n[i].getData(e,this.object.geometry,t[i]);return t}getPropertyAttributeInfo(){return this.attributeAccessors.map(e=>({name:e.name,className:e.definition.class}))}dispose(){this.textureAccessors.forEach(e=>e.dispose()),this.tableAccessors.forEach(e=>e.dispose()),this.attributeAccessors.forEach(e=>e.dispose())}},$c="EXT_structural_metadata";function kA(e,t=[]){let n=e.json.textures?.length||0,i=Array(n).fill(null);return t.forEach(({properties:r})=>{for(let o in r){let{index:a}=r[o];i[a]===null&&(i[a]=e.loadTexture(a))}}),Promise.all(i)}function LA(e,t=[]){let n=e.json.bufferViews?.length||0,i=Array(n).fill(null);return t.forEach(({properties:r})=>{for(let o in r){let{values:a,arrayOffsets:s,stringOffsets:l}=r[o];i[a]===null&&(i[a]=e.getDependency("bufferView",a)),i[s]===null&&(i[s]=e.getDependency("bufferView",s)),i[l]===null&&(i[l]=e.getDependency("bufferView",l))}}),Promise.all(i)}var V1=class{constructor(e){this.parser=e,this.name=$c}async afterRoot({scene:e,parser:t}){let n=t.json.extensionsUsed;if(!n||!n.includes($c))return;let i=null,r=t.json.extensions[$c];if(r.schemaUri){let{manager:l,path:c,requestHeader:h,crossOrigin:p}=t.options,u=new URL(r.schemaUri,c).toString(),m=new J.FileLoader(l);m.setCrossOrigin(p),m.setResponseType("json"),m.setRequestHeader(h),i=m.loadAsync(u).then(f=>{r={...r,schema:f}})}let[o,a]=await Promise.all([kA(t,r.propertyTextures),LA(t,r.propertyTables),i]),s=new zf(r,o,a);e.userData.structuralMetadata=s,e.traverse(l=>{if(t.associations.has(l)){let{meshes:c,primitives:h}=t.associations.get(l),p=t.json.meshes[c]?.primitives[h];if(p&&p.extensions&&p.extensions[$c]){let u=p.extensions[$c];l.userData.structuralMetadata=new zf(r,o,a,u,l)}else l.userData.structuralMetadata=s}})}},R1=new J.Vector2,k1=new J.Vector2,L1=new J.Vector2;function DA(e){return e.x>e.y&&e.x>e.z?0:e.y>e.z?1:2}var F1=class{constructor(e,t,n){this.geometry=e,this.textures=t,this.data=n,this._asyncRead=!1,this.featureIds=n.featureIds.map(i=>{let{texture:r,...o}=i,a={label:null,propertyTable:null,nullFeatureId:null,...o};return r&&(a.texture={texCoord:0,channels:[0],...r}),a})}getTextures(){return this.textures}getFeatureInfo(){return this.featureIds}getFeaturesAsync(...e){this._asyncRead=!0;let t=this.getFeatures(...e);return this._asyncRead=!1,t}getFeatures(e,t){let{geometry:n,textures:i,featureIds:r}=this,o=Array(r.length).fill(null),a=r.length;Jo.increaseSizeTo(a);let s=I1(n,e),l=s[DA(t)];for(let p=0,u=r.length;p<u;p++){let m=r[p],f="nullFeatureId"in m?m.nullFeatureId:null;if("texture"in m){let g=i[m.texture.index];z1(n,m.texture.texCoord,t,s,R1),U1(R1,g.image.width,g.image.height,k1),L1.set(p,0),Jo.renderPixelToTarget(i[m.texture.index],k1,L1)}else if("attribute"in m){let g=n.getAttribute(`_feature_id_${m.attribute}`).getX(l);g!==f&&(o[p]=g)}else{let g=l;g!==f&&(o[p]=g)}}let c=new Uint8Array(a*4);if(this._asyncRead)return Jo.readDataAsync(c).then(()=>(h(),o));return Jo.readData(c),h(),o;function h(){let p=new Uint32Array(1);for(let u=0,m=r.length;u<m;u++){let f=r[u],g="nullFeatureId"in f?f.nullFeatureId:null;if("texture"in f){let{channels:b}=f.texture,x=b.map(w=>c[4*u+w]);new Uint8Array(p.buffer).set(x);let v=p[0];v!==g&&(o[u]=v)}}}}dispose(){this.textures.forEach(e=>{e&&(e.dispose(),e.image instanceof ImageBitmap&&e.image.close())})}},Pp="EXT_mesh_features";function D1(e,t,n){e.traverse(i=>{if(t.associations.has(i)){let{meshes:r,primitives:o}=t.associations.get(i),a=t.json.meshes[r]?.primitives[o];a&&a.extensions&&a.extensions[Pp]&&n(i,a.extensions[Pp])}})}var j1=class{constructor(e){this.parser=e,this.name=Pp}async afterRoot({scene:e,parser:t}){let n=t.json.extensionsUsed;if(!n||!n.includes(Pp))return;let i=t.json.textures?.length||0,r=Array(i).fill(null);D1(e,t,(a,{featureIds:s})=>{s.forEach(l=>{if(l.texture&&r[l.texture.index]===null){let c=l.texture.index;r[c]=t.loadTexture(c)}})});let o=await Promise.all(r);D1(e,t,(a,s)=>{a.userData.meshFeatures=new F1(a.geometry,o,s)})}},G1=class{constructor(){this.name="CESIUM_RTC"}afterRoot(e){if(e.parser.json.extensions&&e.parser.json.extensions.CESIUM_RTC){let{center:t}=e.parser.json.extensions.CESIUM_RTC;t&&(e.scene.position.x+=t[0],e.scene.position.y+=t[1],e.scene.position.z+=t[2])}}},Gf=class{constructor(e){e={metadata:!0,rtc:!0,plugins:[],dracoLoader:null,ktxLoader:null,meshoptDecoder:null,autoDispose:!0,...e},this.tiles=null,this.metadata=e.metadata,this.rtc=e.rtc,this.plugins=e.plugins,this.dracoLoader=e.dracoLoader,this.ktxLoader=e.ktxLoader,this.meshoptDecoder=e.meshoptDecoder,this._gltfRegex=/\.(gltf|glb)$/g,this._dracoRegex=/\.drc$/g,this._loader=null}init(e){let t=new N1.GLTFLoader(e.manager);this.dracoLoader&&(t.setDRACOLoader(this.dracoLoader),e.manager.addHandler(this._dracoRegex,this.dracoLoader)),this.ktxLoader&&t.setKTX2Loader(this.ktxLoader),this.meshoptDecoder&&t.setMeshoptDecoder(this.meshoptDecoder),this.rtc&&t.register(()=>new G1),this.metadata&&(t.register(()=>new V1),t.register(()=>new j1)),this.plugins.forEach(n=>t.register(n)),e.manager.addHandler(this._gltfRegex,t),this.tiles=e,this._loader=t}dispose(){this.tiles.manager.removeHandler(this._gltfRegex),this.tiles.manager.removeHandler(this._dracoRegex),this.autoDispose&&(this.ktxLoader.dispose(),this.dracoLoader.dispose())}};var{clamp:oN}=J.MathUtils;var aN=new Uf.FullScreenQuad(new J.MeshBasicMaterial),NA=new J.DataTexture(new Uint8Array([255,255,255,255]),1,1);NA.needsUpdate=!0;var OA=0,BA=1,IA=2,zA=3,UA=4,VA=5,FA=6,jA=7,GA=8,HA=9,WA=10,XA=11,sN=Object.freeze({NONE:OA,SCREEN_ERROR:BA,GEOMETRIC_ERROR:IA,DISTANCE:zA,DEPTH:UA,RELATIVE_DEPTH:VA,IS_LEAF:FA,RANDOM_COLOR:jA,RANDOM_NODE_COLOR:GA,CUSTOM_COLOR:HA,LOAD_ORDER:WA,INDEXED_COLOR:XA});var lN=Math.PI/4,cN=3/5;var Zo={NONE:0,NOT_READY:1,NO_FIT:2,DEPTH:3,OCCUPANCY:4,SPACING:5,ANGLE:6,FACING:7};var dN=new class{constructor(){this._cache={}}getColor(...e){let t=e.pop(),n=e.join("_"),{_cache:i}=this;return n in i||(t.setHSL(Math.random(),1,.5),i[n]=t.getHex()),t.set(i[n])}};var uN={[Zo.NONE]:16777215,[Zo.NOT_READY]:7829367,[Zo.NO_FIT]:2250239,[Zo.DEPTH]:4473924,[Zo.OCCUPANCY]:65535,[Zo.SPACING]:16776960,[Zo.ANGLE]:16711680,[Zo.FACING]:16711935};var pN=Math.PI/180;var mN=Za*Math.PI*2;var hN=Za*Math.PI*2;var q1=require("three/examples/jsm/loaders/DRACOLoader.js"),$1=require("three/examples/jsm/loaders/KTX2Loader.js"),Y1=require("three/examples/jsm/libs/meshopt_decoder.module.js"),Fr=require("three");var Jc=require("three");function H1(e){return!!e&&!e.isInterleavedBufferAttribute}function W1(e,t,n,i){for(let r=0;r<e.count;r+=1)for(let o=0;o<e.itemSize;o+=1)t.setComponent(r,o,Jc.MathUtils.clamp(e.getComponent(r,o),n,i));return t}function qA(e){for(let t=0;t<e.count;t+=1)for(let n=0;n<e.itemSize;n+=1){let i=e.getComponent(t,n);if(!Number.isFinite(i)||i<0||i>1)return!1}return!0}var Ep=class{constructor(){this.name="RI_VERTEX_COMPRESSION_PLUGIN";this.priority=-99}processTileModel(t){t.traverse(n=>{let i=n.geometry;if(!i)return;let r=i.attributes.normal;H1(r)&&!(r.array instanceof Int16Array)&&(i.attributes.normal=W1(r,new Jc.BufferAttribute(new Int16Array(r.count*r.itemSize),r.itemSize,!0),-1,1));for(let o of["uv","uv1","uv2","uv3"]){let a=i.attributes[o];!H1(a)||a.array instanceof Uint16Array||!qA(a)||(i.attributes[o]=W1(a,new Jc.BufferAttribute(new Uint16Array(a.count*a.itemSize),a.itemSize,!0),0,1))}})}};var Qc=require("react/jsx-runtime"),$A=0,X1=4,YA=6,KA=12,ZA=4;function JA(e){try{let t=typeof window>"u"?new URL(e):new URL(e,window.location.href);return new URL("objects.json",t).toString()}catch{return null}}function Hf({url:e,rotation:t=[0,0,0],errorTarget:n=64,cacheSize:i=800,memoryBudgetMB:r=800,decoderConfig:o,objectBindings:a,itemMaterials:s,sceneConfig:l,selectedItem:c,panelHoveredItem:h,highlightOnHover:p=!0,onItemClick:u,onItemHover:m,onItemDoubleClick:f,onItemContextMenu:g,onObjectCatalog:b,onTilesetBounds:x,onModelLoaded:v,onLoadError:w,nodeRefsOut:M,onNodeRefsChange:_,materialRefsOut:y,explodeFactor:P=0,suspendBindingTransforms:d=!1}){let{camera:S,gl:C,invalidate:T}=(0,Rp.useThree)(),E=(0,Ke.useRef)(null),[k,D]=(0,Ke.useState)(null),I=(0,Ke.useRef)({onItemClick:u,onItemHover:m,onItemDoubleClick:f,onObjectCatalog:b,onTilesetBounds:x,onModelLoaded:v,onLoadError:w,onNodeRefsChange:_});I.current={onItemClick:u,onItemHover:m,onItemDoubleClick:f,onObjectCatalog:b,onTilesetBounds:x,onModelLoaded:v,onLoadError:w,onNodeRefsChange:_};let L=(0,Ke.useRef)(!0),[X,O]=(0,Ke.useState)(null),B=(0,Ke.useRef)(null);B.current=X;let re=(0,Ke.useRef)([]),ke=(0,Ke.useRef)(!1);(0,Ke.useEffect)(()=>{let ae=new op;return O(ae),()=>ae.dispose()},[e]);let te=(0,Ke.useRef)(null),We=(0,Ke.useRef)(0),wt=(0,Ke.useRef)(!1),be=r*1024*1024,ue=(0,Ke.useRef)(!1),Ne=(0,Ke.useRef)(uf),Te=(0,Ke.useRef)(null),bn=(0,Ke.useRef)(null),Oe=(0,Ke.useRef)(null);(0,Ke.useEffect)(()=>()=>{Oe.current!==null&&clearTimeout(Oe.current)},[]);let ot=o?.dracoDecoderPath??Qh,mt=o?.ktx2TranscoderPath??ef,vn=o?.meshopt??!0,[de,ur]=(0,Ke.useState)(null);(0,Ke.useEffect)(()=>{wt.current=!1,ue.current=!1;let ae=new Bf(e);ae.loadAncestors=!0;let he=new up;he.priorityCallback=ae.downloadQueue.priorityCallback,he.maxJobsPerOrigin=KA;let Ee=new Vi;Ee.priorityCallback=ae.parseQueue.priorityCallback,Ee.maxJobs=YA;let Ie=new Vi;Ie.priorityCallback=ae.processNodeQueue.priorityCallback,Ie.maxJobs=ae.processNodeQueue.maxJobs;let _t=new Bc;_t.unloadPriorityCallback=ae.lruCache.unloadPriorityCallback,ae.downloadQueue=he,ae.parseQueue=Ee,ae.processNodeQueue=Ie,ae.lruCache=_t;let Je=ot?new q1.DRACOLoader().setDecoderPath(ot).setWorkerLimit(ZA):null,et=mt?new $1.KTX2Loader().setTranscoderPath(mt).detectSupport(C):null;return ae.registerPlugin(new Gf({dracoLoader:Je,ktxLoader:et,meshoptDecoder:vn?Y1.MeshoptDecoder:null,autoDispose:!1})),ae.registerPlugin(new Vf({disableMipmaps:!1,compressIndex:!0,compressNormals:!1,compressUvs:!1,compressPosition:!0})),ae.registerPlugin(new Ep),ur(ae),window.__riTiles=ae,()=>{ae.forEachLoadedModel(ve=>cc(ve)),ae.dispose(),Je?.dispose(),et?.dispose(),ur(ve=>ve===ae?null:ve)}},[ot,C,mt,vn,e]),(0,Ke.useEffect)(()=>{de&&(Ne.current=uf,Te.current=null,de.errorTarget=n,de.lruCache.maxSize=i,de.lruCache.minSize=Math.max(1,Math.floor(i*.75)),de.lruCache.maxBytesSize=be,de.lruCache.minBytesSize=be*.75,T())},[i,n,T,be,de]);let jt=(0,Ke.useMemo)(()=>{let ae=a??{};return{objectBindings:ae,keyByModelObject:E0(ae),itemMaterials:s,shadingMode:l?.model.shading??"lit",rendererMode:l?.model.renderer??"pbr",selectedKey:c??null,hoveredKey:R0(k,h),highlightOnHover:p,suspendTransforms:d,placementFrame:de?.group.matrixWorld,invalidate:T}},[k,p,T,s,a,h,l,c,d,de]),Gt=(0,Ke.useCallback)(()=>{if(!de)return;let ae=gt.current,he=ke.current?B.current?.nodesByBinding(ae)??{}:{},Ee={};de.group.traverse(et=>{if(!et.isMesh)return;let ve=cf(et);if(!ve)return;let Qe=ae.keyByModelObject[ve]??ve;if(!ae.objectBindings[Qe])return;he[Qe]||(he[Qe]=et);let bt=et.material;bt&&(Ee[Qe]=bt)});let Ie=M?.current??{},_t=Object.keys(Ie),Je=_t.length!==Object.keys(he).length||_t.some(et=>Ie[et]!==he[et]);M&&(M.current=he),y&&(y.current=Ee),(Je||!M)&&I.current.onNodeRefsChange?.()},[y,M,de]),ce=(0,Ke.useCallback)(ae=>rp(ae,jt),[jt]),Be=(0,Ke.useCallback)(ae=>L0(ae,jt),[jt]),zt=(0,Ke.useRef)(Be);zt.current=Be;let gt=(0,Ke.useRef)(jt);gt.current=jt;let Ut=(0,Ke.useCallback)(()=>{let ae=te.current,he=We.current;return!ae||he<=0?gt.current:{...gt.current,explode:{factor:he,centre:ae.centre,radius:ae.radius}}},[]);(0,Ke.useEffect)(()=>{de&&(Be(de.group),L.current=!0,de.forEachLoadedModel(ae=>{Be(ae),dl(ae,Ut())}),T())},[Be,T,Ut,de]),(0,Ke.useEffect)(()=>{let ae=JA(e);if(!ae)return;let he=!1;return fetch(ae).then(Ee=>Ee.ok?Ee.json():null).then(Ee=>{he||!Ee?.objects||(re.current=Ee.objects,ke.current=Ee.bindingFrame==="gltf-identity-v2",ke.current&&B.current?.setCatalog(Ee.objects),L.current=!0,I.current.onObjectCatalog?.(Ee.objects),T())}).catch(()=>{}),()=>{he=!0}},[e,T,X]),(0,Ke.useEffect)(()=>{if(!de)return;let ae=!1,he=()=>T(),Ee=ve=>{ve.scene&&(ve.scene.traverse(Qe=>{let bt=Qe.material;for(let un of Array.isArray(bt)?bt:bt?[bt]:[])un.transparent&&un.side===Fr.DoubleSide&&(un.forceSinglePass=!0)}),zt.current(ve.scene),dl(ve.scene,Ut()),eu(ve.scene)),L.current=!0,ae||(ae=!0,I.current.onModelLoaded?.(de.group)),T()},Ie=ve=>{I.current.onLoadError?.(ve.error)},_t=ve=>{ve.scene&&(df(ve.scene),cc(ve.scene)),L.current=!0};de.setCamera(S),de.setResolutionFromRenderer(S,C),de.addEventListener("needs-update",he),de.addEventListener("load-model",Ee),de.addEventListener("load-error",Ie),de.addEventListener("dispose-model",_t);let Je=()=>{L.current=!0,T()};de.addEventListener("tile-visibility-change",Je);let et=()=>{let ve=de.root;ve&&!ve.content?.uri&&ve.refine==="REPLACE"&&(ve.refine="ADD",T())};return de.addEventListener("load-root-tileset",et),T(),()=>{de.removeEventListener("needs-update",he),de.removeEventListener("load-model",Ee),de.removeEventListener("load-error",Ie),de.removeEventListener("dispose-model",_t),de.removeEventListener("tile-visibility-change",Je),de.removeEventListener("load-root-tileset",et),df(de.group),de.deleteCamera(S),M&&(M.current={}),y&&(y.current={})}},[S,C,T,y,M,Ut,de]);let Ae=Au(ae=>ce(ae)?.binding??null,g),Ce=(0,Ke.useCallback)(ae=>{if(Ae.consumeClick())return;let he=ce(ae.object);he&&(ae.stopPropagation(),I.current.onItemClick?.(he.binding))},[ce,Ae,u]),Pt=(0,Ke.useCallback)(ae=>{let he=ce(ae.object);if(!he)return;I.current.onItemDoubleClick?.(he.binding,nl(ae))&&ae.stopPropagation()},[ce]),St=(0,Ke.useCallback)(ae=>{let he=ce(ae.object),Ee=he?.key??null;Ee!==E.current&&(E.current=Ee,D(Ee),I.current.onItemHover?.(he?.binding??null))},[ce]),dn=(0,Ke.useCallback)(()=>{E.current!==null&&(E.current=null,D(null),I.current.onItemHover?.(null))},[]);return(0,Ke.useEffect)(()=>{T()},[T,de]),(0,Rp.useFrame)((ae,he)=>{if(!de)return;if(de.setResolutionFromRenderer(S,C),ke.current&&X){let kn=X.sync(Ut(),c,d);X.updateBounds(de.root),d&&de.forEachLoadedModel(Dr=>dl(Dr,kn))}if(de.update(),!wt.current){let kn=new Fr.Box3;if(de.getBoundingBox(kn)){wt.current=!0,de.group.updateMatrixWorld(),kn.applyMatrix4(de.group.matrixWorld);let Dr=kn.getBoundingSphere(new Fr.Sphere);te.current={centre:Dr.center.clone(),radius:kn.getSize(new Fr.Vector3).length()*.5},I.current.onTilesetBounds?.(kn),T()}}L.current&&(L.current=!1,Gt());let Ee=Math.min(Math.max(P,0),1),Ie=We.current;Math.abs(Ie-Ee)>1e-4?(We.current=Fr.MathUtils.lerp(Ie,Ee,1-Math.exp(-6*he)),dl(de.group,Ut()),T()):Ie!==Ee&&(We.current=Ee,dl(de.group,Ut()),T());let _t=de,Je=de.lruCache,et=Je.isFull(),ve=Ne.current,Qe=ve.loosened&&Te.current?Te.current:{bytes:Je.maxBytesSize,items:Je.maxSize},bt=0;for(let kn of Je.usedSet??[])bt+=Je.bytesMap?.get(kn)??0;let un=!1,or=de;for(let kn of or.usedSet??[]){let Dr=kn.internal?.loadingState??X1;if(kn.traversal?.used&&kn.internal?.hasContent&&Dr>=$A&&Dr<X1){un=!0;break}}let xn=bn.current??(bn.current={world:new Fr.Matrix4,projection:new Fr.Matrix4}),Vn=!xn.world.equals(S.matrixWorld)||!xn.projection.equals(S.projectionMatrix);Vn&&(xn.world.copy(S.matrixWorld),xn.projection.copy(S.projectionMatrix));let xr={full:et,wanting:un,moved:Vn,usage:Math.max(bt/Math.max(1,Qe.bytes),(Je.usedSet?.size??0)/Math.max(1,Qe.items)),now:performance.now()},Fn=F0(ve,xr);Fn!==ve&&(Fn.loosened&&(!ve.loosened||Fn.raisedAt!==ve.raisedAt)?(ve.loosened||(Te.current=Qe),Je.maxBytesSize=Math.max(Qe.bytes,Je.cachedBytes??0)*pf,Je.maxSize=Math.ceil(Math.max(Qe.items,Je.itemSet?.size??0)*pf)):!Fn.loosened&&ve.loosened&&Te.current&&(Je.maxBytesSize=Te.current.bytes,Je.maxSize=Te.current.items,Te.current=null),Ne.current=Fn,de.errorTarget=n*Fn.factor,T()),!ue.current&&et&&xr.wanting&&Fn.factor>=Lc&&(ue.current=!0,console.warn("[react-immersive] The tile memory budget is full even at the coarsest level of detail, so the model may render incompletely. This usually means the model's textures are too large for streaming \u2014 re-process it with a smaller MAX_TEXTURE_SIZE, or raise memoryBudgetMB."));let li=j0(Fn,xr);li===0?T():li!==null&&Oe.current===null&&(Oe.current=setTimeout(()=>{Oe.current=null,T()},li)),((_t.stats?.downloading??0)>0||(_t.stats?.parsing??0)>0||_t.loadProgress!==void 0&&_t.loadProgress<1&&!et)&&T()}),de?(0,Qc.jsxs)("group",{rotation:t,children:[X?(0,Qc.jsx)("primitive",{object:X.group}):null,(0,Qc.jsx)("primitive",{object:de.group,onClick:Ce,onDoubleClick:Pt,onPointerDown:g?Ae.onPointerDown:void 0,onPointerMove:St,onPointerOut:dn})]}):null}var kp=require("three");var QA=new kp.Matrix4().makeRotationX(Math.PI/2);function K1(e){e.updateMatrixWorld(!0);let t=new kp.Matrix4().copy(e.matrixWorld).invert().premultiply(QA),n=new kp.Matrix4,i=[];for(let[r,o]of Object.entries(lo(e).nodesById)){let a=o;if(!a.isMesh||!a.geometry||!o.name)continue;let s=a.geometry;s.boundingBox||s.computeBoundingBox();let l=s.boundingBox.clone().applyMatrix4(n.multiplyMatrices(t,o.matrixWorld)),c=s.index?s.index.count:s.getAttribute("position")?.count??0;i.push({name:r,triangles:Math.floor(c/3),minimum:l.min.toArray(),maximum:l.max.toArray()})}return i.sort((r,o)=>r.name.localeCompare(o.name))}var je=require("react"),qf=require("@react-three/drei"),Qa=require("@react-three/fiber"),Si=require("three");var Wf=require("three");function gl(e){if(!e?.trim()||/[\u0000-\u001f\u007f]/.test(e))return null;try{let t=new URL(e.trim(),"https://annotation.invalid/");return t.protocol==="https:"||t.protocol==="http:"?e.trim():null}catch{return null}}function Xf(e){return e.category?.trim()??""}function Z1(e,t){if(t===null)return e;let n=new Set(t.map(i=>i.trim()));return e.filter(i=>n.has(Xf(i)))}function J1(e,t){let n=Number.isFinite(e.minDistance)?Math.max(0,e.minDistance):0,i=Number.isFinite(e.maxDistance)?Math.max(0,e.maxDistance):1/0;return t>=n&&t<=i}function bl(e){return!!e&&[e.position,e.target].every(t=>Array.isArray(t)&&t.length===3&&t.every(Number.isFinite))}function ed(e){let t=e.camera;return{position:e.getPosition(new Wf.Vector3,!1).toArray(),target:e.getTarget(new Wf.Vector3,!1).toArray(),azimuthAngle:e.azimuthAngle,polarAngle:e.polarAngle,fov:"fov"in t?Number(t.fov):null,zoom:t.zoom}}function td(e,t){bl(t)&&(e.setLookAt(...t.position,...t.target,!0),Number.isFinite(t.azimuthAngle)&&Number.isFinite(t.polarAngle)&&e.rotateTo(t.azimuthAngle,t.polarAngle,!0),nd(e,t))}function nd(e,t){let n=!1;t.fov!=null&&Number.isFinite(t.fov)&&t.fov>0&&t.fov<180&&"fov"in e.camera&&(e.camera.fov=t.fov,e.camera.updateProjectionMatrix(),n=!0),t.zoom!=null&&Number.isFinite(t.zoom)&&t.zoom>0&&e.zoomTo(t.zoom,!0),n&&e.dispatchEvent({type:"update"})}var On=require("react/jsx-runtime"),eE=.02;function Q1(e,t,n=!1){let i=(0,je.useRef)(null),[r,o]=(0,je.useState)(!0),a=(0,je.useRef)(!0),s=(0,je.useMemo)(()=>new Si.Vector3,[]),l=(0,Qa.useThree)(f=>f.scene),c=(0,je.useRef)(null),h=(0,je.useMemo)(()=>new Si.Vector3(...e.anchorLocalPosition??e.localPosition??e.worldPosition),[e.anchorLocalPosition,e.localPosition,e.worldPosition]),p=(0,je.useMemo)(()=>new Si.Vector3,[]),u=(0,je.useMemo)(()=>new Si.Vector3,[]),m=(0,je.useMemo)(()=>new Si.Vector3,[]);return(0,je.useEffect)(()=>{c.current=null},[e.anchorNodeName]),(0,Qa.useFrame)(({camera:f})=>{let g=i.current,b=g?.parent;if(!g||!b)return;let x=c.current;if(e.anchorNodeName&&(!x||!x.parent)&&(x=xi(l,e.anchorNodeName),c.current=x),x?(x.updateWorldMatrix(!0,!1),p.copy(h).applyMatrix4(x.matrixWorld)):(p.copy(h),b.localToWorld(p)),t){let w=t.current.get(e.id);w||(w=new Si.Vector3,t.current.set(e.id,w)),w.copy(p)}f.getWorldPosition(s);let v=!n||J1(e,s.distanceTo(p));v!==a.current&&(a.current=v,o(v)),m.copy(s).sub(p),m.lengthSq()>0?(m.normalize(),u.copy(p).addScaledVector(m,eE)):u.copy(p),b.worldToLocal(u),g.position.copy(u)}),{anchorRef:i,inRange:r}}function tE({annotation:e,occluders:t,worldPositionsRef:n,onClick:i,onHover:r,showAnnotationOnHover:o}){let a=Me(),[s,l]=(0,je.useState)(!1),{anchorRef:c,inRange:h}=Q1(e,n,!0),p=s||!h,[u,m]=(0,je.useState)(!1),[f,g]=(0,je.useState)(1),b=(0,je.useRef)(null),x=(0,je.useRef)(null),v=(0,je.useRef)(null);(0,je.useEffect)(()=>{h||(b.current&&clearTimeout(b.current),u&&(m(!1),r?.(null)))},[h,u,r]),(0,je.useEffect)(()=>()=>{b.current&&(clearTimeout(b.current),b.current=null),v.current&&(clearTimeout(v.current),v.current=null)},[]);let w=d=>{d.stopPropagation(),d.preventDefault(),b.current&&(clearTimeout(b.current),b.current=null),b.current=window.setTimeout(()=>{i?.(e),b.current=null},10)},M=d=>{d.stopPropagation(),m(!0),g(100),v.current&&(clearTimeout(v.current),v.current=null),r?.(e)},_=d=>{d.stopPropagation(),m(!1),g(1),v.current&&clearTimeout(v.current),v.current=window.setTimeout(()=>{r?.(null),o&&r?.(null),v.current=null},50)},y=d=>{d.stopPropagation();let S=d.currentTarget;S.dataset.pointerX=String(d.clientX),S.dataset.pointerY=String(d.clientY)},P=d=>{d.stopPropagation();let S=d.currentTarget,C=parseFloat(S.dataset.pointerX||"0"),T=parseFloat(S.dataset.pointerY||"0"),E=d.clientX-C,k=d.clientY-T;Math.sqrt(E*E+k*k)<10&&w(d)};return(0,On.jsx)("group",{ref:c,children:(0,On.jsx)(qf.Html,{center:!0,occlude:t,onOcclude:l,pointerEvents:p?"none":"auto",zIndexRange:[1,200],style:{pointerEvents:p?"none":"auto",zIndex:f},className:"annotation-html-wrapper",transparent:!0,children:(0,On.jsx)("div",{ref:x,className:`ri-annotationMarker ${u?"ri-annotationMarker--hovered":""}`,title:e.title,style:{display:p?"none":"flex"},onPointerDown:y,onPointerUp:P,onPointerEnter:M,onPointerLeave:_,onDoubleClick:d=>{d.stopPropagation(),i?.(e)},role:"button",tabIndex:0,"aria-label":a("annotationMarker",{id:e.id,title:e.title}),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.stopPropagation(),i?.(e))},children:(0,On.jsx)("span",{className:"ri-annotationMarker-id",children:e.id})})})})}function nE({annotation:e,occluders:t,popupRef:n,onClose:i,hideCloseButton:r=!1}){let o=Me(),[a,s]=(0,je.useState)(!1),{anchorRef:l}=Q1(e),c=(0,On.jsxs)("div",{ref:n,className:"ri-viewAnnotationPopup",style:{display:a?"none":"block"},onPointerDown:h=>h.stopPropagation(),onClick:h=>h.stopPropagation(),children:[(0,On.jsxs)("div",{className:"ri-viewAnnotationHeader",children:[(0,On.jsx)("h4",{className:"ri-viewAnnotationTitle",children:e.title}),!r&&(0,On.jsx)("button",{onClick:h=>{h.stopPropagation(),i?.()},className:"ri-viewAnnotationClose","aria-label":o("closeAnnotation"),children:"\xD7"})]}),e.category&&(0,On.jsx)("span",{className:"ri-annotationCategory",children:e.category}),e.description&&(0,On.jsx)("p",{className:"ri-viewAnnotationDescription",children:e.description}),e.images?.map((h,p)=>{let u=gl(h.src);return u?(0,On.jsx)("img",{className:"ri-annotationImage",src:u,alt:h.alt??"",loading:"lazy"},`${u}-${p}`):null}),e.links?.map((h,p)=>{let u=gl(h.href);return u?(0,On.jsx)("a",{className:"ri-annotationLink",href:u,target:"_blank",rel:"noopener noreferrer",children:h.label||o("learnMore")},`${u}-${p}`):null})]});return(0,On.jsx)("group",{ref:l,children:(0,On.jsx)(qf.Html,{occlude:t,onOcclude:s,pointerEvents:a?"none":"auto",zIndexRange:[1e3,2e3],style:{pointerEvents:a?"none":"auto",zIndex:1e3},transparent:!0,children:c})})}function $f({annotations:e,sceneConfig:t,activeAnnotation:n,popupRef:i,canvasRootRef:r,worldPositionsRef:o,modelLoaded:a,onAnnotationClick:s,onAnnotationHover:l,onCloseAnnotation:c,hideCloseButton:h=!1,showAnnotationOnHover:p=!1}){let u=(0,Qa.useThree)(L=>L.invalidate),m=(0,Qa.useThree)(L=>L.scene),[f,g]=(0,je.useState)(null),[b,x]=(0,je.useState)(!1),v=(0,je.useRef)(null);(0,je.useEffect)(()=>{v.current!==null&&n===null&&(g(null),x(!1)),v.current=n?.id??null},[n]);let w=(0,je.useRef)(null),M=(0,je.useRef)(null),_=(0,je.useRef)(null),y=(0,je.useMemo)(()=>{let L=[];return m.traverse(X=>{let O=X;O.isMesh&&!O.isSkinnedMesh&&L.push({current:X})}),L},[m,e,a]),P=(0,je.useCallback)(()=>{u();let L=()=>{u(),M.current=window.requestAnimationFrame(()=>{u(),M.current=null})};M.current=window.requestAnimationFrame(L)},[u]);(0,je.useEffect)(()=>{P()},[e,P]),(0,je.useEffect)(()=>{P()},[n,P]),(0,je.useEffect)(()=>()=>{M.current!==null&&window.cancelAnimationFrame(M.current),_.current&&clearTimeout(_.current)},[]);let d=n||f,S=(0,je.useMemo)(()=>d?e.find(L=>L.id===d.id)??null:null,[d,e]),C=(0,je.useCallback)(L=>{if(b&&f?.id===L.id){x(!1),g(null),c?.();return}x(!0),g(L),s?.(L)},[b,f,s,c]),T=(0,je.useCallback)(L=>{l?.(L),p&&!b&&(_.current&&(clearTimeout(_.current),_.current=null),L?g(L):_.current=window.setTimeout(()=>{g(null),c?.(),_.current=null},100))},[b,l,p,c]),E=(0,je.useCallback)(()=>{x(!1),g(null),c?.()},[c]),k=(0,je.useCallback)(L=>{let X=L.target;if(X.closest?.(".ri-annotationMarker")||X.closest?.(".ri-viewAnnotationPopup")||X.closest?.(".annotation-html-wrapper"))return;let O=r.current;O&&O.contains(X)&&(x(!1),g(null),c?.())},[r,c]),D=(0,je.useCallback)(L=>{L.key==="Escape"&&b&&(x(!1),g(null),c?.())},[b,c]);(0,je.useEffect)(()=>{let L=r.current;return L&&(L.addEventListener("click",k),L.addEventListener("pointerdown",k)),document.addEventListener("keydown",D),()=>{L&&(L.removeEventListener("click",k),L.removeEventListener("pointerdown",k)),document.removeEventListener("keydown",D)}},[r,k,D]);let I=(0,je.useMemo)(()=>(t?.model.rotation??[0,0,0]).map(L=>L*Math.PI/180),[t?.model.rotation]);return(0,je.useEffect)(()=>{u()},[u,I]),(0,Qa.useFrame)((L,X)=>{if(!w.current)return;w.current.rotation.x=Si.MathUtils.lerp(w.current.rotation.x,I[0],1-Math.exp(-5*X)),w.current.rotation.y=Si.MathUtils.lerp(w.current.rotation.y,I[1],1-Math.exp(-5*X)),w.current.rotation.z=Si.MathUtils.lerp(w.current.rotation.z,I[2],1-Math.exp(-5*X));let{rotation:O}=w.current;Math.abs(O.x-I[0])+Math.abs(O.y-I[1])+Math.abs(O.z-I[2])>1e-4&&u()}),(0,On.jsxs)("group",{ref:w,children:[e.map(L=>{let X=`${L.worldPosition.join(",")}-${L.title}-${L.id}`;return(0,On.jsx)(tE,{annotation:L,occluders:y,worldPositionsRef:o,onClick:C,onHover:T,showAnnotationOnHover:p},X)}),S?(0,On.jsx)(nE,{annotation:S,occluders:y,popupRef:i,onClose:E,hideCloseButton:h},`popup-${S.id}`):null]})}var fo=require("react"),Np=require("@react-three/drei");var Dp=require("react"),ew=require("@react-three/drei"),tw=require("@react-three/fiber"),_i=require("three");var Lp=require("react/jsx-runtime");function es(e){return(0,tw.useThree)(n=>Bi(n.gl))?(0,Lp.jsx)(rE,{...e}):(0,Lp.jsx)(ew.Line,{points:e.points,color:e.color,lineWidth:e.lineWidth,dashed:e.dashed})}function rE({points:e,color:t,dashed:n=!1}){let i=(0,Dp.useMemo)(()=>{let r=new _i.BufferGeometry().setFromPoints(e.map(s=>s instanceof _i.Vector3?s:new _i.Vector3(...s))),o=n?new _i.LineDashedMaterial({color:t,dashSize:.02,gapSize:.02}):new _i.LineBasicMaterial({color:t}),a=new _i.Line(r,o);return n&&a.computeLineDistances(),a},[e,t,n]);return(0,Dp.useEffect)(()=>()=>{i.geometry.dispose(),i.material.dispose()},[i]),(0,Lp.jsx)("primitive",{object:i})}var En=require("three");var He=require("react/jsx-runtime"),ts="#22d3ee",iE="#facc15";function vl(e,t){let n=e<10?e.toFixed(3):e.toFixed(2);return t?`${n} ${t}`:n}function nw(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2,(e[2]+t[2])/2]}function Qo({position:e,children:t}){return(0,He.jsx)(Np.Html,{center:!0,position:e,zIndexRange:[20,0],style:{pointerEvents:"none"},children:(0,He.jsx)("div",{className:"ri-measureLabel",children:t})})}function rw({positions:e,triangles:t}){let n=(0,fo.useMemo)(()=>{let i=new En.Vector3(...e[0]),r=new En.BufferGeometry;return r.setAttribute("position",new En.Float32BufferAttribute(e.flatMap(o=>new En.Vector3(...o).sub(i).toArray()),3)),r.setIndex(t.flat()),r},[e,t]);return(0,fo.useEffect)(()=>()=>n.dispose(),[n]),(0,He.jsx)("mesh",{position:e[0],geometry:n,raycast:()=>{},renderOrder:100,children:(0,He.jsx)("meshBasicMaterial",{color:ts,side:En.DoubleSide,transparent:!0,opacity:.18,depthWrite:!1})})}var oE=[[0,1,2]];function aE({positions:e}){let t=Du(e);if(t===null)return null;let n=new En.Vector3(...e[1]),i=new En.Vector3(...e[0]).sub(n),r=new En.Vector3(...e[2]).sub(n),o=Math.min(i.length(),r.length())*.22;i.normalize(),r.normalize();let a=i.clone().cross(r);a.lengthSq()<1e-12&&a.copy(i).cross(Math.abs(i.y)<.9?new En.Vector3(0,1,0):new En.Vector3(1,0,0)),a.normalize();let s=t*Math.PI/180,l=Array.from({length:33},(h,p)=>i.clone().applyAxisAngle(a,s*p/32).multiplyScalar(o).add(n).toArray()),c=i.clone().applyAxisAngle(a,s/2).multiplyScalar(o*1.4).add(n).toArray();return(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(es,{points:l,color:ts,lineWidth:2}),(0,He.jsxs)(Qo,{position:c,children:[t.toFixed(2),"\xB0"]})]})}function sE({box:e,unit:t}){let n=(0,fo.useMemo)(()=>[(e.min[0]+e.max[0])/2,(e.min[1]+e.max[1])/2,(e.min[2]+e.max[2])/2],[e.min,e.max]),i=(0,fo.useMemo)(()=>{let[s,l,c]=e.size,h=new En.BoxGeometry(s||1e-4,l||1e-4,c||1e-4),p=new En.EdgesGeometry(h);return h.dispose(),p},[e.size]);(0,fo.useEffect)(()=>()=>{i.dispose()},[i]);let[r,o,a]=e.size;return(0,He.jsxs)("group",{position:n,children:[(0,He.jsx)("lineSegments",{geometry:i,children:(0,He.jsx)("lineBasicMaterial",{color:iE})}),(0,He.jsxs)(Qo,{position:[0,-o/2,a/2],children:["W ",vl(r,t)]}),(0,He.jsxs)(Qo,{position:[-r/2,0,a/2],children:["H ",vl(o,t)]}),(0,He.jsxs)(Qo,{position:[r/2,-o/2,0],children:["D ",vl(a,t)]})]})}function Yf({points:e,unit:t,box:n,showDimensions:i,tool:r="distance",areaClosed:o=!1,snapPreview:a}){let s=(0,fo.useMemo)(()=>e.map(h=>h.position),[e]),l=(0,fo.useMemo)(()=>r==="area"&&o?Nu(s):null,[r,o,s]),c=r==="pointToPlane"&&e.length===2?xy(e[0],e[1].position):null;return(0,He.jsxs)("group",{children:[e.map(h=>(0,He.jsx)(Np.Html,{center:!0,position:h.position,zIndexRange:[15,0],style:{pointerEvents:"none"},children:(0,He.jsx)("div",{className:`ri-measureDot${h.snapped?" ri-measureDot--snapped":""}`})},h.id)),r==="distance"&&e.slice(1).map((h,p)=>{let u=e[p].position,m=h.position,f=new En.Vector3(...u).distanceTo(new En.Vector3(...m));return(0,He.jsxs)("group",{children:[(0,He.jsx)(es,{points:[u,m],color:ts,lineWidth:2}),(0,He.jsx)(Qo,{position:nw(u,m),children:vl(f,t)})]},`${e[p].id}-${h.id}`)}),(r==="angle"||r==="area")&&s.length>=2&&(0,He.jsx)(es,{points:o?[...s,s[0]]:s,color:ts,lineWidth:2}),r==="angle"&&(0,He.jsx)(aE,{positions:s}),l&&!("error"in l)&&(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(rw,{positions:s,triangles:l.triangles}),(0,He.jsx)(Qo,{position:l.center,children:vl(l.area,t?`${t}\xB2`:"")})]}),r==="pointToPlane"&&e[0]?.faceVertices&&(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(rw,{positions:e[0].faceVertices,triangles:oE}),(0,He.jsx)(es,{points:[...e[0].faceVertices,e[0].faceVertices[0]],color:ts,lineWidth:1}),e.length===1&&(0,He.jsx)(Qo,{position:e[0].position,children:"Reference plane"})]}),c&&(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(es,{points:[e[1].position,c.projection],color:ts,lineWidth:2}),(0,He.jsx)(es,{points:[e[0].position,c.projection],color:ts,lineWidth:1,dashed:!0}),(0,He.jsx)(Qo,{position:nw(e[1].position,c.projection),children:vl(c.distance,t)})]}),a&&(0,He.jsxs)(Np.Html,{center:!0,position:a.position,zIndexRange:[20,0],style:{pointerEvents:"none"},children:[(0,He.jsx)("div",{className:"ri-measureSnapTarget"}),(0,He.jsx)("div",{className:"ri-measureSnapLabel",children:a.snapped==="vertex"?"Vertex":"Edge"})]}),i&&n?(0,He.jsx)(sE,{box:n,unit:t}):null]})}var ea=require("lucide-react"),Op=require("react"),Nt=require("react/jsx-runtime");function Kf(e){let t=Me(),n=(0,Op.useRef)(null);(0,Op.useLayoutEffect)(()=>{if(!n.current)return;let s=()=>e.onHeight(n.current?.getBoundingClientRect().height??34),l=new ResizeObserver(s);return l.observe(n.current),s(),()=>l.disconnect()},[e.onHeight]);let{tool:i,pointCount:r,areaClosed:o}=e,a=i==="angle"?[t("angleFirstArmHint"),t("angleVertexHint"),t("angleSecondArmHint"),t("angleNewHint")][r]:i==="area"?t(o?"areaNewHint":"areaCornersHint"):i==="pointToPlane"?[t("pointToPlaneFaceHint"),t("pointToPlanePointHint"),t("pointToPlaneNewHint")][r]:t("distanceHint");return(0,Nt.jsxs)("div",{ref:n,className:"ri-measureTools",style:{top:e.top},children:[(0,Nt.jsxs)("div",{className:"ri-measureToolbarRow",children:[(0,Nt.jsx)("button",{type:"button",className:`ri-measureButton ${e.active?"ri-measureButton--active":""}`,disabled:e.disabled,onClick:e.onToggle,title:e.active?t("stopMeasuring"):t("startMeasuring"),"aria-pressed":e.active,children:(0,Nt.jsx)(ea.PencilRuler,{size:16})}),(0,Nt.jsx)("button",{type:"button",className:`ri-measureButton ${e.showDimensions?"ri-measureButton--active":""}`,disabled:e.disabled,onClick:e.onDimensions,title:t("toggleBoundingDimensions"),"aria-pressed":e.showDimensions,children:(0,Nt.jsx)(ea.RulerDimensionLine,{size:16})}),e.active&&(0,Nt.jsxs)(Nt.Fragment,{children:[(0,Nt.jsxs)("select",{className:"ri-measureSelect","aria-label":t("measurementTool"),value:i,disabled:e.disabled,onChange:s=>e.onTool(s.target.value),children:[(0,Nt.jsx)("option",{value:"distance",children:t("distance")}),(0,Nt.jsx)("option",{value:"angle",children:t("angle")}),(0,Nt.jsx)("option",{value:"area",children:t("area")}),(0,Nt.jsx)("option",{value:"pointToPlane",children:t("pointToPlane")})]}),(0,Nt.jsxs)("select",{className:"ri-measureSelect","aria-label":t("measurementSnapping"),value:e.snap,disabled:e.disabled,onChange:s=>e.onSnap(s.target.value),children:[(0,Nt.jsx)("option",{value:"none",children:t("noSnapping")}),(0,Nt.jsx)("option",{value:"auto",children:t("snapAuto")}),(0,Nt.jsx)("option",{value:"vertex",children:t("snapVertex")}),(0,Nt.jsx)("option",{value:"edge",children:t("snapEdge")})]})]}),r>0&&(0,Nt.jsxs)(Nt.Fragment,{children:[(0,Nt.jsx)("button",{type:"button",className:"ri-measureButton",onClick:e.onUndo,disabled:e.disabled,title:t("undoMeasurementPoint"),children:(0,Nt.jsx)(ea.Undo2,{size:16})}),(0,Nt.jsx)("button",{type:"button",className:"ri-measureButton",onClick:e.onClear,disabled:e.disabled,title:t("clearMeasurements"),children:(0,Nt.jsx)(ea.Eraser,{size:16})})]}),e.active&&i==="area"&&!o&&(0,Nt.jsx)("button",{type:"button",className:"ri-measureFinish",onClick:e.onFinishArea,disabled:e.disabled||r<3,children:t("finishArea")})]}),e.active&&(0,Nt.jsx)("div",{className:`ri-measureHint${e.error?" ri-measureHint--error":""}`,role:"status",children:e.error?t.message(e.error):a})]})}var xt=require("react"),ns=require("@react-three/xr"),sw=require("@react-three/fiber"),rd=require("three"),Mi=require("react/jsx-runtime"),lE=1,iw=1,cE=.1,dE=10;function uE(e,t){let[n,i,r]=e.size,o=(e.min[0]+e.max[0])/2,a=(e.min[2]+e.max[2])/2,s=Math.max(n,i,r)||1;return{scale:t==="real-world"?1:lE/s,offset:[-o,-e.min[1],-a]}}function ow(e){let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.hypot(t,n)}function aw(e){let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.atan2(n,t)}var pE=(0,xt.forwardRef)(function({box:t,scaleMode:n,children:i,onARStateChange:r},o){let a=(0,xt.useRef)(null),s=(0,xt.useRef)(null),l=(0,xt.useRef)(null),c=(0,ns.useXR)(L=>L.session!=null),h=(0,ns.useXR)(L=>L.mode==="immersive-ar"),p=(0,xt.useMemo)(()=>t?uE(t,n):null,[t,n]),u=(0,xt.useRef)(new rd.Vector3(0,0,-iw)),m=(0,xt.useRef)(1),f=(0,xt.useRef)(0),g=(0,xt.useRef)(!0),b=(0,xt.useRef)(!1),x=(0,xt.useMemo)(()=>new rd.Matrix4,[]),v=(0,xt.useRef)(new rd.Vector3),w=(0,xt.useRef)(!1),M=(0,xt.useRef)(null),_=(0,xt.useRef)(!1),y=(0,xt.useRef)(0),P=(0,xt.useRef)(0),d=(0,xt.useRef)(1),S=(0,xt.useRef)(0),C=(0,xt.useCallback)(()=>{if(!r||!h)return;let L={canPlace:w.current,isPlacementMode:g.current,isModelPlaced:b.current},X=M.current;X&&X.canPlace===L.canPlace&&X.isPlacementMode===L.isPlacementMode&&X.isModelPlaced===L.isModelPlaced||(M.current=L,r(L))},[h,r]),T=(0,xt.useCallback)(()=>!h||!w.current?!1:(u.current.copy(v.current),b.current=!0,g.current=!1,C(),!0),[C,h]),E=(0,xt.useCallback)(()=>{h&&(g.current=!0,C())},[C,h]),k=(0,xt.useCallback)(()=>{let L=T();return!L&&h&&(g.current=!1,C()),L},[C,h,T]),D=(0,xt.useCallback)(()=>{h&&(g.current=!1,C())},[C,h]);(0,xt.useImperativeHandle)(o,()=>({placeCurrent:T,startPlacementMode:E,finishPlacementMode:k,cancelPlacementMode:D}),[D,k,T,E]),(0,xt.useEffect)(()=>{if(!c){u.current.set(0,0,-iw),m.current=1,f.current=0,w.current=!1,_.current=!1,g.current=!0,b.current=!1,M.current=null;return}h&&(w.current=!1,_.current=!1,g.current=!0,b.current=!1,M.current=null,C())},[C,c,h]),(0,ns.useXRHitTest)((L,X)=>{if(!h||L.length===0){w.current&&(w.current=!1,C());return}X(x,L[0])&&(v.current.setFromMatrixPosition(x),w.current||(w.current=!0,C()))},"viewer"),(0,ns.useXRInputSourceEvent)("all","select",()=>{!h||_.current||!g.current||T()},[h,T]),(0,xt.useEffect)(()=>{if(!h)return;let L=B=>{B.touches.length===2&&(_.current=!0,y.current=ow(B.touches),P.current=aw(B.touches),d.current=m.current,S.current=f.current)},X=B=>{if(!_.current||B.touches.length!==2)return;B.preventDefault();let re=ow(B.touches);if(y.current>0){let te=re/y.current;m.current=Math.min(dE,Math.max(cE,d.current*te))}let ke=aw(B.touches);f.current=S.current-(ke-P.current)},O=B=>{B.touches.length===0&&requestAnimationFrame(()=>{_.current=!1})};return window.addEventListener("touchstart",L),window.addEventListener("touchmove",X,{passive:!1}),window.addEventListener("touchend",O),window.addEventListener("touchcancel",O),()=>{window.removeEventListener("touchstart",L),window.removeEventListener("touchmove",X),window.removeEventListener("touchend",O),window.removeEventListener("touchcancel",O)}},[h]),(0,sw.useFrame)(()=>{let L=a.current,X=s.current;if(!L||!X)return;!c||!p?(L.visible=!0,L.position.set(0,0,0),L.rotation.set(0,0,0),X.scale.setScalar(1)):(L.visible=!h||b.current,L.position.copy(u.current),L.rotation.set(0,f.current,0),X.scale.setScalar(p.scale*m.current));let O=l.current;if(O){let B=h&&g.current&&w.current;O.visible=B,B&&O.position.copy(v.current)}});let I=c&&p?p.offset:[0,0,0];return(0,Mi.jsxs)(Mi.Fragment,{children:[(0,Mi.jsxs)("mesh",{ref:l,visible:!1,rotation:[-Math.PI/2,0,0],children:[(0,Mi.jsx)("ringGeometry",{args:[.05,.07,32]}),(0,Mi.jsx)("meshBasicMaterial",{color:"#22d3ee",transparent:!0,opacity:.95})]}),(0,Mi.jsx)("group",{ref:a,children:(0,Mi.jsx)("group",{ref:s,children:(0,Mi.jsx)("group",{position:I,children:i})})})]})}),lw=pE;var Ip=require("react");var mE="ri:license-grant:v1",hE={"260cd89ea13f":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEwjr3ofKTkkcxOM0GYl/RlJj9JsuyjSF8sYmCd2YqsHJCEO8EvlNDrO2Kl4agFKo6dRhyR2/oWeiU6P9WIqRbvw=="},cw=new Map;function uw(e){let t=atob(e);return Uint8Array.from(t,n=>n.charCodeAt(0)).buffer}function dw(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return uw(t.padEnd(Math.ceil(t.length/4)*4,"="))}function fE(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===1&&typeof t.licenseKeyHash=="string"&&typeof t.domain=="string"&&(t.environment==="development"||t.environment==="production")&&typeof t.tier=="string"&&t.tier.length>0&&typeof t.issuedAt=="number"&&Number.isInteger(t.issuedAt)&&typeof t.expiresAt=="number"&&Number.isInteger(t.expiresAt)}async function Bp(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e.trim())),n=String.fromCharCode(...new Uint8Array(t));return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Zf(e,t){return`${mE}:${t}:${e}`}function gE(e,t){let n=cw.get(e);if(n)return n;let i=crypto.subtle.importKey("spki",uw(t),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);return cw.set(e,i),i}async function Jf(e,t,n){if(!globalThis.crypto?.subtle)return null;try{let[i,r,o,a,...s]=e.split("."),l=hE[r];if(i!=="ri1"||!l||!o||!a||s.length>0)return null;let c=JSON.parse(new TextDecoder().decode(dw(o)));if(!fE(c)||!await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},await gE(r,l),dw(a),new TextEncoder().encode(`${i}.${r}.${o}`)))return null;let p=Math.floor(Date.now()/1e3),u=c.expiresAt-c.issuedAt;return c.licenseKeyHash!==t||c.domain!==n||c.expiresAt<=p||c.issuedAt>p+300||u<=0||u>43200?null:{environment:c.environment,tier:c.tier,expiresAt:c.expiresAt}}catch{return null}}async function pw(e,t,n){try{return await Jf(e,await Bp(t),n)}catch{return null}}async function mw(e,t,n){try{let i=await Bp(t);return await Jf(e,i,n)?(localStorage.setItem(Zf(i,n),e),!0):!1}catch{return!1}}async function hw(e,t){try{let n=await Bp(e),i=Zf(n,t),r=localStorage.getItem(i);if(!r)return null;let o=await Jf(r,n,t);return o||localStorage.removeItem(i),o}catch{return null}}async function Qf(e,t){try{let n=await Bp(e);localStorage.removeItem(Zf(n,t))}catch{}}var bE=["localhost","127.0.0.1","0.0.0.0"],vE=e=>bE.includes(e)||e.endsWith(".local")||e.endsWith(".localhost"),bw="https://react-immersive.liveroom.dev/api/validate-license",vw=()=>typeof window<"u",xE=300*1e3,yE=5e3,wE=400,tg=new Map,eg=new Map,ta=class extends Error{},xw=async(e,t,n)=>{let i=await hw(e,t);return i?(console.warn("[react-immersive] License server unreachable \u2014 using a previously verified, time-limited offline grant."),{status:"valid",reason:"Previously verified offline grant",environment:i.environment,tier:i.tier,isLocalDomain:n}):null},fw=async(e,t,n)=>{let i=await xw(e,t,n);return i||(console.warn("[react-immersive] License server unreachable and no valid offline grant is available \u2014 license validation failed."),{status:"invalid",reason:"Could not reach license server",isLocalDomain:n})},SE=e=>e instanceof ta||e instanceof TypeError,_E=()=>new Promise(e=>setTimeout(e,wE)),ME=e=>e==="development"||e==="production",CE=e=>{if(!e||typeof e!="object")return!1;let t=e;return!(typeof t.valid!="boolean"||t.reason!==void 0&&typeof t.reason!="string"||t.environment!==void 0&&!ME(t.environment)||t.tier!==void 0&&typeof t.tier!="string"||t.offlineGrant!==void 0&&typeof t.offlineGrant!="string")},TE=e=>{if(!e||typeof e!="object")return null;let t=e,n=t.reason??t.error;return typeof n=="string"&&n.trim()?n:null},yw=(e,t,n)=>`${n}::${e}::${t}`,ww=e=>{let t=tg.get(e);return t?Date.now()-t.timestamp>xE?(tg.delete(e),null):t.result:null},PE=(e,t)=>({status:e.valid?"valid":"invalid",reason:e.reason,environment:e.environment,tier:e.tier,isLocalDomain:t}),AE=(e,t)=>({status:"invalid",reason:e,isLocalDomain:t});async function EE(e,t,n,i){let r=yw(e,t,i),o=ww(r);if(o)return o;let a=eg.get(r);if(a)return a;let s=(async()=>{for(let l=0;l<2;l+=1)try{return await RE(e,t,n,r,i)}catch(c){if(!SE(c))throw c;if(l===0){let h=await xw(e,t,n);if(h)return h;await _E();continue}return fw(e,t,n)}return fw(e,t,n)})().finally(()=>{eg.delete(r)});return eg.set(r,s),s}async function RE(e,t,n,i,r){let o=new AbortController,a=setTimeout(()=>o.abort(),yE),s;try{s=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store",signal:o.signal,body:JSON.stringify({licenseKey:e,domain:t})})}catch(h){throw o.signal.aborted?new ta("License validation timed out"):h}finally{clearTimeout(a)}let l;try{l=await s.json()}catch{throw new ta(`License server returned a non-JSON response${s.status?` (${s.status})`:""}`)}if(!s.ok){if(s.status===429||s.status>=500)throw new ta(`License server error (${s.status})`);let h=TE(l)??`License validation failed${s.status?` (${s.status})`:""}`;return await Qf(e,t),AE(h,n)}if(!CE(l))throw new ta("License server returned an unexpected payload");let c=PE(l,n);if(c.status==="valid"&&r!==bw){let h=l.offlineGrant?await pw(l.offlineGrant,e,t):null;if(!h)throw new ta("License validation endpoint did not return a verifiable signed grant");c={...c,environment:h.environment,tier:h.tier}}return c.status==="valid"?(tg.set(i,{result:c,timestamp:Date.now()}),l.offlineGrant&&(await mw(l.offlineGrant,e,t)||console.warn("[react-immersive] The license server returned an invalid offline grant; it was not cached."))):await Qf(e,t),c}var gw=(e,t)=>{let n=e.trim();return!vw()||!n?null:ww(yw(n,window.location.hostname.toLowerCase(),t))},zp=(e,t=bw)=>{let[n,i]=(0,Ip.useState)(()=>gw(e,t)??{status:"checking",isLocalDomain:!1});return(0,Ip.useEffect)(()=>{if(!vw())return;let r=!1,o=p=>{r||i(p)},a=e.trim(),s=window.location.hostname.toLowerCase(),l=vE(s),c=gw(e,t);return c?(o(c),()=>{r=!0}):(o({status:"checking",isLocalDomain:l}),a?((async()=>{try{o(await EE(a,s,l,t))}catch(p){let u=p instanceof TypeError?"Could not reach license server":p instanceof Error?p.message:"License validation failed";o({status:"invalid",reason:u,isLocalDomain:l})}})(),()=>{r=!0}):(o({status:"invalid",reason:"No license key provided",isLocalDomain:l}),()=>{r=!0}))},[e,t]),n};var fn=require("react");var Yn=require("react/jsx-runtime"),kE={up:{width:38,height:22},down:{width:38,height:22},left:{width:22,height:38},right:{width:22,height:38}},LE={up:"4 16 12 8 20 16",down:"4 8 12 16 20 8",left:"16 4 8 12 16 20",right:"8 4 16 12 8 20"},Up=({direction:e})=>{let t=kE[e],n=LE[e];return(0,Yn.jsxs)("svg",{"aria-hidden":"true",className:"mc__arrow-icon",focusable:"false",viewBox:"0 0 24 24",width:t.width,height:t.height,fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:`${t.width}px`,height:`${t.height}px`,pointerEvents:"none",padding:0,margin:0,overflow:"visible"},children:[(0,Yn.jsx)("polyline",{points:n,stroke:"rgba(0, 0, 0, 0.9)",strokeWidth:"6",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Yn.jsx)("polyline",{points:n,stroke:"#2095F2",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})},go=16,DE={"bottom-left":{bottom:go,left:go,top:"auto",right:"auto",transform:"none"},"bottom-right":{bottom:go,right:go,top:"auto",left:"auto",transform:"none"},"top-left":{top:go,left:go,bottom:"auto",right:"auto",transform:"none"},"top-right":{top:go,right:go,bottom:"auto",left:"auto",transform:"none"},center:{top:"50%",left:"50%",bottom:"auto",right:"auto",transform:"translate(-50%, -50%)"},"center-bottom":{bottom:-10,left:"50%",top:"auto",right:"auto",transform:"translateX(-50%)"},"center-top":{top:go,left:"50%",bottom:"auto",right:"auto",transform:"translateX(-50%)"}},NE=({controlsRef:e,enabled:t=!0,opacity:n=.9,moveSensitivity:i=.001,rotateSensitivity:r=.01,position:o="center-bottom"})=>{let a=Me(),s=(0,fn.useRef)(null),[l,c]=(0,fn.useState)({x:0,y:0}),h=(0,fn.useRef)(!1),p=(0,fn.useRef)({x:0,y:0}),u=(0,fn.useRef)(void 0),m=(0,fn.useRef)(void 0),f=(0,fn.useRef)(null),g=(0,fn.useRef)(0),b=()=>e.current,x=(D,I,L)=>{let X=Math.hypot(D,I);if(X>L){let O=L/X;return{x:D*O,y:I*O}}return{x:D,y:I}},v=D=>{let L=Math.abs(D);return L<.12?0:Math.sign(D)*((L-.12)/(1-.12))},w=(0,fn.useCallback)(()=>{let D=()=>{let{x:I,y:L}=p.current,X=v(I),O=v(L);if(t&&(X!==0||O!==0)){let B=b();B&&B.rotate(-X*r,-O*r,!0)}u.current=requestAnimationFrame(D)};u.current=requestAnimationFrame(D)},[t,r]),M=(0,fn.useCallback)(()=>{u.current&&cancelAnimationFrame(u.current)},[]),_=(0,fn.useCallback)((D,I)=>{if(!s.current||!h.current)return;let L=s.current.getBoundingClientRect(),X=L.left+L.width/2,O=L.top+L.height/2,B=L.width/2-18,re=D-X,ke=I-O,te=x(re,ke,B);c(te),p.current={x:te.x/B,y:te.y/B}},[]),y=(0,fn.useCallback)(D=>{if(!t)return;D.preventDefault(),D.stopPropagation(),h.current=!0,w();let I="touches"in D?D.touches[0]:D;_(I.clientX,I.clientY)},[t,w,_]),P=(0,fn.useCallback)(D=>{if(!h.current)return;D.preventDefault();let I="touches"in D?D.touches[0]:D;_(I.clientX,I.clientY)},[_]),d=(0,fn.useCallback)(()=>{h.current=!1,c({x:0,y:0}),p.current={x:0,y:0},M()},[M]),S=i*10,C=(0,fn.useCallback)(D=>{t&&b()?.forward(D*S,!0)},[t,S]),T=(0,fn.useCallback)(D=>{t&&b()?.truck(D*S,0,!0)},[t,S]),E=(0,fn.useCallback)((D,I,L)=>{if(!t)return;m.current&&cancelAnimationFrame(m.current),f.current={control:D,amount:I,action:L},g.current=0,L(I);let X=O=>{if(!f.current)return;if(g.current===0){g.current=O,m.current=requestAnimationFrame(X);return}if(O-g.current>200){let{amount:re,action:ke}=f.current;ke(re),g.current=O}m.current=requestAnimationFrame(X)};m.current=requestAnimationFrame(X)},[t]),k=(0,fn.useCallback)(D=>{f.current?.control===D&&(m.current&&(cancelAnimationFrame(m.current),m.current=void 0),f.current=null,g.current=0)},[]);return(0,fn.useEffect)(()=>(window.addEventListener("mousemove",P),window.addEventListener("mouseup",d),window.addEventListener("touchmove",P,{passive:!1}),window.addEventListener("touchend",d),window.addEventListener("touchcancel",d),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",d),window.removeEventListener("touchmove",P),window.removeEventListener("touchend",d),window.removeEventListener("touchcancel",d),M(),m.current&&cancelAnimationFrame(m.current)}),[P,d,M]),t?(0,Yn.jsx)("div",{className:"mc__wrapper",style:{opacity:n,...DE[o]},children:(0,Yn.jsxs)("div",{className:"mc__dpad",children:[(0,Yn.jsx)("button",{"aria-label":a("moveForward"),className:"mc__arrow mc__arrow--up",onMouseDown:()=>E("up",1,C),onMouseUp:()=>k("up"),onMouseLeave:()=>k("up"),onTouchStart:D=>{D.preventDefault(),E("up",1,C)},onTouchEnd:()=>k("up"),onTouchCancel:()=>k("up"),children:(0,Yn.jsx)(Up,{direction:"up"})}),(0,Yn.jsxs)("div",{className:"mc__middle-row",children:[(0,Yn.jsx)("button",{"aria-label":a("moveLeft"),className:"mc__arrow mc__arrow--left",onMouseDown:()=>E("left",-1,T),onMouseUp:()=>k("left"),onMouseLeave:()=>k("left"),onTouchStart:D=>{D.preventDefault(),E("left",-1,T)},onTouchEnd:()=>k("left"),onTouchCancel:()=>k("left"),children:(0,Yn.jsx)(Up,{direction:"left"})}),(0,Yn.jsx)("div",{ref:s,className:"mc__joystick",onMouseDown:y,onTouchStart:y,children:(0,Yn.jsx)("div",{className:"mc__knob",style:{transform:`translate(${l.x}px, ${l.y}px)`}})}),(0,Yn.jsx)("button",{"aria-label":a("moveRight"),className:"mc__arrow mc__arrow--right",onMouseDown:()=>E("right",1,T),onMouseUp:()=>k("right"),onMouseLeave:()=>k("right"),onTouchStart:D=>{D.preventDefault(),E("right",1,T)},onTouchEnd:()=>k("right"),onTouchCancel:()=>k("right"),children:(0,Yn.jsx)(Up,{direction:"right"})})]}),(0,Yn.jsx)("button",{"aria-label":a("moveBackward"),className:"mc__arrow mc__arrow--down",onMouseDown:()=>E("down",-1,C),onMouseUp:()=>k("down"),onMouseLeave:()=>k("down"),onTouchStart:D=>{D.preventDefault(),E("down",-1,C)},onTouchEnd:()=>k("down"),onTouchCancel:()=>k("down"),children:(0,Yn.jsx)(Up,{direction:"down"})})]})}):null},Sw=NE;var tn=require("react"),rg=require("three");var ng=new WeakSet;function xl(e){ng.add(e)}function _w(e){let t=ng.has(e);return t&&ng.delete(e),t}function Mw(e){return[e.x,e.y,e.z]}function bo(e,t){let n=new rg.Vector3,i=new rg.Vector3;return t.getPosition(n),t.getTarget(i),{position:Mw(n),target:Mw(i),fov:"fov"in e&&typeof e.fov=="number"?e.fov:null,zoom:"zoom"in e&&typeof e.zoom=="number"?e.zoom:1,azimuthAngle:t.azimuthAngle,polarAngle:t.polarAngle}}function OE(e,t){return e?e.position[0]===t.position[0]&&e.position[1]===t.position[1]&&e.position[2]===t.position[2]&&e.target[0]===t.target[0]&&e.target[1]===t.target[1]&&e.target[2]===t.target[2]&&e.fov===t.fov&&e.zoom===t.zoom&&e.azimuthAngle===t.azimuthAngle&&e.polarAngle===t.polarAngle:!1}async function id(e,t,n=.6){let i=e.smoothTime;e.smoothTime=il(e,n);try{return await t()}finally{e.smoothTime=i}}function Cw(e={}){let t=(0,tn.useRef)(e);t.current=e;let n=(0,tn.useRef)(null),[i,r]=(0,tn.useState)(null),[o,a]=(0,tn.useState)(()=>({...e.presets})),s=(0,tn.useRef)(o);s.current=o;let l=(0,tn.useCallback)(S=>{r(C=>OE(C,S)?C:S)},[]),c=(0,tn.useCallback)(S=>{l(S)},[l]),h=(0,tn.useRef)(null),p=(0,tn.useRef)(null),u=(0,tn.useRef)(null),m=(0,tn.useCallback)(S=>{n.current=S;let C=bo(S.raw.controls.camera,S.raw.controls);l(C),S.raw.scene!==p.current&&(p.current=S.raw.scene,h.current=null,u.current=null),S.homeCameraState&&!h.current&&(h.current=S.homeCameraState);let{initialPosition:T,initialTarget:E,initialTransition:k=!1}=t.current;if((T||E)&&S.raw.scene&&(T||S.homeCameraState)&&u.current!==S.raw.controls){u.current=S.raw.controls,S.homeCameraState||xl(S.raw.controls);let D=T??C.position,I=E??C.target;S.raw.controls.setLookAt(D[0],D[1],D[2],I[0],I[1],I[2],k).then(()=>{if(n.current?.raw.controls!==S.raw.controls)return;let L=bo(S.raw.controls.camera,S.raw.controls);h.current={position:L.position,target:L.target},l(L)}).catch(()=>{})}},[l]),f=(0,tn.useCallback)(async()=>{let S=n.current,C=S?.raw.controls;if(!C)return!1;try{let T=h.current;return T?await id(C,()=>C.setLookAt(T.position[0],T.position[1],T.position[2],T.target[0],T.target[1],T.target[2],!0)):S?.raw.scene?await id(C,()=>C.fitToBox(S.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})):await id(C,()=>C.reset(!0)),!0}catch{return!1}},[]),g=(0,tn.useCallback)(async()=>{let S=n.current;if(!S?.raw.controls||!S.raw.scene)return!1;try{return await id(S.raw.controls,()=>S.raw.controls.fitToBox(S.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),b=(0,tn.useCallback)(async S=>{let C=n.current;if(!C?.raw.controls)return!1;let T=jo(C.objectBindings,S);if(!T)return!1;let E=C.raw.nodes[T];if(!E)return!1;try{return await id(C.raw.controls,()=>C.raw.controls.fitToBox(E,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),x=(0,tn.useCallback)(async(S,C=!0)=>{let T=n.current?.raw.controls;if(!T)return!1;try{return n.current?.homeCameraState||xl(T),await T.setTarget(S[0],S[1],S[2],C),l(bo(T.camera,T)),!0}catch{return!1}},[l]),v=(0,tn.useCallback)(async(S,C=!0)=>{let T=n.current?.raw.controls;if(!T)return!1;try{n.current?.homeCameraState||xl(T);let E=[T.setLookAt(S.position[0],S.position[1],S.position[2],S.target[0],S.target[1],S.target[2],C)];S.azimuthAngle!=null&&S.polarAngle!=null&&E.push(T.rotateTo(S.azimuthAngle,S.polarAngle,C)),await Promise.all(E);let k=T.camera,D=!1;return S.fov!=null&&"fov"in k&&typeof k.fov=="number"&&(k.fov=S.fov,D=!0),S.zoom!=null&&"zoom"in k&&typeof k.zoom=="number"&&(k.zoom=S.zoom,D=!0),D&&"updateProjectionMatrix"in k&&k.updateProjectionMatrix(),l(bo(k,T)),!0}catch{return!1}},[l]),w=(0,tn.useCallback)((S,C=!0)=>v(S,C),[v]),M=(0,tn.useCallback)((S,C,T=!0)=>v({position:S,target:C},T),[v]),_=(0,tn.useCallback)(async(S,C,T=!0)=>{let E=n.current?.raw.controls;if(!E)return!1;try{return n.current?.homeCameraState||xl(E),await E.rotateTo(S*Math.PI/180,C*Math.PI/180,T),l(bo(E.camera,E)),!0}catch{return!1}},[l]),y=(0,tn.useCallback)(async(S,C=!0)=>{let T=n.current?.raw.controls;if(!T)return!1;try{return n.current?.homeCameraState||xl(T),await T.dollyTo(S,C),l(bo(T.camera,T)),!0}catch{return!1}},[l]),P=(0,tn.useCallback)(S=>{let C=n.current?.raw.controls,T=S.trim();if(!C||!T)return null;let E=bo(C.camera,C);return s.current={...s.current,[T]:E},a(k=>({...k,[T]:E})),l(E),E},[l]),d=(0,tn.useCallback)((S,C=!0)=>{let T=s.current[S];return T?v(T,C):Promise.resolve(!1)},[v]);return{cameraState:i,cameraPresets:o,resetView:f,focusObject:b,fitScene:g,setCameraTarget:x,setCameraState:w,lookAt:M,orbitTo:_,dollyTo:y,savePreset:P,goToPreset:d,handleCameraChange:c,handleViewerReady:m}}var od=require("three");function Vp(e){return[e.x,e.y,e.z]}function Tw(e){let t=new od.Box3().setFromObject(e),n=0;return e.traverse(i=>{i.isMesh&&(n+=1)}),{bounds:{min:Vp(t.min),max:Vp(t.max),center:Vp(t.getCenter(new od.Vector3)),size:Vp(t.getSize(new od.Vector3))},objectCount:n,materialVariants:nf(e),materialVariantGroups:al(e)}}function BE(e){return typeof e=="object"&&!Array.isArray(e)}function IE(e,t){return"group"in t?e.group===t.group:"tag"in t?e.tags?.includes(t.tag)??!1:(e.type??"other")===t.type}function rs(e,t){if(BE(t))return Object.entries(e).filter(([,r])=>IE(r,t)).map(([r])=>r);let i=(typeof t=="string"?[t]:t).map(r=>jo(e,r)).filter(r=>r!==null);return[...new Set(i)]}var zE="#ff3b30",UE=Object.freeze({}),Pw=e=>e;function VE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function FE(e,t){let n=e.metadata;for(let i of t.split(".")){if(!VE(n))return;n=n[i]}return n}function og(e,t){if("metric"in t){let n=e.metrics?.[t.metric];return!(typeof n!="number"||!Number.isFinite(n)||t.above!==void 0&&!(n>t.above)||t.below!==void 0&&!(n<t.below))}if("status"in t){let n=e.status??"normal";return Array.isArray(t.status)?t.status.includes(n):t.status===n}return FE(e,t.metadata)===t.equals}function jE(e){let t=e.trim().replace(/^#/,""),n=t.length===3?t.split("").map(i=>i+i).join(""):t;return/^[0-9a-f]{6}$/i.test(n)?[0,2,4].map(i=>parseInt(n.slice(i,i+2),16)):null}var ig=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function GE(e,t){let n=e.map(([l,c])=>({at:l,rgb:jE(c)})).filter(l=>Number.isFinite(l.at)&&l.rgb!==null).sort((l,c)=>l.at-c.at);if(n.length===0||!Number.isFinite(t))return null;if(t<=n[0].at)return ig(n[0].rgb);let i=n[n.length-1];if(t>=i.at)return ig(i.rgb);let r=n.findIndex(l=>l.at>=t),o=n[r-1],a=n[r],s=a.at===o.at?1:(t-o.at)/(a.at-o.at);return ig(o.rgb.map((l,c)=>l+(a.rgb[c]-l)*s))}function Aw(e,t){if(!t?.length)return{bindings:e,pulses:UE,sourceOf:Pw};let n=new Map,i={};for(let a of t){let s=a.target?rs(e,a.target):Object.keys(e),l=a.when?Array.isArray(a.when)?a.when:[a.when]:[];for(let c of s){let h=e[c];if(!l.every(u=>og(h,u)))continue;let p={...a.material};if(a.colorScale){let u=h.metrics?.[a.colorScale.metric],m=typeof u=="number"?GE(a.colorScale.stops,u):null;m&&(p={...p,[a.colorScale.channel??"baseColor"]:m})}if(a.pulse){let u=a.pulse===!0?{}:a.pulse;i[c]={color:u.color??zE,speed:u.speed!==void 0&&u.speed>0?u.speed:1};let m=p.emissiveIntensity??n.get(c)?.emissiveIntensity??h.style?.material?.emissiveIntensity;m!==void 0&&m>0||(p.emissiveIntensity=1)}Object.keys(p).length>0&&n.set(c,{...n.get(c),...p})}}if(n.size===0)return{bindings:e,pulses:i,sourceOf:Pw};let r={...e},o=new WeakMap;for(let[a,s]of n){let l=e[a],c={...l,style:{...l.style,material:{...l.style?.material,...s}}};r[a]=c,o.set(c,l)}return{bindings:r,pulses:i,sourceOf:a=>o.get(a)??a}}var HE=.12,Ew=new Set;function ag(e,t){return t?new Set(rs(e,t.target)):Ew}function Rw(e,t){let n=ag(e.bindings,t);if(!t||n.size===0)return{...e,setAside:Ew};let i=Math.min(Math.max(t.ghostOpacity??HE,0),1),r={...e.bindings},o=new WeakMap,a=new Set;for(let[s,l]of Object.entries(e.bindings)){if(n.has(s))continue;a.add(s);let c=t.mode==="hide"?{...l,visible:!1}:{...l,style:{...l.style,material:{...l.style?.material,opacity:Math.min(l.style?.material?.opacity??1,i)}}};r[s]=c,o.set(c,e.sourceOf(l))}return{bindings:r,pulses:e.pulses,sourceOf:s=>o.get(s)??e.sourceOf(s),setAside:a}}var Dw=require("react");var Lw=require("react"),sg=require("@react-three/fiber"),kw=new WeakMap;function Fp(e){let t=(0,sg.useThree)(i=>i.get),n=(0,sg.useThree)(i=>i.setEvents);(0,Lw.useEffect)(()=>{if(!e)return;let i=kw.get(t);if(!i){let o=new Set;i=o,kw.set(t,o);let a=t().events.filter;n({filter:(s,l)=>{let c=a?a(s,l):s;return o.size===0?c:c.filter(h=>{for(let p of o)if(!p(h))return!1;return!0})}})}i.add(e);let r=i;return()=>{r.delete(e)}},[e,t,n])}function lg({setAside:e,nodeRefs:t}){let n=(0,Dw.useMemo)(()=>{if(e.size===0)return null;let i={refs:null,bound:new Map};return r=>{let o=t.current??{};if(i.refs!==o){let s=new Map;for(let[l,c]of Object.entries(o))s.set(c,e.has(l));i={refs:o,bound:s}}let{bound:a}=i;for(let s=r.object;s;s=s.parent){let l=a.get(s);if(l!==void 0)return!l}return!0}},[e,t]);return Fp(n),null}var Er=require("react"),Uw=require("@react-three/drei"),yl=require("@react-three/fiber"),is=require("three");var cg=require("three"),jp={x:0,y:1,z:2},Nw=e=>Math.min(Math.max(e,0),1);function dg(e,t){let n=jp[t.axis],i=e.min[n],r=e.max[n];if(!Number.isFinite(i)||!Number.isFinite(r)||r<i)return null;let o=Number.isFinite(t.position)?t.position:.5;return i+(r-i)*Nw(o)}function Ow(e,t,n){let i=dg(t,n);if(i===null)return!1;let r=new cg.Vector3;return r.setComponent(jp[n.axis],n.flip?1:-1),e.normal.copy(r),e.constant=n.flip?-i:i,!0}function Bw(e,t,n,i){let r=jp[i],o=new cg.Vector3().setComponent(r,1),a=n.clone().addScaledVector(o,-n.dot(o));if(a.lengthSq()<1e-8)return null;a.normalize();let s=e.direction.dot(a);if(Math.abs(s)<1e-8)return null;let l=t.clone().sub(e.origin).dot(a)/s;return Number.isFinite(l)?e.origin.getComponent(r)+e.direction.getComponent(r)*l:null}function Iw(e,t,n){let i=jp[t],r=e.max[i]-e.min[i];return r>0?Nw((n-e.min[i])/r):null}var os=require("react/jsx-runtime"),WE={x:0,y:1,z:2},zw="#22d3ee";function ug({section:e,box:t,modelRef:n,showHandle:i,onPositionChange:r,onDraggingChange:o}){let a=(0,yl.useThree)(g=>g.gl),s=(0,yl.useThree)(g=>g.raycaster),l=(0,yl.useThree)(g=>g.invalidate),c=(0,Er.useMemo)(()=>new is.Plane,[]),h=(0,Er.useMemo)(()=>[c],[c]),p=e.enabled&&t!==null&&Ow(c,t,e),u=(0,Er.useRef)(new Map),m=()=>{for(let[g,b]of u.current)g.clippingPlanes=b.clippingPlanes,g.side=b.side,g.needsUpdate=!0;u.current.clear()};(0,Er.useEffect)(()=>{if(p)return a.localClippingEnabled=!0,l(),()=>{m(),l()}},[p,a,l]),(0,Er.useEffect)(()=>{p&&l()},[p,e.axis,e.position,e.flip,t,l]),(0,yl.useFrame)(()=>{let g=n.current;if(!p||!g)return;let b=u.current;g.traverse(x=>{let v=x.material;if(v)for(let w of Array.isArray(v)?v:[v]){let M=b.get(w);if(w.clippingPlanes===h&&w.side===is.DoubleSide)continue;let _=w.side===is.DoubleSide&&M?M.side:w.side;b.set(w,{clippingPlanes:M?M.clippingPlanes:w.clippingPlanes,side:_}),w.clippingPlanes=h,w.clipShadows=!0,w.side=is.DoubleSide,w.needsUpdate=!0}})});let f=(0,Er.useMemo)(()=>p?g=>!!g.object.userData.riSectionHandle||c.distanceToPoint(g.point)>=-1e-4:null,[p,c]);return Fp(f),(0,Er.useEffect)(()=>{if(!p)return;let g=s,b=g.firstHitOnly;return g.firstHitOnly=!1,()=>{g.firstHitOnly=b}},[p,s]),!p||!i||!t?null:(0,os.jsx)(XE,{section:e,box:t,onPositionChange:r,onDraggingChange:o})}function XE({section:e,box:t,onPositionChange:n,onDraggingChange:i}){let[r,o]=(0,Er.useState)(!1),[a,s]=(0,Er.useState)(!1),l=(0,Er.useRef)(null),c=WE[e.axis],h=dg(t,e)??0,p=[0,1,2].map(x=>(t.max[x]-t.min[x])*1.08||.01),u=[0,1,2].map(x=>(t.min[x]+t.max[x])/2);u[c]=h;let[m,f]=e.axis==="x"?[p[2],p[1]]:e.axis==="y"?[p[0],p[2]]:[p[0],p[1]],g=e.axis==="x"?[0,Math.PI/2,0]:e.axis==="y"?[-Math.PI/2,0,0]:[0,0,0],b=x=>{a&&(x.target?.releasePointerCapture?.(x.pointerId),l.current=null,s(!1),i(!1))};return(0,os.jsxs)("mesh",{ref:x=>{x&&(nu(x),x.userData.riSectionHandle=!0)},position:u,rotation:g,renderOrder:2,onPointerOver:x=>{x.stopPropagation(),o(!0)},onPointerOut:()=>o(!1),onPointerDown:x=>{x.stopPropagation(),x.target?.setPointerCapture?.(x.pointerId),l.current={point:x.point.clone(),direction:x.ray.direction.clone(),coordinate:x.point.getComponent(c),cut:h},s(!0),i(!0)},onPointerMove:x=>{let v=l.current;if(!a||!v)return;x.stopPropagation();let w=Bw(x.ray,v.point,v.direction,e.axis);if(w===null)return;let M=Iw(t,e.axis,v.cut+(w-v.coordinate));M!==null&&n(M)},onPointerUp:b,onPointerCancel:b,onClick:x=>x.stopPropagation(),children:[(0,os.jsx)("planeGeometry",{args:[m,f]}),(0,os.jsx)("meshBasicMaterial",{color:zw,transparent:!0,opacity:a?.22:r?.16:.08,side:is.DoubleSide,depthWrite:!1,toneMapped:!1}),(0,os.jsx)(Uw.Edges,{color:zw,renderOrder:3})]})}var Vw=require("react-colorful"),na=require("react/jsx-runtime"),pg=({colorPicker:e,onClose:t,itemMaterials:n,setItemMaterials:i,inline:r=!1})=>{let o=Me();return(0,na.jsxs)("div",{className:`ri-popover${r?" ri-popover--inline":""}`,style:r?{padding:12}:{left:e.x,top:e.y,width:"min(225px, calc(100vw - 24px))",padding:12},onPointerDown:a=>a.stopPropagation(),children:[(0,na.jsx)("p",{className:"ri-popoverLabel",children:o("color")}),(0,na.jsx)(Vw.HexColorPicker,{color:n[e.objectId]?.hex??"#ffffff",onChange:a=>i(s=>({...s,[e.objectId]:{...s[e.objectId],hex:a}}))}),(0,na.jsxs)("div",{className:"ri-inlineRow",children:[(0,na.jsx)("span",{className:"ri-colorCode",children:n[e.objectId]?.hex??"#ffffff"}),(0,na.jsx)("button",{className:"ri-secondaryButton",onClick:t,children:o("done")})]})]})};var Ct=require("react/jsx-runtime"),mg=({materialPopup:e,textureUrl:t,triggerFileUpload:n,clearTexture:i,canPlaceImage:r=!0,inline:o=!1,offset:a,rotationDegrees:s,onOffsetChange:l,onRotationChange:c,isPositioning:h=!1,onEndPositioning:p})=>{let u=Me();return(0,Ct.jsxs)("div",{className:`ri-popover${o?" ri-popover--inline":""}`,style:o?{overflow:"hidden"}:{left:e.x,top:e.y,width:"min(300px, calc(100vw - 24px))",overflow:"hidden"},onPointerDown:m=>m.stopPropagation(),children:[(0,Ct.jsx)("div",{className:"ri-popoverHeader",children:(0,Ct.jsx)("p",{className:"ri-popoverLabel",style:{marginBottom:0},children:u("material")})}),(0,Ct.jsxs)("div",{className:"ri-materialBody",children:[t?(0,Ct.jsx)("div",{className:"ri-previewFrame",children:(0,Ct.jsx)("img",{src:t,alt:u("texturePreview"),className:"ri-previewImage"})}):(0,Ct.jsxs)("div",{className:"ri-emptyState",children:[(0,Ct.jsx)("svg",{width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",children:(0,Ct.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3 21h18M3 3h18"})}),(0,Ct.jsx)("span",{style:{fontSize:12},children:u("noTextureApplied")})]}),r?(0,Ct.jsx)("button",{onClick:()=>n(e.objectId),className:"ri-uploadButton",children:u(t?"replaceImage":"uploadImage")}):(0,Ct.jsx)("p",{className:"ri-formatHint",children:u("noTextureCoordinates")}),t&&(0,Ct.jsx)("button",{onClick:()=>i(e.objectId),className:"ri-removeButton",children:u("removeTexture")}),r?(0,Ct.jsx)("p",{className:"ri-formatHint",children:"JPG \xB7 PNG \xB7 WebP"}):null,t&&(l||c)&&(0,Ct.jsxs)("div",{className:"ri-texturePosition",children:[(0,Ct.jsx)("p",{className:"ri-texturePositionLabel",children:u("texturePosition")}),(0,Ct.jsxs)("div",{className:"ri-texturePositionGrid",children:[(0,Ct.jsxs)("label",{className:"ri-texturePositionField",children:[(0,Ct.jsx)("span",{children:u("offsetX")}),(0,Ct.jsx)("input",{type:"number",step:.01,value:a?.[0]??0,onChange:m=>l?.(e.objectId,0,Number(m.target.value))})]}),(0,Ct.jsxs)("label",{className:"ri-texturePositionField",children:[(0,Ct.jsx)("span",{children:u("offsetY")}),(0,Ct.jsx)("input",{type:"number",step:.01,value:a?.[1]??0,onChange:m=>l?.(e.objectId,1,Number(m.target.value))})]})]}),(0,Ct.jsxs)("label",{className:"ri-texturePositionField ri-texturePositionField--full",children:[(0,Ct.jsx)("span",{children:u("rotation")}),(0,Ct.jsxs)("div",{className:"ri-texturePositionSliderRow",children:[(0,Ct.jsx)("input",{type:"range",min:0,max:360,step:1,value:s??0,onChange:m=>c?.(e.objectId,Number(m.target.value))}),(0,Ct.jsx)("input",{type:"number",min:0,max:360,step:1,value:Math.round(s??0),onChange:m=>c?.(e.objectId,Number(m.target.value))})]})]}),h?(0,Ct.jsx)("button",{type:"button",className:"ri-uploadButton",onClick:p,title:u("confirmTexturePosition"),children:u("donePositioning")}):(0,Ct.jsx)("p",{className:"ri-texturePositionHint",children:u("textureOffsetHint")})]})]})]})};var ni=require("react");var Lt=require("react/jsx-runtime");function Fw({entries:e}){return(0,Lt.jsx)(Lt.Fragment,{children:e.map(([t,n])=>{let i=n!==null&&typeof n=="object",r=i?Object.entries(n):[];return i&&r.length>0?(0,Lt.jsxs)("div",{className:"left-panel__data-group",children:[(0,Lt.jsx)("span",{className:"left-panel__data-key",children:t}),(0,Lt.jsx)("div",{className:"left-panel__data-children",children:(0,Lt.jsx)(Fw,{entries:r})})]},t):(0,Lt.jsxs)("div",{className:"left-panel__data-row",children:[(0,Lt.jsx)("span",{className:"left-panel__data-key",children:t}),(0,Lt.jsx)("span",{className:`left-panel__data-value left-panel__data-value--${typeof n}`,children:i?Array.isArray(n)?"[]":"{}":String(n)})]},t)})})}function qE({content:e}){let t=e!=null,[n,i]=(0,ni.useState)(t),[r,o]=(0,ni.useState)(t),a=(0,ni.useRef)(e);return t&&(a.current=e),(0,ni.useEffect)(()=>{if(t){i(!0);return}if(n){o(!1);let s=setTimeout(()=>i(!1),300);return()=>clearTimeout(s)}},[t,n]),(0,ni.useEffect)(()=>{if(n&&t){let s=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(s)}},[n,t]),n?(0,Lt.jsx)("div",{className:`left-panel__action-extra${r?" left-panel__action-extra--open":""}`,children:(0,Lt.jsx)("div",{className:"left-panel__action-extra-inner",children:e??a.current})}):null}function hg({isOpen:e,selectedObject:t,currentAction:n,onClose:i,onAction:r,renderActionExtra:o,translateDefaultActions:a=!1}){let s=Me(),[l,c]=(0,ni.useState)(t);(0,ni.useEffect)(()=>{t&&c(t)},[t]);let h=t??l,p=h?Object.entries(h).filter(([u])=>u!=="actions"&&u!=="decals"):[];return(0,Lt.jsx)("div",{className:`left-panel ${e?"left-panel--open":"left-panel--closed"}`,children:h&&(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsxs)("div",{className:"left-panel__header",children:[(0,Lt.jsx)("p",{className:"left-panel__title",children:h.label}),(0,Lt.jsx)("button",{onClick:i,className:"left-panel__close-btn","aria-label":s("closePanel"),children:"\u2715"})]}),p.length>0&&(0,Lt.jsx)("div",{className:"left-panel__data",children:(0,Lt.jsx)(Fw,{entries:p})}),(0,Lt.jsx)("hr",{className:"left-panel__divider"}),h.actions&&h.actions.length>0&&(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)("div",{className:"left-panel__actions-label",children:s("actions")}),(0,Lt.jsx)("div",{className:"left-panel__actions-list",children:h.actions.map((u,m)=>{let f=n?.action.id===u.id&&(n.binding===h||n.binding?.id===h.id||n.binding?.modelObjectId===h.modelObjectId||n.objectId===h.id||n.objectId===h.modelObjectId),g=o?.(u.id);return(0,Lt.jsxs)(ni.Fragment,{children:[(0,Lt.jsx)("button",{onClick:b=>r({objectId:h.modelObjectId||h.id||"",action:u,binding:h,screenX:b.clientX,screenY:b.clientY}),className:["left-panel__action-btn",`left-panel__action-btn--${u.id}`,f?"left-panel__action-btn--active":""].filter(Boolean).join(" "),"data-action-id":u.id,"data-label":u.label,children:a?s.message(u.label):u.label}),(0,Lt.jsx)(qE,{content:g})]},m)})})]})]})})}var ad=require("react"),Gp=require("lucide-react");var jw=require("react");var cr=require("react/jsx-runtime");function Gw({openButtonLabel:e,openButtonAriaLabel:t,eyebrow:n,title:i,searchValue:r,onSearchChange:o,searchPlaceholder:a,children:s,isOpen:l,onToggle:c,openButtonIcon:h,closeButtonIcon:p,closeButtonAriaLabel:u}){let m=Me(),[f,g]=(0,jw.useState)(!1),b=l!==void 0?l:f,x=v=>{l===void 0&&g(v),c?.(v)};return(0,cr.jsxs)("div",{className:`ri-sidepanel-wrap ${b?"ri-sidepanel-wrap--open":"ri-sidepanel-wrap--closed"}`,children:[!b&&(0,cr.jsxs)("button",{type:"button",className:"ri-sidepanel__open-btn",onClick:()=>x(!0),"aria-label":t,title:m("openPanel"),children:[h,e?(0,cr.jsx)("span",{children:e}):null]}),(0,cr.jsxs)("div",{className:`ri-sidepanel ${b?"ri-sidepanel--open":"ri-sidepanel--closed"}`,"aria-hidden":!b,children:[(0,cr.jsxs)("div",{className:"ri-sidepanel__header",children:[(0,cr.jsxs)("div",{className:"ri-sidepanel__header-top",children:[(0,cr.jsx)("span",{className:"ri-sidepanel__eyebrow",children:n}),(0,cr.jsx)("button",{type:"button",className:"ri-sidepanel__close-btn",onClick:()=>x(!1),"aria-label":u,title:m("close"),children:p??(0,cr.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,cr.jsx)("path",{d:"M1 1L11 11M11 1L1 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})})]}),(0,cr.jsx)("p",{className:"ri-sidepanel__title",children:i})]}),(0,cr.jsx)("div",{className:"ri-sidepanel__search-wrap",children:(0,cr.jsx)("input",{className:"ri-sidepanel__search",type:"text",placeholder:a,value:r,onChange:v=>o(v.target.value)})}),(0,cr.jsx)("div",{className:"ri-sidepanel__list",children:s})]})]})}var ri=require("react/jsx-runtime");function fg({objectBindings:e,onAction:t,onFocus:n,onHover:i,isOpen:r,onToggle:o,isolatedKeys:a=null,onIsolate:s}){let l=Me(),[c,h]=(0,ad.useState)(null),[p,u]=(0,ad.useState)(""),m=(0,ad.useMemo)(()=>Object.entries(e).filter(([f,g])=>{let b=p.toLowerCase();return f.toLowerCase().includes(b)||(g.label??"").toLowerCase().includes(b)}),[e,p]);return(0,ri.jsx)(Gw,{openButtonLabel:"",openButtonAriaLabel:l("openSceneObjectsPanel"),openButtonIcon:(0,ri.jsx)(Gp.Boxes,{width:16,height:16,"aria-hidden":"true"}),eyebrow:l("sceneObjects"),title:l("visibleEntries",{count:m.length}),searchValue:p,onSearchChange:u,searchPlaceholder:l("searchNodesLabels"),isOpen:r,onToggle:o,closeButtonAriaLabel:l("closeSceneObjectsPanel"),children:m.map(([f,g])=>{let b=g.visible!==!1,x=c===f,v=a?.has(f)??!1;return(0,ri.jsxs)("div",{onClick:()=>n(g),onMouseEnter:()=>{h(f),i?.(g)},onMouseLeave:()=>{h(null),i?.(null)},className:`ri-sidepanel__row${x?" ri-sidepanel__row--hovered":""}${a!==null&&!v?" ri-sidepanel__row--setAside":""}`,children:[(0,ri.jsx)("button",{type:"button",className:`ri-sidepanel__label ri-sidepanel__labelButton${x?" ri-sidepanel__label--hovered":""}`,onFocus:()=>{h(f),i?.(g)},onBlur:()=>{h(null),i?.(null)},children:g.label??f}),s?(0,ri.jsx)("button",{type:"button",onClick:M=>{M.stopPropagation(),s(g)},className:`ri-sidepanel__isolate-btn${v?" ri-sidepanel__isolate-btn--active":""}`,title:l(v?"showAll":"isolate"),"aria-label":l(v?"showAllObject":"isolateObject",{name:g.label??f}),"aria-pressed":v,children:(0,ri.jsx)(Gp.Focus,{width:14,height:14,"aria-hidden":"true"})}):null,(0,ri.jsx)("button",{type:"button",onClick:M=>{M.stopPropagation(),t?.({objectId:f,action:{id:"toggle-visibility",label:"Toggle Visibility",type:"command"},binding:g})},className:"ri-sidepanel__vis-btn",title:l(b?"hide":"show"),"aria-label":l(b?"hideObject":"showObject",{name:g.label??f}),children:(0,ri.jsx)("span",{className:`ri-sidepanel__checkbox${b?" ri-sidepanel__checkbox--checked":""}`,children:b&&(0,ri.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",children:(0,ri.jsx)("path",{d:"M1.5 5L4 7.5L8.5 2.5",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})})]},f)})})}var Ci=require("react");function Hw(e,t){let n=[];for(let[i,r]of Object.entries(e))(t.bindings[i]??r).visible!==!1&&(t.setAside.has(i)||n.push({key:i,binding:r,label:r.label||i}));return n}function Ww(e,t,n){if(n===0)return null;switch(e){case"ArrowDown":case"ArrowRight":return Math.min(t+1,n-1);case"ArrowUp":case"ArrowLeft":return Math.max(t-1,0);case"Home":return 0;case"End":return n-1;default:return null}}function Xw(e,t,n){let i=n.toLocaleLowerCase();if(!i)return null;let r=[...i].every(s=>s===i[0]),o=i.length>1&&!r?t:t+1,a=r?[i,i[0]]:[i];for(let s of a)for(let l=0;l<e.length;l++){let c=((o+l)%e.length+e.length)%e.length;if(e[c].label.toLocaleLowerCase().startsWith(s))return c}return null}var ra=require("react/jsx-runtime"),$E=600;function qw({objects:e,selectedKey:t,onHighlight:n,onSelect:i,onClearSelection:r}){let o=Me(),a=(0,Ci.useId)(),[s,l]=(0,Ci.useState)(!1),[c,h]=(0,Ci.useState)(null),p=(0,Ci.useRef)({query:"",at:0}),u=c?e.findIndex(M=>M.key===c):-1,m=u>=0?e[u]:null;(0,Ci.useEffect)(()=>{t&&e.some(M=>M.key===t)&&h(t)},[t,e]);let f=s?m?.binding??null:null,g=(0,Ci.useRef)(n);g.current=n,(0,Ci.useEffect)(()=>{if(s)return g.current(f),()=>g.current(null)},[s,f]);let b=M=>{M!==null&&e[M]&&h(e[M].key)},x=M=>{let _=m?u:-1,y=Ww(M.key,Math.max(_,0),e.length);if(y!==null){M.preventDefault(),b(_<0&&M.key!=="End"?0:y);return}if(M.key==="Enter"||M.key===" "){if(!m)return;M.preventDefault(),i(m.binding);return}if(M.key==="Escape"){if(!t)return;M.preventDefault(),M.stopPropagation(),r();return}if(M.key.length===1&&M.key!==" "&&!M.ctrlKey&&!M.metaKey&&!M.altKey){let P=Date.now(),d=p.current;d.query=P-d.at>$E?M.key:d.query+M.key,d.at=P,M.preventDefault(),b(Xw(e,_,d.query))}};if(e.length===0)return null;let v=`${a}-option`,w=`${a}-hint`;return(0,ra.jsxs)("div",{className:`ri-objectNavigator${s?" ri-objectNavigator--focused":""}`,children:[(0,ra.jsx)("div",{role:"listbox",tabIndex:0,className:"ri-objectNavigator__list","aria-label":o("objectNavigator"),"aria-describedby":w,"aria-activedescendant":m?v:void 0,onFocus:()=>{l(!0),m||h(e[0].key)},onBlur:()=>l(!1),onKeyDown:x,children:m?(0,ra.jsxs)("div",{id:v,role:"option","aria-selected":m.key===t,"aria-setsize":e.length,"aria-posinset":u+1,className:`ri-objectNavigator__option${m.key===t?" ri-objectNavigator__option--selected":""}`,children:[(0,ra.jsx)("span",{className:"ri-objectNavigator__name",children:m.label}),(0,ra.jsx)("span",{className:"ri-objectNavigator__position","aria-hidden":"true",children:o("objectNavigatorPosition",{position:u+1,count:e.length})})]}):null}),(0,ra.jsx)("div",{id:w,className:"ri-objectNavigator__hint",children:o("objectNavigatorHint")})]})}var $w=require("react"),Yw="(prefers-reduced-motion: reduce)";function YE(e){if(typeof window>"u"||!window.matchMedia)return()=>{};let t=window.matchMedia(Yw);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}var KE=()=>typeof window<"u"&&!!window.matchMedia?.(Yw).matches;function wl(e="user"){let t=(0,$w.useSyncExternalStore)(YE,KE,()=>!1);return e==="always"?!0:e==="never"?!1:t}var o_=require("lucide-react");var Hp=require("react"),gg=(0,Hp.createContext)({isInsideEditor:!1,activeTab:"object",activeSubTab:"General",tier:"free"});var Rr=()=>(0,Hp.useContext)(gg);var ia=require("react/jsx-runtime");function Wp({visible:e,message:t,tone:n="default",progress:i}){if(!e)return null;let r=typeof i=="number"&&Number.isFinite(i),o=r?Math.min(Math.max(i,0),100):0,a=Math.round(o);return(0,ia.jsxs)("div",{className:"bb-loadingOverlay",role:"status","aria-live":"polite",children:[r&&(0,ia.jsxs)("div",{className:"bb-loadingProgressRow",children:[(0,ia.jsx)("div",{className:"bb-loadingProgress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,children:(0,ia.jsx)("div",{className:"bb-loadingProgress__bar",style:{width:`${a}%`}})}),(0,ia.jsxs)("span",{className:"bb-loadingProgress__label",children:[a,"%"]})]}),(0,ia.jsx)("span",{className:`bb-loadingMessage bb-status--${n}`,children:t})]})}function ZE(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function bg(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function JE(e){let t=e.toLowerCase();return t.includes("light")?"light":t.includes("wheel")||t.includes("rim")||t.includes("tire")?"wheel":t.includes("glass")||t.includes("window")||t.includes("windshield")||t.includes("sunroof")?"glass":t.includes("seat")||t.includes("dashboard")||t.includes("console")||t.includes("doorpanel")?"interior":t.includes("floor")?"floor":t.includes("wall")?"wall":t.includes("door")?"door":t.includes("chair")||t.includes("table")||t.includes("sofa")||t.includes("bed")?"furniture":"other"}function Kw(e,t=!0){return e==="light"||e.endsWith("light")?[{id:"toggle-light",label:"Toggle Light",type:"command"},{id:"change-light-color",label:"Change Light Color",type:"command"},{id:"set-brightness",label:"Set Brightness",type:"command"}]:[{id:"change-color",label:"Change Color",type:"command"},...t?[{id:"change-material",label:"Change Material",type:"command"}]:[],{id:"toggle-visibility",label:"Toggle Visibility",type:"command"}]}function Zw(e,t=!0){let n=JE(e);return{id:ZE(e),modelObjectId:e,type:n,label:bg(e),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:Kw(n,t),metrics:{},metadata:{}}}function Xp(e,t){return Object.fromEntries(e.map(n=>[n,Zw(n,!t?.has(n))]))}function Jw(e,t){let n=new Set,i={};for(let r of e){let o=Zw(r,!t?.has(r)),a=o.id||"object",s=a;for(let c=2;n.has(s);c++)s=`${a}-${c}`;n.add(s),o.id=s;let l=(o.actions??[]).filter(c=>gc.includes(c.id));o.actions=l.length>0?l:Kw("other",!t?.has(r)),i[r]=o}return i}function sd(e){let t=new Set;for(let[n,i]of Object.entries(lo(e).nodesById))xu(i)||t.add(n);return t}function ld(e){let{nodesById:t}=lo(e),n=[];for(let[i,r]of Object.entries(t)){let o=r;o.isMesh&&o.geometry&&r.name&&n.push(i)}return n.sort((i,r)=>i.localeCompare(r))}var Ue=require("react"),Kp=require("@react-three/fiber"),Zp=require("@react-three/drei"),ft=require("three");var Qw="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N15mFxllfjx76nqTmclewJJSEIWsgBh3xcNi0mqExHUjMO46wwz/lSYcQHFJTqKqCgoKu4CMipBBQzpEAJE9kWQnSydzr7va3d6qTq/P97ukD1Vdd9b997q83mefgKm6r1Huuq+577LecEYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYY00q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OedwXnA4CIllDFQBCiGqTrC5UIH8/YxIcPKJyO2WpovDCiV5oZDT2fjyeWDv2FXusIdT6Za3+EsTaqAJACFFtMtWFLVu2uAvlaJniQAW4VAqwUnBWwcHLAFbKgHKM/XO+q6OVOhY6GVgZGMrUtIPmQBQcfQqUYS7zUUlREpIsy1JKZolEyhVH4vxIagNMsoYSAEJITpxLFtrO/ZNR2uoCQ4DzC3ovWKq6wIACMBSIEAAbYIMIwA64AafT/s6RupbzI2kKgGQNJQCEEEPIztoFNrZeQWEzrLJ2we10rHU67GcSydQMMKoAkOyxTAZNCCETMXt1YSAysv9ES8dmMP61hub2B/WOh1gDVQAIIZZn9upCoLBgpSAKUUVWqAJAssZQWS4hhJjNJdUFhoDCUcnAZ2SzunCmq/+NjjPdP64PtT+d3b8ByVeUABBCiEb+9vbbndEiqVhldWEW/n87d2yDIBQGAfi5A8SpHIAFKByO1gEeLYWhI5pYQU9iyfvtmMAEY75vgrvuqktpfyuMiNdwf1zH6Xk7sAJ/xAAA+FFtc6lKKXVE1NupnNf53Xc5L0fnAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4ug8WQhGFNH5HGgAAAABJRU5ErkJggg==";var Ze=require("react/jsx-runtime"),vg=-100,xg=100,cS=.03,nR=.03,rR=.03,nS=.5,iR=Qw,oR=eS,aR=tS,sR=Math.PI/4,rS=.4,Sl=64,iS=cS*3,yg="#4d7dff",oS="#ffcc00",aS=.02,lR=new ft.Vector3(0,1,0),qp=32,sS="#ff9d3d",$p=4;function wg(e){let t=new Float32Array((Sl+1)*3);for(let n=0;n<=Sl;n++){let i=n/Sl*Math.PI*2,r=Math.cos(i)*rS,o=Math.sin(i)*rS,a=0,s=0,l=0;e==="x"?(s=r,l=o):e==="y"?(a=r,l=o):(a=r,s=o),t[n*3]=a,t[n*3+1]=s,t[n*3+2]=l}return t}function cR(e){let t=Math.abs(e.y)<.99?new ft.Vector3(0,1,0):new ft.Vector3(1,0,0),n=new ft.Vector3().crossVectors(e,t).normalize(),i=new ft.Vector3().crossVectors(e,n).normalize();return[n,i]}function lS(e,t,n=1e-5){return Math.abs(e[0]-t[0])<n&&Math.abs(e[1]-t[1])<n&&Math.abs(e[2]-t[2])<n}var _l=null,Sg=new Set;function cd(e){_l!==e&&(_l=e,Sg.forEach(t=>t()))}function _g(e){return Sg.add(e),()=>Sg.delete(e)}function Yp(){return _l}function dS({light:e,position:t,rotation:n=[0,0,0],color:i,intensity:r,visible:o,onPositionChange:a,onRotationChange:s,onDraggingChange:l}){let{activeTab:c,activeSubTab:h,setActiveTab:p,setActiveSubTab:u}=Rr(),{camera:m,gl:f,raycaster:g,invalidate:b}=(0,Kp.useThree)(),x=(0,Ue.useRef)(null),v=(0,Ue.useRef)(null),w=(0,Ue.useRef)(null),M=(0,Ue.useRef)(null),_=(0,Ue.useRef)(null),y=(0,Ue.useRef)(null),P=(0,Ue.useRef)(null),d=(0,Ue.useRef)(null),S=(0,Ue.useRef)(null),C=(0,Ue.useRef)(null),T=(0,Ue.useRef)(null),E=(0,Ue.useMemo)(()=>new ft.Matrix4,[]),k=(0,Ue.useMemo)(()=>new ft.Quaternion,[]),D=(0,Ue.useMemo)(()=>new ft.Vector3(1,1,1),[]),I=(0,Ue.useRef)([0,0,0]),L=(0,Ue.useRef)([0,0,0]),X=(0,Ue.useRef)(!1),O=(0,Ue.useRef)(null),B=(0,Ue.useRef)(null),re=(0,Ue.useRef)(null),ke=(0,Ue.useRef)(l);(0,Ue.useEffect)(()=>{ke.current=l},[l]);let te=(0,Ue.useMemo)(()=>new ft.Vector3(t[0],t[1],t[2]),[t]),We=(0,Ue.useMemo)(()=>new ft.Euler(n[0],n[1],n[2]),[n]),wt=(0,Ue.useMemo)(()=>new Float32Array(6),[]),be=(0,Ue.useMemo)(()=>wg("x"),[]),ue=(0,Ue.useMemo)(()=>wg("y"),[]),Ne=(0,Ue.useMemo)(()=>wg("z"),[]),Te=(0,Ue.useMemo)(()=>new Float32Array((qp+1)*3),[]),bn=(0,Ue.useMemo)(()=>new Float32Array($p*2*3),[]),Oe=e?.type==="point",ot=e?.type==="spot",mt=Oe?oR:ot?aR:iR,vn=Oe?nR:ot?rR:cS,de=(0,Ue.useMemo)(()=>new ft.TextureLoader().load(mt),[mt]),ur=(0,Ue.useSyncExternalStore)(_g,Yp,Yp),jt=!!e&&ur===e.id,Gt=(0,Ue.useRef)(new ft.Vector3),ce=(0,Ue.useRef)(new ft.Euler);(0,Ue.useEffect)(()=>{X.current||(Gt.current.copy(te),ce.current.copy(We),b())},[te,We,b]),(0,Ue.useEffect)(()=>{e&&_l===e.id&&!o&&cd(null)},[e?.id,o]),(0,Ue.useEffect)(()=>()=>{e&&_l===e.id&&cd(null),re.current!==null&&(cancelAnimationFrame(re.current),re.current=null)},[e?.id]);let Be=(0,Ue.useCallback)(()=>{if(X.current||!jt)return;let Ae=Gt.current,Ce=new ft.Quaternion().setFromEuler(ce.current);E.compose(Ae,Ce,D)},[E,D,jt]);(0,Kp.useFrame)(()=>{if(x.current&&x.current.position.copy(Gt.current),Be(),w.current){w.current.lookAt(m.position);let Ae=m,Ce;Ae.isOrthographicCamera?Ce=vn/Ae.zoom:Ce=m.position.distanceTo(Gt.current)*vn,w.current.scale.setScalar(Ce)}if(P.current){let Ae=m,Ce;Ae.isOrthographicCamera?Ce=iS/Ae.zoom:Ce=m.position.distanceTo(Gt.current)*iS,P.current.scale.setScalar(Ce)}if(_.current){let Ae=_.current.getAttribute("position"),Ce=Ae.array;Ce[0]=0,Ce[1]=0,Ce[2]=0,Ce[3]=Gt.current.x,Ce[4]=Gt.current.y,Ce[5]=Gt.current.z,Ae.needsUpdate=!0,_.current.computeBoundingSphere()}if(y.current){let Ae=Gt.current,Ce=Ae.length();y.current.visible=Ce>nS,Ce>1e-6&&(y.current.position.copy(Ae).multiplyScalar(.5),y.current.scale.set(1,Ce,1),y.current.quaternion.setFromUnitVectors(lR,Ae.clone().normalize()))}if(M.current&&(M.current.visible=Gt.current.length()>nS),ot&&d.current&&S.current&&C.current){let Ae=Gt.current,Ce=Ae.length();if(Ce>1e-6){d.current.visible=!0;let Pt=Ae.clone().negate().normalize(),St=Ce,dn=e?.angle??Math.PI/6,ae=St*Math.tan(dn),he=Ae.clone().add(Pt.clone().multiplyScalar(St)),[Ee,Ie]=cR(Pt),_t=S.current.getAttribute("position"),Je=_t.array;for(let Qe=0;Qe<=qp;Qe++){let bt=Qe/qp*Math.PI*2,un=he.x+(Ee.x*Math.cos(bt)+Ie.x*Math.sin(bt))*ae,or=he.y+(Ee.y*Math.cos(bt)+Ie.y*Math.sin(bt))*ae,xn=he.z+(Ee.z*Math.cos(bt)+Ie.z*Math.sin(bt))*ae;Je[Qe*3]=un,Je[Qe*3+1]=or,Je[Qe*3+2]=xn}_t.needsUpdate=!0,S.current.computeBoundingSphere();let et=C.current.getAttribute("position"),ve=et.array;for(let Qe=0;Qe<$p;Qe++){let bt=Qe/$p*Math.PI*2,un=he.x+(Ee.x*Math.cos(bt)+Ie.x*Math.sin(bt))*ae,or=he.y+(Ee.y*Math.cos(bt)+Ie.y*Math.sin(bt))*ae,xn=he.z+(Ee.z*Math.cos(bt)+Ie.z*Math.sin(bt))*ae,Vn=Qe*6;ve[Vn]=Ae.x,ve[Vn+1]=Ae.y,ve[Vn+2]=Ae.z,ve[Vn+3]=un,ve[Vn+4]=or,ve[Vn+5]=xn}et.needsUpdate=!0,C.current.computeBoundingSphere()}else d.current.visible=!1}});let zt=(0,Ue.useCallback)(()=>{re.current!==null&&(cancelAnimationFrame(re.current),re.current=null),I.current=t,L.current=[n[0],n[1],n[2]],X.current=!0,O.current=null,B.current=null,ke.current?.(!0)},[t,n]),gt=(0,Ue.useCallback)((Ae,Ce,Pt,St)=>{let dn=new ft.Vector3(I.current[0],I.current[1],I.current[2]),ae=new ft.Vector3,he=new ft.Quaternion,Ee=new ft.Vector3;St.decompose(ae,he,Ee);let Ie=dn.clone().applyMatrix4(St),_t=[Math.min(Math.max(Ie.x,vg),xg),Math.min(Math.max(Ie.y,vg),xg),Math.min(Math.max(Ie.z,vg),xg)],Je=new ft.Quaternion().setFromEuler(new ft.Euler(L.current[0],L.current[1],L.current[2],"XYZ")),et=new ft.Quaternion().copy(he).multiply(Je),ve=new ft.Euler().setFromQuaternion(et,"XYZ"),Qe=[ve.x,ve.y,ve.z];Gt.current.set(_t[0],_t[1],_t[2]),ce.current.set(Qe[0],Qe[1],Qe[2]),O.current=_t,B.current=Qe;let bt=new ft.Quaternion().setFromEuler(ce.current);E.compose(Gt.current,bt,D),b()},[E,D,b]),Ut=(0,Ue.useCallback)(()=>{X.current=!1;let Ae=O.current,Ce=B.current;O.current=null,B.current=null;let Pt=Ae&&!lS(Ae,I.current),St=Ce&&!lS(Ce,L.current);Pt&&a&&a(Ae),St&&s&&s(Ce),Pt||St?re.current=requestAnimationFrame(()=>{re.current=null,ke.current?.(!1)}):ke.current?.(!1)},[a,s]);return(0,Ue.useEffect)(()=>{let Ae=St=>{let dn=f.domElement.getBoundingClientRect();return new ft.Vector2((St.clientX-dn.left)/dn.width*2-1,-((St.clientY-dn.top)/dn.height)*2+1)},Ce=St=>!!St.target.closest?.("button, input, textarea, .ri-annotationPopup, .ri-colorPicker, .ri-materialPicker"),Pt=St=>{if(Ce(St))return;let dn=Ae(St);g.setFromCamera(dn,m);let ae=[];if(v.current&&ae.push(v.current),w.current&&ae.push(w.current),ae.length===0)return;if(g.intersectObjects(ae,!1).length>0){let Ee=e?.id??null;_l!==Ee&&(cd(Ee),p?.("scene"),u?.("Lighting")),St.preventDefault(),St.stopPropagation()}};return f.domElement.addEventListener("pointerdown",Pt),()=>{f.domElement.removeEventListener("pointerdown",Pt)}},[m,g,f,e,p,u]),c!=="scene"||h!=="Lighting"||!e||!o||e.type==="none"||e.type==="hemisphere"?null:(0,Ze.jsxs)("group",{ref:Ae=>{Ae&&nu(Ae)},children:[(0,Ze.jsxs)("group",{ref:x,children:[(0,Ze.jsx)("sprite",{ref:w,children:(0,Ze.jsx)("spriteMaterial",{map:de,transparent:!0,opacity:.9,blending:ft.AdditiveBlending,depthWrite:!1,rotation:ot?sR:0},mt)}),(0,Ze.jsx)(Zp.Sphere,{ref:v,args:[.25,16,16],children:(0,Ze.jsx)("meshBasicMaterial",{transparent:!0,opacity:.01})}),Oe&&(0,Ze.jsxs)("group",{ref:P,children:[(0,Ze.jsxs)("lineLoop",{renderOrder:999,children:[(0,Ze.jsx)("bufferGeometry",{children:(0,Ze.jsx)("bufferAttribute",{attach:"attributes-position",args:[be,3],count:Sl+1})}),(0,Ze.jsx)("lineBasicMaterial",{color:yg,transparent:!0,opacity:.6,depthTest:!1,depthWrite:!1})]}),(0,Ze.jsxs)("lineLoop",{renderOrder:999,children:[(0,Ze.jsx)("bufferGeometry",{children:(0,Ze.jsx)("bufferAttribute",{attach:"attributes-position",args:[ue,3],count:Sl+1})}),(0,Ze.jsx)("lineBasicMaterial",{color:yg,transparent:!0,opacity:.6,depthTest:!1,depthWrite:!1})]}),(0,Ze.jsxs)("lineLoop",{renderOrder:999,children:[(0,Ze.jsx)("bufferGeometry",{children:(0,Ze.jsx)("bufferAttribute",{attach:"attributes-position",args:[Ne,3],count:Sl+1})}),(0,Ze.jsx)("lineBasicMaterial",{color:yg,transparent:!0,opacity:.6,depthTest:!1,depthWrite:!1})]})]})]}),!Oe&&!ot&&(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsxs)("mesh",{ref:y,children:[(0,Ze.jsx)("cylinderGeometry",{args:[aS,aS,1,8,1,!0]}),(0,Ze.jsx)("meshBasicMaterial",{color:oS,transparent:!0,opacity:.05,blending:ft.AdditiveBlending,depthWrite:!1,depthTest:!1})]}),(0,Ze.jsxs)("line",{ref:M,children:[(0,Ze.jsx)("bufferGeometry",{ref:_,children:(0,Ze.jsx)("bufferAttribute",{attach:"attributes-position",args:[wt,3],count:2})}),(0,Ze.jsx)("lineBasicMaterial",{color:oS,transparent:!0,opacity:.7,blending:ft.AdditiveBlending})]})]}),ot&&(0,Ze.jsxs)("group",{ref:d,children:[(0,Ze.jsxs)("lineLoop",{renderOrder:999,children:[(0,Ze.jsx)("bufferGeometry",{ref:S,children:(0,Ze.jsx)("bufferAttribute",{attach:"attributes-position",args:[Te,3],count:qp+1})}),(0,Ze.jsx)("lineBasicMaterial",{color:sS,transparent:!0,opacity:.85,depthTest:!1,depthWrite:!1})]}),(0,Ze.jsxs)("lineSegments",{renderOrder:999,children:[(0,Ze.jsx)("bufferGeometry",{ref:C,children:(0,Ze.jsx)("bufferAttribute",{attach:"attributes-position",args:[bn,3],count:$p*2})}),(0,Ze.jsx)("lineBasicMaterial",{color:sS,transparent:!0,opacity:.5,depthTest:!1,depthWrite:!1})]})]}),jt&&a&&(0,Ze.jsx)(Zp.PivotControls,{ref:T,matrix:E,autoTransform:!1,fixed:!0,scale:90,lineWidth:3,axisColors:["#ff2d6f","#64dfa6","#2f8fe8"],hoveredColor:"#ffd84d",opacity:.95,depthTest:!1,disableScaling:!0,onDragStart:zt,onDrag:gt,onDragEnd:Ut})]})}var Yt=require("react"),mS=require("@react-three/drei"),Qp=require("@react-three/fiber"),In=require("three");var Bn=require("three");function Jp(e){e.updateWorldMatrix(!0,!0);let t=new Bn.Matrix4().copy(e.matrixWorld).invert(),n=new Bn.Box3,i=new Bn.Box3,r=!1;return e.traverse(o=>{let a=o;if(!a.isMesh||!a.geometry||(a.geometry.boundingBox||a.geometry.computeBoundingBox(),!a.geometry.boundingBox))return;let s=new Bn.Matrix4().multiplyMatrices(t,o.matrixWorld);i.copy(a.geometry.boundingBox).applyMatrix4(s),n.union(i),r=!0}),r?n.getCenter(new Bn.Vector3):new Bn.Vector3}function uS(e,t="XYZ"){return new Bn.Quaternion().setFromEuler(new Bn.Euler(e[0],e[1],e[2],t))}function dR(e,t,n,i,r="XYZ"){let a=new Bn.Vector3(...i).multiply(new Bn.Vector3(...n)).applyQuaternion(uS(t,r)).add(new Bn.Vector3(...e));return[a.x,a.y,a.z]}function pS(e,t,n,i,r,o="XYZ"){let a=new Bn.Vector3(...dR(e,t,i,r,o)),s=new Bn.Vector3(...r).multiply(new Bn.Vector3(...i)).applyQuaternion(uS(n,o)),l=a.sub(s);return[l.x,l.y,l.z]}var Mg=require("react/jsx-runtime");function Cg({node:e,space:t,onTransformChange:n,onDraggingChange:i}){let r=(0,Qp.useThree)(T=>T.invalidate),o=(0,Yt.useMemo)(()=>Jp(e),[e]),a=(0,Yt.useMemo)(()=>new In.Matrix4,[]),s=(0,Yt.useRef)(!1),l=(0,Yt.useRef)(new In.Matrix4),c=(0,Yt.useRef)(new In.Matrix4),h=(0,Yt.useRef)(null),p=(0,Yt.useRef)(0),u=(0,Yt.useRef)([]),m=(0,Yt.useRef)(null),f=(0,Yt.useRef)(i);f.current=i;let g=(0,Yt.useMemo)(()=>new In.Vector3,[]),b=(0,Yt.useMemo)(()=>new In.Quaternion,[]),x=(0,Yt.useMemo)(()=>new In.Vector3,[]),v=(0,Yt.useMemo)(()=>new In.Quaternion,[]),w=(0,Yt.useMemo)(()=>new In.Vector3(1,1,1),[]),M=(0,Yt.useMemo)(()=>new In.Quaternion,[]),_=(0,Yt.useMemo)(()=>new In.Vector3,[]),y=(0,Yt.useMemo)(()=>new In.Vector3,[]),P=(0,Yt.useRef)([0,0,0]),d=(0,Yt.useCallback)(()=>{s.current||(e.updateWorldMatrix(!0,!1),g.copy(o).applyMatrix4(e.matrixWorld),e.getWorldQuaternion(b),v.copy(b),t==="world"&&v.identity(),a.compose(g,v,w))},[g,a,v,w,e,o,t,b]);(0,Yt.useLayoutEffect)(()=>(d(),()=>{let T=m.current!==null;T&&(cancelAnimationFrame(m.current),m.current=null),(s.current||T)&&(s.current=!1,f.current(!1));for(let E of u.current)Js(E);u.current=[]}),[d]),(0,Qp.useFrame)(()=>d());let S=(0,Yt.useCallback)(()=>{m.current!==null&&(cancelAnimationFrame(m.current),m.current=null),e.updateWorldMatrix(!0,!0),u.current=[];for(let T of Zs(e))Kx(T)||(Su(T,T.matrixWorld),u.current.push(T));e.updateWorldMatrix(!0,!1),g.copy(o).applyMatrix4(e.matrixWorld),e.getWorldQuaternion(b),e.getWorldScale(x),l.current.compose(g,b,x),c.current.copy(a),P.current=[e.rotation.x,e.rotation.y,e.rotation.z],h.current=null,s.current=!0,i(!0)},[g,a,e,i,o,b,x]),C=(0,Yt.useCallback)((T,E)=>{let k=l.current.clone().premultiply(E),D=c.current.clone().premultiply(E);k.decompose(_,b,y);let I=_.clone();D.decompose(g,v,w),t==="world"&&v.identity(),a.compose(g,v,w),T.decompose(_,M,y);let L=new In.Euler().setFromQuaternion(M,e.rotation.order),[X,O,B]=P.current,re=[X+L.x,O+L.y,B+L.z],ke=new In.Quaternion().setFromEuler(new In.Euler(re[0],re[1],re[2],e.rotation.order)),We=(e.parent?.matrixWorld||new In.Matrix4).clone().invert(),wt=I.clone().applyMatrix4(We),be=o.clone().multiply(e.scale).applyQuaternion(ke),ue=wt.clone().sub(be),Ne=[ue.x,ue.y,ue.z];e.position.set(Ne[0],Ne[1],Ne[2]),e.rotation.set(re[0],re[1],re[2],e.rotation.order),e.updateMatrixWorld(!0),r(),h.current={position:Ne,rotation:re}},[g,M,a,v,w,r,e,o,_,y,t,b]);return(0,Mg.jsx)("group",{children:(0,Mg.jsx)(mS.PivotControls,{matrix:a,autoTransform:!1,fixed:!0,scale:90,lineWidth:3,axisColors:["#ff2d6f","#64dfa6","#2f8fe8"],hoveredColor:"#ffd84d",opacity:.95,depthTest:!1,disableScaling:!0,onDragStart:S,onDrag:(T,E,k,D)=>C(E,D),onDragEnd:()=>{s.current=!1;let T=h.current;if(h.current=null,T)n(T),m.current=requestAnimationFrame(()=>{m.current=null,i(!1)});else if(u.current.length>0){for(let E of u.current)Js(E);e.updateMatrixWorld(!0),r(),i(!1)}else i(!1);u.current=[]}})})}var hS=require("three");function uR(e){let t=e.object;if(!t.isSkinnedMesh||!e.face||!t.skeleton)return null;let n=t.geometry,i=n.getAttribute("skinIndex"),r=n.getAttribute("skinWeight"),o=n.getAttribute("position");if(!i||!r||!o)return null;let a=t.worldToLocal(e.point.clone()),s=[e.face.a,e.face.b,e.face.c],l=new hS.Vector3,c=s[0],h=1/0;for(let m of s){l.fromBufferAttribute(o,m);let f=l.distanceToSquared(a);f<h&&(h=f,c=m)}let p=i.getComponent(c,0),u=r.getComponent(c,0);for(let m=1;m<4;m++){let f=r.getComponent(c,m);f>u&&(u=f,p=i.getComponent(c,m))}return t.skeleton.bones[p]??null}function fS(e){let t=uR(e)??e.object,n=Ac(t);if(!n)return null;t.updateWorldMatrix(!0,!1);let i=t.worldToLocal(e.point.clone());return{anchorNodeName:n,anchorLocalPosition:[i.x,i.y,i.z]}}function gS(e,t,n){if(!e.anchorNodeName||!e.anchorLocalPosition)return!1;let i=xi(t,e.anchorNodeName);return i?(i.updateWorldMatrix(!0,!1),n.set(...e.anchorLocalPosition).applyMatrix4(i.matrixWorld),!0):!1}var vo=require("react"),tm=require("@react-three/fiber"),em=require("three");function Tg({annotation:e,enabled:t,controlsRef:n,offsetRef:i}){let r=(0,tm.useThree)(u=>u.scene),o=(0,vo.useRef)(null),a=(0,vo.useRef)(!1),s=(0,vo.useMemo)(()=>new em.Vector3,[]),l=(0,vo.useMemo)(()=>new em.Vector3,[]),c=(0,vo.useMemo)(()=>new em.Vector3,[]),h=e?.anchorNodeName,p=e?.anchorLocalPosition;return(0,vo.useEffect)(()=>{o.current=null,a.current=!1},[h,e?.id]),(0,tm.useFrame)(()=>{let u=n.current,m=i.current;if(!t||!u||!m||!h||!p){a.current=!1;return}let f=o.current;if((!f||!f.parent)&&(f=xi(r,h),o.current=f),!f){a.current=!1;return}f.updateWorldMatrix(!0,!1),s.set(p[0],p[1],p[2]).applyMatrix4(f.matrixWorld),!(a.current&&s.distanceToSquared(l)<1e-8)&&(l.copy(s),a.current=!0,c.copy(s).add(m),u.setLookAt(c.x,c.y,c.z,s.x,s.y,s.z,!0))}),null}var nt=require("react"),as=require("three");function bS({sceneAnnotations:e,controlledAnnotationCategories:t,onAnnotationCategoriesChange:n,showAnnotationFilters:i,initialCategories:r,controlledActiveAnnotation:o,onActiveAnnotationChange:a,onAnnotationsChange:s,controlsRef:l,sceneRef:c,annotationWorldPositionsRef:h,tourCameraOffsetRef:p,initialCameraStateRef:u,engagement:m,engagementRef:f}){let[g,b]=(0,nt.useState)(!1),[x,v]=(0,nt.useState)(()=>e??[]);(0,nt.useEffect)(()=>{if(x.length>0){let ce=x.reduce((Be,zt)=>Math.max(Be,zt.id),0);P.current=ce}else P.current=0},[x]);let[w,M]=(0,nt.useState)(null),[_,y]=(0,nt.useState)({title:"",description:""}),P=(0,nt.useRef)(0),[d,S]=(0,nt.useState)(null),[C,T]=(0,nt.useState)(-1),[E,k]=(0,nt.useState)(!1),D=(0,nt.useRef)(null),[I,L]=(0,nt.useState)(()=>r),X=t===void 0?I:t,O=(0,nt.useMemo)(()=>Z1(x,X),[x,X]),B=(0,nt.useMemo)(()=>[...new Set(x.map(Xf))].sort(),[x]),re=i&&B.some(Boolean),ke=ce=>{t===void 0&&L(ce),n?.(ce)},te=(0,nt.useMemo)(()=>[...O].sort((ce,Be)=>ce.id-Be.id),[O]),We=(0,nt.useMemo)(()=>JSON.stringify([X?.map(ce=>ce.trim()).sort()??null,te]),[X,te]),wt=(0,nt.useMemo)(()=>C<0||C>=te.length?null:te[C],[C,te]),be=(0,nt.useCallback)(ce=>{if(o!==void 0){a?.(ce);return}S(ce?{annotation:ce}:null)},[o,a]),ue=(0,nt.useRef)(null),Ne=(0,nt.useCallback)(ce=>{let Be=l.current,zt=c.current;if(!Be)return;let gt=new as.Vector3,Ut=h.current.get(ce.id);Ut?gt.copy(Ut):zt&&gS(ce,zt,gt)||gt.set(ce.worldPosition[0],ce.worldPosition[1],ce.worldPosition[2]),p.current=null;let Ae=Be.smoothTime;Be.smoothTime=il(Be,.6);let Ce=ce.worldNormal;if(bl(ce.cameraView))td(Be,ce.cameraView);else{if(zt){let Pt=new as.Box3().setFromObject(zt),St=new as.Vector3;Pt.getCenter(St);let dn=new as.Vector3;Pt.getSize(dn);let ae=dn.length()*.2,he;Ce?he=new as.Vector3(Ce[0],Ce[1],Ce[2]):he=gt.clone().sub(St),he.lengthSq()<1e-6&&he.set(0,0,1),he.normalize();let Ee=Math.max(ae*.6,.3),Ie=gt.clone().add(he.multiplyScalar(Ee));Be.setPosition(Ie.x,Ie.y,Ie.z,!0),ce.anchorNodeName&&ce.anchorLocalPosition&&(p.current=Ie.clone().sub(gt))}Be.setTarget(gt.x,gt.y,gt.z,!0),ue.current&&nd(Be,ue.current)}D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{Be.smoothTime=Ae,D.current=null},800),be(ce)},[be]),Te=(0,nt.useCallback)(()=>{te.length!==0&&(l.current&&(ue.current=ed(l.current)),m.startTour(te.length),b(!0),T(0),Ne(te[0]))},[te,Ne,m]),bn=(0,nt.useCallback)(()=>{if(te.length===0||C<0)return;k(!0);let ce=(C-1+te.length)%te.length;T(ce),Ne(te[ce]),setTimeout(()=>k(!1),500)},[C,te,Ne]),Oe=(0,nt.useCallback)(()=>{if(te.length===0||C<0)return;if(C===te.length-1){if(m.completeTour(),b(!1),T(-1),be(null),l.current&&u.current){let Be=u.current;td(l.current,{...ue.current,...Be}),ue.current=null}return}k(!0);let ce=C+1;T(ce),Ne(te[ce]),setTimeout(()=>k(!1),500)},[C,te,Ne,be,m]),ot=(0,nt.useCallback)(()=>{if(m.stopTour(),b(!1),T(-1),be(null),l.current&&u.current){let ce=u.current;td(l.current,{...ue.current,...ce}),ue.current=null}},[be,m]);(0,nt.useEffect)(()=>{f.current.stopTour("annotations-changed"),ue.current&&l.current&&(td(l.current,{...ue.current,...u.current??{}}),ue.current=null),p.current=null,T(-1),b(!1)},[We]),(0,nt.useEffect)(()=>()=>{D.current&&clearTimeout(D.current)},[]),(0,nt.useEffect)(()=>{wt&&g&&ue.current&&be(wt)},[wt,be,g]),(0,nt.useEffect)(()=>{if(e===void 0)return;let ce=e.map(Be=>({...Be,localPosition:Be.localPosition??Be.worldPosition}));v(ce)},[e]);let mt=(0,nt.useCallback)(()=>{if(o!==void 0){a?.(null);return}S(null)},[o,a]),vn=o!==void 0?o:d?.annotation??null,de=(0,nt.useMemo)(()=>vn?O.find(Be=>Be.id===vn.id)??null:null,[vn,O]);(0,nt.useEffect)(()=>{vn&&!de&&mt()},[vn,de,mt]);let ur=(0,nt.useCallback)(()=>{if(!w||!_.title.trim())return;P.current+=1;let Be={id:P.current,worldPosition:w.worldPosition,localPosition:w.localPosition,worldNormal:w.worldNormal,anchorNodeName:w.anchor?.anchorNodeName,anchorLocalPosition:w.anchor?.anchorLocalPosition,title:_.title.trim(),description:_.description},zt=[...x,Be];v(zt),s?.(zt),M(null)},[w,_,x,s]),jt=(0,nt.useCallback)(()=>M(null),[]),Gt=(0,nt.useCallback)(ce=>{bl(ce.cameraView)?Ne(ce):be(ce)},[be,Ne]);return{annotations:x,pendingAnnotation:w,setPendingAnnotation:M,annotationForm:_,setAnnotationForm:y,currentAnnotationIndex:C,isNavigating:E,localAnnotationCategories:I,selectedAnnotationCategories:X,visibleAnnotations:O,availableAnnotationCategories:B,annotationFiltersVisible:re,changeAnnotationCategories:ke,sortedAnnotations:te,currentAnnotation:wt,setActiveAnnotation:be,focusAnnotation:Ne,startGuidedTour:Te,goToPreviousAnnotation:bn,goToNextAnnotation:Oe,stopGuidedTour:ot,closeViewingAnnotation:mt,activeAnnotation:vn,activeViewingAnnotation:de,isGuidedTourActive:g,handleAnnotationOk:ur,handleAnnotationCancel:jt,handleAnnotationMarkerClick:Gt}}var ii=require("react"),xS=require("three");var zn=require("three");function nm(e,t){if(!(e instanceof zn.Mesh)||!t)return null;let n=e.geometry.getAttribute("position");if(!n?.count)return null;e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);let i=new zn.Box3,r=new zn.Vector3;if(hi(e)){let y=e;y.computeBoundingBox(),y.computeBoundingSphere();for(let P=0;P<n.count;P++)i.expandByPoint(e.getVertexPosition(P,r))}else e.geometry.boundingBox||e.geometry.computeBoundingBox(),i.copy(e.geometry.boundingBox);if(i.applyMatrix4(e.matrixWorld),i.isEmpty())return null;let o=i.getCenter(new zn.Vector3),a=t.getWorldPosition(new zn.Vector3),s=t.getWorldDirection(new zn.Vector3),l=t.isOrthographicCamera,c=new zn.Raycaster,h=y=>{if(l){let d=a.distanceTo(o)+i.getSize(r).length()+1;c.set(y.clone().addScaledVector(s,-d),s)}else c.set(a,y.clone().sub(a).normalize());let P=c.intersectObject(e,!1)[0];return P?Va({...P,ray:c.ray},e):null},p=h(o);if(p)return p;let u=e.geometry.index,m=u?.count??n.count,f=new zn.Vector3,g=new zn.Vector3,b=new zn.Vector3,x=new zn.Vector3,v=new zn.Vector3,w=new zn.Vector3,M=null,_=1/0;for(let y=0;y+2<m;y+=3){if(e.getVertexPosition(u?u.getX(y):y,f).applyMatrix4(e.matrixWorld),e.getVertexPosition(u?u.getX(y+1):y+1,g).applyMatrix4(e.matrixWorld),e.getVertexPosition(u?u.getX(y+2):y+2,b).applyMatrix4(e.matrixWorld),x.copy(f).add(g).add(b).multiplyScalar(1/3),zn.Triangle.getNormal(f,g,b,v),l?w.copy(s).negate():w.copy(a).sub(x),v.dot(w)<=0)continue;let P=x.distanceToSquared(o);P<_&&(_=P,M=x.clone())}return M?h(M):null}var Un=require("three");function rm(e,t,n,i){if(!(e instanceof Un.Mesh)||!t)return null;e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);let r=new Un.Vector3().fromArray(n.position);if(hi(e)){let c=e;c.computeBoundingBox(),c.computeBoundingSphere();let h=c.geometry.getAttribute("position");if(!h)return null;let p=c.geometry.index,u=p?.count??h.count,m=new Un.Triangle,f=new Un.Vector3,g=new Un.Vector3,b=1/0,x=null;for(let v=0;v+2<u;v+=3){let w=[0,1,2].map(_=>p?p.getX(v+_):v+_);m.a.fromBufferAttribute(h,w[0]),m.b.fromBufferAttribute(h,w[1]),m.c.fromBufferAttribute(h,w[2]),m.closestPointToPoint(r,f);let M=f.distanceToSquared(r);if(!(M>=b||!m.getBarycoord(f,g))&&(b=M,x=new Un.Vector3().addScaledVector(c.getVertexPosition(w[0],new Un.Vector3),g.x).addScaledVector(c.getVertexPosition(w[1],new Un.Vector3),g.y).addScaledVector(c.getVertexPosition(w[2],new Un.Vector3),g.z),b<1e-12))break}if(!x)return null;r.copy(x)}if(r.applyMatrix4(e.matrixWorld).project(t),!Number.isFinite(r.x)||r.z<-1||r.z>1)return null;let o=new Un.Vector2(i==="left"?-.0035:i==="right"?.0035:0,i==="down"?-.0035:i==="up"?.0035:0),a=new Un.Raycaster,s=n.size*.01,l=new Un.Vector3().fromArray(n.position);for(let c=1;c>=1/1024;c/=2){a.setFromCamera(new Un.Vector2(r.x,r.y).addScaledVector(o,c),t);let h=a.intersectObject(e,!1)[0];if(h){let p=Va({...h,ray:a.ray},e);if(new Un.Vector3().fromArray(p.position).distanceTo(l)<=s)return p}}return null}var vS=()=>`decal-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function yS({currentObjectBindings:e,currentObjectBindingsRef:t,applyObjectBindings:n,nodeRefsMap:i,controlsRef:r,decalMove:o,decalDragging:a,setDecalDragging:s,setDecalError:l,setDecalControl:c,decalRequestRef:h,onTextureUpload:p,currentPanelObjectId:u,modelUrl:m}){let f=(0,ii.useCallback)((y,P)=>{let d=t.current,S=d[y];if(!S)return;let C=P(S.decals??[]);n({...d,[y]:{...S,decals:C.length>0?C:void 0}})},[n,e]),g=(0,ii.useMemo)(()=>{if(!a)return null;let{objectKey:y,decalId:P}=a,d=e[y],S=d?.decals?.find(C=>C.id===P);return S?{objectId:d.modelObjectId??y,decal:S,onCancel:()=>s(null),onCommit:C=>{f(y,T=>T.map(E=>E.id===P?{...E,...C}:E)),s(null)}}:null},[a,e,f]),b=o??g,x=(0,ii.useCallback)((y,P)=>{h.current++;let d=t.current[y],S=i.current[d?.modelObjectId??y],C=nm(S,r.current?.camera);if(!C)return l("Could not find a surface on this object for the decal."),!1;let T={...P,...C};return f(y,E=>[...E,T]),l(null),c(E=>E&&{...E,activeId:T.id}),s({objectKey:y,decalId:T.id}),!0},[f]),v=(0,ii.useCallback)(y=>{let P=t.current[y],d=i.current[P?.modelObjectId??y]?.geometry;if(!d)return .2;d.boundingBox||d.computeBoundingBox();let S=d.boundingBox?.getSize(new xS.Vector3),C=S?Math.max(S.x,S.y,S.z):0;return C>0&&Number.isFinite(C)?C/3:.2},[]),w=(0,ii.useRef)([]);(0,ii.useEffect)(()=>()=>{for(let y of w.current)URL.revokeObjectURL(y)},[]);let M=(0,ii.useCallback)(async(y,P,d)=>{let S=++h.current;s(null);let C;if(p){if(C=await p(d,y),S!==h.current)return}else C=URL.createObjectURL(d),w.current.push(C);x(P,{id:vS(),image:C,size:v(P)})},[v,p,x]);return(0,ii.useEffect)(()=>{h.current++,l(null),s(null)},[u,m]),{editDecals:f,activeDecalMove:b,addCenteredDecal:x,decalSizeFor:v,startImageDecal:M,decalControlHandlers:(y,P)=>({onSelect:d=>{h.current++,l(null),s(null),c({...y,activeId:d})},onAddText:(d,S)=>x(P,{id:vS(),text:d,color:S,size:v(P)}),onAddImage:d=>{M(y.objectId,P,d)},onChange:(d,S)=>f(P,C=>C.map(T=>T.id===d?{...T,...S}:T)),onNudge:(d,S)=>{let C=t.current[P],T=C?.decals?.find(D=>D.id===d);if(!T)return;let E=i.current[C.modelObjectId??P],k=rm(E,r.current?.camera,T,S);if(!k){l("No visible surface in that direction. Try another arrow or rotate the view.");return}l(null),s(null),f(P,D=>D.map(I=>I.id===d?{...I,...k}:I))},onMove:d=>{h.current++,e[P]?.decals?.find(C=>C.id===d)&&(l(null),s(C=>C?.objectKey===P&&C.decalId===d?null:{objectKey:P,decalId:d}))},onRemove:d=>{s(null),f(P,S=>S.filter(C=>C.id!==d)),c({...y,activeId:null})},onClose:()=>{h.current++,l(null),s(null),c(null)}})}}var dd=require("react");function wS({canvasAreaElement:e,controlsRef:t,enabled:n}){let i=(0,dd.useRef)(new Set),r=(0,dd.useRef)(null);(0,dd.useEffect)(()=>{let o=e;if(!o||!n)return;let a=new Set(["w","a","s","d"," ","c"]),s=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]),l=0,c=f=>f.code==="Space"?" ":f.key.toLowerCase(),h=()=>{i.current.clear(),l=0,r.current!==null&&(cancelAnimationFrame(r.current),r.current=null)},p=f=>{let g=t.current,b=i.current;if(!g||b.size===0){r.current=null,l=0;return}let x=l?Math.min((f-l)/1e3,.05):1/60;l=f;let v=Math.max(g.distance*.75,.01)*x;b.has("w")&&g.forward(v,!1),b.has("s")&&g.forward(-v,!1),b.has("a")&&g.truck(-v,0,!1),b.has("d")&&g.truck(v,0,!1),b.has(" ")&&g.truck(0,v,!1),b.has("c")&&g.truck(0,-v,!1),r.current=requestAnimationFrame(p)},u=f=>{if(f.target!==o){h();return}if(s.has(f.key)){let b=t.current;if(!b)return;f.preventDefault();let x=Math.PI/90,v=Math.max(b.distance*.05,.01);f.key==="ArrowUp"?f.shiftKey?b.forward(v,!0):b.rotate(0,-x,!0):f.key==="ArrowDown"?f.shiftKey?b.forward(-v,!0):b.rotate(0,x,!0):f.key==="ArrowLeft"?b.rotate(-x,0,!0):b.rotate(x,0,!0);return}let g=c(f);a.has(g)&&(f.preventDefault(),i.current.add(g),r.current===null&&(r.current=requestAnimationFrame(p)))},m=f=>{i.current.delete(c(f))};return o.addEventListener("keydown",u),o.addEventListener("keyup",m),o.addEventListener("blur",h),()=>{o.removeEventListener("keydown",u),o.removeEventListener("keyup",m),o.removeEventListener("blur",h),h()}},[e,t,n])}var Kn=require("react");var SS=1,pR=4,mR=.0015,hR=.1,fR=8;function _S({moveZoomTarget:e,setMoveZoomTarget:t,currentObjectBindingsRef:n,materialRefsOut:i,rendererCaptureRef:r,canvasAreaRef:o,canvasAreaElement:a,applyBindingStyle:s}){let l=(0,Kn.useRef)(null),c=(0,Kn.useRef)(!1),h=(0,Kn.useRef)([0,0]),p=(0,Kn.useRef)([0,0]),u=(0,Kn.useRef)(1),m=(0,Kn.useRef)(null),f=(0,Kn.useCallback)((M,_)=>{let y=e;if(!y)return;let P=n.current[y.objectKey]?.style?.material?.[y.textureKey],d=P?.path;if(!d)return;let S=P?.rotation??0,C=mi(y.textureKey),T=wc(d,C),E=i.current[y.objectKey],k=Array.isArray(E)?E:E?[E]:[],D=yu[y.textureKey];for(let I of k){let L=I;D in L&&(L[D]=Cu(L.userData,y.textureKey,T,d,M,_,S))}r.current?.invalidate()},[e]),g=(0,Kn.useCallback)(M=>{if(!e)return;M.currentTarget.setPointerCapture?.(M.pointerId),l.current={x:M.clientX,y:M.clientY},c.current=!1;let _=n.current[e.objectKey]?.style?.material?.[e.textureKey];if(h.current=_?.offset??[0,0],p.current=h.current,u.current=_?.scale??1,m.current===null){let y=()=>{r.current?.invalidate(),m.current=requestAnimationFrame(y)};m.current=requestAnimationFrame(y)}},[e]),b=(0,Kn.useCallback)(M=>{if(!e||!l.current)return;let _=o.current,y=_?.clientWidth||1,P=_?.clientHeight||1,d=M.clientX-l.current.x,S=M.clientY-l.current.y;if(!c.current&&Math.hypot(d,S)<pR)return;c.current=!0;let C=-(d/y)*SS,T=S/P*SS,[E,k]=h.current,D=[E+C,k+T];p.current=D,f(D,u.current),s(e.objectKey,I=>({...I,material:{...I?.material,[e.textureKey]:{...I?.material?.[e.textureKey],path:n.current[e.objectKey]?.style?.material?.[e.textureKey]?.path,offset:D}}}))},[e,f,s]),x=(0,Kn.useCallback)(M=>{if(!e)return;M.target?.releasePointerCapture?.(M.pointerId),m.current!==null&&(cancelAnimationFrame(m.current),m.current=null);let _=c.current,y=e;if(_){s(y.objectKey,P=>({...P,material:{...P?.material,[y.textureKey]:{...P?.material?.[y.textureKey],path:n.current[y.objectKey]?.style?.material?.[y.textureKey]?.path,offset:p.current}}})),l.current=null,c.current=!1;return}l.current=null,t(null)},[e,s]);(0,Kn.useEffect)(()=>{if(!e)return m.current!==null&&(cancelAnimationFrame(m.current),m.current=null),()=>{m.current!==null&&(cancelAnimationFrame(m.current),m.current=null)}},[e]),(0,Kn.useEffect)(()=>{let M=a;if(!(!M||!e))return M.addEventListener("pointermove",b),M.addEventListener("pointerup",x),M.addEventListener("pointercancel",x),()=>{M.removeEventListener("pointermove",b),M.removeEventListener("pointerup",x),M.removeEventListener("pointercancel",x)}},[a,e,b,x]);let v=(0,Kn.useCallback)(M=>{if(!e)return;M.preventDefault();let _=e,y=Math.exp(-M.deltaY*mR),P=Math.min(fR,Math.max(hR,u.current*y));u.current=P,f(p.current,P),s(_.objectKey,d=>({...d,material:{...d?.material,[_.textureKey]:{...d?.material?.[_.textureKey],path:n.current[_.objectKey]?.style?.material?.[_.textureKey]?.path,scale:P}}}))},[e,f,s]);return(0,Kn.useEffect)(()=>{let M=a;if(!(!M||!e))return M.addEventListener("wheel",v,{passive:!1}),()=>M.removeEventListener("wheel",v)},[a,e,v]),{beginMoveZoom:(0,Kn.useCallback)(M=>{c.current=!1,l.current=null,t(M)},[t]),handleMoveZoomPointerDown:g}}var im=require("@react-three/fiber"),gR=.2;function Pg({enabled:e,speed:t,controlsRef:n}){let i=(0,im.useThree)(r=>r.invalidate);return(0,im.useFrame)((r,o)=>{!e||!n.current||(n.current.rotate(o*gR*t,0,!1),i())}),null}var Ti=require("lucide-react");var Dt=require("react/jsx-runtime");function MS({count:e,onDismiss:t}){let n=Me();return(0,Dt.jsxs)("div",{className:"ri-bindingsMismatchBanner",children:[(0,Dt.jsx)(Ti.AlertTriangle,{size:14,className:"ri-bindingsMismatchBanner__icon"}),(0,Dt.jsx)("span",{children:n(e===1?"bindingMismatchOne":"bindingMismatchMany",{count:e})}),(0,Dt.jsx)("button",{type:"button",className:"ri-bindingsMismatchBanner__dismiss",onClick:i=>{i.stopPropagation(),t()},"aria-label":n("dismiss"),children:(0,Dt.jsx)(Ti.X,{size:12})})]})}function CS({triangles:e,offset:t,onDismiss:n}){let i=Me();return(0,Dt.jsxs)("div",{className:`ri-largeModelBanner ${t?"ri-largeModelBanner--offset":""}`,children:[(0,Dt.jsx)(Ti.AlertTriangle,{size:14,className:"ri-largeModelBanner__icon"}),(0,Dt.jsx)("span",{children:i("largeModelWarning",{millions:Math.round(e/1e6)})}),(0,Dt.jsx)("button",{type:"button",className:"ri-largeModelBanner__dismiss",onClick:r=>{r.stopPropagation(),n()},"aria-label":i("dismiss"),children:(0,Dt.jsx)(Ti.X,{size:12})})]})}function TS({missing:e,total:t}){let n=Me();return(0,Dt.jsxs)("div",{className:"ri-uvCheckerBanner",role:"status",children:[(0,Dt.jsx)(Ti.AlertTriangle,{size:14,className:"ri-uvCheckerBanner__icon"}),(0,Dt.jsxs)("span",{children:[e===t?"UV Checker: this model has no UV0 coordinates.":`UV Checker: ${e} of ${t} meshes have no UV0 coordinates.`," ",n("missingUVsAreShownInMagenta")]})]})}function PS({failure:e,source:t}){return(0,Dt.jsx)("div",{className:"ri-loadError",role:"alert",children:(0,Dt.jsxs)("div",{className:"ri-loadError__card",children:[(0,Dt.jsxs)("div",{className:"ri-loadError__header",children:[(0,Dt.jsx)(Ti.AlertTriangle,{size:16,"aria-hidden":"true"}),(0,Dt.jsx)("span",{className:"ri-loadError__title",children:e.title})]}),(0,Dt.jsx)("p",{className:"ri-loadError__detail",children:e.detail}),(0,Dt.jsx)("p",{className:"ri-loadError__source",children:t}),e.technical&&(0,Dt.jsx)("p",{className:"ri-loadError__technical",children:e.technical})]})})}function AS({rebuilding:e,onReload:t}){let n=Me();return(0,Dt.jsx)("div",{className:"ri-contextRecovery",role:"alert",children:(0,Dt.jsxs)("div",{className:"ri-contextRecovery__card",children:[(0,Dt.jsx)(Ti.AlertTriangle,{size:24,"aria-hidden":"true"}),(0,Dt.jsx)("h2",{children:n(e?"contextRestoringTitle":"contextLostTitle")}),(0,Dt.jsx)("p",{children:n(e?"contextRestoringMessage":"contextLostMessage")}),(0,Dt.jsxs)("button",{type:"button",onClick:t,disabled:e,children:[(0,Dt.jsx)(Ti.RotateCcw,{size:16,"aria-hidden":"true"}),n("reloadViewer")]})]})})}var ud=require("react");function ES({applyBindingStyle:e,resolveObjectKey:t,onTextureUpload:n,fileInputRef:i,pendingObjectId:r,createdBlobUrls:o,texturePositioning:a,setMoveZoomTarget:s}){let l=(0,ud.useCallback)((x,v)=>{let w=o.current[x];w&&URL.revokeObjectURL(w),v.startsWith("blob:")?o.current[x]=v:delete o.current[x],e(x,M=>({...M,material:{...M?.material,texture:{path:v}}}))},[e]),c=x=>{let v=x.target.files?.[0],w=r.current;if(!v||!w)return;let M=t(w);M&&(n?n(v,M).then(_=>l(M,_),_=>console.error("onTextureUpload failed:",_)):l(M,URL.createObjectURL(v)),x.target.value="")},h=x=>{r.current=x,i.current?.click()},p=x=>{let v=t(x);if(!v)return;e(v,M=>M?.material?.texture?{...M,material:{...M.material,texture:void 0}}:M);let w=o.current[v];w&&(URL.revokeObjectURL(w),delete o.current[v])},u=!!a,m=typeof a=="object"?a:void 0,f=(0,ud.useCallback)((x,v,w)=>{if(m?.onOffsetChange){m.onOffsetChange(x,v,w);return}e(x,M=>{let _=M?.material?.texture;if(!_?.path)return M;let y=_.offset??[0,0],P=[y[0],y[1]];return P[v]=w,{...M,material:{...M?.material,texture:{..._,offset:P}}}})},[e,m]),g=(0,ud.useCallback)((x,v)=>{if(m?.onRotationChange){m.onRotationChange(x,v);return}e(x,w=>{let M=w?.material?.texture;if(!M?.path)return w;let _=(v%360+360)%360;return{...w,material:{...w?.material,texture:{...M,rotation:_*Math.PI/180}}}})},[e,m]),b=(0,ud.useCallback)(()=>{s(null),m?.onEndPositioning?.()},[m]);return{handleFileChange:c,triggerFileUpload:h,clearTexture:p,texturePositioningEnabled:u,texturePositioningOverrides:m,setMaterialTextureOffset:f,setMaterialTextureRotation:g,endMaterialTexturePositioning:b}}function RS({materialPopup:e,resolveObjectKey:t,currentObjectBindings:n,nodeRefsMap:i,moveZoomTarget:r,texturePositioningEnabled:o,texturePositioningOverrides:a,setMaterialTextureOffset:s,setMaterialTextureRotation:l,endMaterialTexturePositioning:c}){let h=e?t(e.objectId):null,p=h?n[h]?.style?.material?.texture?.path:void 0,u=p?Mu(p)??p:void 0,m=xu(h?i.current[h]:null),f=o?a?.offset??(h?n[h]?.style?.material?.texture?.offset:void 0):void 0,g=o?a?.rotationDegrees??(h?((n[h]?.style?.material?.texture?.rotation??0)*180/Math.PI%360+360)%360:0):0,b=o?a?.isPositioning??!!(h&&r?.objectKey===h&&r?.textureKey==="texture"):!1;return{materialTextureUrl:u,materialTargetTakesImage:m,materialTextureOffset:f,materialTextureRotationDegrees:g,isMaterialTexturePositioning:b,materialTextureOnOffsetChange:o?s:void 0,materialTextureOnRotationChange:o?l:void 0,materialTextureOnEndPositioning:o?c:void 0}}var Ml=require("react");var om=e=>e==="#000000"?"#ffffff":e;function kS({nodeRefsMap:e,currentObjectBindingsRef:t,applyObjectBindings:n}){let i=(0,Ml.useRef)({}),r=(0,Ml.useCallback)(a=>{let s=kx(e.current[a]),l=t.current[a]?.style?.material,c=l?.emissive??s.color,h=l?.emissiveIntensity??s.intensity;return{color:c,intensity:h,on:c!=="#000000"&&h>0}},[]),o=(0,Ml.useCallback)((a,s)=>{let l=t.current,c=l[a];c&&n({...l,[a]:{...c,style:{...c.style,material:{...c.style?.material,...s}}}})},[n]);return{glowMemoryRef:i,readObjectGlow:r,applyGlow:o}}function LS({setCurrentAction:e,bindingKeyIndex:t,currentObjectBindings:n,applyObjectBindings:i,resolveObjectKey:r,closeColorPicker:o,setColorPicker:a,setMaterialPopupsByObject:s,setItemMaterials:l,getPopoverPosition:c,decalRequestRef:h,setDecalError:p,setDecalDragging:u,setDecalControl:m,resolvedSceneConfigRef:f,applyLightPatches:g,readObjectGlow:b,applyGlow:x,glowMemoryRef:v,setLightControl:w,onAction:M}){return(0,Ml.useCallback)(_=>{let{objectId:y,action:P,binding:d}=_;switch(e(_),P.id){case"toggle-visibility":{let S=y;d?.modelObjectId&&(S=t.byModelObjectId.get(d.modelObjectId)??S);let C=n[S],T=C?.visible===!1;C&&i({...n,[S]:{...C,visible:T}});break}case"change-color":o(),s(S=>{if(!(y in S))return S;let C={...S};return delete C[y],C}),l(S=>{let C=r(y,d)??y,T=S[y]?.hex,E=n[C]?.style?.material?.baseColor;return{...S,[y]:{...S[y],hex:T??E??"#ffffff"}}}),a(c(y,225,250,d,_));break;case"change-material":o(),s(S=>{if(y in S){let C={...S};return delete C[y],C}return{...S,[y]:c(y,300,320,d,_)}});break;case"add-text":case"add-image":{o();let S=P.id;h.current++,p(null),u(null),m(C=>C?.objectId===y&&C.kind===S?null:{objectId:y,kind:S,activeId:null});break}case"toggle-light":case"change-light-color":case"set-brightness":{let S=r(y,d);if(!S)break;let C=Rx(f.current,n,S);if(P.id==="toggle-light"){if(C.length>0){let D=!C.some(I=>I.visible);g(Object.fromEntries(C.map(I=>[I.id,{visible:D}])));break}let k=b(S);k.on?(v.current[S]=k.intensity,x(S,{emissiveIntensity:0})):x(S,{emissive:om(k.color),emissiveIntensity:v.current[S]??1});break}let T=P.id,E=C.length>0?null:b(S);w(k=>k?.objectId===y&&k.kind===T?null:{objectId:y,kind:T,target:E?{type:"glow",objectKey:S,baseIntensity:E.on?E.intensity:v.current[S]??1}:{type:"lights",lightIds:C.map(D=>D.id),baseIntensity:Object.fromEntries(C.map(D=>[D.id,D.intensity]))},percent:E&&!E.on?0:100});break}default:break}M?.(_)},[i,x,g,b,n,c,M,o,r,t])}var gn=require("lucide-react");var se=require("react/jsx-runtime");function DS({categories:e,selected:t,disabled:n,onChange:i}){let r=Me();return(0,se.jsxs)("div",{className:"ri-annotationFilters",role:"group","aria-label":r("annotationCategories"),onPointerDown:o=>o.stopPropagation(),children:[(0,se.jsx)("span",{children:r("annotations")}),(0,se.jsx)("button",{type:"button","aria-pressed":t===null,disabled:n,onClick:()=>i(null),children:r("all")}),e.map(o=>(0,se.jsx)("button",{type:"button",disabled:n,"aria-pressed":t?.some(a=>a.trim()===o)??!1,onClick:()=>i(t===null?[o]:t.some(a=>a.trim()===o)?t.filter(a=>a.trim()!==o):[...t,o]),children:o||r("uncategorized")},o))]})}function NS({onCancel:e}){let t=Me();return(0,se.jsxs)("div",{className:"ri-isolationPill",role:"status",onPointerDown:n=>n.stopPropagation(),children:[(0,se.jsx)("span",{className:"ri-isolationPill__label",children:t("decalDragHint")}),(0,se.jsx)("button",{type:"button",className:"ri-isolationPill__button",onClick:e,children:t("cancel")})]})}function OS({label:e,onShowAll:t}){let n=Me();return(0,se.jsxs)("div",{className:"ri-isolationPill",onPointerDown:i=>i.stopPropagation(),children:[(0,se.jsx)("span",{className:"ri-isolationPill__label",children:e}),(0,se.jsx)("button",{type:"button",className:"ri-isolationPill__button",onClick:t,children:n("showAll")})]})}function BS({groups:e,activeVariants:t,onSelect:n}){let i=Me();return(0,se.jsx)(se.Fragment,{children:e.map((r,o)=>(0,se.jsxs)("div",{className:"ri-variantPicker",role:"group","aria-label":r.name??i("materialVariants"),onPointerDown:a=>a.stopPropagation(),children:[r.name?(0,se.jsx)("span",{className:"ri-variantPicker__group","aria-hidden":"true",children:r.name}):null,r.variants.map(a=>{let s=t.includes(a.name);return(0,se.jsxs)("button",{type:"button",className:`ri-variantPicker__option ${s?"ri-variantPicker__option--active":""}`,"aria-pressed":s,onClick:()=>n(a.name),children:[a.swatch?(0,se.jsx)("span",{className:"ri-variantPicker__swatch",style:{background:a.swatch},"aria-hidden":"true"}):null,a.label]},a.name)})]},r.name??`group-${o}`))})}function IS({count:e,active:t,index:n,navigating:i,onStart:r,onPrevious:o,onNext:a,onStop:s}){let l=Me();return t?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)("button",{className:"ri-tourButton",onClick:o,disabled:i||e===0||n<=0,title:l("previousAnnotation"),children:[(0,se.jsx)(gn.ChevronLeft,{size:16}),(0,se.jsx)("span",{children:l("previous")})]}),(0,se.jsx)("button",{className:"ri-tourButton ri-tourButton--stop",onClick:s,title:l("stopGuidedTour"),children:(0,se.jsx)(gn.Square,{size:16})}),(0,se.jsxs)("button",{className:"ri-tourButton ri-tourButton--next",onClick:a,disabled:i||e===0,title:l("nextAnnotation"),children:[(0,se.jsx)("span",{children:l("next")}),(0,se.jsx)(gn.ChevronRight,{size:16})]})]}):(0,se.jsx)("button",{className:"ri-navButtonSingle",onClick:r,disabled:e===0,title:l("startGuidedTour"),children:l("guidedTour")})}function zS({fullscreen:e,disabled:t}){let n=Me();return(0,se.jsxs)("div",{className:"mv-fullscreenWrapper",children:[e.error&&(0,se.jsx)("div",{className:"mv-fullscreenError",role:"alert",children:n.message(e.error)}),(0,se.jsx)("button",{type:"button",className:"mv-fullscreenButton",onClick:()=>{e.toggle()},disabled:e.pending||t,title:e.active?n("exitFullscreen"):n("enterFullscreen"),"aria-label":e.active?n("exitFullscreen"):n("enterFullscreen"),"aria-pressed":e.active,children:e.active?(0,se.jsx)(gn.Minimize,{}):(0,se.jsx)(gn.Maximize,{})})]})}function US({open:e,current:t,disabled:n,onSelect:i,onToggle:r}){let o=Me();return(0,se.jsxs)("div",{className:"mv-controllersWrapper",onPointerDown:a=>a.stopPropagation(),children:[e&&(0,se.jsxs)("div",{className:"mv-controllersMenu",children:[(0,se.jsx)("button",{type:"button",className:`mv-controllersMenuItem ${t==="orbit"?"mv-controllersMenuItem--active":""}`,onClick:()=>i("orbit"),children:o("orbitControl")}),(0,se.jsx)("button",{type:"button",className:`mv-controllersMenuItem ${t==="pointerLock"?"mv-controllersMenuItem--active":""}`,onClick:()=>i("pointerLock"),children:o("pointLock")})]}),(0,se.jsx)("button",{className:"mv-controllersButton",onClick:r,title:o("cameraController"),"aria-label":o("cameraControllerSettings"),disabled:n,children:(0,se.jsx)(gn.Orbit,{size:15})})]})}function VS({menu:e,recording:t,hasScene:n,canCaptureImage:i,canRecord:r,hasCinematic:o}){let a=Me(),{isDownloading:s,downloadMenuOpen:l,uvExportError:c,toggleDownloadMenu:h,handleDownloadMesh:p,handleDownloadScreenshot:u,handleDownloadUvLayout:m,handleDownloadVideo:f,videoFormat:g,setVideoFormat:b,videoExportError:x}=e;return(0,se.jsxs)("div",{className:"mv-downloadWrapper",onPointerDown:v=>v.stopPropagation(),children:[l&&(0,se.jsxs)("div",{className:"mv-downloadMenu",children:[(0,se.jsxs)("button",{className:"mv-downloadMenuItem",onClick:p,disabled:s||t||!n,children:[(0,se.jsx)(gn.Box,{size:14}),a("downloadGLB")]}),(0,se.jsx)("div",{className:"mv-downloadMenuDivider"}),i&&(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)("button",{className:"mv-downloadMenuItem",onClick:u,disabled:t||!n,children:[(0,se.jsx)(gn.Camera,{size:14}),a("downloadPNG")]}),(0,se.jsx)("div",{className:"mv-downloadMenuDivider"})]}),(0,se.jsxs)("button",{className:"mv-downloadMenuItem",onClick:m,disabled:t||!n,children:[(0,se.jsx)(gn.FileImage,{size:14}),a("downloadUVLayout")]}),(0,se.jsx)("div",{className:"mv-downloadMenuDivider"}),(0,se.jsxs)("label",{className:"mv-downloadMenuItem",children:[a("videoFormat"),(0,se.jsxs)("select",{"aria-label":a("videoFormat"),value:g,onChange:v=>b(v.target.value),children:[(0,se.jsx)("option",{value:"auto",children:a("auto")}),(0,se.jsx)("option",{value:"webm",disabled:!Qi("webm"),children:"WebM"}),(0,se.jsx)("option",{value:"mp4",disabled:!Qi("mp4"),children:"MP4"}),(0,se.jsx)("option",{value:"gif",disabled:!Qi("gif"),children:"GIF"})]})]}),(0,se.jsxs)("button",{className:"mv-downloadMenuItem",onClick:()=>{f("turntable")},disabled:t||!r||!Qi(g),children:[(0,se.jsx)(gn.Play,{size:14}),a("recordTurntableVideo")]}),o&&(0,se.jsxs)("button",{className:"mv-downloadMenuItem",onClick:()=>{f("cinematic")},disabled:t||!r||!Qi(g),children:[(0,se.jsx)(gn.Play,{size:14}),a("recordCinematicVideo")]}),!Qi()&&!Qi("gif")&&(0,se.jsx)("div",{className:"mv-downloadMenuNotice",role:"status",children:a("videoUnsupported")}),x&&(0,se.jsx)("div",{className:"mv-downloadMenuNotice",role:"alert",children:a.message(x)}),c&&(0,se.jsx)("div",{className:"mv-downloadMenuNotice",role:"status","aria-live":"polite",children:a.message(c)})]}),(0,se.jsx)("button",{className:"mv-downloadButton",onClick:h,disabled:s||t||!n,title:a("downloadOptions"),children:s?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)("span",{className:"mv-downloadButton__spinner"}),a("exporting")]}):(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(gn.Download,{size:15}),a("download")]})})]})}function FS({x:e,y:t,form:n,setForm:i,onOk:r,onCancel:o}){let a=Me();return(0,se.jsxs)("div",{className:"ri-annotationPopup",style:{left:e,top:t},onPointerDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),children:[(0,se.jsx)("input",{autoFocus:!0,className:"ri-annotationInput",placeholder:a("annotationTitlePlaceholder"),value:n.title,onChange:s=>i(l=>({...l,title:s.target.value})),onKeyDown:s=>{s.key==="Enter"&&r(),s.key==="Escape"&&o()}}),(0,se.jsx)("textarea",{className:"ri-annotationTextarea",placeholder:a("description"),value:n.description,onChange:s=>i(l=>({...l,description:s.target.value})),onKeyDown:s=>{s.key==="Escape"&&o()},rows:5}),(0,se.jsxs)("div",{className:"ri-annotationActions",children:[(0,se.jsx)("button",{onClick:r,className:`ri-annotationOkBtn ${n.title.trim()?"":"disabled"}`,disabled:!n.title.trim(),children:a("ok")}),(0,se.jsx)("button",{onClick:o,className:"ri-annotationCancelBtn",children:a("cancel")}),(0,se.jsx)("div",{className:"ri-annotationIcons"})]})]})}var jS=require("qrcode.react"),nn=require("lucide-react");var Le=require("react/jsx-runtime");function GS({top:e,xrStore:t,arSupported:n,vrSupported:i,quickLookSupported:r,mobileHandoffUrl:o,mobileHandoffOpen:a,onQuickLook:s,onOpenMobileHandoff:l}){let c=Me();return(0,Le.jsxs)("div",{className:"ri-xrTools",style:{top:`${e}px`},children:[!n&&r&&(0,Le.jsxs)("button",{type:"button",className:"ri-xrButton",onClick:s,title:c("viewThisModelInARWithAppleQuickLook"),children:[(0,Le.jsx)(nn.Box,{size:16}),c("viewInAR")]}),o&&(0,Le.jsxs)("button",{type:"button",className:"ri-xrButton",onClick:l,title:c("openThisExperienceOnAPhoneForAR"),"aria-haspopup":"dialog","aria-expanded":a,children:[(0,Le.jsx)(nn.QrCode,{size:16}),(0,Le.jsx)("span",{children:c("openOnPhone")})]}),t&&n&&(0,Le.jsxs)("button",{type:"button",className:"ri-xrButton",onClick:()=>t.enterAR().catch(h=>{console.error("Failed to enter AR session:",h)}),title:c("viewThisModelInYourSpace"),children:[(0,Le.jsx)(nn.Smartphone,{size:16}),(0,Le.jsx)("span",{children:c("enterAR")})]}),t&&i&&(0,Le.jsxs)("button",{type:"button",className:"ri-xrButton",onClick:()=>t.enterVR().catch(h=>{console.error("Failed to enter VR session:",h)}),title:c("viewThisModelInVR"),children:[(0,Le.jsx)(nn.RectangleGoggles,{size:16}),(0,Le.jsx)("span",{children:c("enterVR")})]})]})}function HS({url:e,onClose:t}){let n=Me();return(0,Le.jsx)("div",{className:"ri-mobileHandoffBackdrop",onMouseDown:i=>{i.target===i.currentTarget&&t()},children:(0,Le.jsxs)("section",{className:"ri-mobileHandoffDialog",role:"dialog","aria-modal":"true","aria-labelledby":"ri-mobileHandoffTitle",children:[(0,Le.jsx)("button",{type:"button",className:"ri-mobileHandoffClose",onClick:t,"aria-label":n("closePhoneHandoff"),children:(0,Le.jsx)(nn.X,{size:18})}),(0,Le.jsx)(nn.Smartphone,{size:22,"aria-hidden":"true"}),(0,Le.jsx)("h2",{id:"ri-mobileHandoffTitle",children:n("viewInAR")}),(0,Le.jsx)("p",{children:n("arScanCode")}),(0,Le.jsx)("div",{className:"ri-mobileHandoffQr",children:(0,Le.jsx)(jS.QRCodeSVG,{value:e,size:208,level:"M",marginSize:4,title:n("qrCodeToOpenThisModelOnAPhone")})})]})})}function WS({top:e,active:t,onToggle:n}){let i=Me();return(0,Le.jsx)("div",{className:"ri-uvCheckerTools",style:{top:`${e}px`},children:(0,Le.jsx)("button",{type:"button",className:`ri-measureButton ${t?"ri-measureButton--active":""}`,onClick:n,title:i(t?"disableUVChecker":"enableUVChecker"),"aria-label":i(t?"disableUVChecker":"enableUVChecker"),"aria-pressed":t,children:(0,Le.jsx)(nn.Grid3X3,{size:16})})})}function XS({top:e,open:t,factor:n,onToggleOpen:i,onFactorChange:r}){let o=Me();return(0,Le.jsxs)("div",{className:"ri-explodeTools",style:{top:`${e}px`},children:[(0,Le.jsx)("button",{type:"button",className:`ri-measureButton ${t||n>0?"ri-measureButton--active":""}`,onClick:i,title:o("explodedView"),"aria-pressed":t,children:(0,Le.jsx)(nn.Expand,{size:16})}),t&&(0,Le.jsx)("div",{className:"ri-explodeSlider",onPointerDown:a=>a.stopPropagation(),children:(0,Le.jsx)("input",{type:"range",min:0,max:100,value:Math.round(n*100),onChange:a=>r(Number(a.target.value)/100),"aria-label":o("explodeAmount")})})]})}function qS({top:e,section:t,onChange:n}){let i=Me();return(0,Le.jsxs)("div",{className:"ri-sectionTools",style:{top:`${e}px`},children:[(0,Le.jsx)("button",{type:"button",className:`ri-measureButton ${t.enabled?"ri-measureButton--active":""}`,onClick:()=>n({enabled:!t.enabled}),title:t.enabled?i("removeSectionCut"):i("sectionCut"),"aria-label":i("sectionCut"),"aria-pressed":t.enabled,children:(0,Le.jsx)(nn.Slice,{size:16})}),t.enabled&&(0,Le.jsxs)("div",{className:"ri-sectionPanel",onPointerDown:r=>r.stopPropagation(),children:[(0,Le.jsx)("div",{className:"ri-sectionAxes",role:"group","aria-label":i("sectionAxis"),children:Iu.map(r=>(0,Le.jsx)("button",{type:"button",className:`ri-sectionAxis ${t.axis===r?"ri-sectionAxis--active":""}`,"aria-pressed":t.axis===r,onClick:()=>n({axis:r}),children:r.toUpperCase()},r))}),(0,Le.jsx)("input",{type:"range",min:0,max:100,value:Math.round(t.position*100),onChange:r=>n({position:Number(r.target.value)/100}),"aria-label":i("sectionPosition")}),(0,Le.jsx)("button",{type:"button",className:`ri-sectionAxis ${t.flip?"ri-sectionAxis--active":""}`,"aria-pressed":t.flip,"aria-label":i("keepTheOtherSide"),title:i("keepTheOtherSide"),onClick:()=>n({flip:!t.flip}),children:(0,Le.jsx)(nn.FlipVertical2,{size:14})})]})]})}function $S({top:e,playing:t,disabled:n,onPlay:i,onPause:r,onStop:o}){let a=Me();return(0,Le.jsxs)("div",{className:"ri-cinematicTools",style:{top:`${e}px`},children:[(0,Le.jsx)("button",{type:"button",className:`ri-measureButton ${t?"ri-measureButton--active":""}`,disabled:n,onClick:t?r:i,title:a(t?"pauseCinematic":"playCinematic"),"aria-pressed":t,children:t?(0,Le.jsx)(nn.Pause,{size:16}):(0,Le.jsx)(nn.Play,{size:16})}),t&&(0,Le.jsx)("button",{type:"button",className:"ri-measureButton ri-measureButton--stop",onClick:o,title:a("stopCinematicAndResetCamera"),children:(0,Le.jsx)(nn.Square,{size:16})})]})}function YS({progress:e,onCancel:t}){let n=Me();return(0,Le.jsx)("div",{className:"ri-recordingOverlay",onPointerDown:i=>i.stopPropagation(),children:(0,Le.jsxs)("div",{className:"ri-isolationPill",role:"status","aria-live":"polite",children:[(0,Le.jsx)("span",{className:"ri-isolationPill__label",children:n("recordingVideo",{progress:e})}),(0,Le.jsx)("button",{type:"button",className:"ri-isolationPill__button",onClick:t,children:n("cancel")})]})})}function KS(e){let t={total:0,missing:0};return e.traverse(n=>{let i=n;!i.isMesh||!i.geometry||(t.total+=1,i.geometry.getAttribute("uv")||(t.missing+=1))}),t}var Zn=require("three");function ZS(e,t,n){let i=t?.camera;if(!(i instanceof Zn.PerspectiveCamera))return null;let o=(e instanceof Zn.Box3?e:new Zn.Box3().setFromObject(e)).getSize(new Zn.Vector3).length();return!Number.isFinite(o)||o<=0?null:(i.near=o/100,i.far=o*100,i.updateProjectionMatrix(),t&&n===void 0&&(t.maxDistance=o*10),o)}function JS(e,t){let n=e.camera;if(!(n instanceof Zn.PerspectiveCamera)||!(t>0))return;let i=Math.min(Math.max(e.distance/200,t/1e5),t/100);Math.abs(i-n.near)<=n.near*.01||(n.near=i,n.updateProjectionMatrix())}var am={paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5},pd={kind:"model"};function QS(e,t){let n=new Zn.Box3().setFromObject(t);return n.isEmpty()?!1:(n.expandByScalar(n.getSize(new Zn.Vector3).length()*.05),n.containsPoint(e.getTarget(new Zn.Vector3)))}function e_(e,t){return e.getTarget(new Zn.Vector3).distanceTo(t)<=Math.max(e.distance,1)*.001}async function Ag(e,t,n=.6){let i=e.smoothTime;e.smoothTime=il(e,n);try{return await t()}finally{e.smoothTime=i}}async function t_(e,t,{flyIn:n,onStart:i,invalidate:r}){if(n){let o=(t instanceof Zn.Box3?t:new Zn.Box3().setFromObject(t)).getBoundingSphere(new Zn.Sphere),a=o.center.clone(),l=e.getPosition(new Zn.Vector3).clone().sub(e.getTarget(new Zn.Vector3));l.lengthSq()<1e-6&&l.set(0,0,1),l.normalize();let c=Math.max(o.radius*10,20),h=a.clone().add(l.multiplyScalar(c));await e.setLookAt(h.x,h.y,h.z,a.x,a.y,a.z,!1)}i(),await Ag(e,()=>e.fitToBox(t,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),await new Promise(o=>{let a=performance.now(),s=()=>{e.active===!1||performance.now()-a>8e3?(e.dispatchEvent({type:"update"}),r(),o()):(r(),setTimeout(s,100))};setTimeout(s,100)})}var n_=require("react");function r_({enabled:e,canvasAreaElement:t,fitAttemptedRef:n,fitInFlightRef:i,controlsRef:r,cameraFramingRef:o,nodeRefsMap:a,fitScene:s}){(0,n_.useEffect)(()=>{if(!e)return;let l=t;if(!l)return;let c=null,h=new ResizeObserver(()=>{!n.current||i.current||(c&&clearTimeout(c),c=setTimeout(()=>{let p=r.current,u=o.current;if(u.kind==="view"&&p){if(e_(p,u.target))return}else if(u.kind==="object"&&p){let m=a.current[u.key];if(m&&QS(p,m)){p.fitToBox(m,!0,am).catch(()=>{});return}}s()},150))});return h.observe(l),()=>{h.disconnect(),c&&clearTimeout(c)}},[t,s,e])}var ie=require("react/jsx-runtime"),i_=Object.freeze({});function Cl(e){let t=Tx(e),n=mu(t.modelUrl,t.tilesetUrl),i=(0,N.useRef)(n);i.current=n;let r=(0,N.useRef)(null),o=(0,N.useRef)(null),a=(0,N.useCallback)(()=>{let g=o.current;g&&(r.current=g.snapshot())},[]),s=zv(a),l=Qv(e),[c,h]=(0,N.useState)(null);(0,N.useEffect)(()=>()=>{c&&URL.revokeObjectURL(c)},[c]);let p=()=>{a();let g=i.current;o.current?.captureFrame().then(b=>{b&&(g===i.current?h(b):URL.revokeObjectURL(b))})};Fo(()=>{r.current=null,h(null)},[n]);let u=(0,N.useRef)(null),m=qv({loading:t.loading,reveal:t.reveal,rootRef:u,onPark:p}),{release:f}=s;return(0,N.useEffect)(()=>{m.live||f()},[m.live,f]),(0,ie.jsx)(hv,{labels:e.labels,children:(0,ie.jsx)("div",{className:"ri-viewerSlot",ref:u,children:m.live?(0,ie.jsx)(bR,{...t,contextRecovery:s,engagement:l,resumeRef:r,viewerHandleRef:o,offscreen:!m.visible,frame:c},s.generation):(0,ie.jsx)(Yv,{className:"ri-viewer",background:Ch(t.backgroundColor,t.sceneConfig),poster:c??t.poster,onReveal:m.awaitingReveal?m.reveal:void 0})})})}function bR({labels:e,contextRecovery:t,engagement:n,modelUrl:i,tilesetUrl:r,tilesErrorTarget:o=8,tilesCacheSize:a=800,onObjectCatalog:s,modelFormat:l,licenseKey:c,licenseValidationUrl:h,objectBindings:p="auto",selectedObject:u,panelHoveredObject:m,onObjectBindingsChange:f,onObjectSelect:g,onObjectHover:b,onObjectDoubleClick:x,onObjectContextMenu:v,decalMove:w,onObjectEditLeaseChange:M,onSceneLoaded:_,onModelLoaded:y,onLoadError:P,onProgress:d,onCameraControllerChange:S,cameraControllerType:C,onAction:T,onHiddenObjectsChange:E,onCameraChange:k,onViewerReady:D,onTextureUpload:I,onAnimationsReady:L,onAnnotationsChange:X,activeAnnotation:O,onActiveAnnotationChange:B,camera:re,cameraLimits:ke,backgroundColor:te,shadows:We=!0,showObjectBindingDataPanel:wt=!0,customObjectBindingDataPanel:be,customSceneObjectsPanel:ue,showSceneObjectsPanel:Ne=!0,showDownloadButton:Te=!0,downloadFilename:bn="model",showResetButton:Oe=!0,showFullscreenButton:ot=!1,showLoadingOverlay:mt=!0,showMouseController:vn=!1,mouseControllerPosition:de="center-bottom",mouseControllerOpacity:ur=1,moveSensitivity:jt=.08,zoomSensitivity:Gt=1,sceneConfig:ce,onSceneConfigChange:Be,disableZoom:zt=!1,zoomOnSelected:gt=!0,highlightOnHover:Ut=!0,enableCameraControls:Ae=!0,onAutoFit:Ce,refitOnResize:Pt=!0,renderMode:St="demand",maxDpr:dn=2,preserveDrawingBuffer:ae=!1,webgpu:he=!1,performanceProfile:Ee="auto",dracoDecoderPath:Ie,ktx2TranscoderPath:_t,meshopt:Je=!0,showMeasureTools:et=!1,showUvCheckerButton:ve=!1,showExplodeControls:Qe=!1,showMaterialVariants:bt=!0,showObjectNavigator:un=!0,showSectionTools:or=!1,isolation:xn,onIsolationChange:Vn,showIsolateControls:xr=!1,cinematic:Fn,measurementUnit:li="m",enableXR:ha=!1,usdzUrl:kn,arScaleMode:Dr="normalized",mobileHandoffUrl:z,showAnnotationNavigation:U=!0,showAnnotationOnHover:H=!1,showAnnotationFilters:oe=!0,annotationCategories:Q,onAnnotationCategoriesChange:fe,moveModeEnabled:we=!1,objectTransformSpace:pn="world",enableKeyboardNavigation:tt=!1,reducedMotion:$e="user",showViewGizmo:Ye=!1,overlay:Vt,unsafe_sceneChildren:Se,autoRotate:Ht,autoRotateSpeed:Ln,onTexturePositioningChange:jn,endTexturePositioningRef:yr,texturePositioning:mn,poster:Cn,resumeRef:Xi,viewerHandleRef:hs,offscreen:Il,frame:Pd}){let Dn=Me(),fs=mu(i,r),[Sn]=(0,N.useState)(()=>Xi.current?.model===fs?Xi.current:null),rn=wl($e);(0,N.useEffect)(()=>()=>n.interrupt(),[n]);let zl=(0,N.useRef)(n);zl.current=n;let fa=p==="auto",ga=fa?i_:p,{isInsideEditor:Ul,activeTab:Vl,activeSubTab:Mo}=Rr(),Em=Ul&&Vl==="scene"&&Mo==="Lighting",Co=zp(c,h),[qi,Ad]=(0,N.useState)(()=>Sn?.lightEdits??{}),[gs,wr]=(0,N.useState)(Sn?.variantEdit),[ci,Wr]=(0,N.useState)(Sn?.sectionEdit),at=(0,N.useMemo)(()=>{let A=Lh(ce??ja,qi);return gs!==void 0&&(A={...A,model:sl(A.model,gs)}),ci!==void 0&&(A={...A,section:{...Fa,...A.section,...ci}}),A},[ce,qi,gs,ci]),To=(0,N.useRef)(at);To.current=at;let bs=(0,N.useMemo)(()=>Wo(at.model),[at.model]);(0,N.useEffect)(()=>{n.setActiveVariants(bs)},[bs,n]);let Po=ce?Wo(ce.model).join(`
|
|
3691
|
+
`):"";Fo(()=>{wr(void 0)},[Po,i]);let vs=JSON.stringify(ce?.section??null);Fo(()=>{Wr(void 0)},[vs,i]);let ba=(0,N.useCallback)(A=>{if(Be){let V=To.current;Be({...V,section:{...Fa,...V.section,...A}});return}Wr(V=>({...V,...A}))},[Be]),[Ri,Tn]=(0,N.useState)(!1),pr=(0,N.useRef)([]),ki=(0,N.useCallback)(A=>{let V=To.current,ee=Wo(V.model),pe=pr.current,_e=pe.find(qt=>qt.variants.some(yn=>yn.name===A)),Mt=ee.find(qt=>_e?_e.variants.some(yn=>yn.name===qt):qt===A)??null,_n=ee.includes(A)?ee.filter(qt=>qt!==A):Hu(ee,A,pe);if(n.chooseVariant(_n.includes(A)?A:null,Mt,_e?.name??null),Be){Be({...V,model:sl(V.model,_n)});return}wr(_n)},[Be,n]),va=(0,N.useCallback)(A=>{if(Be){Be(Lh(To.current,A));return}Ad(V=>{let ee={...V};for(let[pe,_e]of Object.entries(A))ee[pe]={...V[pe],..._e};return ee})},[Be]),[Ao,Fl]=(0,N.useState)(null),[di,xa]=(0,N.useState)(null),[Wt,jl]=(0,N.useState)(null),Gl=(0,N.useRef)(0),[xs,ya]=(0,N.useState)(null),[Ed,Rd]=(0,N.useState)(Sn?.uvCheckerOverride??null),wa=at.model.renderer==="uv-checker",Eo=ve?Ed??wa:wa,Rt=(0,N.useMemo)(()=>{let A=Eo?"uv-checker":wa?"pbr":at.model.renderer;return A===at.model.renderer?at:{...at,model:{...at.model,renderer:A}}},[wa,at,Eo]);Fo(()=>{Rd(null)},[i,at.model.renderer,ve,r]);let ys=(0,N.useMemo)(()=>Ch(te,at),[te,at]),Hl=(0,N.useMemo)(()=>({dracoDecoderPath:Ie,ktx2TranscoderPath:_t,meshopt:Je}),[Ie,_t,Je]),Li=(0,N.useMemo)(()=>Gv(Ee),[Ee]),pt=(0,N.useRef)(null),[kd,Rm]=(0,N.useState)(()=>Sn&&Sn.cameraControllerType!=="pointerLock"?Sn.cameraControllerType:"orbit"),[Sa,ws]=(0,N.useState)(!1),$i=C!==void 0?C:kd,Ss=(0,N.useCallback)(A=>{ws(!1),A!==$i&&(Rm(A),S?.(A))},[$i,S]),[mr,Dd]=(0,N.useState)(!1),[Ft,Ro]=(0,N.useState)(null),_a=!!(mn||jn||yr),Nd=(0,N.useRef)(jn);Nd.current=jn,(0,N.useEffect)(()=>{Nd.current?.(Ft)},[Ft]),(0,N.useEffect)(()=>{if(yr)return yr.current=()=>Ro(null),()=>{yr.current=null}},[]),(0,N.useEffect)(()=>{pt.current&&(pt.current.dollySpeed=Math.max(Gt,0))},[Gt]),(0,N.useEffect)(()=>{pt.current&&(pt.current.enabled=Ae&&!mr&&!Ri&&!Ft)},[Ae,mr,Ri,Ft]);let _s=(0,N.useRef)(null),Ms=(0,N.useRef)(new Map),Od=(0,N.useRef)(null),km=(0,N.useRef)(null),Sr=(0,N.useRef)(null),Bd=(0,N.useRef)({});(0,N.useEffect)(()=>()=>{for(let A of Object.values(Bd.current))URL.revokeObjectURL(A)},[]);let ar=(0,N.useRef)({}),Ma=(0,N.useRef)(pd),[,Id]=(0,N.useState)(0),zd=(0,N.useCallback)(()=>{Id(A=>A+1)},[]),Cs=(0,N.useRef)({}),Ud=(0,N.useRef)(null),Ts=Lv(ot),Nr=(0,N.useRef)(null),[Wl,Lm]=(0,N.useState)(null),Dm=(0,N.useCallback)(A=>{Nr.current=A,Lm(A)},[]);wS({canvasAreaElement:Wl,controlsRef:pt,enabled:tt&&Ae&&!we});let Xl=(0,N.useRef)(null),[Vd,Fd]=(0,N.useState)(()=>Sn?.objectBindings??ga),[ko,Ca]=(0,N.useState)({}),[jd,ql]=(0,N.useState)(null),[$l,Yl]=(0,N.useState)(null),[Nm,Om]=(0,N.useState)(null),[Bm,Im]=(0,N.useState)(null),[Or,Gd]=(0,N.useState)(null),[zm,Um]=(0,N.useState)({}),sr=(0,N.useRef)(null),Ps=(0,N.useRef)(null),Kl=(0,N.useRef)(0),Zl=(0,N.useRef)(null),[As,Vm]=(0,N.useState)(0),Xr=(0,N.useRef)(!1),Ta=(0,N.useRef)(!1),Jl=(0,N.useRef)(!!re);Jl.current=!!re;let _r=(0,N.useRef)(null),R=(0,N.useRef)(Sn?.camera?{camera:Sn.camera,home:Sn.home}:null),[j,Z]=(0,N.useState)(!!i),[ne,Pe]=(0,N.useState)(!i||!!Ce||!!re),[Xe,Xt]=(0,N.useState)(!1),[Ge,Jn]=(0,N.useState)([]),[Yi,Lo]=(0,N.useState)(!1),[Fm,jm]=(0,N.useState)(null),[nb,Ql]=(0,N.useState)(!1),[$M,YM]=(0,N.useState)(0),Gm=(0,N.useRef)(""),rb=(0,N.useRef)(""),[ib,ob]=(0,N.useState)(!1),[Hm,KM]=(0,N.useState)(null),[ZM,ab]=(0,N.useState)(!1),[Wm,sb]=(0,N.useState)({total:0,missing:0}),[JM,lb]=(0,N.useState)("loadingModel"),[QM,Xm]=(0,N.useState)(null),Do=(0,N.useRef)({}),Es=(0,N.useCallback)(()=>{let A=pt.current;!A||_r.current||(_r.current=ed(A))},[]),[Hd,cb]=(0,N.useState)(()=>Sn?.explodeFactor??0),[eC,db]=(0,N.useState)(!1);Fo(()=>{cb(0),db(!1)},[i,r]);let Pa=(0,N.useMemo)(()=>{let A=at.cinematic,V=A?.enabled?{waypoints:A.waypoints,duration:A.duration,loop:A.loop,autoPlay:A.autoPlay}:null;return Fn===void 0?V&&(V.waypoints?.length??0)>=2?V:null:Fn===!1?null:Fn===!0?V??{}:{...V??{},...Fn}},[Fn,at]),[ub,Br]=(0,N.useState)(!1),[tC,Aa]=(0,N.useState)(!1),qm=(0,N.useRef)(!1);(0,N.useEffect)(()=>{Br(!1),Aa(!1),qm.current=!1},[i,r]),(0,N.useEffect)(()=>{if(!(!Pa?.autoPlay||qm.current)&&Xe&&ne&&!j){if(qm.current=!0,rn)return;Br(!0),Aa(!1)}},[Pa,Xe,ne,j,rn]);let nC=(0,N.useCallback)(()=>{Br(!1),Aa(!0)},[]),{captureVideo:$m,cancelVideo:Ym,isRecording:pb,recording:Qn,progress:rC,onProgress:iC}=kv({rendererCaptureRef:Sr,controlsRef:pt,cinematicConfig:Pa,ready:t.status==="ready"&&Xe&&ne&&!j,modelUrl:`${i}|${r??""}`,onCaptureStart:nC});(0,N.useEffect)(()=>{t.status==="lost"&&(n.interrupt(),Ym(),Br(!1),pt.current?.stop())},[t.status,Ym,n]);let{xrStore:oC,presenterRef:aC,arSupported:mb,vrSupported:hb,quickLookSupported:fb,resolvedMobileHandoffUrl:Wd,isMobileHandoffOpen:gb,arOverlay:sC,openMobileHandoff:lC,closeMobileHandoff:cC,openQuickLook:dC,handleARStateChange:uC}=Ey({enableXR:ha,usdzUrl:kn,mobileHandoffUrl:z,engagement:n}),Rs=Tv(he),bb=(0,N.useRef)(Rs);bb.current=Rs;let ks=Rs==="webgpu",Xd=ks?null:oC,vb=or||at.section?.enabled===!0;(0,N.useEffect)(()=>{if(!ks)return;let A=[vb&&"the section cut",we&&"the move gizmo"].filter(Boolean);A.length!==0&&console.info(`[react-immersive] With WebGPU, ${A.join(" and ")} ${A.length>1?"aren't":"isn't"} available; ${A.length>1?"they need":"it needs"} WebGL.`)},[ks,vb,we]);let{annotations:QR,pendingAnnotation:Ea,setPendingAnnotation:xb,annotationForm:pC,setAnnotationForm:Km,currentAnnotationIndex:mC,isNavigating:hC,localAnnotationCategories:fC,selectedAnnotationCategories:gC,visibleAnnotations:bC,availableAnnotationCategories:vC,annotationFiltersVisible:Zm,changeAnnotationCategories:xC,sortedAnnotations:Jm,currentAnnotation:yC,setActiveAnnotation:ek,focusAnnotation:tk,startGuidedTour:wC,goToPreviousAnnotation:SC,goToNextAnnotation:_C,stopGuidedTour:MC,closeViewingAnnotation:Qm,activeAnnotation:nk,activeViewingAnnotation:eh,isGuidedTourActive:th,handleAnnotationOk:CC,handleAnnotationCancel:TC,handleAnnotationMarkerClick:PC}=bS({sceneAnnotations:ce?.annotations,controlledAnnotationCategories:Q,onAnnotationCategoriesChange:fe,showAnnotationFilters:oe,initialCategories:Sn?.annotationCategories??null,controlledActiveAnnotation:O,onActiveAnnotationChange:B,onAnnotationsChange:X,controlsRef:pt,sceneRef:sr,annotationWorldPositionsRef:Ms,tourCameraOffsetRef:_s,initialCameraStateRef:_r,engagement:n,engagementRef:zl}),AC=at.section??Fa,yb=bt&&Xe&&Ge.length>0;pr.current=Ge;let wb=Oe||Te||ot&&Ts.supported||U&&Jm.length>0,Ls=!fa&&f!==void 0,st=Ls?ga:Vd;Do.current=st,(0,N.useEffect)(()=>{if(!Ft)return;let A=st[Ft.objectKey]?.style?.material?.[Ft.textureKey]?.path;(!_a||!A)&&Ro(null)},[st,_a,Ft]);let nh=(0,N.useRef)({}),[qd,EC]=(0,N.useState)({});(0,N.useEffect)(()=>{let A={...qd},V=!1,ee=new Set;for(let[pe,_e]of Object.entries(st)){ee.add(pe);let Mt=_e.style?.material,_n=nh.current[pe]??{},qt={};for(let Gn of Ii){let pi=Mt?.[Gn]?.path;pi&&(qt[Gn]=pi,pi!==_n[Gn]&&(A[pe]!==Gn&&(V=!0),A[pe]=Gn))}let yn=A[pe];if(yn&&!qt[yn]){let Gn=Ii.find(pi=>!!qt[pi]);Gn?A[pe]=Gn:delete A[pe],V=!0}nh.current[pe]=qt}for(let pe of Object.keys(A))ee.has(pe)||(delete A[pe],delete nh.current[pe],V=!0);V&&EC(A)},[st]);let RC=(0,N.useMemo)(()=>Object.entries(st).map(([A,V])=>JSON.stringify([A,V.modelObjectId,V.transform??null])).sort().join(""),[st]),{measureMode:Ra,measureModeRef:Sb,measurePoints:_b,measurementTool:Mb,areaClosed:Cb,measurementError:kC,selectMeasurementTool:LC,undoMeasurementPoint:DC,finishMeasureArea:NC,snapMode:OC,setSnapMode:BC,snapPreview:IC,handleMeasurePointerMove:zC,clearSnapPreview:Tb,showDimensions:Pb,measureBox:rh,modelBounds:UC,refreshBounds:Ab,clearMeasurements:VC,toggleMeasureMode:FC,toggleDimensions:jC,handleMeasurePointerDown:GC,handleMeasureClick:HC}=_y({canvasAreaRef:Nr,controlsRef:pt,sceneRef:sr,modelUrl:`${i}|${r??""}`,modelRotation:at.model.rotation,bindingTransformSignature:RC,modelLoaded:Xe,enabled:et&&!Qn}),[WC,XC]=(0,N.useState)(34),qC=vy({sceneRef:sr,materialRefs:Cs,rendererCaptureRef:Sr,objectBindings:st,downloadFilename:bn,captureVideo:$m}),Eb=(0,N.useMemo)(()=>Object.fromEntries(Object.entries(st).filter(([,A])=>A.visible===!1).map(([A])=>[A,!0])),[st]),No=(0,N.useMemo)(()=>{let A=new WeakMap,V=new Map,ee=new Map;for(let[pe,_e]of Object.entries(st))A.set(_e,pe),V.has(_e.id)||V.set(_e.id,pe),ee.has(_e.modelObjectId)||ee.set(_e.modelObjectId,pe);return{byReference:A,byId:V,byModelObjectId:ee}},[st]),ui=(0,N.useCallback)(A=>A?No.byReference.get(A)??No.byModelObjectId.get(A.modelObjectId)??No.byId.get(A.id)??null:null,[No]),ih=u!==void 0,ka=ih?u??null:Bm,hn=ui(ka);(0,N.useEffect)(()=>{n.setSelectedPart(hn)},[hn,n]);let oh=hn?ar.current[hn]??null:null,$C=hn?qd[hn]:void 0,Rb=ui(Ut?m??$l??Nm:null),YC=Rb?ar.current[Rb]??null:null,kb=(0,N.useCallback)(A=>{Om(A),b?.(A)},[b]),Lb=wt&&ka!==null&&hn!==null,La=(hn?st[hn]:null)??ka,ec=La&&(La.modelObjectId||La.id)||null,tc=ec?zm[ec]??null:null,[KC,Db]=(0,N.useState)(""),Nb=(0,N.useRef)(null);(0,N.useEffect)(()=>{let A=Nb.current;if(A!==hn)if(Nb.current=hn,hn){let V=La?.label||ka?.label||hn;Db(Dn("objectSelected",{name:V}))}else A&&Db(Dn("selectionCleared"))},[hn,La,ka,Dn]),Fo(()=>{Ls||Fd(ga)},[Ls,ga]),(0,N.useEffect)(()=>{E?.(Eb)},[Eb,E]);let Ds=(0,N.useCallback)((A,V)=>{if($i==="pointerLock"){Ss("orbit");return}A&&V?n.viewPart({objectId:A.id,objectKey:ui(A)??(A.modelObjectId||A.id),label:A.label,source:V}):A||n.setSelectedPart(null),ih||Im(A),g?.(A)},[$i,Ss,ih,g,ui,n]),Ki=(0,N.useCallback)(A=>{Ls||Fd(A),f?.(A)},[Ls,f]),Ob=(0,N.useRef)(Sn?.objectBindings?`${i}
|
|
3692
|
+
${r??""}`:null),$d=(0,N.useCallback)((A,V)=>{if(!fa)return;let ee=`${i}
|
|
3693
|
+
${r??""}`,pe=Ob.current===ee?Do.current:i_;Ob.current=ee;let _e=Jw(A,V);for(let Mt of Object.keys(_e))pe[Mt]&&(_e[Mt]=pe[Mt]);Ki(_e)},[fa,i,r,Ki]),{glowMemoryRef:Bb,readObjectGlow:Yd,applyGlow:ah}=kS({nodeRefsMap:ar,currentObjectBindingsRef:Do,applyObjectBindings:Ki}),ZC=(0,N.useCallback)(A=>{let V=hn;if(!V||!A)return;let ee=Do.current[V];ee&&Ki({...Do.current,[V]:{...ee,transform:{...ee.transform,...A}}})},[Ki,hn]),Oo=(0,N.useCallback)((A,V)=>st[A]?A:V?ui(V):No.byId.get(A)??No.byModelObjectId.get(A)??null,[st,ui,No]),Kd=(0,N.useCallback)((A,V)=>{let ee=Oo(A),pe=ee?st[ee]:void 0;!ee||!pe||Ki({...st,[ee]:{...pe,style:V(pe.style)}})},[Oo,st,Ki]),Di=(0,N.useCallback)(()=>{if(Or){let A=ko[Or.objectId]?.hex;A!==void 0&&(Kd(Or.objectId,V=>({...V,material:{...V?.material,baseColor:A}})),Ca(V=>({...V,[Or.objectId]:{}})))}Gd(null)},[Or,ko,Kd]),sh=(0,N.useCallback)(()=>{Ds(null),ql(null),Di()},[Ds,Di]),JC=(0,N.useCallback)((A,V,ee,pe,_e)=>{let Mt=Ud.current,_n=Nr.current,qt=pt.current?.camera;if(!Mt)return{objectId:A,x:24,y:24};let yn=Mt.getBoundingClientRect(),Gn=12,pi=yn.width-V-Gn,zs=yn.height-ee-Gn,Io=Math.max(Gn,(yn.width-V)/2),rc=Math.max(Gn,(yn.height-ee)/2),Us=Oo(A,pe),ic=Us?ar.current[Us]:null,Ni=(Vs,Da)=>Da<=Gn?Gn:Math.min(Math.max(Vs,Gn),Da);if(_n&&qt&&ic){let Vs=_n.getBoundingClientRect(),Da=new xo.Vector3;new xo.Box3().setFromObject(ic).getCenter(Da),Da.project(qt);let _T=(Da.x+1)/2*Vs.width+(Vs.left-yn.left),MT=(1-Da.y)/2*Vs.height+(Vs.top-yn.top);return{objectId:A,x:Ni(_T+24,pi),y:Ni(MT-ee/2,zs)}}let mh=typeof _e?.screenX=="number"?_e.screenX-yn.left:Io,hh=typeof _e?.screenY=="number"?_e.screenY-yn.top:rc;return{objectId:A,x:Ni(mh,pi),y:Ni(hh,zs)}},[Oo]),Zd=LS({setCurrentAction:ql,bindingKeyIndex:No,currentObjectBindings:st,applyObjectBindings:Ki,resolveObjectKey:Oo,closeColorPicker:Di,setColorPicker:Gd,setMaterialPopupsByObject:Um,setItemMaterials:Ca,getPopoverPosition:JC,decalRequestRef:Gl,setDecalError:jl,setDecalDragging:ya,setDecalControl:xa,resolvedSceneConfigRef:To,applyLightPatches:va,readObjectGlow:Yd,applyGlow:ah,glowMemoryRef:Bb,setLightControl:Fl,onAction:T});(0,N.useEffect)(()=>{if(Or)return window.addEventListener("pointerdown",Di),()=>window.removeEventListener("pointerdown",Di)},[Or,Di]),(0,N.useEffect)(()=>{if(!eh)return;let A=V=>{if(Xl.current&&!Xl.current.contains(V.target)){if(V.target.closest?.(".ri-annotationMarker"))return;Qm()}};return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A)}},[eh,Qm]),(0,N.useEffect)(()=>{if(!Ea)return;let A=V=>{let ee=V.target;if(ee.closest?.(".ri-annotationPopup")||ee.closest?.("button, input, textarea, .ri-measureTools, .ri-xrTools, .ri-buttonContainer"))return;let pe=Nr.current;!pe||!pe.contains(ee)||(xb(null),Km({title:"",description:""}))};return document.addEventListener("mousedown",A,!0),document.addEventListener("touchstart",A,!0),()=>{document.removeEventListener("mousedown",A,!0),document.removeEventListener("touchstart",A,!0)}},[Ea]);let{handleFileChange:QC,triggerFileUpload:Ib,clearTexture:zb,texturePositioningEnabled:eT,texturePositioningOverrides:tT,setMaterialTextureOffset:nT,setMaterialTextureRotation:rT,endMaterialTexturePositioning:iT}=ES({applyBindingStyle:Kd,resolveObjectKey:Oo,onTextureUpload:I,fileInputRef:Od,pendingObjectId:km,createdBlobUrls:Bd,texturePositioning:mn,setMoveZoomTarget:Ro}),lh=(0,N.useRef)(D);lh.current=D;let qr=(0,N.useCallback)(()=>{let A=pt.current;!A||!lh.current||lh.current({objectBindings:Do.current,homeCameraState:_r.current,captureImage:V=>pb()?Promise.reject(new Error("Wait for video export to finish before capturing an image.")):ou(Sr.current,V),captureVideo:$m,invalidate:()=>Sr.current?.invalidate(),rendererBackend:bb.current??"webgl",raw:{controls:A,scene:sr.current,nodes:ar.current}})},[$m,pb]),nc=(0,N.useCallback)(async(A=!1)=>{let V=pt.current,ee=Ps.current??sr.current;if(!V||!ee)return!1;Ma.current=pd;try{return await t_(V,ee,{flyIn:A,onStart:()=>Pe(!0),invalidate:()=>Sr.current?.invalidate()}),Xr.current=!0,Es(),qr(),!0}catch(pe){return console.error("Fit scene error:",pe),!1}},[Es,qr]);(0,N.useEffect)(()=>{if(Xr.current=!1,Ta.current=!1,_r.current=null,sr.current=null,Ps.current=null,Xt(!1),Jn([]),Lo(!1),jm(null),Ql(!1),Gm.current="",sb({total:0,missing:0}),lb("loadingModel"),Xm(null),Sn?.model!==mu(i,r)&&(R.current=null),!i){Z(!1),Pe(!0);return}Z(!0),Pe(!!Ce||Jl.current);let A=!1,V=null,ee=_e=>{V=setTimeout(pe,_e)},pe=()=>{if(A||Xr.current||Ta.current)return;let _e=Ps.current??sr.current;if(!pt.current||!_e){ee(100);return}Kl.current=ZS(_e,pt.current,ke?.maxDistance)??Kl.current;let Mt=R.current;if(Mt){R.current=null,Kv(pt.current,Mt.camera),Xr.current=!0,Mt.home?_r.current=Mt.home:Es(),qr(),Z(!1),Pe(!0),Sr.current?.invalidate();return}if(_w(pt.current)){Xr.current=!0,Es(),qr(),Z(!1),Pe(!0),Sr.current?.invalidate();return}Ta.current=!0,(Ce?Ce():Jl.current?Promise.resolve(!0):nc(!0)).then(qt=>{Xr.current=qt!==!1,Xr.current?(Es(),qr(),Z(!1)):A||ee(100)}).catch(()=>{Xr.current=!1,A||ee(100)}).finally(()=>{Ta.current=!1})};return ee(50),()=>{A=!0,V&&clearTimeout(V)}},[Es,ke?.maxDistance,nc,i,qr,Ce,Sn,r]),r_({enabled:Pt,canvasAreaElement:Wl,fitAttemptedRef:Xr,fitInFlightRef:Ta,controlsRef:pt,cameraFramingRef:Ma,nodeRefsMap:ar,fitScene:nc});let Jd=(0,N.useCallback)(A=>{let V=pt.current;if(!V)return;let ee=A.cameraState;if(ee?.position&&ee?.target){let[Mt,_n,qt]=ee.position,yn=new xo.Vector3(...ee.target);V.setPosition(Mt,_n,qt,!0),V.setTarget(yn.x,yn.y,yn.z,!0),Ma.current={kind:"view",target:yn};return}let pe=ui(A),_e=pe?ar.current[pe]:null;!pe||!_e||(V.fitToBox(_e,!0,am).catch(()=>{}),Ma.current={kind:"object",key:pe})},[ui]);(0,N.useEffect)(()=>{hn||(Ma.current=pd)},[hn]);let ch=(0,N.useCallback)((A,V="canvas")=>{Sb.current||(Br(!1),Di(),ql(null),Ds(A,V),!(zt||!gt)&&Jd(A))},[Ds,Di,Jd,zt,gt]),{beginMoveZoom:Ub,handleMoveZoomPointerDown:oT}=_S({moveZoomTarget:Ft,setMoveZoomTarget:Ro,currentObjectBindingsRef:Do,materialRefsOut:Cs,rendererCaptureRef:Sr,canvasAreaRef:Nr,canvasAreaElement:Wl,applyBindingStyle:Kd}),Vb=(0,N.useCallback)(A=>{if(!_a)return!1;let V=ui(A);if(!V)return!1;let ee=qd[V];return ee?(Ub({objectKey:V,textureKey:ee}),!0):!1},[_a,ui,qd,Ub]),dh=(0,N.useRef)(!1),{editDecals:ik,activeDecalMove:Ns,addCenteredDecal:ok,decalSizeFor:aT,startImageDecal:ak,decalControlHandlers:sT}=yS({currentObjectBindings:st,currentObjectBindingsRef:Do,applyObjectBindings:Ki,nodeRefsMap:ar,controlsRef:pt,decalMove:w,decalDragging:xs,setDecalDragging:ya,setDecalError:jl,setDecalControl:xa,decalRequestRef:Gl,onTextureUpload:I,currentPanelObjectId:ec,modelUrl:i}),Fb=(0,N.useMemo)(()=>Aw(st,Rt.styleRules),[st,Rt.styleRules]),[jb,Gb]=(0,N.useState)(()=>Sn?.isolation??null);Fo(()=>{Gb(null)},[i]);let Os=xn!==void 0?xn:jb,uh=(0,N.useCallback)(A=>{xn===void 0&&Gb(A),Vn?.(A)},[xn,Vn]),Zi=(0,N.useMemo)(()=>Rw(Fb,Os),[Fb,Os]),Ji=(0,N.useMemo)(()=>Zi.setAside.size>0?ag(st,Os):null,[Zi,st,Os]),lT=(0,N.useCallback)(A=>{let V=ui(A),ee=V!==null&&Ji?.size===1&&Ji.has(V);uh(ee?null:{...Os,target:A.id})},[uh,Os,Ji]),{sourceOf:Bo}=Zi,cT=(0,N.useMemo)(()=>un?Hw(st,Zi):[],[un,st,Zi]),Hb=(0,N.useCallback)(A=>{let V=Bo(A);ch(V)},[ch,Bo]),Wb=(0,N.useCallback)(A=>kb(A&&Bo(A)),[kb,Bo]),Xb=(0,N.useCallback)((A,V)=>{let ee=Bo(A);return x?.({binding:ee,...V})===!0?(dh.current=!0,!0):Vb(ee)},[x,Vb,Bo]),qb=(0,N.useMemo)(()=>v?(A,V)=>v({binding:Bo(A),...V}):void 0,[v,Bo]),$b=(0,N.useCallback)(A=>{Ds(A,"panel"),!zt&&Jd(A)},[Ds,Jd,zt]);(0,N.useEffect)(()=>{qr()},[qr,st]);let Yb=(0,N.useCallback)((A,V)=>{JS(V,Kl.current),k?.(bo(A,V)),qr()},[qr,k]),dT=(0,N.useCallback)(A=>{Zl.current=new Set(A.map(V=>V.name)),Vm(V=>V+1),$d(A.map(V=>V.name)),s?.(A)},[$d,s]),uT=(0,N.useCallback)(A=>{Ps.current=A,Sr.current?.invalidate()},[]),Kb=(0,N.useCallback)(A=>{sr.current=A,Ab(A),sb(KS(A));let V=bh(A);KM(V>lc?V:null),ab(!1),Xm(null),V>lc&&lb("preparingLargeModel"),Xt(!0),Jn(al(A)),Lo(!1),jm(null),ob(!1),r||(s&&s(K1(A)),$d(ld(A),sd(A))),_?.(A),y?.(Tw(A)),qr()},[$d,qr,y,s,_,Ab,r]),Zb=(0,N.useCallback)(A=>{Z(!1),Pe(!0),Lo(!0),jm(A),P?.(A)},[P]),pT=(0,N.useCallback)(A=>{A.lengthComputable&&A.total>0&&Xm(A.loaded/A.total*100),d?.(A)},[d]),Jb=(0,N.useCallback)((A,V,ee)=>{if(!Be)return;let pe={...at,lighting:{...at.lighting,lights:at.lighting.lights.map(_e=>_e.id===A?{..._e,position:V,...ee?{rotation:ee}:{}}:_e)}};Be(pe)},[at,Be]);(0,N.useEffect)(()=>{let A=sr.current;if(!Xe||!A){Ql(!1);return}let V=Object.entries(st);if(V.length===0){Ql(!1);return}let ee=r?Zl.current:new Set(Object.keys(lo(A).nodesById));if(!ee||ee.size===0){Ql(!1);return}let pe=V.map(([Mt,_n])=>_n.modelObjectId??Mt).filter(Mt=>!ee.has(Mt));Ql(pe.length>0),YM(pe.length);let _e=pe.join(`
|
|
3694
|
+
`);if(pe.length>0&&_e!==Gm.current){let Mt=pe.slice(0,10).map(qt=>`"${qt}"`).join(", "),_n=pe.length>10?` and ${pe.length-10} more`:"";console.warn(`[react-immersive] ${pe.length} object binding(s) point at nodes this model doesn't have, so they can't be selected: ${Mt}${_n}. Each binding's modelObjectId (or its key) must match a node name; log onObjectCatalog to see this model's names.`)}Gm.current=_e},[Xe,st,As,r]),(0,N.useEffect)(()=>{if(T||Ul)return;let A=[];for(let[ee,pe]of Object.entries(st))for(let _e of pe.actions??[])gc.includes(_e.id)||A.push(`"${_e.id}" on "${pe.label??ee}"`);let V=A.join(`
|
|
3695
|
+
`);if(A.length>0&&V!==rb.current){let ee=A.slice(0,10).join(", "),pe=A.length>10?` and ${A.length-10} more`:"";console.warn(`[react-immersive] ${A.length} action button(s) do nothing because ModelViewer has no onAction handler: ${ee}${pe}. ModelViewer itself handles ${gc.join(", ")}; handle other ids in onAction, or pass useViewerActions().handleAction to run their effects.`)}rb.current=V},[st,Ul,T]);let ph=(0,N.useCallback)(async()=>{if(pt.current&&_r.current&&nd(pt.current,_r.current),Ce){await Ce();return}let A=pt.current;if(!A)return;let V=_r.current;try{V?(Ma.current=pd,await Ag(A,()=>A.setLookAt(V.position[0],V.position[1],V.position[2],V.target[0],V.target[1],V.target[2],!0))):await nc()}catch(ee){console.error("Reset camera error:",ee)}},[Ce,nc]),sk=(0,N.useCallback)(()=>{Aa(!1),Br(!0)},[]),lk=(0,N.useCallback)(()=>{Br(!1)},[]),mT=(0,N.useCallback)(()=>{Br(!1),Aa(!0),setTimeout(()=>{ph()},100)},[ph]),hT=(0,N.useCallback)((A,V)=>{Yb(A,V)},[Yb]),fT=(0,N.useCallback)(A=>{if(Sb.current)return;if(dh.current){dh.current=!1;return}let V=Vl==="scene"&&Mo==="Annotations";if(A.target.closest("button, input, textarea, .ri-colorPicker, .ri-materialPicker, .ri-annotationPopup, .ri-annotationMarker, .ri-viewAnnotationPopup"))return;let pe=Nr.current,_e=pt.current,Mt=_e?.camera,_n=sr.current;if(!pe||!_e||!Mt||!_n||!V&&!_e.enabled)return;let qt=pe.getBoundingClientRect(),yn=(A.clientX-qt.left)/qt.width*2-1,Gn=-((A.clientY-qt.top)/qt.height)*2+1,pi=new xo.Raycaster;pi.setFromCamera(new xo.Vector2(yn,Gn),Mt);let zs=pi.intersectObject(_n,!0);if(zs.length===0)return;if(!V){let{x:Ni,y:mh,z:hh}=zs[0].point;_e.setOrbitPoint(Ni,mh,hh);return}let Io=zs[0],rc=Io.point,Us=_n.worldToLocal(Io.point.clone()),ic=[0,0,1];if(Io.face){let Ni=Io.face.normal.clone().transformDirection(Io.object.matrixWorld).normalize();ic=[Ni.x,Ni.y,Ni.z]}xb({worldPosition:[rc.x,rc.y,rc.z],localPosition:[Us.x,Us.y,Us.z],worldNormal:ic,anchor:fS(Io),screenX:A.clientX-qt.left,screenY:A.clientY-qt.top}),Km({title:"",description:""})},[Vl,Mo]);if((0,N.useEffect)(()=>{hs.current={snapshot:()=>{let A=pt.current,V=R.current;return{model:fs,camera:Xr.current&&A?ed(A):V?.camera,home:_r.current??V?.home,lightEdits:qi,variantEdit:gs,sectionEdit:ci,isolation:jb,objectBindings:Ls?void 0:Vd,explodeFactor:Hd,cameraControllerType:kd,uvCheckerOverride:Ed,annotationCategories:fC}},captureFrame:()=>{let A=Sr.current;return!A||t.status!=="ready"||!Xe||!ne?Promise.resolve(null):Iv(A)}}}),(0,N.useEffect)(()=>()=>{hs.current=null},[hs]),Co.status==="checking"){let A=Pd??Cn;return A?(0,ie.jsx)("div",{className:"ri-viewer ri-viewerPlaceholder",style:{background:ys},children:(0,ie.jsx)(uu,{src:A})}):(0,ie.jsx)("div",{className:"ri-viewer ri-viewer--license-checking",children:(0,ie.jsx)(Na,{title:Dn("verifyingLicense"),message:Dn("checkingYourLicenseKey")})})}if(Co.status==="invalid")return(0,ie.jsx)("div",{className:"ri-viewer ri-viewer--license-invalid",children:(0,ie.jsx)(Na,{tone:"error",title:Dn("invalidLicense"),message:Co.isLocalDomain?Co.reason??Dn("licenseHasBeenRevokedOrHasExpired"):Dn("failedToLoadPleaseContactTheSiteAdministrator")})});let{materialTextureUrl:Qb,materialTargetTakesImage:ev,materialTextureOffset:tv,materialTextureRotationDegrees:nv,isMaterialTexturePositioning:rv,materialTextureOnOffsetChange:iv,materialTextureOnRotationChange:ov,materialTextureOnEndPositioning:av}=RS({materialPopup:tc,resolveObjectKey:Oo,currentObjectBindings:st,nodeRefsMap:ar,moveZoomTarget:Ft,texturePositioningEnabled:eT,texturePositioningOverrides:tT,setMaterialTextureOffset:nT,setMaterialTextureRotation:rT,endMaterialTexturePositioning:iT}),gT=Nr.current?.offsetWidth??600,bT=Nr.current?.offsetHeight??400,vT=350,xT=290,yT=Ea?Math.min(Ea.screenX+12,gT-vT-8):0,wT=Ea?Math.min(Ea.screenY,bT-xT-8):0,ST=mt&&!!i&&!Yi&&!Xe,Bs=ha&&(Xd&&(mb||hb)||fb||!!Wd),sv=(Bs?1:0)+(ve?1:0),Is=A=>16+A*42+(et&&A>sv?Math.max(0,WC-34):0);return(0,ie.jsxs)("div",{className:"ri-viewer",ref:Ts.rootRef,style:{background:ys},"data-reduced-motion":rn?"":void 0,children:[(0,ie.jsx)("div",{className:"ri-visuallyHidden",role:"status","aria-atomic":"true",children:KC}),t.status!=="ready"&&(0,ie.jsx)(AS,{rebuilding:t.status==="rebuilding",onReload:t.reload}),(0,ie.jsxs)("div",{className:"ri-viewerLeft",ref:Ud,inert:t.status!=="ready",children:[be?be({isOpen:Lb,selectedObject:La,currentAction:jd,onClose:sh,onAction:Zd}):(0,ie.jsx)(hg,{translateDefaultActions:fa,isOpen:Lb,selectedObject:La,currentAction:jd,onClose:sh,onAction:Zd,renderActionExtra:A=>{if(A==="change-color"&&Or)return(0,ie.jsx)(pg,{inline:!0,colorPicker:Or,onClose:Di,itemMaterials:ko,setItemMaterials:Ca});if((A==="change-light-color"||A==="set-brightness")&&Ao?.kind===A&&Ao.objectId===ec){let V=Ao,ee=V.target,pe=ee.type==="lights"?at.lighting.lights.find(_e=>_e.id===ee.lightIds[0])?.color??"#ffffff":om(Yd(ee.objectKey).color);return(0,ie.jsx)(Dx,{kind:V.kind,color:pe,brightness:V.percent,onColorChange:_e=>{if(ee.type==="lights"){va(Object.fromEntries(ee.lightIds.map(_n=>[_n,{color:_e}])));return}let Mt=Yd(ee.objectKey);ah(ee.objectKey,{emissive:_e,emissiveIntensity:Mt.intensity>0?Mt.intensity:Bb.current[ee.objectKey]??1})},onBrightnessChange:_e=>{if(Fl({...V,percent:_e}),ee.type==="lights"){va(Object.fromEntries(ee.lightIds.map(Mt=>[Mt,{intensity:(ee.baseIntensity[Mt]??0)*(_e/100)}])));return}ah(ee.objectKey,{emissive:om(Yd(ee.objectKey).color),emissiveIntensity:ee.baseIntensity*(_e/100)})},onClose:()=>Fl(null)})}if((A==="add-text"||A==="add-image")&&di?.kind===A&&di.objectId===ec){let V=di,ee=Oo(V.objectId);if(!ee)return null;let pe=A==="add-image";return(0,ie.jsx)(Ox,{kind:A,decals:(st[ee]?.decals??[]).filter(_e=>!!_e.image===pe),activeId:V.activeId,error:Wt?Dn.message(Wt):null,moving:xs?.objectKey===ee&&xs.decalId===V.activeId,defaultSize:aT(ee),...sT(V,ee)})}return A==="change-material"&&tc?(0,ie.jsx)(mg,{inline:!0,triggerFileUpload:Ib,materialPopup:tc,textureUrl:Qb,clearTexture:zb,canPlaceImage:ev,offset:tv,rotationDegrees:nv,onOffsetChange:iv,onRotationChange:ov,isPositioning:rv,onEndPositioning:av}):null}}),(0,ie.jsxs)("div",{className:`ri-canvasArea ${Ra?"ri-canvasArea--measuring":""} ${ne?"":"ri-canvasArea--positioning"} ${we?"ri-canvasArea--moveMode":""}`,ref:Dm,tabIndex:tt?0:void 0,role:tt?"group":void 0,"aria-label":tt?Dn("cameraKeyboardHelp"):void 0,onDoubleClick:fT,onPointerDown:A=>{if(tt&&Nr.current?.focus({preventScroll:!0}),Ft){oT(A);return}GC(A)},onClick:Ft?void 0:HC,onPointerMove:zC,onPointerLeave:Tb,onWheel:Tb,children:[Xe&&!Ra&&t.status==="ready"?(0,ie.jsx)(qw,{objects:cT,selectedKey:hn,onHighlight:Yl,onSelect:A=>ch(A,"keyboard"),onClearSelection:sh}):null,_a&&!r&&(Ft||$C)&&(0,ie.jsx)("div",{className:"ri-moveZoomHint",role:"status",style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",zIndex:5,padding:"6px 12px",borderRadius:999,fontSize:12,fontWeight:500,color:"#fff",background:Ft?"rgba(37, 99, 235, 0.92)":"rgba(0, 0, 0, 0.6)",pointerEvents:"none",whiteSpace:"nowrap"},children:Dn(Ft?"texturePositioningHint":"texturePositioningStartHint")}),nb&&!ib&&(0,ie.jsx)(MS,{count:$M,onDismiss:()=>ob(!0)}),Hm!==null&&!ZM&&(0,ie.jsx)(CS,{triangles:Hm,offset:nb&&!ib,onDismiss:()=>ab(!0)}),Rt.model.renderer==="uv-checker"&&Wm.missing>0&&(0,ie.jsx)(TS,{missing:Wm.missing,total:Wm.total}),(0,ie.jsx)("input",{ref:Od,type:"file",accept:"image/png,image/jpeg,image/webp",className:"ri-hiddenInput",onChange:QC}),(0,ie.jsx)(Xs,{onError:t.fail,children:Rs?(0,ie.jsxs)(qh,{backend:Rs,onRendererCreated:t.onRendererCreated,suspended:t.status!=="ready",paused:Il&&!Qn,camera:re,backgroundColor:te,shadows:We&&at.shadows.enabled,sceneConfig:Rt,selectedObjectRef:oh,hoveredObjectRef:YC,highlightOnHover:Ut,renderMode:St,maxDpr:dn,reduceGpuLoad:Li,xrStore:Xd,rendererCaptureRef:Sr,preserveDrawingBuffer:ae,children:[(0,ie.jsx)(Jh,{lightingConfig:at.lighting,shadowConfig:at.shadows,shadowsEnabled:We,environmentRotation:at.environment.rotation,environmentConfig:at.environment,modelBounds:UC,objectBindings:st,nodeRefs:ar}),Em&&at.lighting.lights.map(A=>!A.visible||A.type==="none"||A.type==="hemisphere"||A.attachment?null:(0,ie.jsx)(dS,{light:A,position:A.position,rotation:A.rotation,color:A.color,intensity:A.intensity,visible:A.visible,onPositionChange:V=>Jb(A.id,V,A.rotation),onRotationChange:V=>Jb(A.id,A.position,V),onDraggingChange:Dd},A.id)),(0,ie.jsx)(lg,{setAside:Zi.setAside,nodeRefs:ar}),!ks&&(0,ie.jsx)(ug,{section:at.section??Fa,box:rh,modelRef:sr,showHandle:or,onPositionChange:A=>ba({position:A}),onDraggingChange:Tn}),(0,ie.jsx)(Kh,{controlsRef:pt,onCameraChange:hT,cameraLimits:ke,controllerType:$i,onPointerLockExit:()=>Ss("orbit"),reducedMotion:rn}),(0,ie.jsx)(Pg,{enabled:Qn||Ra||Ns||rn||$i==="pointerLock"?!1:Ht??at.model.autoRotate??!1,speed:Ln??at.model.autoRotateSpeed??1,controlsRef:pt}),Ye&&!Qn&&(0,ie.jsx)(sm.GizmoHelper,{alignment:"top-right",margin:[80,80],renderPriority:2,onUpdate:()=>{pt.current?.update(0),Sr.current?.invalidate()},children:(0,ie.jsx)(sm.GizmoViewport,{axisColors:["#ff3653","#8adb00","#2c8fff"],labelColor:"white"})}),we&&!ks&&oh&&hn&&(0,ie.jsx)(Cg,{node:oh,space:pn,onTransformChange:ZC,onDraggingChange:A=>{Dd(A),ka&&M?.(ka,A)}},hn),Ns&&(0,ie.jsx)(ly,{target:Ns,nodes:ar,controls:pt}),(0,ie.jsx)(tu,{onLoadError:Zb,children:(0,ie.jsx)(N.Suspense,{fallback:null,children:(()=>{let A=(0,ie.jsxs)(ie.Fragment,{children:[r?(0,ie.jsx)(Hf,{url:r,rotation:Rt.model.rotation,errorTarget:o,cacheSize:a,decoderConfig:Hl,objectBindings:Zi.bindings,itemMaterials:ko,sceneConfig:Rt,selectedItem:hn,panelHoveredItem:m??$l,highlightOnHover:Ut,onItemClick:Hb,onItemHover:Wb,onItemDoubleClick:Xb,onItemContextMenu:qb,onObjectCatalog:dT,onTilesetBounds:uT,onModelLoaded:Kb,onLoadError:Zb,nodeRefsOut:ar,onNodeRefsChange:zd,materialRefsOut:Cs,explodeFactor:Hd,suspendBindingTransforms:mr}):(0,ie.jsx)(sf,{url:i,modelFormat:l,objectBindings:Zi.bindings,selectedItem:hn,itemMaterials:ko,onItemClick:Hb,onItemDoubleClick:Xb,onItemContextMenu:qb,onItemHover:Wb,onModelLoaded:Kb,onAnimationsReady:L,nodeRefsOut:ar,onNodeRefsChange:zd,materialRefsOut:Cs,panelHoveredItem:m??$l,sceneConfig:Rt,zoomOnSelected:gt,highlightOnHover:Ut,decoderConfig:Hl,onLoadProgress:pT,explodeFactor:Hd,suspendBindingTransforms:mr,pulses:Zi.pulses}),(0,ie.jsx)($f,{annotations:bC,sceneConfig:at,activeAnnotation:eh,popupRef:Xl,canvasRootRef:Nr,worldPositionsRef:Ms,modelLoaded:Xe,onAnnotationClick:PC,onCloseAnnotation:Qm,hideCloseButton:th,showAnnotationOnHover:H}),(0,ie.jsx)(Tg,{annotation:yC,enabled:th&&!Qn,controlsRef:pt,offsetRef:_s}),Qn?(0,ie.jsx)(su,{controlsRef:pt,sceneRef:sr,config:Qn.config,playing:!0,resetOnPlay:!0,playOnce:!0,startAtPath:!0,onStarted:Qn.onStarted,onFinished:Qn.onFinished,onProgress:iC},"video-export"):Pa&&(0,ie.jsx)(su,{controlsRef:pt,sceneRef:sr,config:Pa,playing:ub&&!Ra,resetOnPlay:tC,onFinished:()=>{Br(!1),Aa(!1)},onUserInteract:()=>{Br(!1)}},"cinematic-preview"),et&&(0,ie.jsx)(Yf,{points:_b,unit:li,box:rh,showDimensions:Pb,tool:Mb,areaClosed:Cb,snapPreview:Ra?IC:null})]});return Xd?(0,ie.jsx)(lw,{ref:aC,box:rh,scaleMode:Dr,onARStateChange:uC,children:A}):A})()})},r??i),Se&&(0,ie.jsx)(N.Suspense,{fallback:null,children:Se})]}):null}),(0,ie.jsx)(uu,{src:Pd??Cn,hidden:Xe&&ne}),Vt&&(0,ie.jsx)("div",{className:"ri-overlay",children:Vt}),mt&&i&&Yi&&(0,ie.jsx)(PS,{failure:_x(Fm,r||i,r?void 0:l,e),source:r||i}),(0,ie.jsx)(Wp,{visible:ST,message:Dn(JM,{millions:Math.round((Hm??0)/1e6)}),progress:QM??void 0}),Bs&&(0,ie.jsx)(GS,{top:Is(0),xrStore:Xd,arSupported:mb,vrSupported:hb,quickLookSupported:fb,mobileHandoffUrl:Wd,mobileHandoffOpen:gb,onQuickLook:dC,onOpenMobileHandoff:lC}),sC,gb&&Wd&&(0,ie.jsx)(HS,{url:Wd,onClose:cC}),ve&&(0,ie.jsx)(WS,{top:Is(Bs?1:0),active:Eo,onToggle:()=>Rd(A=>!(A??wa))}),et&&(0,ie.jsx)(Kf,{top:Is(sv),active:Ra,disabled:!!Qn,tool:Mb,snap:OC,pointCount:_b.length,areaClosed:Cb,error:kC,showDimensions:Pb,onToggle:()=>{Br(!1),FC()},onTool:LC,onSnap:BC,onUndo:DC,onClear:VC,onFinishArea:NC,onDimensions:jC,onHeight:XC}),Qe&&(0,ie.jsx)(XS,{top:Is((Bs?1:0)+(ve?1:0)+(et?1:0)),open:eC,factor:Hd,onToggleOpen:()=>db(A=>!A),onFactorChange:cb}),or&&!ks&&(0,ie.jsx)(qS,{top:Is((Bs?1:0)+(ve?1:0)+(et?1:0)+(Qe?1:0)),section:AC,onChange:ba}),Pa&&(0,ie.jsx)($S,{top:Is((Bs?1:0)+(ve?1:0)+(et?1:0)+(Qe?1:0)+(or?1:0)),playing:ub,disabled:!!Qn||Ra,onPlay:()=>{Aa(!1),Br(!0)},onPause:()=>Br(!1),onStop:mT}),Qn&&(0,ie.jsx)(YS,{progress:rC,onCancel:Ym}),(Zm||yb||Ns||xr&&Ji)&&(0,ie.jsxs)("div",{className:`ri-bottomStack ${wb?"ri-bottomStack--aboveButtons":""} ${Zm?"ri-bottomStack--annotationFilters":""}`,children:[Zm&&(0,ie.jsx)(DS,{categories:vC,selected:gC,disabled:!!Qn,onChange:xC}),Ns&&(0,ie.jsx)(NS,{onCancel:Ns.onCancel}),xr&&Ji&&(0,ie.jsx)(OS,{label:Ji.size===1?Dn("isolatedObject",{name:(()=>{let[A]=Ji;return st[A]?.label??A})()}):Dn("isolatedObjects",{count:Ji.size}),onShowAll:()=>uh(null)}),yb&&(0,ie.jsx)(BS,{groups:Ge,activeVariants:bs,onSelect:ki})]}),wb&&(0,ie.jsxs)("div",{className:"ri-buttonContainer",children:[(0,ie.jsx)("div",{className:"ri-tourControls",children:U&&Jm.length>0&&(0,ie.jsx)(IS,{count:Jm.length,active:th,index:mC,navigating:hC,onStart:wC,onPrevious:SC,onNext:_C,onStop:MC})}),(0,ie.jsxs)("div",{className:"mv-rightControls",children:[ot&&Ts.supported&&(0,ie.jsx)(zS,{fullscreen:Ts,disabled:!!Qn}),Oe&&(0,ie.jsx)("button",{className:"mv-resetButton",onClick:ph,disabled:!!Qn,title:Dn("resetCameraView"),children:(0,ie.jsx)(o_.RotateCcw,{})}),(0,ie.jsx)(US,{open:Sa,current:$i,disabled:!!Qn,onSelect:Ss,onToggle:()=>ws(A=>!A)}),Te&&(0,ie.jsx)(VS,{menu:qC,recording:!!Qn,hasScene:!!sr.current,canCaptureImage:ae||Rs==="webgpu",canRecord:Xe&&ne&&!j,hasCinematic:!!Pa})]})]}),Ea&&(0,ie.jsx)(FS,{x:yT,y:wT,form:pC,setForm:Km,onOk:CC,onCancel:TC})]}),be&&Or&&(0,ie.jsx)(pg,{colorPicker:Or,onClose:Di,itemMaterials:ko,setItemMaterials:Ca}),be&&tc&&(0,ie.jsx)(mg,{triggerFileUpload:Ib,materialPopup:tc,textureUrl:Qb,clearTexture:zb,canPlaceImage:ev,offset:tv,rotationDegrees:nv,onOffsetChange:iv,onRotationChange:ov,isPositioning:rv,onEndPositioning:av})]}),Ne&&(0,ie.jsx)("div",{className:"ri-viewerRight",inert:t.status!=="ready",children:ue?ue({objectBindings:st,onAction:Zd,onFocus:$b,onHover:Yl}):(0,ie.jsx)(fg,{objectBindings:st,onAction:Zd,onFocus:$b,onHover:Yl,isolatedKeys:Ji,onIsolate:xr?lT:void 0})}),vn&&(0,ie.jsx)(Sw,{controlsRef:pt,enabled:t.status==="ready",opacity:ur,moveSensitivity:jt,position:de})]})}var oa=require("react");var md=require("three"),lm=1e-6;function a_(){let e=[null,null],t=0,n=!1,i=new md.Vector3,r=new md.Vector3,o=new md.Vector3,a=new md.Vector3,s=(c,h)=>{let p=e[c],u=e[h];if(!p||!u)return;p.controls.getPosition(i,!1),p.controls.getTarget(o,!1),u.controls.getPosition(r,!1),u.controls.getTarget(a,!1);let m=p.controls.camera.zoom;if(!(i.distanceToSquared(r)<lm&&o.distanceToSquared(a)<lm&&Math.abs(m-u.controls.camera.zoom)<lm)){n=!0;try{Math.abs(m-u.controls.camera.zoom)>=lm&&u.controls.zoomTo(m,!1),u.controls.setLookAt(i.x,i.y,i.z,o.x,o.y,o.z,!1)}finally{n=!1}u.invalidate()}},l=c=>{n||(c===t?s(c,1-c):s(t,c))};return{attach(c,h,p){let u=e[c];if(u?.controls===h){u.invalidate=p;return}u?.detach();let m=()=>l(c),f=()=>{t=c};h.addEventListener("update",m),h.addEventListener("controlstart",f),e[c]={controls:h,invalidate:p,detach:()=>{h.removeEventListener("update",m),h.removeEventListener("controlstart",f)}},s(t,1-t)},get leader(){return t},detach(){e.forEach(c=>c?.detach()),e[0]=e[1]=null}}}var yo=require("react/jsx-runtime"),cm=.05,s_=.2,l_=e=>Math.min(Math.max(Number.isFinite(e)?e:.5,0),1);function c_({split:e,onSplitChange:t,labels:n,containerRef:i,beforeAction:r}){let o=Me(),a=p=>{let u=i.current?.getBoundingClientRect();u&&u.width>0&&t(l_((p-u.left)/u.width))},s=p=>{p.preventDefault(),p.stopPropagation(),p.currentTarget.setPointerCapture(p.pointerId),p.currentTarget.focus(),a(p.clientX)},l=p=>{p.currentTarget.hasPointerCapture(p.pointerId)&&a(p.clientX)},c=p=>{let u={ArrowLeft:e-cm,ArrowDown:e-cm,ArrowRight:e+cm,ArrowUp:e+cm,PageDown:e-s_,PageUp:e+s_,Home:0,End:1}[p.key];u!==void 0&&(p.preventDefault(),p.stopPropagation(),t(l_(u)))},h=Math.round(e*100);return(0,yo.jsxs)(yo.Fragment,{children:[(0,yo.jsxs)("span",{className:"ri-compare__label ri-compare__label--before",hidden:e<.08,children:[n[0],r]}),(0,yo.jsx)("span",{className:"ri-compare__label ri-compare__label--after",hidden:e>.92,children:n[1]}),(0,yo.jsx)("div",{className:"ri-compare__divider",role:"slider",tabIndex:0,"aria-label":o("compareDivider"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":h,"aria-valuetext":o("compareDividerValue",{before:n[0],after:n[1],percent:h,rest:100-h}),onPointerDown:s,onPointerMove:l,onKeyDown:c,children:(0,yo.jsx)("span",{className:"ri-compare__handle","aria-hidden":"true"})})]})}var hd=require("react/jsx-runtime");function d_({liveViewerRef:e,renderBefore:t,split:n,onSplitChange:i,labels:r,beforeAction:o}){let a=(0,oa.useRef)(null),s=(0,oa.useMemo)(()=>a_(),[]);(0,oa.useEffect)(()=>()=>s.detach(),[s]);let l=(0,oa.useCallback)(c=>{let h=e.current;h&&s.attach(0,h.raw.controls,h.invalidate),s.attach(1,c.raw.controls,c.invalidate)},[s,e]);return(0,hd.jsxs)("div",{ref:a,className:"ri-compare ri-compare--overlay",style:{"--ri-compare-split":`${n*100}%`},children:[(0,hd.jsx)("div",{className:"ri-compare__layer ri-compare__layer--before",children:t(l)}),(0,hd.jsx)(c_,{split:n,onSplitChange:i,labels:r,containerRef:a,beforeAction:o})]})}var rr=require("react"),u_={currentClip:null,isPlaying:!1,speed:1,time:0,duration:0,active:[]};function p_(){let e=(0,rr.useRef)(null),t=(0,rr.useRef)(null),[n,i]=(0,rr.useState)([]),[r,o]=(0,rr.useState)([]),[a,s]=(0,rr.useState)(u_);(0,rr.useEffect)(()=>()=>{t.current?.()},[]);let l=(0,rr.useCallback)(g=>{t.current?.(),e.current=g,i(g.clips),o(g.clipDetails??g.clips.map(b=>({sourceName:b,duration:0}))),s(g.getState?.()??u_),t.current=g.subscribe?.(s)??null},[]),c=(0,rr.useCallback)(g=>{let b=e.current;b&&(g(b),!b.subscribe&&b.getState&&s(b.getState()))},[]),h=(0,rr.useCallback)((g,b)=>c(x=>x.play(g,b)),[c]),p=(0,rr.useCallback)(g=>c(b=>b.pause(g)),[c]),u=(0,rr.useCallback)(g=>c(b=>b.stop(g)),[c]),m=(0,rr.useCallback)((g,b)=>c(x=>x.setSpeed(g,b)),[c]),f=(0,rr.useCallback)((g,b)=>c(x=>x.seek?.(g,b)),[c]);return{clips:n,clipDetails:r,...a,play:h,pause:p,stop:u,setSpeed:m,seek:f,handleAnimationsReady:l}}var vR="react-immersive:binding-builder";var Tl="session",ls="model",Pl="textures",fd="current";var ss=null;function um(){return ss||(ss=new Promise((e,t)=>{if(typeof indexedDB>"u"){t(new Error("IndexedDB is not available in this environment."));return}let n=indexedDB.open(vR,2);n.onupgradeneeded=()=>{let i=n.result;i.objectStoreNames.contains(Tl)||i.createObjectStore(Tl),i.objectStoreNames.contains(ls)||i.createObjectStore(ls),i.objectStoreNames.contains(Pl)||i.createObjectStore(Pl)},n.onsuccess=()=>{let i=n.result;i.onversionchange=()=>{i.close(),ss=null},e(i)},n.onerror=()=>t(n.error??new Error("Failed to open IndexedDB."))}),ss.catch(()=>{ss=null}),ss)}function pm(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onerror=()=>n(e.error??new Error("IndexedDB transaction failed.")),e.onabort=()=>n(e.error??new Error("IndexedDB transaction aborted."))})}function Eg(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error??new Error("IndexedDB request failed."))})}function dm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xR(e){if(!dm(e)||e.version!==1)return!1;let t=e.model;return typeof e.savedAt=="number"&&dm(e.bindings)&&dm(e.sceneConfig)&&dm(t)&&typeof t.name=="string"&&(t.kind==="file"&&typeof t.key=="string"||t.kind==="url"&&typeof t.url=="string")}async function m_(e,t){let n=await um(),i={...e,version:1,savedAt:Date.now()},r=n.transaction([Tl,ls],"readwrite"),o=pm(r);if(r.objectStore(Tl).put(i,fd),i.model.kind==="file"&&t){let a={key:i.model.key,blob:t,name:t.name,type:t.type,lastModified:t.lastModified};r.objectStore(ls).put(a,fd)}else i.model.kind==="url"&&r.objectStore(ls).delete(fd);return await o,i}async function h_(){let t=(await um()).transaction([Tl,ls],"readonly"),n=pm(t),[i,r]=await Promise.all([Eg(t.objectStore(Tl).get(fd)),Eg(t.objectStore(ls).get(fd))]);return await n,xR(i)?i.model.kind==="url"?{session:i,file:null}:!r||r.key!==i.model.key?null:{session:i,file:new File([r.blob],r.name,{type:r.type,lastModified:r.lastModified})}:null}async function mm(e,t){let i=(await um()).transaction(Pl,"readwrite"),r=pm(i),o={blob:t,name:t.name,type:t.type,savedAt:Date.now()};i.objectStore(Pl).put(o,e),await r}async function gd(e){let n=(await um()).transaction(Pl,"readonly"),i=pm(n),r=await Eg(n.objectStore(Pl).get(e));return await i,r?new File([r.blob],r.name,{type:r.type,lastModified:r.savedAt}):null}var wm=require("react");var M_=require("react"),la=require("lucide-react"),gm=require("react-colorful");var Pi=require("react"),b_=require("react-dom"),hm=require("lucide-react"),fm=require("react-colorful");function aa(e){let t=e.replace("#","").match(/.{2}/g).map(i=>parseInt(i,16)/255).map(i=>i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4));return .2126*t[0]+.7152*t[1]+.0722*t[2]>.179?"#000":"#fff"}var f_=require("react");function g_(e,t,n){(0,f_.useEffect)(()=>{if(!n)return;let i=Array.isArray(e)?e:[e],r=o=>{let a=o.target;i.some(l=>l.current?.contains(a))||t()};return document.addEventListener("pointerdown",r,!0),()=>{document.removeEventListener("pointerdown",r,!0)}},[e,t,n])}var De=require("react/jsx-runtime");function bd({anchorRef:e,onClose:t,children:n}){let i=(0,Pi.useRef)(null),[r,o]=(0,Pi.useState)(null);return g_([i,e],t,!0),(0,Pi.useLayoutEffect)(()=>{let a=e.current;if(!a)return;let s=a.getBoundingClientRect(),l=222,c=8,h=Math.min(Math.max(s.right-l,c),window.innerWidth-l-c),p=Math.min(s.bottom+6,window.innerHeight-200);o({top:p,left:h})},[e]),r?(0,b_.createPortal)((0,De.jsx)("div",{ref:i,className:"se-colorPickerPopover",style:{position:"fixed",top:r.top,left:r.left},children:n}),document.body):null}function yR(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function wo({title:e,children:t}){return(0,De.jsxs)("section",{className:"se-section",children:[(0,De.jsx)("h3",{className:"se-sectionTitle",children:e}),(0,De.jsx)("div",{className:"se-sectionBody",children:t})]})}function yt({title:e,open:t,onToggle:n,trailing:i,children:r,disabled:o,tooltip:a}){let s=a?`${a}`:e;return(0,De.jsxs)("section",{className:"se-panel",children:[(0,De.jsxs)("button",{type:"button",className:"se-panelHeader",onClick:n,"aria-expanded":t,title:s,children:[(0,De.jsxs)("span",{className:"se-panelHeaderMain",children:[(0,De.jsx)(hm.ChevronDown,{size:16,className:`se-panelChevron ${t?"se-panelChevron--open":""}`}),(0,De.jsx)("span",{className:"se-panelTitle",children:e}),a?(0,De.jsx)("span",{className:"se-panelHelp",title:s,"aria-label":s,role:"img",onClick:l=>l.stopPropagation(),children:(0,De.jsx)(hm.Info,{size:13})}):null]}),i?(0,De.jsx)("span",{className:"se-panelTrailing",onClick:l=>l.stopPropagation(),children:i}):null]}),t?(0,De.jsx)("div",{className:"se-panelBody",style:o?{opacity:.45,pointerEvents:"none"}:void 0,children:r}):null]})}function At({checked:e,onChange:t,label:n}){return(0,De.jsxs)("label",{className:"se-switch","aria-label":n,children:[(0,De.jsx)("input",{type:"checkbox",checked:e,onChange:i=>t(i.target.checked)}),(0,De.jsx)("span",{className:"se-switchTrack",children:(0,De.jsx)("span",{className:"se-switchThumb"})})]})}function q({label:e,value:t,min:n,max:i,step:r,formatValue:o,onChange:a,disabled:s=!1}){return(0,De.jsxs)("label",{className:`se-field ${s?"se-field--disabled":""}`,children:[(0,De.jsxs)("span",{className:"se-fieldLabel",children:[e,(0,De.jsx)("span",{className:"se-fieldValue",children:o?o(t):t})]}),(0,De.jsx)("input",{className:"se-slider",type:"range",min:n,max:i,step:r,value:t,onChange:l=>a(Number(l.target.value)),disabled:s})]})}function Tt({label:e,checked:t,onChange:n}){return(0,De.jsxs)("label",{className:"se-field se-fieldInline",children:[(0,De.jsx)("span",{className:"se-fieldLabel",children:e}),(0,De.jsx)("input",{type:"checkbox",className:"se-checkbox",checked:t,onChange:i=>n(i.target.checked)})]})}function jr({label:e,value:t,options:n,onChange:i}){return(0,De.jsxs)("label",{className:"se-field se-fieldInline",children:[(0,De.jsx)("span",{className:"se-fieldLabel",children:e}),(0,De.jsx)("select",{className:"se-select",value:t,onChange:r=>i(r.target.value),children:n.map(r=>(0,De.jsx)("option",{value:r,children:yR(r)},r))})]})}function kr({label:e,value:t,onChange:n}){let[i,r]=(0,Pi.useState)(!1),o=(0,Pi.useRef)(null);return(0,De.jsxs)("div",{className:"se-field",children:[(0,De.jsxs)("div",{className:"se-fieldInline",children:[(0,De.jsx)("span",{className:"se-fieldLabel",children:e}),(0,De.jsx)("span",{ref:o,style:{display:"inline-flex"},children:(0,De.jsx)(fm.HexColorInput,{prefixed:!0,className:"se-swatch",onClick:()=>r(a=>!a),style:{background:t,color:aa(t)},color:t,onChange:n})})]}),i?(0,De.jsx)(bd,{anchorRef:o,onClose:()=>r(!1),children:(0,De.jsx)(fm.HexColorPicker,{color:t,onChange:n})}):null]})}function v_({value:e,min:t,max:n,step:i,onChange:r}){let[o,a]=(0,Pi.useState)(String(e)),s=(0,Pi.useRef)(!1);return(0,Pi.useLayoutEffect)(()=>{s.current||a(String(e))},[e]),(0,De.jsx)("input",{type:"number",className:"se-numberInput",min:t,max:n,step:i,value:o,onFocus:()=>{s.current=!0},onChange:l=>{let c=l.target.value;a(c),c!==""&&c!=="-"&&!Number.isNaN(Number(c))&&r(Number(c))},onBlur:()=>{s.current=!1,a(String(e))}})}function sa({label:e,value:t,min:n,max:i,step:r,onChange:o}){return(0,De.jsxs)("div",{className:"se-field",children:[(0,De.jsx)("span",{className:"se-fieldLabel",children:e}),(0,De.jsx)("div",{className:"se-vectorRow",children:["X","Y","Z"].map((s,l)=>(0,De.jsxs)("label",{className:"se-vectorAxis",children:[(0,De.jsx)("span",{children:s}),(0,De.jsx)(v_,{value:t[l],min:n,max:i,step:r,onChange:c=>{let h=[...t];h[l]=c,o(h)}})]},s))})]})}function cs({label:e,value:t,min:n,max:i,step:r,onChange:o}){return(0,De.jsxs)("div",{className:"se-field",children:[(0,De.jsx)("span",{className:"se-fieldLabel",children:e}),(0,De.jsx)("div",{className:"se-vectorRow",children:["X","Y"].map((s,l)=>(0,De.jsxs)("label",{className:"se-vectorAxis",children:[(0,De.jsx)("span",{children:s}),(0,De.jsx)(v_,{value:t[l],min:n,max:i,step:r,onChange:c=>{let h=[...t];h[l]=c,o(h)}})]},s))})]})}var x_={free:0,starter:1,growth:2};function y_(e){return e==="starter"||e==="growth"||e==="scale"?e==="scale"?"growth":e:"free"}function Ai(e,t){return x_[e]>=x_[t]}var w_={free:"Free",starter:"Starter",growth:"Growth"};var S_=require("lucide-react");var vd=require("react/jsx-runtime");function ir({requiredTier:e,feature:t}){return(0,vd.jsxs)("div",{className:"bb-tierLock",children:[(0,vd.jsx)(S_.Lock,{size:16}),(0,vd.jsxs)("p",{className:"bb-tierLockMessage",children:[t," requires the ",w_[e]," plan or higher."]})]})}var $=require("react/jsx-runtime"),wR=["lit","unlit","normals"],SR=["color","image","environment"];function __(e){let t=e%360;return t<0?t+360:t}function Al({title:e,open:t,onToggle:n,children:i,trailing:r}){return(0,$.jsxs)("section",{className:"se-panel",children:[(0,$.jsxs)("button",{type:"button",className:"se-panelHeader",onClick:n,"aria-expanded":t,children:[(0,$.jsxs)("span",{className:"se-panelHeaderMain",children:[(0,$.jsx)(la.ChevronDown,{size:16,className:`se-panelChevron ${t?"se-panelChevron--open":""}`}),(0,$.jsx)("span",{className:"se-panelTitle",children:e})]}),r?(0,$.jsx)("span",{className:"se-panelTrailing",onClick:o=>o.stopPropagation(),children:r}):null]}),t?(0,$.jsx)("div",{className:"se-panelBody",children:i}):null]})}function Rg({config:e,onChange:t,materialVariantGroups:n=[]}){let{model:i,camera:r,wireframe:o,background:a,environment:s}=e,l=Wo(i),c=n.length>0?l.filter(d=>!n.some(S=>S.variants.some(C=>C.name===d))):[],{tier:h}=Rr(),p=Ai(h,"starter"),u=wl(),[m,f]=(0,M_.useState)({general:!0,camera:!0,autoRotate:!1,section:!1,wireframe:!1,background:!1}),g=d=>f(S=>({...S,[d]:!S[d]})),b=d=>t({...e,model:d}),x=d=>t({...e,camera:d}),v=e.section??Fa,w=d=>t({...e,section:{...v,...d}}),M=d=>t({...e,wireframe:d}),_=d=>t({...e,background:d}),y=d=>t({...e,environment:d}),P=d=>{y({...s,source:"preset",preset:d})};return(0,$.jsxs)("div",{className:"se-generalContent",children:[(0,$.jsxs)(Al,{title:"General",open:m.general,onToggle:()=>g("general"),children:[(0,$.jsxs)("div",{className:"se-field",children:[(0,$.jsxs)("div",{className:"se-fieldLabel",children:[(0,$.jsx)("span",{children:"Straighten model"}),(0,$.jsx)("button",{type:"button",className:"se-iconButton",onClick:()=>b({...i,rotation:[0,0,0]}),"aria-label":"Reset model rotation",children:(0,$.jsx)(la.RotateCcw,{size:16})})]}),(0,$.jsx)("div",{className:"se-axisStepperGrid",children:["X","Y","Z"].map((d,S)=>(0,$.jsxs)("div",{className:"se-axisStepper",children:[(0,$.jsx)("button",{type:"button",className:"se-axisStepperButton",onClick:()=>{let C=[...i.rotation];C[S]=__(C[S]-90),b({...i,rotation:C})},"aria-label":`Rotate ${d} axis backward`,children:(0,$.jsx)(la.ChevronLeft,{size:16})}),(0,$.jsx)("span",{className:"se-axisStepperLabel",children:d}),(0,$.jsx)("button",{type:"button",className:"se-axisStepperButton",onClick:()=>{let C=[...i.rotation];C[S]=__(C[S]+90),b({...i,rotation:C})},"aria-label":`Rotate ${d} axis forward`,children:(0,$.jsx)(la.ChevronRight,{size:16})})]},d))})]}),(0,$.jsx)(sa,{label:"Rotation",value:i.rotation,min:0,max:360,step:1,onChange:d=>b({...i,rotation:d})}),(0,$.jsxs)("div",{className:"se-field",children:[(0,$.jsx)("span",{className:"se-fieldLabel",children:"Renderer"}),(0,$.jsx)("div",{className:"se-segmentedControl se-segmentedControl--renderer",children:ky.map(d=>(0,$.jsx)("button",{type:"button",className:`se-segmentedOption ${i.renderer===d?"se-segmentedOption--active":""}`,onClick:()=>b({...i,renderer:d}),children:d==="uv-checker"?"UV CHECKER":d.toUpperCase()},d))})]}),(0,$.jsx)(jr,{label:"Shading",value:i.shading,options:wR,onChange:d=>b({...i,shading:d})}),n.map((d,S)=>{let C=l.find(T=>d.variants.some(E=>E.name===T));return(0,$.jsxs)("label",{className:"se-field se-fieldInline",children:[(0,$.jsx)("span",{className:"se-fieldLabel",children:d.name??"Material variant"}),(0,$.jsxs)("select",{className:"se-select",value:C??"",onChange:T=>{let E=T.target.value,k=l.filter(D=>D!==C);b(sl(i,E?Hu(k,E,n):k))},children:[(0,$.jsx)("option",{value:"",children:"Model default"}),d.variants.map(T=>(0,$.jsx)("option",{value:T.name,children:T.label},T.name))]})]},d.name??`group-${S}`)}),c.length>0?(0,$.jsxs)("div",{className:"se-placeholder se-placeholder--spaced",children:["Not in this model: ",c.join(", "),"."," ",(0,$.jsx)("button",{type:"button",className:"se-linkButton",onClick:()=>b(sl(i,l.filter(d=>!c.includes(d)))),children:"Remove"})]}):null]}),(0,$.jsx)(Al,{title:"Camera",open:m.camera,onToggle:()=>g("camera"),children:(0,$.jsx)(q,{label:"Field Of View",value:r.fieldOfView,min:20,max:100,step:.1,formatValue:d=>`${d.toFixed(3)}\xB0`,onChange:d=>x({...r,fieldOfView:d})})}),(0,$.jsxs)(Al,{title:"Auto Rotate",open:m.autoRotate,onToggle:()=>g("autoRotate"),trailing:(0,$.jsxs)("label",{className:"se-switch","aria-label":"Toggle auto rotate",children:[(0,$.jsx)("input",{type:"checkbox",checked:i.autoRotate??!1,onChange:d=>b({...i,autoRotate:d.target.checked})}),(0,$.jsx)("span",{className:"se-switchTrack",children:(0,$.jsx)("span",{className:"se-switchThumb"})})]}),children:[i.autoRotate&&u?(0,$.jsx)("div",{className:"se-placeholder se-placeholder--spaced",children:"Your device is set to reduce motion, so this preview won't turn. Visitors without that setting will see it."}):null,i.autoRotate?(0,$.jsx)(q,{label:"Rotation Speed",value:i.autoRotateSpeed??1,min:.1,max:3,step:.1,formatValue:d=>`${d.toFixed(1)}x`,onChange:d=>b({...i,autoRotateSpeed:d})}):(0,$.jsx)("div",{className:"se-placeholder",children:"Enable auto rotate to adjust its speed."})]}),(0,$.jsx)(Al,{title:"Section Cut",open:m.section,onToggle:()=>g("section"),trailing:(0,$.jsxs)("label",{className:"se-switch","aria-label":"Toggle section cut",children:[(0,$.jsx)("input",{type:"checkbox",checked:v.enabled,onChange:d=>w({enabled:d.target.checked})}),(0,$.jsx)("span",{className:"se-switchTrack",children:(0,$.jsx)("span",{className:"se-switchThumb"})})]}),children:v.enabled?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{className:"se-field",children:[(0,$.jsx)("span",{className:"se-fieldLabel",children:"Cut across"}),(0,$.jsx)("div",{className:"se-segmentedControl",children:Iu.map(d=>(0,$.jsx)("button",{type:"button",className:`se-segmentedOption ${v.axis===d?"se-segmentedOption--active":""}`,onClick:()=>w({axis:d}),children:d.toUpperCase()},d))})]}),(0,$.jsx)(q,{label:"Position",value:v.position,min:0,max:1,step:.01,formatValue:d=>`${Math.round(d*100)}%`,onChange:d=>w({position:d})}),(0,$.jsx)(Tt,{label:"Keep the other side",checked:v.flip,onChange:d=>w({flip:d})})]}):(0,$.jsx)("div",{className:"se-placeholder",children:"Cut the model open to see inside. Drag the plane in the preview, or set it here."})}),(0,$.jsx)(Al,{title:"Wireframe",open:m.wireframe,onToggle:()=>g("wireframe"),trailing:(0,$.jsxs)("label",{className:"se-switch","aria-label":"Toggle wireframe preview",children:[(0,$.jsx)("input",{type:"checkbox",checked:p&&o.enabled,disabled:!p,onChange:d=>M({...o,enabled:d.target.checked})}),(0,$.jsx)("span",{className:"se-switchTrack",children:(0,$.jsx)("span",{className:"se-switchThumb"})})]}),children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:"Opacity",value:o.opacity,min:0,max:1,step:.01,onChange:d=>M({...o,opacity:d})}),(0,$.jsx)(kr,{label:"Wire color",value:o.color,onChange:d=>M({...o,color:d})})]}):(0,$.jsx)(ir,{requiredTier:"starter",feature:"Wireframe preview"})}),(0,$.jsx)(Al,{title:"Background",open:m.background,onToggle:()=>g("background"),trailing:(0,$.jsxs)("label",{className:"se-switch","aria-label":"Toggle scene background",children:[(0,$.jsx)("input",{type:"checkbox",checked:a.enabled,onChange:d=>_({...a,enabled:d.target.checked})}),(0,$.jsx)("span",{className:"se-switchTrack",children:(0,$.jsx)("span",{className:"se-switchThumb"})})]}),children:a.enabled?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{className:"se-field",children:[(0,$.jsx)("span",{className:"se-fieldLabel",children:"Background type"}),(0,$.jsx)("div",{className:"se-segmentedControl",children:SR.map(d=>(0,$.jsx)("button",{type:"button",className:`se-segmentedOption ${a.type===d?"se-segmentedOption--active":""}`,onClick:()=>_({...a,type:d}),children:d},d))})]}),a.type==="environment"?p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{className:"se-field",children:[(0,$.jsx)("span",{className:"se-fieldLabel",children:"Environment source"}),(0,$.jsxs)("div",{className:"se-segmentedControl",children:[(0,$.jsx)("button",{type:"button",className:`se-segmentedOption ${s.source==="preset"?"se-segmentedOption--active":""}`,onClick:()=>y({...s,source:"preset"}),children:"PRESET"}),(0,$.jsx)("button",{type:"button",className:`se-segmentedOption ${s.source==="custom"?"se-segmentedOption--active":""}`,onClick:()=>y({...s,source:"custom"}),children:"CUSTOM"})]})]}),s.source==="preset"?(0,$.jsx)(jr,{label:"Environment preset",value:s.preset,options:Ly,onChange:P}):(0,$.jsxs)("label",{className:"se-field",children:[(0,$.jsx)("span",{className:"se-fieldLabel",children:"Custom environment URL"}),(0,$.jsx)("input",{type:"text",className:"se-textInput",placeholder:"https://example.com/environment.hdr",value:s.customEnvironmentUrl,onChange:d=>y({...s,customEnvironmentUrl:d.target.value})}),(0,$.jsx)("span",{className:"bb-note",children:"Enter a HDR, EXR, JPG, JPEG, PNG, or WEBP URL."}),s.customEnvironmentUrl.trim()&&!Bu(s.customEnvironmentUrl)?(0,$.jsx)("span",{className:"bb-note",style:{color:"#fca5a5"},children:"Invalid image/HDRI URL."}):null]}),(0,$.jsx)(q,{label:"Environment intensity",value:s.intensity,min:0,max:3,step:.05,onChange:d=>y({...s,intensity:d})})]}):(0,$.jsx)(ir,{requiredTier:"starter",feature:"Environment backgrounds"}):null,a.type==="image"?(0,$.jsxs)("label",{className:"se-field",children:[(0,$.jsx)("span",{className:"se-fieldLabel",children:"Background image URL"}),(0,$.jsx)("input",{type:"text",className:"se-textInput",placeholder:"https://example.com/background.jpg",value:a.imageUrl,onChange:d=>_({...a,imageUrl:d.target.value})})]}):null,a.type==="color"?(0,$.jsxs)("div",{className:"se-field",children:[(0,$.jsx)("span",{className:"se-fieldLabel",children:"Background color"}),(0,$.jsx)("div",{className:"se-inlineColorPicker",children:(0,$.jsx)(gm.HexColorPicker,{color:a.color,onChange:d=>_({...a,color:d})})}),(0,$.jsx)("div",{className:"se-fieldInline",children:(0,$.jsx)(gm.HexColorInput,{prefixed:!0,className:"se-swatch",style:{background:a.color,color:aa(a.color)},color:a.color,onChange:d=>_({...a,color:d})})})]}):null]}):(0,$.jsx)("div",{className:"se-placeholder",children:"Background rendering is disabled for this scene preset."})})]})}var $_=require("react");var xe=require("react/jsx-runtime");function C_({pp:e,set:t,open:n,toggle:i}){let{ssao:r}=e;return(0,xe.jsxs)(yt,{title:"SSAO",tooltip:"Adds soft contact shadows in corners, creases, and tight spaces.",open:n.ssao,onToggle:()=>i("ssao"),disabled:!r.enabled,trailing:(0,xe.jsx)(At,{checked:r.enabled,onChange:o=>t("ssao",{...r,enabled:o}),label:"Toggle SSAO"}),children:[(0,xe.jsx)(q,{label:"Samples",value:r.samples,min:1,max:64,step:1,onChange:o=>t("ssao",{...r,samples:o})}),(0,xe.jsx)(q,{label:"Rings",value:r.rings,min:1,max:12,step:1,onChange:o=>t("ssao",{...r,rings:o})}),(0,xe.jsx)(q,{label:"Intensity",value:r.intensity,min:0,max:20,step:.5,onChange:o=>t("ssao",{...r,intensity:o})}),(0,xe.jsx)(q,{label:"Radius",value:r.radius,min:.01,max:1,step:.01,onChange:o=>t("ssao",{...r,radius:o})}),(0,xe.jsx)(q,{label:"Bias",value:r.bias,min:0,max:.1,step:.001,onChange:o=>t("ssao",{...r,bias:o})}),(0,xe.jsx)(q,{label:"Luminance Influence",value:r.luminanceInfluence,min:0,max:1,step:.01,onChange:o=>t("ssao",{...r,luminanceInfluence:o})}),(0,xe.jsx)(q,{label:"Fade",value:r.fade,min:0,max:.1,step:.001,onChange:o=>t("ssao",{...r,fade:o})}),(0,xe.jsx)(q,{label:"Min Radius Scale",value:r.minRadiusScale,min:0,max:1,step:.01,onChange:o=>t("ssao",{...r,minRadiusScale:o})}),(0,xe.jsx)(q,{label:"World Distance Threshold",value:r.worldDistanceThreshold,min:0,max:100,step:.1,onChange:o=>t("ssao",{...r,worldDistanceThreshold:o})}),(0,xe.jsx)(q,{label:"World Distance Falloff",value:r.worldDistanceFalloff,min:0,max:20,step:.1,onChange:o=>t("ssao",{...r,worldDistanceFalloff:o})}),(0,xe.jsx)(q,{label:"World Proximity Threshold",value:r.worldProximityThreshold,min:0,max:100,step:.1,onChange:o=>t("ssao",{...r,worldProximityThreshold:o})}),(0,xe.jsx)(q,{label:"World Proximity Falloff",value:r.worldProximityFalloff,min:0,max:20,step:.1,onChange:o=>t("ssao",{...r,worldProximityFalloff:o})})]})}function T_({pp:e,set:t,open:n,toggle:i}){let{autofocus:r}=e;return(0,xe.jsxs)(yt,{title:"Auto focus",tooltip:"Keeps the focus plane tracking a subject so the image stays sharp where you want it.",open:n.autofocus,onToggle:()=>i("autofocus"),disabled:!r.enabled,trailing:(0,xe.jsx)(At,{checked:r.enabled,onChange:o=>t("autofocus",{...r,enabled:o}),label:"Toggle Autofocus"}),children:[(0,xe.jsx)(q,{label:"Focus Distance",value:r.focusDistance,min:0,max:50,step:.1,onChange:o=>t("autofocus",{...r,focusDistance:o})}),(0,xe.jsx)(q,{label:"Focus Range",value:r.focusRange,min:.1,max:50,step:.1,onChange:o=>t("autofocus",{...r,focusRange:o})}),(0,xe.jsx)(q,{label:"Focal Length",value:r.focalLength,min:0,max:1,step:.01,onChange:o=>t("autofocus",{...r,focalLength:o})}),(0,xe.jsx)(q,{label:"Bokeh Scale",value:r.bokehScale,min:0,max:20,step:.1,onChange:o=>t("autofocus",{...r,bokehScale:o})}),(0,xe.jsx)(sa,{label:"Target",value:r.target,min:-100,max:100,step:.1,onChange:o=>t("autofocus",{...r,target:o})}),(0,xe.jsx)(Tt,{label:"Mouse Follow",checked:r.mouse,onChange:o=>t("autofocus",{...r,mouse:o})}),(0,xe.jsx)(Tt,{label:"Manual Update",checked:r.manual,onChange:o=>t("autofocus",{...r,manual:o})}),(0,xe.jsx)(q,{label:"Debug",value:r.debug,min:0,max:1,step:.01,onChange:o=>t("autofocus",{...r,debug:o})}),(0,xe.jsx)(q,{label:"Smooth Time",value:r.smoothTime,min:0,max:2,step:.01,onChange:o=>t("autofocus",{...r,smoothTime:o})})]})}function P_({pp:e,set:t,open:n,toggle:i}){let{godRays:r}=e;return(0,xe.jsxs)(yt,{title:"God Rays",tooltip:"Creates light shafts that streak outward from a bright sun or light source.",open:n.godRays,onToggle:()=>i("godRays"),disabled:!r.enabled,trailing:(0,xe.jsx)(At,{checked:r.enabled,onChange:o=>t("godRays",{...r,enabled:o}),label:"Toggle GodRays"}),children:[(0,xe.jsx)(sa,{label:"Sun Position",value:r.sunPosition,min:-100,max:100,step:.1,onChange:o=>t("godRays",{...r,sunPosition:o})}),(0,xe.jsx)(q,{label:"Samples",value:r.samples,min:1,max:128,step:1,onChange:o=>t("godRays",{...r,samples:o})}),(0,xe.jsx)(q,{label:"Density",value:r.density,min:0,max:2,step:.01,onChange:o=>t("godRays",{...r,density:o})}),(0,xe.jsx)(q,{label:"Decay",value:r.decay,min:0,max:1,step:.01,onChange:o=>t("godRays",{...r,decay:o})}),(0,xe.jsx)(q,{label:"Weight",value:r.weight,min:0,max:2,step:.01,onChange:o=>t("godRays",{...r,weight:o})}),(0,xe.jsx)(q,{label:"Exposure",value:r.exposure,min:0,max:2,step:.01,onChange:o=>t("godRays",{...r,exposure:o})}),(0,xe.jsx)(q,{label:"Clamp Max",value:r.clampMax,min:0,max:2,step:.01,onChange:o=>t("godRays",{...r,clampMax:o})}),(0,xe.jsx)(Tt,{label:"Blur",checked:r.blur,onChange:o=>t("godRays",{...r,blur:o})}),(0,xe.jsx)(jr,{label:"Kernel Size",value:r.kernelSize,options:Mc,onChange:o=>t("godRays",{...r,kernelSize:o})})]})}function A_({pp:e,set:t,open:n,toggle:i}){let{lensflare:r}=e;return(0,xe.jsxs)(yt,{title:"Lens Flare",tooltip:"Adds camera flare artifacts and glow from a bright light source.",open:n.lensflare,onToggle:()=>i("lensflare"),disabled:!r.enabled,trailing:(0,xe.jsx)(At,{checked:r.enabled,onChange:o=>t("lensflare",{...r,enabled:o}),label:"Toggle Lensflare"}),children:[(0,xe.jsx)(sa,{label:"Lens Position",value:r.lensPosition,min:-100,max:100,step:.1,onChange:o=>t("lensflare",{...r,lensPosition:o})}),(0,xe.jsx)(q,{label:"Smooth Time",value:r.smoothTime,min:0,max:1,step:.01,onChange:o=>t("lensflare",{...r,smoothTime:o})}),(0,xe.jsx)(q,{label:"Glare Size",value:r.glareSize,min:0,max:1,step:.01,onChange:o=>t("lensflare",{...r,glareSize:o})}),(0,xe.jsx)(q,{label:"Flare Size",value:r.flareSize,min:0,max:.1,step:.001,onChange:o=>t("lensflare",{...r,flareSize:o})}),(0,xe.jsx)(q,{label:"Flare Speed",value:r.flareSpeed,min:0,max:.2,step:.001,onChange:o=>t("lensflare",{...r,flareSpeed:o})}),(0,xe.jsx)(q,{label:"Flare Shape",value:r.flareShape,min:0,max:.2,step:.001,onChange:o=>t("lensflare",{...r,flareShape:o})}),(0,xe.jsx)(Tt,{label:"Animated",checked:r.animated,onChange:o=>t("lensflare",{...r,animated:o})}),(0,xe.jsx)(Tt,{label:"Anamorphic",checked:r.anamorphic,onChange:o=>t("lensflare",{...r,anamorphic:o})}),(0,xe.jsx)(kr,{label:"Color Gain",value:r.colorGain,onChange:o=>t("lensflare",{...r,colorGain:o})}),(0,xe.jsx)(q,{label:"Halo Scale",value:r.haloScale,min:0,max:2,step:.01,onChange:o=>t("lensflare",{...r,haloScale:o})}),(0,xe.jsx)(Tt,{label:"Secondary Ghosts",checked:r.secondaryGhosts,onChange:o=>t("lensflare",{...r,secondaryGhosts:o})}),(0,xe.jsx)(Tt,{label:"Additional Streaks",checked:r.aditionalStreaks,onChange:o=>t("lensflare",{...r,aditionalStreaks:o})}),(0,xe.jsx)(q,{label:"Ghost Scale",value:r.ghostScale,min:0,max:1,step:.01,onChange:o=>t("lensflare",{...r,ghostScale:o})}),(0,xe.jsx)(q,{label:"Opacity",value:r.opacity,min:0,max:1,step:.01,onChange:o=>t("lensflare",{...r,opacity:o})}),(0,xe.jsx)(Tt,{label:"Star Burst",checked:r.starBurst,onChange:o=>t("lensflare",{...r,starBurst:o})})]})}function E_({pp:e,set:t,open:n,toggle:i}){let{depthOfField:r}=e;return(0,xe.jsxs)(yt,{title:"Depth Of Field",tooltip:"Blurs areas that sit away from the focal plane for a camera-like look.",open:n.depthOfField,onToggle:()=>i("depthOfField"),disabled:!r.enabled,trailing:(0,xe.jsx)(At,{checked:r.enabled,onChange:o=>t("depthOfField",{...r,enabled:o}),label:"Toggle DepthOfField"}),children:[(0,xe.jsx)(q,{label:"Focus Distance",value:r.focusDistance,min:0,max:50,step:.1,onChange:o=>t("depthOfField",{...r,focusDistance:o})}),(0,xe.jsx)(q,{label:"Focus Range",value:r.focusRange,min:.1,max:50,step:.1,onChange:o=>t("depthOfField",{...r,focusRange:o})}),(0,xe.jsx)(q,{label:"Focal Length",value:r.focalLength,min:0,max:1,step:.01,onChange:o=>t("depthOfField",{...r,focalLength:o})}),(0,xe.jsx)(q,{label:"Bokeh Scale",value:r.bokehScale,min:0,max:20,step:.1,onChange:o=>t("depthOfField",{...r,bokehScale:o})})]})}var qe=require("react/jsx-runtime"),_R=["linear","reinhard","aces"];function R_({pp:e,set:t,open:n,toggle:i}){let{colorAverage:r}=e;return(0,qe.jsx)(yt,{title:"Color Average",tooltip:"Blends the frame toward a single average color for a washed-out stylized look.",open:n.colorAverage,onToggle:()=>i("colorAverage"),disabled:!r.enabled,trailing:(0,qe.jsx)(At,{checked:r.enabled,onChange:o=>t("colorAverage",{...r,enabled:o}),label:"Toggle ColorAverage"}),children:(0,qe.jsx)("div",{className:"se-placeholder",children:"Averages the frame color using the docs default blend mode."})})}function k_({pp:e,set:t,open:n,toggle:i}){let{brightnessContrast:r}=e;return(0,qe.jsxs)(yt,{title:"Brightness Contrast",tooltip:"Raises or lowers overall brightness and contrast across the scene.",open:n.brightnessContrast,onToggle:()=>i("brightnessContrast"),disabled:!r.enabled,trailing:(0,qe.jsx)(At,{checked:r.enabled,onChange:o=>t("brightnessContrast",{...r,enabled:o}),label:"Toggle BrightnessContrast"}),children:[(0,qe.jsx)(q,{label:"Brightness",value:r.brightness,min:-1,max:1,step:.01,onChange:o=>t("brightnessContrast",{...r,brightness:o})}),(0,qe.jsx)(q,{label:"Contrast",value:r.contrast,min:-1,max:1,step:.01,onChange:o=>t("brightnessContrast",{...r,contrast:o})})]})}function L_({pp:e,set:t,open:n,toggle:i}){let{hueSaturation:r}=e;return(0,qe.jsxs)(yt,{title:"Hue Saturation",tooltip:"Shifts the hue and saturation to tint the whole image.",open:n.hueSaturation,onToggle:()=>i("hueSaturation"),disabled:!r.enabled,trailing:(0,qe.jsx)(At,{checked:r.enabled,onChange:o=>t("hueSaturation",{...r,enabled:o}),label:"Toggle HueSaturation"}),children:[(0,qe.jsx)(q,{label:"Hue",value:r.hue,min:-Math.PI,max:Math.PI,step:.01,formatValue:o=>`${o.toFixed(2)} rad`,onChange:o=>t("hueSaturation",{...r,hue:o})}),(0,qe.jsx)(q,{label:"Saturation",value:r.saturation,min:-1,max:1,step:.01,onChange:o=>t("hueSaturation",{...r,saturation:o})})]})}function D_({pp:e,set:t,open:n,toggle:i}){let{vignette:r}=e;return(0,qe.jsxs)(yt,{title:"Vignette",tooltip:"Darkens the edges of the screen so the center feels more focused.",open:n.vignette,onToggle:()=>i("vignette"),disabled:!r.enabled,trailing:(0,qe.jsx)(At,{checked:r.enabled,onChange:o=>t("vignette",{...r,enabled:o}),label:"Toggle Vignette"}),children:[(0,qe.jsx)(q,{label:"Offset",value:r.offset,min:0,max:1,step:.01,onChange:o=>t("vignette",{...r,offset:o})}),(0,qe.jsx)(q,{label:"Darkness",value:r.darkness,min:0,max:1,step:.01,onChange:o=>t("vignette",{...r,darkness:o})}),(0,qe.jsx)(Tt,{label:"Eskil",checked:r.eskil,onChange:o=>t("vignette",{...r,eskil:o})})]})}function N_({pp:e,set:t,open:n,toggle:i}){let{bloom:r}=e;return(0,qe.jsxs)(yt,{title:"Bloom",tooltip:"Makes bright areas glow and bleed softly into nearby pixels.",open:n.bloom,onToggle:()=>i("bloom"),disabled:!r.enabled,trailing:(0,qe.jsx)(At,{checked:r.enabled,onChange:o=>t("bloom",{...r,enabled:o}),label:"Toggle Bloom"}),children:[(0,qe.jsx)(q,{label:"Threshold",value:r.luminanceThreshold,min:0,max:1,step:.01,onChange:o=>t("bloom",{...r,luminanceThreshold:o})}),(0,qe.jsx)(q,{label:"Smoothing",value:r.luminanceSmoothing,min:0,max:1,step:.01,onChange:o=>t("bloom",{...r,luminanceSmoothing:o})}),(0,qe.jsx)(q,{label:"Intensity",value:r.intensity,min:0,max:3,step:.05,onChange:o=>t("bloom",{...r,intensity:o})}),(0,qe.jsx)(Tt,{label:"Mipmap Blur",checked:r.mipmapBlur,onChange:o=>t("bloom",{...r,mipmapBlur:o})}),(0,qe.jsx)(q,{label:"Radius",value:r.radius,min:0,max:1,step:.01,onChange:o=>t("bloom",{...r,radius:o})}),(0,qe.jsx)(q,{label:"Levels",value:r.levels,min:1,max:16,step:1,onChange:o=>t("bloom",{...r,levels:o})})]})}function O_({pp:e,set:t,open:n,toggle:i}){let{toneMapping:r}=e;return(0,qe.jsxs)(yt,{title:"Tone Mapping",tooltip:"Remaps HDR lighting to screen output and controls exposure style.",open:n.toneMapping,onToggle:()=>i("toneMapping"),disabled:!r.enabled,trailing:(0,qe.jsx)(At,{checked:r.enabled,onChange:o=>t("toneMapping",{...r,enabled:o}),label:"Toggle ToneMapping"}),children:[(0,qe.jsxs)("div",{className:"se-field",children:[(0,qe.jsx)("span",{className:"se-fieldLabel",children:"Mode"}),(0,qe.jsx)("div",{className:"se-segmentedControl",children:_R.map(o=>(0,qe.jsx)("button",{type:"button",className:`se-segmentedOption ${r.mode===o?"se-segmentedOption--active":""}`,onClick:()=>t("toneMapping",{...r,mode:o}),children:o==="aces"?"Filmic":o.charAt(0).toUpperCase()+o.slice(1)},o))})]}),(0,qe.jsx)(q,{label:"Resolution",value:r.resolution,min:64,max:4096,step:64,onChange:o=>t("toneMapping",{...r,resolution:o})}),(0,qe.jsx)(q,{label:"White Point",value:r.whitePoint,min:0,max:16,step:.01,onChange:o=>t("toneMapping",{...r,whitePoint:o})}),(0,qe.jsx)(q,{label:"Middle Grey",value:r.middleGrey,min:0,max:1,step:.01,onChange:o=>t("toneMapping",{...r,middleGrey:o})}),(0,qe.jsx)(q,{label:"Min Luminance",value:r.minLuminance,min:0,max:1,step:.01,onChange:o=>t("toneMapping",{...r,minLuminance:o})}),(0,qe.jsx)(q,{label:"Average Luminance",value:r.averageLuminance,min:0,max:4,step:.01,onChange:o=>t("toneMapping",{...r,averageLuminance:o})}),(0,qe.jsx)(q,{label:"Adaptation Rate",value:r.adaptationRate,min:0,max:10,step:.01,onChange:o=>t("toneMapping",{...r,adaptationRate:o})}),(0,qe.jsx)(q,{label:"Exposure",value:r.exposure,min:0,max:3,step:.01,onChange:o=>t("toneMapping",{...r,exposure:o})})]})}function B_({pp:e,set:t,open:n,toggle:i}){let{sepia:r}=e;return(0,qe.jsx)(yt,{title:"Sepia",tooltip:"Adds a warm vintage brown tint to the entire image.",open:n.sepia,onToggle:()=>i("sepia"),disabled:!r.enabled,trailing:(0,qe.jsx)(At,{checked:r.enabled,onChange:o=>t("sepia",{...r,enabled:o}),label:"Toggle Sepia"}),children:(0,qe.jsx)(q,{label:"Intensity",value:r.intensity,min:0,max:1,step:.01,onChange:o=>t("sepia",{...r,intensity:o})})})}var Ve=require("react/jsx-runtime");function I_({pp:e,set:t,open:n,toggle:i}){let{dotScreen:r}=e;return(0,Ve.jsxs)(yt,{title:"Dot Screen",tooltip:"Overlays a halftone dot pattern for a printed or retro look.",open:n.dotScreen,onToggle:()=>i("dotScreen"),disabled:!r.enabled,trailing:(0,Ve.jsx)(At,{checked:r.enabled,onChange:o=>t("dotScreen",{...r,enabled:o}),label:"Toggle DotScreen"}),children:[(0,Ve.jsx)(q,{label:"Angle",value:r.angle,min:0,max:Math.PI*2,step:.01,formatValue:o=>`${o.toFixed(2)} rad`,onChange:o=>t("dotScreen",{...r,angle:o})}),(0,Ve.jsx)(q,{label:"Scale",value:r.scale,min:.1,max:10,step:.05,onChange:o=>t("dotScreen",{...r,scale:o})})]})}function z_({pp:e,set:t,open:n,toggle:i}){let{glitch:r}=e;return(0,Ve.jsxs)(yt,{title:"Glitch",tooltip:"Introduces digital distortion, tearing, and scan noise.",open:n.glitch,onToggle:()=>i("glitch"),disabled:!r.enabled,trailing:(0,Ve.jsx)(At,{checked:r.enabled,onChange:o=>t("glitch",{...r,enabled:o}),label:"Toggle Glitch"}),children:[(0,Ve.jsx)(jr,{label:"Mode",value:r.mode,options:Dy,onChange:o=>t("glitch",{...r,mode:o})}),(0,Ve.jsx)(cs,{label:"Delay",value:r.delay,min:0,max:10,step:.01,onChange:o=>t("glitch",{...r,delay:o})}),(0,Ve.jsx)(cs,{label:"Duration",value:r.duration,min:0,max:5,step:.01,onChange:o=>t("glitch",{...r,duration:o})}),(0,Ve.jsx)(cs,{label:"Strength",value:r.strength,min:0,max:2,step:.01,onChange:o=>t("glitch",{...r,strength:o})}),(0,Ve.jsx)(cs,{label:"Chromatic Aberration Offset",value:r.chromaticAberrationOffset,min:0,max:.02,step:1e-4,onChange:o=>t("glitch",{...r,chromaticAberrationOffset:o})}),(0,Ve.jsx)(q,{label:"Columns",value:r.columns,min:0,max:.5,step:.001,onChange:o=>t("glitch",{...r,columns:o})}),(0,Ve.jsx)(q,{label:"Ratio",value:r.ratio,min:0,max:1,step:.01,onChange:o=>t("glitch",{...r,ratio:o})})]})}function U_({pp:e,set:t,open:n,toggle:i}){let{grid:r}=e;return(0,Ve.jsxs)(yt,{title:"Grid",tooltip:"Adds a visual grid overlay that feels retro or debug-like.",open:n.grid,onToggle:()=>i("grid"),disabled:!r.enabled,trailing:(0,Ve.jsx)(At,{checked:r.enabled,onChange:o=>t("grid",{...r,enabled:o}),label:"Toggle Grid"}),children:[(0,Ve.jsx)(q,{label:"Scale",value:r.scale,min:.1,max:10,step:.05,onChange:o=>t("grid",{...r,scale:o})}),(0,Ve.jsx)(q,{label:"Line Width",value:r.lineWidth,min:0,max:1,step:.01,onChange:o=>t("grid",{...r,lineWidth:o})})]})}function V_({pp:e,set:t,open:n,toggle:i}){let{chromaticAberration:r}=e;return(0,Ve.jsxs)(yt,{title:"Chromatic Aberration",tooltip:"Separates color channels slightly to mimic lens fringing.",open:n.chromaticAberration,onToggle:()=>i("chromaticAberration"),disabled:!r.enabled,trailing:(0,Ve.jsx)(At,{checked:r.enabled,onChange:o=>t("chromaticAberration",{...r,enabled:o}),label:"Toggle ChromaticAberration"}),children:[(0,Ve.jsx)(q,{label:"Offset X",value:r.offsetX,min:0,max:.02,step:1e-4,onChange:o=>t("chromaticAberration",{...r,offsetX:o})}),(0,Ve.jsx)(q,{label:"Offset Y",value:r.offsetY,min:0,max:.02,step:1e-4,onChange:o=>t("chromaticAberration",{...r,offsetY:o})}),(0,Ve.jsx)(Tt,{label:"Radial Modulation",checked:r.radialModulation,onChange:o=>t("chromaticAberration",{...r,radialModulation:o})}),(0,Ve.jsx)(q,{label:"Modulation Offset",value:r.modulationOffset,min:0,max:1,step:.01,onChange:o=>t("chromaticAberration",{...r,modulationOffset:o})})]})}function F_({pp:e,set:t,open:n,toggle:i}){let{noise:r}=e;return(0,Ve.jsxs)(yt,{title:"Noise",tooltip:"Adds film grain or static noise to the rendered image.",open:n.noise,onToggle:()=>i("noise"),disabled:!r.enabled,trailing:(0,Ve.jsx)(At,{checked:r.enabled,onChange:o=>t("noise",{...r,enabled:o}),label:"Toggle Noise"}),children:[(0,Ve.jsx)(q,{label:"Amount",value:r.opacity,min:0,max:1,step:.01,onChange:o=>t("noise",{...r,opacity:o})}),(0,Ve.jsx)(Tt,{label:"Premultiply",checked:r.premultiply,onChange:o=>t("noise",{...r,premultiply:o})})]})}function j_({pp:e,set:t,open:n,toggle:i}){let{scanline:r}=e;return(0,Ve.jsx)(yt,{title:"Scan Line",tooltip:"Draws horizontal CRT-style scan lines over the frame.",open:n.scanline,onToggle:()=>i("scanline"),disabled:!r.enabled,trailing:(0,Ve.jsx)(At,{checked:r.enabled,onChange:o=>t("scanline",{...r,enabled:o}),label:"Toggle Scanline"}),children:(0,Ve.jsx)(q,{label:"Density",value:r.density,min:0,max:10,step:.25,onChange:o=>t("scanline",{...r,density:o})})})}function G_({pp:e,set:t,open:n,toggle:i}){let{pixelation:r}=e;return(0,Ve.jsx)(yt,{title:"Pixelation",tooltip:"Reduces detail into larger pixels for a blocky stylized effect.",open:n.pixelation,onToggle:()=>i("pixelation"),disabled:!r.enabled,trailing:(0,Ve.jsx)(At,{checked:r.enabled,onChange:o=>t("pixelation",{...r,enabled:o}),label:"Toggle Pixelation"}),children:(0,Ve.jsx)(q,{label:"Granularity",value:r.granularity,min:0,max:20,step:1,onChange:o=>t("pixelation",{...r,granularity:o})})})}function H_({pp:e,set:t,open:n,toggle:i}){let{ramp:r}=e;return(0,Ve.jsxs)(yt,{title:"Ramp",tooltip:"Adds a screen-space color gradient, or masks effects earlier in the stack.",open:n.ramp,onToggle:()=>i("ramp"),disabled:!r.enabled,trailing:(0,Ve.jsx)(At,{checked:r.enabled,onChange:o=>t("ramp",{...r,enabled:o}),label:"Toggle Ramp"}),children:[(0,Ve.jsx)(jr,{label:"Ramp Type",value:r.rampType,options:Ny,onChange:o=>t("ramp",{...r,rampType:o})}),(0,Ve.jsx)(cs,{label:"Ramp Start",value:r.rampStart,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,rampStart:o})}),(0,Ve.jsx)(cs,{label:"Ramp End",value:r.rampEnd,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,rampEnd:o})}),(0,Ve.jsx)(kr,{label:"Start Color",value:r.startColor,onChange:o=>t("ramp",{...r,startColor:o})}),(0,Ve.jsx)(kr,{label:"End Color",value:r.endColor,onChange:o=>t("ramp",{...r,endColor:o})}),!r.rampMask&&(0,Ve.jsx)(q,{label:"Gradient Opacity",value:r.opacity??.5,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,opacity:o})}),(0,Ve.jsx)(q,{label:"Bias",value:r.rampBias,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,rampBias:o})}),(0,Ve.jsx)(q,{label:"Gain",value:r.rampGain,min:0,max:1,step:.01,onChange:o=>t("ramp",{...r,rampGain:o})}),(0,Ve.jsx)(Tt,{label:"Mask Earlier Effects",checked:r.rampMask,onChange:o=>t("ramp",{...r,rampMask:o})}),(0,Ve.jsx)(Tt,{label:"Invert",checked:r.rampInvert,onChange:o=>t("ramp",{...r,rampInvert:o})})]})}var Kt=require("react/jsx-runtime");function W_({pp:e,set:t,open:n,toggle:i}){let{outline:r}=e;return(0,Kt.jsxs)(yt,{title:"Outline",tooltip:"Draws a visible edge around the selected object binding.",open:n.outline,onToggle:()=>i("outline"),disabled:!r.enabled,trailing:(0,Kt.jsx)(At,{checked:r.enabled,onChange:o=>t("outline",{...r,enabled:o}),label:"Toggle Outline"}),children:[(0,Kt.jsx)("div",{className:"se-placeholder",children:"Outlines the currently selected object binding in the model editor."}),(0,Kt.jsx)(q,{label:"Selection Layer",value:r.selectionLayer,min:0,max:20,step:1,onChange:o=>t("outline",{...r,selectionLayer:o})}),(0,Kt.jsx)(q,{label:"Edge Strength",value:r.edgeStrength,min:0,max:10,step:.1,onChange:o=>t("outline",{...r,edgeStrength:o})}),(0,Kt.jsx)(q,{label:"Pulse Speed",value:r.pulseSpeed,min:0,max:10,step:.1,onChange:o=>t("outline",{...r,pulseSpeed:o})}),(0,Kt.jsx)(kr,{label:"Visible Edge Color",value:r.visibleEdgeColor,onChange:o=>t("outline",{...r,visibleEdgeColor:o})}),(0,Kt.jsx)(kr,{label:"Hidden Edge Color",value:r.hiddenEdgeColor,onChange:o=>t("outline",{...r,hiddenEdgeColor:o})}),(0,Kt.jsx)(jr,{label:"Kernel Size",value:r.kernelSize,options:Mc,onChange:o=>t("outline",{...r,kernelSize:o})}),(0,Kt.jsx)(Tt,{label:"Blur",checked:r.blur,onChange:o=>t("outline",{...r,blur:o})}),(0,Kt.jsx)(Tt,{label:"X-Ray",checked:r.xRay,onChange:o=>t("outline",{...r,xRay:o})})]})}function X_({pp:e,set:t,open:n,toggle:i}){let{selectiveBloom:r}=e;return(0,Kt.jsxs)(yt,{title:"Selective Bloom",tooltip:"Applies bloom only to objects assigned to the selected layer.",open:n.selectiveBloom,onToggle:()=>i("selectiveBloom"),disabled:!r.enabled,trailing:(0,Kt.jsx)(At,{checked:r.enabled,onChange:o=>t("selectiveBloom",{...r,enabled:o}),label:"Toggle SelectiveBloom"}),children:[(0,Kt.jsx)("div",{className:"se-placeholder",children:"Applies bloom to the currently selected object binding."}),(0,Kt.jsx)(q,{label:"Selection Layer",value:r.selectionLayer,min:0,max:20,step:1,onChange:o=>t("selectiveBloom",{...r,selectionLayer:o})}),(0,Kt.jsx)(q,{label:"Intensity",value:r.intensity,min:0,max:5,step:.05,onChange:o=>t("selectiveBloom",{...r,intensity:o})}),(0,Kt.jsx)(q,{label:"Threshold",value:r.luminanceThreshold,min:0,max:1,step:.01,onChange:o=>t("selectiveBloom",{...r,luminanceThreshold:o})}),(0,Kt.jsx)(q,{label:"Smoothing",value:r.luminanceSmoothing,min:0,max:1,step:.01,onChange:o=>t("selectiveBloom",{...r,luminanceSmoothing:o})}),(0,Kt.jsx)(jr,{label:"Kernel Size",value:r.kernelSize,options:Mc,onChange:o=>t("selectiveBloom",{...r,kernelSize:o})}),(0,Kt.jsx)(Tt,{label:"Mipmap Blur",checked:r.mipmapBlur,onChange:o=>t("selectiveBloom",{...r,mipmapBlur:o})}),(0,Kt.jsx)(Tt,{label:"Inverted",checked:r.inverted,onChange:o=>t("selectiveBloom",{...r,inverted:o})}),(0,Kt.jsx)(Tt,{label:"Ignore Background",checked:r.ignoreBackground,onChange:o=>t("selectiveBloom",{...r,ignoreBackground:o})})]})}function q_({pp:e,set:t,open:n,toggle:i}){let{smaa:r}=e;return(0,Kt.jsx)(yt,{title:"SMAA",tooltip:"Reduces jagged edges with subpixel anti-aliasing.",open:n.smaa,onToggle:()=>i("smaa"),trailing:(0,Kt.jsx)(At,{checked:r.enabled,onChange:o=>t("smaa",{...r,enabled:o}),label:"Toggle SMAA"}),children:(0,Kt.jsx)("div",{className:"se-placeholder",children:"Subpixel Morphological Anti-Aliasing smooths jagged edges in post-process."})})}var Jt=require("react/jsx-runtime");function kg({config:e,onChange:t}){let[n,i]=(0,$_.useState)({autofocus:!1,colorAverage:!1,dotScreen:!1,glitch:!1,godRays:!1,grid:!1,lensflare:!1,outline:!1,selectiveBloom:!1,ramp:!1,ssao:!1,brightnessContrast:!1,hueSaturation:!1,depthOfField:!1,chromaticAberration:!1,vignette:!1,bloom:!1,toneMapping:!1,noise:!1,sepia:!1,scanline:!1,pixelation:!1,smaa:!1}),r=l=>i(c=>({...c,[l]:!c[l]})),o=e.postProcessing,s={pp:o,set:(l,c)=>t({...e,postProcessing:{...o,[l]:c}}),open:n,toggle:r};return(0,Jt.jsxs)("div",{className:"se-generalContent",children:[(0,Jt.jsx)(C_,{...s}),(0,Jt.jsx)(T_,{...s}),(0,Jt.jsx)(R_,{...s}),(0,Jt.jsx)(I_,{...s}),(0,Jt.jsx)(z_,{...s}),(0,Jt.jsx)(P_,{...s}),(0,Jt.jsx)(U_,{...s}),(0,Jt.jsx)(A_,{...s}),(0,Jt.jsx)(W_,{...s}),(0,Jt.jsx)(X_,{...s}),(0,Jt.jsx)(k_,{...s}),(0,Jt.jsx)(L_,{...s}),(0,Jt.jsx)(E_,{...s}),(0,Jt.jsx)(V_,{...s}),(0,Jt.jsx)(D_,{...s}),(0,Jt.jsx)(N_,{...s}),(0,Jt.jsx)(O_,{...s}),(0,Jt.jsx)(F_,{...s}),(0,Jt.jsx)(B_,{...s}),(0,Jt.jsx)(j_,{...s}),(0,Jt.jsx)(G_,{...s}),(0,Jt.jsx)(H_,{...s}),(0,Jt.jsx)(q_,{...s})]})}var xd=require("react"),ca=require("lucide-react");var ye=require("react/jsx-runtime"),MR=["512","1024","2048","4096"],Y_={none:"None",directional:"Direction",point:"Point",spot:"Spot",hemisphere:"Hemi"};function CR({index:e,light:t,selected:n,onSelect:i,onToggleVisible:r}){return(0,ye.jsxs)("div",{className:`se-lightRow ${n?"se-lightRow--active":""}`,onClick:i,children:[(0,ye.jsxs)("span",{className:"se-lightRowLabel",children:[e+1,": ",Y_[t.type]]}),(0,ye.jsx)("button",{type:"button",className:"se-iconButton","aria-label":t.visible?"Hide light":"Show light",onClick:o=>{o.stopPropagation(),r()},children:t.visible?(0,ye.jsx)(ca.Eye,{size:14}):(0,ye.jsx)(ca.EyeOff,{size:14})})]})}function TR(){return{id:crypto.randomUUID(),type:"directional",color:"#ffffff",intensity:1,position:[5,10,5],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}}function Lg({config:e,onChange:t}){let[n,i]=(0,xd.useState)({lights:!0,shadows:!1,groundShadows:!1,environment:!1,envShadow:!1}),r=(0,xd.useSyncExternalStore)(_g,Yp),[o,a]=(0,xd.useState)(e.lighting.lights[0]?.id??null),s=r??o,l=d=>{a(d),cd(d)},c=d=>i(S=>({...S,[d]:!S[d]})),{tier:h}=Rr(),p=Ai(h,"starter"),{lighting:u,shadows:m,groundShadows:f,environment:g}=e,b=d=>t({...e,lighting:d}),x=d=>t({...e,shadows:d}),v=d=>t({...e,groundShadows:d}),w=d=>t({...e,environment:d}),M=(d,S)=>{b({...u,lights:u.lights.map(C=>C.id===d?{...C,...S}:C)})},_=u.lights.find(d=>d.id===s)??null,y=()=>{let d=TR();b({...u,lights:[...u.lights,d]}),l(d.id)},P=()=>{if(!_)return;let d=u.lights.filter(S=>S.id!==_.id);b({...u,lights:d}),l(d[0]?.id??null)};return(0,ye.jsxs)("div",{className:"se-generalContent",children:[(0,ye.jsxs)(yt,{title:"Lights",open:n.lights,onToggle:()=>c("lights"),children:[(0,ye.jsx)("div",{className:"se-lightList",children:u.lights.map((d,S)=>(0,ye.jsx)(CR,{index:S,light:d,selected:d.id===s,onSelect:()=>l(d.id),onToggleVisible:()=>M(d.id,{visible:!d.visible})},d.id))}),(0,ye.jsxs)("div",{className:"se-lightActions",children:[(0,ye.jsx)("button",{type:"button",className:"se-iconButton",onClick:y,title:"Add light",children:(0,ye.jsx)(ca.Plus,{size:14})}),_&&u.lights.length>1&&(0,ye.jsx)("button",{type:"button",className:"se-iconButton",onClick:P,title:"Remove selected light",children:(0,ye.jsx)(ca.Trash2,{size:14})})]}),_?(0,ye.jsxs)("div",{className:"se-lightProps",children:[(0,ye.jsxs)("div",{className:"se-field",children:[(0,ye.jsx)("span",{className:"se-fieldLabel",children:"Type"}),(0,ye.jsx)("div",{className:"se-segmentedControl",style:{gridAutoColumns:"1fr"},children:Ry.map(d=>(0,ye.jsx)("button",{type:"button",className:`se-segmentedOption ${_.type===d?"se-segmentedOption--active":""}`,onClick:()=>M(_.id,{type:d}),children:Y_[d]},d))})]}),(0,ye.jsx)(kr,{label:"Color",value:_.color,onChange:d=>M(_.id,{color:d})}),(0,ye.jsx)(q,{label:"Intensity",value:_.intensity,min:0,max:10,step:.1,onChange:d=>M(_.id,{intensity:d})}),_.type!=="hemisphere"&&_.type!=="none"&&(0,ye.jsx)(sa,{label:"Position",value:_.position,min:-100,max:100,step:.05,onChange:d=>M(_.id,{position:d})}),_.type==="spot"&&(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)(q,{label:"Angle",value:_.angle??Math.PI/6,min:0,max:Math.PI/2,step:.01,formatValue:d=>`${Math.round(d*180/Math.PI)}\xB0`,onChange:d=>M(_.id,{angle:d})}),(0,ye.jsx)(q,{label:"Penumbra",value:_.penumbra??.2,min:0,max:1,step:.01,onChange:d=>M(_.id,{penumbra:d})}),(0,ye.jsx)(q,{label:"Distance",value:_.distance??0,min:0,max:100,step:.5,onChange:d=>M(_.id,{distance:d})}),(0,ye.jsx)(q,{label:"Decay",value:_.decay??2,min:0,max:4,step:.1,onChange:d=>M(_.id,{decay:d})})]}),(0,ye.jsx)(Tt,{label:"Attached to camera",checked:_.attachedToCamera,onChange:d=>M(_.id,{attachedToCamera:d})}),(0,ye.jsx)(Tt,{label:"Cast shadows",checked:_.castShadow,onChange:d=>M(_.id,{castShadow:d})}),(0,ye.jsx)(q,{label:"Shadow bias",value:_.shadowBias,min:-.01,max:.01,step:1e-4,onChange:d=>M(_.id,{shadowBias:d})})]}):null]}),(0,ye.jsxs)(yt,{title:"Shadows",open:n.shadows,onToggle:()=>c("shadows"),disabled:!m.enabled,trailing:(0,ye.jsx)(At,{checked:m.enabled,onChange:d=>x({...m,enabled:d}),label:"Toggle shadows"}),children:[(0,ye.jsx)(jr,{label:"Map size",value:String(m.mapSize),options:MR,onChange:d=>x({...m,mapSize:Number(d)})}),(0,ye.jsx)(q,{label:"Bias",value:m.bias,min:-.01,max:.01,step:1e-4,onChange:d=>x({...m,bias:d})}),(0,ye.jsx)(q,{label:"Normal bias",value:m.normalBias,min:0,max:.2,step:.01,onChange:d=>x({...m,normalBias:d})}),(0,ye.jsx)(q,{label:"Radius (softness)",value:m.radius,min:0,max:20,step:.5,onChange:d=>x({...m,radius:d})})]}),(0,ye.jsxs)(yt,{title:"Ground Shadows",open:n.groundShadows,onToggle:()=>c("groundShadows"),disabled:!f.enabled,trailing:(0,ye.jsx)(At,{checked:f.enabled,onChange:d=>v({...f,enabled:d}),label:"Toggle ground shadows"}),children:[(0,ye.jsxs)("div",{className:"se-field",children:[(0,ye.jsx)("span",{className:"se-fieldLabel",children:"Mode"}),(0,ye.jsx)("div",{className:"se-segmentedControl",style:{gridAutoColumns:"1fr"},children:["shadowCatcher"].map(d=>(0,ye.jsx)("button",{type:"button",className:`se-segmentedOption ${f.mode===d?"se-segmentedOption--active":""}`,onClick:()=>v({...f,mode:d}),children:d==="shadowCatcher"?"Shadow Catcher":"Baked AO"},d))})]}),f.mode==="bakedAO"&&(0,ye.jsx)("div",{className:"se-placeholder",children:"Requires pre-baked AO textures \u2014 not yet available."}),(0,ye.jsx)(q,{label:"Intensity",value:f.intensity,min:0,max:1,step:.01,onChange:d=>v({...f,intensity:d})}),(0,ye.jsx)(q,{label:"Border fade",value:f.borderFade,min:0,max:10,step:.1,onChange:d=>v({...f,borderFade:d})}),(0,ye.jsx)(q,{label:"Height",value:f.height,min:-5,max:5,step:.1,onChange:d=>v({...f,height:d})}),(0,ye.jsx)(q,{label:"Size",value:f.size,min:1,max:50,step:.5,onChange:d=>v({...f,size:d})})]}),(0,ye.jsx)(yt,{title:"Environment",open:n.environment,onToggle:()=>c("environment"),children:p?(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)(q,{label:"Orientation",value:g.rotation,min:0,max:360,step:1,formatValue:d=>`${d}\xB0`,onChange:d=>w({...g,rotation:d})}),(0,ye.jsx)(q,{label:"Brightness",value:g.intensity,min:0,max:3,step:.05,onChange:d=>w({...g,intensity:d})}),(0,ye.jsxs)(yt,{title:"Shadow",open:n.envShadow,onToggle:()=>c("envShadow"),trailing:(0,ye.jsx)(At,{checked:g.shadowLight.enabled,onChange:d=>w({...g,shadowLight:{...g.shadowLight,enabled:d}}),label:"Toggle environment shadow light"}),disabled:!g.shadowLight.enabled,children:[(0,ye.jsx)(q,{label:"Light intensity",value:g.shadowLight.intensity,min:0,max:20,step:.1,onChange:d=>w({...g,shadowLight:{...g.shadowLight,intensity:d}})}),(0,ye.jsx)(q,{label:"Shadow bias",value:g.shadowLight.bias,min:-.01,max:.01,step:1e-4,onChange:d=>w({...g,shadowLight:{...g.shadowLight,bias:d}})})]})]}):(0,ye.jsx)(ir,{requiredTier:"starter",feature:"Environment lighting"})})]})}var bm=require("react"),Gr=require("lucide-react");var ge=require("react/jsx-runtime"),PR={playing:"Playing",paused:"Paused",finished:"Finished"},K_={repeat:"Looping",once:"Play once","ping-pong":"Ping-pong"};function AR(e){if(!Number.isFinite(e)||e<=0)return"Unknown duration";let t=Math.round(e*10)/10;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),i=(t%60).toFixed(1).padStart(4,"0");return`${n}:${i}`}function Z_(e){let t=Number.isFinite(e)&&e>0?e:0;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),i=(t%60).toFixed(1).padStart(4,"0");return`${n}:${i}`}function ER(e){return Number.isFinite(e)?Math.min(3,Math.max(.1,Number(e.toFixed(2)))):1}function Dg({config:e,onChange:t,clipDetails:n,active:i,play:r,pause:o,stop:a,setSpeed:s,seek:l}){let[c,h]=(0,bm.useState)(!1),p=(0,bm.useMemo)(()=>new Map(n.map(y=>[y.sourceName,y.duration])),[n]),u=e.animations.clips.filter(y=>!y.hidden),m=e.animations.clips.filter(y=>y.hidden),f=(y,P=e.animations.autoplayClip)=>{t({...e,animations:{clips:y(e.animations.clips),autoplayClip:P}})},g=(y,P)=>{f(d=>d.map(S=>S.sourceName===y?P(S):S))},b=(y,P)=>{g(y,d=>({...d,loopMode:P}))},x=(y,P)=>{let d=ER(P);g(y,S=>({...S,speed:d})),i.some(S=>S.clip===y)&&s(d,y)},v=(y,P)=>{g(y,d=>({...d,displayName:P}))},w=y=>{let P=e.animations.autoplayClip===y?null:y;t({...e,animations:{...e.animations,autoplayClip:P}})},M=y=>{f(P=>P.map(d=>d.sourceName===y?{...d,hidden:!0}:d),e.animations.autoplayClip===y?null:e.animations.autoplayClip),i.some(P=>P.clip===y)&&a(y)},_=y=>{f(P=>P.map(d=>d.sourceName===y?{...d,hidden:!1}:d))};return e.animations.clips.length===0?(0,ge.jsx)(wo,{title:"Animations",children:(0,ge.jsx)("div",{className:"se-helperCard",children:"Upload a model with embedded animations to manage playback, naming, autoplay, and per-clip speed here."})}):(0,ge.jsxs)(wo,{title:"Animations",children:[u.length===0&&(0,ge.jsx)("div",{className:"se-helperCard",children:(0,ge.jsx)("span",{children:"Preview clips directly in the viewer (several can play at once), choose one optional autoplay animation, and use soft delete to hide clips without modifying the GLB."})}),u.length===0?(0,ge.jsx)("div",{className:"se-placeholder",children:"All animations are currently removed. Restore a clip below to make it available again."}):(0,ge.jsx)("div",{className:"se-animationList",children:u.map(y=>{let P=i.find(E=>E.clip===y.sourceName),d=P?.status==="playing",S=P?.time??0,C=p.get(y.sourceName)??0,T=P?PR[P.status]:"Ready";return(0,ge.jsxs)("article",{className:`se-animationCard ${P?"se-animationCard--active":""}`,children:[(0,ge.jsxs)("div",{className:"se-animationHeader",children:[(0,ge.jsxs)("div",{className:"se-animationHeading",children:[(0,ge.jsxs)("div",{className:"se-animationTitleRow",children:[(0,ge.jsx)("span",{className:"se-animationStatus",children:T}),e.animations.autoplayClip===y.sourceName?(0,ge.jsx)("span",{className:"se-animationBadge",children:"Autoplay"}):null]}),(0,ge.jsx)("div",{className:"se-animationSource",children:y.sourceName})]}),(0,ge.jsx)("button",{type:"button",className:"se-animationDangerButton",onClick:()=>M(y.sourceName),title:"Remove animation",children:(0,ge.jsx)(Gr.Trash2,{size:16})})]}),(0,ge.jsxs)("div",{className:"se-field",children:[(0,ge.jsx)("span",{className:"se-fieldLabel",children:"Display name"}),(0,ge.jsx)("input",{className:"se-textInput",value:y.displayName,onChange:E=>v(y.sourceName,E.target.value),placeholder:"Animation name"})]}),(0,ge.jsxs)("div",{className:"se-animationMeta",children:[(0,ge.jsx)("span",{children:AR(C)}),(0,ge.jsx)("span",{children:K_[y.loopMode]??K_.repeat}),(0,ge.jsxs)("span",{children:[y.speed.toFixed(2),"x"]})]}),(0,ge.jsxs)("div",{className:"se-animationButtonRow",children:[(0,ge.jsx)("button",{type:"button",className:"se-animationButton se-animationButton--icon",onClick:()=>d&&!P?.reverse?o(y.sourceName):r(y.sourceName,{alongside:!0}),"aria-label":d&&!P?.reverse?"Pause":"Play",title:d&&!P?.reverse?"Pause":"Play",children:d&&!P?.reverse?(0,ge.jsx)(Gr.Pause,{size:16}):(0,ge.jsx)(Gr.Play,{size:16})}),(0,ge.jsx)("button",{type:"button",className:"se-animationButton se-animationButton--icon",onClick:()=>d&&P?.reverse?o(y.sourceName):r(y.sourceName,{alongside:!0,reverse:!0}),"aria-label":d&&P?.reverse?"Pause":"Play backwards",title:d&&P?.reverse?"Pause":"Play backwards",children:d&&P?.reverse?(0,ge.jsx)(Gr.Pause,{size:16}):(0,ge.jsx)(Gr.Rewind,{size:16})}),(0,ge.jsx)("button",{type:"button",className:"se-animationButton se-animationButton--icon",onClick:()=>a(y.sourceName),disabled:!P,"aria-label":"Stop",title:"Stop",children:(0,ge.jsx)(Gr.Square,{size:16})})]}),(0,ge.jsxs)("div",{className:"se-animationSeekRow",children:[(0,ge.jsx)("input",{className:"se-slider se-animationSeek",type:"range",min:0,max:Math.max(C,.001),step:.01,value:Math.min(S,C),disabled:!P||C<=0,onChange:E=>l(Number(E.target.value),y.sourceName),"aria-label":"Seek"}),(0,ge.jsxs)("span",{className:"se-animationSeekTime",children:[Z_(Math.min(S,C))," / ",Z_(C)]})]}),(0,ge.jsxs)("div",{className:"se-animationGrid",children:[(0,ge.jsxs)("label",{className:"se-field",children:[(0,ge.jsx)("span",{className:"se-fieldLabel",children:"Loop mode"}),(0,ge.jsxs)("select",{className:"se-select",value:y.loopMode,onChange:E=>b(y.sourceName,E.target.value),children:[(0,ge.jsx)("option",{value:"repeat",children:"Loop"}),(0,ge.jsx)("option",{value:"once",children:"Play Once"}),(0,ge.jsx)("option",{value:"ping-pong",children:"Ping-Pong"})]})]}),(0,ge.jsxs)("label",{className:"se-field",children:[(0,ge.jsxs)("span",{className:"se-fieldLabel",children:["Speed",(0,ge.jsxs)("span",{className:"se-fieldValue",children:[y.speed.toFixed(2),"x"]})]}),(0,ge.jsxs)("div",{className:"se-animationSpeedRow",children:[(0,ge.jsx)("input",{className:"se-slider",type:"range",min:.1,max:3,step:.1,value:y.speed,onChange:E=>x(y.sourceName,Number(E.target.value))}),(0,ge.jsx)("input",{className:"se-numberInput se-animationSpeedInput",type:"number",min:.1,max:3,step:.1,value:y.speed,onChange:E=>x(y.sourceName,Number(E.target.value))})]})]})]}),(0,ge.jsx)("button",{type:"button",className:`se-animationAutoplayButton ${e.animations.autoplayClip===y.sourceName?"se-animationAutoplayButton--active":""}`,onClick:()=>w(y.sourceName),children:e.animations.autoplayClip===y.sourceName?"Disable autoplay":"Set as autoplay"})]},y.sourceName)})}),m.length>0?(0,ge.jsxs)("section",{className:"se-removedAnimations",children:[(0,ge.jsx)("button",{type:"button",className:"se-panelHeader",onClick:()=>h(y=>!y),children:(0,ge.jsxs)("span",{className:"se-panelHeaderMain",children:[(0,ge.jsx)(Gr.ChevronDown,{size:16,className:`se-panelChevron ${c?"se-panelChevron--open":""}`}),(0,ge.jsxs)("span",{className:"se-panelTitle",children:["Removed Animations (",m.length,")"]})]})}),c?(0,ge.jsx)("div",{className:"se-removedAnimationList",children:m.map(y=>(0,ge.jsxs)("div",{className:"se-removedAnimationRow",children:[(0,ge.jsxs)("div",{children:[(0,ge.jsx)("div",{className:"se-removedAnimationName",children:y.displayName||y.sourceName}),(0,ge.jsx)("div",{className:"se-animationSource",children:y.sourceName})]}),(0,ge.jsx)("button",{type:"button",className:"se-animationButton",onClick:()=>_(y.sourceName),children:"Restore"})]},y.sourceName))}):null]}):null]})}var vm=require("react"),El=require("lucide-react");var le=require("react/jsx-runtime");function Ng({config:e,onChange:t,cameraState:n,onPreviewView:i}){let[r,o]=(0,vm.useState)(null),[a,s]=(0,vm.useState)(""),[l,c]=(0,vm.useState)(""),h=b=>{o(structuredClone(b)),s(b.minDistance?.toString()??""),c(b.maxDistance?.toString()??"")},p=a.trim()===""?void 0:Number(a),u=l.trim()===""?void 0:Number(l),m=[p,u].some(b=>b!==void 0&&(!Number.isFinite(b)||b<0))?"Distances must be non-negative numbers.":p!==void 0&&u!==void 0&&p>u?"Maximum distance must be at least the minimum.":r?.images?.some(b=>b.src.trim()&&!gl(b.src))||r?.links?.some(b=>b.href.trim()&&!gl(b.href))?"Use an HTTP(S) URL or a relative path for images and links.":null,f=()=>{if(!r?.title.trim()||m)return;let b={...r,title:r.title.trim(),category:r.category?.trim()||void 0,minDistance:p,maxDistance:u,images:r.images?.filter(x=>x.src.trim()).map(x=>({...x,src:x.src.trim()})),links:r.links?.filter(x=>x.href.trim()).map(x=>({...x,href:x.href.trim(),label:x.label.trim()||"Learn more"}))};t({...e,annotations:e.annotations.map(x=>x.id===r.id?b:x)}),o(null)},g=b=>{window.confirm("Delete this annotation?")&&(t({...e,annotations:e.annotations.filter(x=>x.id!==b).map((x,v)=>({...x,id:v+1}))}),o(null))};return(0,le.jsxs)(wo,{title:"Annotations",children:[e.annotations.length===0?(0,le.jsx)("div",{className:"bb-emptyAnnotations",children:"No annotations yet. Double-click on the model to add one."}):(0,le.jsx)("div",{className:"se-annotationList",children:e.annotations.map(b=>(0,le.jsxs)("div",{className:"se-annotationRow",children:[(0,le.jsxs)("span",{className:"se-annotationNumber",children:["#",b.id]}),(0,le.jsxs)("div",{className:"se-annotationSummary",children:[(0,le.jsxs)("div",{className:"se-annotationHeading",children:[(0,le.jsx)("span",{className:"se-annotationTitle",title:b.title,children:b.title}),b.category?.trim()&&(0,le.jsx)("span",{className:"se-annotationCategory",title:b.category,children:b.category})]}),b.description&&(0,le.jsx)("p",{className:"se-annotationDescription",title:b.description,children:b.description})]}),(0,le.jsxs)("div",{className:"se-annotationActions",children:[bl(b.cameraView)&&(0,le.jsx)("button",{type:"button",className:"se-annotationAction",disabled:!i,onClick:()=>i?.(b.cameraView),title:"Preview saved view","aria-label":`Preview saved view for ${b.title}`,children:(0,le.jsx)(El.Eye,{size:15,"aria-hidden":"true"})}),(0,le.jsx)("button",{type:"button",className:"se-annotationAction",onClick:()=>h(b),title:"Edit annotation","aria-label":`Edit ${b.title}`,children:(0,le.jsx)(El.Pencil,{size:15,"aria-hidden":"true"})}),(0,le.jsx)("button",{type:"button",className:"se-annotationAction se-annotationAction--delete",onClick:()=>g(b.id),title:"Delete annotation","aria-label":`Delete ${b.title}`,children:(0,le.jsx)(El.Trash2,{size:15,"aria-hidden":"true"})})]})]},b.id))}),r&&(0,le.jsx)("div",{className:"bb-editAnnotationOverlay",onClick:()=>o(null),children:(0,le.jsxs)("div",{className:"bb-editAnnotationPopup",onKeyDown:b=>{b.key==="Escape"&&(b.stopPropagation(),o(null))},role:"dialog","aria-modal":"true","aria-labelledby":"annotation-edit-title",onClick:b=>b.stopPropagation(),children:[(0,le.jsxs)("div",{className:"bb-editAnnotationHeader",children:[(0,le.jsx)("h3",{id:"annotation-edit-title",className:"bb-editAnnotationTitle",children:"Edit annotation"}),(0,le.jsx)("button",{className:"bb-editAnnotationClose","aria-label":"Close annotation editor",onClick:()=>o(null),children:"\xD7"})]}),(0,le.jsxs)("div",{className:"bb-editAnnotationBody",children:[(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsx)("span",{className:"bb-label",children:"Title"}),(0,le.jsx)("input",{className:"bb-input",autoFocus:!0,value:r.title,onChange:b=>o({...r,title:b.target.value})})]}),(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsx)("span",{className:"bb-label",children:"Description"}),(0,le.jsx)("textarea",{className:"bb-textarea",rows:3,value:r.description,onChange:b=>o({...r,description:b.target.value})})]}),(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsx)("span",{className:"bb-label",children:"Category"}),(0,le.jsx)("input",{className:"bb-input",value:r.category??"",onChange:b=>o({...r,category:b.target.value}),placeholder:"For example, Features"})]}),(0,le.jsxs)("p",{className:"se-annotationCoordinates",children:["Position: [",r.worldPosition.map(b=>b.toFixed(2)).join(", "),"]"]}),(0,le.jsxs)("fieldset",{className:"bb-annotationFields",children:[(0,le.jsx)("legend",{children:"Saved camera view"}),(0,le.jsx)("p",{children:r.cameraView?"Tours use this saved view. Clear it to restore automatic close-up zoom.":"Tours automatically zoom in on the marker. Capture a view to use custom framing."}),(0,le.jsxs)("div",{className:"bb-annotationFieldActions",children:[(0,le.jsx)("button",{className:"bb-button",disabled:!n,onClick:()=>n&&o({...r,cameraView:structuredClone(n)}),children:"Capture current view"}),(0,le.jsx)("button",{className:"bb-button",disabled:!r.cameraView||!i,onClick:()=>r.cameraView&&i?.(r.cameraView),children:"Preview"}),(0,le.jsx)("button",{className:"bb-button",disabled:!r.cameraView,onClick:()=>o({...r,cameraView:void 0}),children:"Clear view"})]})]}),(0,le.jsxs)("fieldset",{className:"bb-annotationFields",children:[(0,le.jsx)("legend",{children:"Marker distance (scene units)"}),(0,le.jsx)("p",{children:"Leave blank to show markers at any distance."}),(0,le.jsxs)("div",{className:"bb-annotationDistanceFields",children:[(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsx)("span",{className:"bb-label",children:"Minimum distance"}),(0,le.jsx)("input",{className:"bb-input",type:"number",min:"0",step:"any",value:a,onChange:b=>s(b.target.value)})]}),(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsx)("span",{className:"bb-label",children:"Maximum distance"}),(0,le.jsx)("input",{className:"bb-input",type:"number",min:"0",step:"any",value:l,onChange:b=>c(b.target.value)})]})]})]}),(0,le.jsxs)("fieldset",{className:"bb-annotationFields",children:[(0,le.jsx)("legend",{children:"Images"}),r.images?.map((b,x)=>(0,le.jsxs)("div",{className:"bb-annotationMediaRow",children:[(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsxs)("span",{className:"bb-label",children:["Image URL ",x+1]}),(0,le.jsx)("input",{className:"bb-input",value:b.src,onChange:v=>o({...r,images:r.images.map((w,M)=>M===x?{...w,src:v.target.value}:w)}),placeholder:"https://example.com/image.jpg"})]}),(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsxs)("span",{className:"bb-label",children:["Image description ",x+1]}),(0,le.jsx)("input",{className:"bb-input",value:b.alt??"",onChange:v=>o({...r,images:r.images.map((w,M)=>M===x?{...w,alt:v.target.value}:w)})})]}),(0,le.jsxs)("button",{className:"bb-button",onClick:()=>o({...r,images:r.images.filter((v,w)=>w!==x)}),children:["Remove image ",x+1]})]},x)),(0,le.jsx)("button",{className:"bb-button",onClick:()=>o({...r,images:[...r.images??[],{src:"",alt:""}]}),children:"Add image"})]}),(0,le.jsxs)("fieldset",{className:"bb-annotationFields",children:[(0,le.jsx)("legend",{children:"Links"}),r.links?.map((b,x)=>(0,le.jsxs)("div",{className:"bb-annotationMediaRow",children:[(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsxs)("span",{className:"bb-label",children:["Link URL ",x+1]}),(0,le.jsx)("input",{className:"bb-input",value:b.href,onChange:v=>o({...r,links:r.links.map((w,M)=>M===x?{...w,href:v.target.value}:w)}),placeholder:"https://example.com/details"})]}),(0,le.jsxs)("label",{className:"bb-field",children:[(0,le.jsxs)("span",{className:"bb-label",children:["Link label ",x+1]}),(0,le.jsx)("input",{className:"bb-input",value:b.label,onChange:v=>o({...r,links:r.links.map((w,M)=>M===x?{...w,label:v.target.value}:w)})})]}),(0,le.jsxs)("button",{className:"bb-button",onClick:()=>o({...r,links:r.links.filter((v,w)=>w!==x)}),children:["Remove link ",x+1]})]},x)),(0,le.jsx)("button",{className:"bb-button",onClick:()=>o({...r,links:[...r.links??[],{href:"",label:""}]}),children:"Add link"})]}),m&&(0,le.jsx)("p",{role:"alert",children:m}),(0,le.jsxs)("div",{className:"bb-editAnnotationActions",children:[(0,le.jsx)("button",{className:"bb-button",onClick:()=>o(null),children:"Cancel"}),(0,le.jsx)("button",{className:"bb-button bb-button--primary",disabled:!r.title.trim()||!!m,onClick:f,children:"Save"}),(0,le.jsx)("button",{className:"bb-button bb-button--danger",onClick:()=>g(r.id),children:"Delete"})]})]})]})})]})}var ji=require("react"),oi=require("lucide-react");var Re=require("react/jsx-runtime"),RR={enabled:!0,waypoints:[],loop:!0,autoPlay:!1},ds=3.5;function Og({config:e,onChange:t,cameraState:n,onPreviewWaypoint:i}){let r=e.cinematic??RR,o=wl(),{waypoints:a}=r,s=(0,ji.useCallback)((v,w)=>{if(v.length<2)return 0;let M=0;for(let _=0;_<v.length-1;_++){let y=v[_].segmentDuration??ds;M+=y}return w&&v.length>1&&(M+=v[v.length-1].segmentDuration??ds),Math.max(M,0)},[]),l=(0,ji.useCallback)(v=>{t({...e,cinematic:{...r,...v}})},[e,r,t]),c=(0,ji.useCallback)(()=>{if(!n)return;let v={position:[...n.position],target:[...n.target],...n.azimuthAngle!=null?{azimuthAngle:n.azimuthAngle}:{},...n.polarAngle!=null?{polarAngle:n.polarAngle}:{},segmentDuration:ds},w=[...a,v],M=s(w,r.loop);l({waypoints:w,duration:M})},[n,a,r.loop,s,l]),h=(0,ji.useCallback)(v=>{let w=a.filter((_,y)=>y!==v),M=s(w,r.loop);l({waypoints:w,duration:M})},[a,r.loop,s,l]),p=(0,ji.useCallback)((v,w)=>{let M=v+w;if(M<0||M>=a.length)return;let _=[...a];[_[v],_[M]]=[_[M],_[v]];let y=s(_,r.loop);l({waypoints:_,duration:y})},[a,r.loop,s,l]),u=(0,ji.useCallback)((v,w)=>{let M=a.map((y,P)=>P===v?{...y,...w}:y),_=s(M,r.loop);l({waypoints:M,duration:_})},[a,r.loop,s,l]),[m,f]=(0,ji.useState)(!1),g=a.some(v=>v.segmentDuration!==void 0),b=(0,ji.useCallback)(v=>v>=a.length-1?ds:a[v]?.segmentDuration??ds,[a]),x=a.length>=2;return(0,Re.jsxs)(wo,{title:"Cinematic Camera",children:[(0,Re.jsx)("p",{className:"se-cinematicHint",children:"Frame the model in the viewer, then capture it as a waypoint. The camera glides through the waypoints in order \u2014 enable and press play in the viewer to preview."}),(0,Re.jsxs)("button",{type:"button",className:"bb-button bb-button--primary se-cinematicAdd",onClick:c,disabled:!n,title:"Capture the current camera view as a waypoint",children:[(0,Re.jsx)(oi.Plus,{size:15}),"Add waypoint from current view"]}),(0,Re.jsxs)("div",{className:"se-customizeToggle",children:[(0,Re.jsxs)("label",{className:"se-toggleLabel",children:[(0,Re.jsx)("input",{type:"checkbox",checked:m,onChange:v=>f(v.target.checked)}),(0,Re.jsx)(oi.Settings,{size:14}),(0,Re.jsx)("span",{children:"Customize durations between waypoints"})]}),m&&(0,Re.jsxs)("span",{className:"se-toggleHint",children:["Set duration for each segment between waypoints: 1\u21922, 2\u21923, etc. Default: ",ds,"s"]})]}),a.length===0?(0,Re.jsx)("div",{className:"bb-emptyAnnotations",children:"No waypoints yet. Position the camera and add your first one."}):(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)("div",{className:"se-waypointList",children:a.map((v,w)=>{let M=b(w),_=w===a.length-1,y=v.segmentDuration!==void 0&&v.segmentDuration!==ds;return(0,Re.jsxs)("div",{children:[(0,Re.jsxs)("div",{className:"se-waypointCard",children:[(0,Re.jsx)("div",{className:"se-waypointBadge",children:w+1}),(0,Re.jsxs)("div",{className:"se-waypointBody",children:[(0,Re.jsxs)("div",{className:"se-waypointCoords",children:["pos [",v.position.map(P=>P.toFixed(1)).join(", "),"]"]}),(0,Re.jsxs)("div",{className:"se-waypointCoords",children:["look [",v.target.map(P=>P.toFixed(1)).join(", "),"]"]}),m&&!_&&(0,Re.jsxs)("div",{className:`se-customBadge ${y?"se-customBadge--custom":"se-customBadge--default"}`,children:[M.toFixed(1),"s",!y&&" (default)"]})]}),(0,Re.jsxs)("div",{className:"se-waypointActions",children:[(0,Re.jsx)("button",{className:"se-waypointAction",onClick:()=>i?.(v),title:"Fly camera to this waypoint",disabled:!i,children:(0,Re.jsx)(oi.MapPin,{size:15})}),(0,Re.jsx)("button",{className:"se-waypointAction",onClick:()=>p(w,-1),title:"Move up",disabled:w===0,children:(0,Re.jsx)(oi.ArrowUp,{size:15})}),(0,Re.jsx)("button",{className:"se-waypointAction",onClick:()=>p(w,1),title:"Move down",disabled:_,children:(0,Re.jsx)(oi.ArrowDown,{size:15})}),(0,Re.jsx)("button",{className:"se-waypointAction se-waypointAction--delete",onClick:()=>h(w),title:"Delete waypoint",children:(0,Re.jsx)(oi.Trash2,{size:15})})]})]}),m&&!_&&(0,Re.jsxs)("div",{className:"se-segmentBetween",children:[(0,Re.jsxs)("div",{className:"se-segmentLabel",children:[w+1," \u2192 ",w+2,!v.segmentDuration&&" (default)"]}),(0,Re.jsxs)("div",{className:"se-segmentControls",children:[(0,Re.jsx)("span",{className:"se-durationLabel",children:"Duration:"}),(0,Re.jsx)("input",{type:"range",className:"se-segmentSlider",min:1,max:20,step:.5,value:M,onChange:P=>{let d=parseFloat(P.target.value);u(w,{segmentDuration:d})}}),(0,Re.jsxs)("span",{className:"se-segmentValue",children:[M.toFixed(1),"s"]}),(0,Re.jsxs)("div",{className:"se-presetButtons",children:[[2,4,6,8].map(P=>(0,Re.jsxs)("button",{className:"se-presetButton",onClick:()=>u(w,{segmentDuration:P}),children:[P,"s"]},`preset-${w}-${P}`)),(0,Re.jsx)("button",{className:"se-presetButton se-presetButton--default",onClick:()=>{let P=a.map((S,C)=>{if(C===w){let{segmentDuration:T,...E}=S;return E}return S}),d=s(P,r.loop);l({waypoints:P,duration:d})},children:"Reset"})]})]})]})]},`waypoint-wrapper-${w}`)})}),(0,Re.jsxs)("div",{className:"se-totalDuration",children:[(0,Re.jsx)("span",{className:"se-totalLabel",children:"Total duration:"}),(0,Re.jsx)("span",{className:"se-totalValue",children:x?(r.duration??s(a,r.loop)).toFixed(1)+"s":"-"}),!x&&(0,Re.jsx)("span",{className:"se-totalHint",children:"(need at least 2 waypoints)"})]})]}),(0,Re.jsx)(Tt,{label:"Enable cinematic camera",checked:r.enabled,onChange:v=>l({enabled:v})}),(0,Re.jsx)(Tt,{label:"Loop",checked:r.loop,onChange:v=>{let w=v,M=s(a,w);l({loop:w,duration:M})}}),(0,Re.jsx)(Tt,{label:"Auto-play on load",checked:r.autoPlay,onChange:v=>l({autoPlay:v})}),r.autoPlay&&o?(0,Re.jsx)("div",{className:"se-placeholder se-placeholder--spaced",children:"Your device is set to reduce motion, so this preview won't play on its own. Visitors without that setting will see it."}):null,!m&&x&&(0,Re.jsx)(q,{label:"Duration",value:r.duration??s(a,r.loop),min:4,max:120,step:1,formatValue:v=>`${v}s`,onChange:v=>l({duration:v})})]})}var us=require("react"),ym=require("react-colorful"),br=require("lucide-react");var J_=["other","body","light","wheel","glass","interior","floor","wall","door","furniture","decor","electronics","seat","table","chair","window","sofa","bed","engine","headlight"],xm=["normal","hidden","selected","disabled"];var Y=require("react/jsx-runtime"),Bg={all:"All objects",group:"Group",tag:"Tag",type:"Type",object:"One object"},Q_={metric:"Metric",status:"Status",metadata:"Metadata"},kR={metric:"",stops:[[0,"#3b82f6"],[100,"#ef4444"]]};function LR(e){return e===void 0?"all":typeof e=="string"||Array.isArray(e)?"object":"group"in e?"group":"tag"in e?"tag":"type"}function yd(e){return e===void 0?"":typeof e=="string"?e:Array.isArray(e)?e[0]??"":"group"in e?e.group:"tag"in e?e.tag:e.type}function eM(e,t){if(e!=="all")return e==="object"?t:e==="group"?{group:t}:e==="tag"?{tag:t}:{type:t}}function DR(e){return"metric"in e?"metric":"status"in e?"status":"metadata"}function tM(e){return e==="metric"?{metric:""}:e==="status"?{status:["disabled"]}:{metadata:"",equals:""}}function NR(e){let t=e.trim();return t==="true"?!0:t==="false"?!1:t==="null"?null:t!==""&&Number.isFinite(Number(t))?Number(t):e}function Ig(e){return e.trim()===""||!Number.isFinite(Number(e))?void 0:Number(e)}function nM(e,t="",n=0){return typeof e!="object"||e===null||Array.isArray(e)?t?[t]:[]:n>2?t?[t]:[]:Object.entries(e).flatMap(([i,r])=>nM(r,t?`${t}.${i}`:i,n+1))}var wd=e=>[...new Set(e.filter(t=>!!t))].sort((t,n)=>t.localeCompare(n));function Gi({label:e,children:t}){return(0,Y.jsxs)("label",{className:"se-field",children:[(0,Y.jsx)("span",{className:"se-fieldLabel",children:e}),t]})}function Sd({label:e,checked:t,color:n,onToggle:i,onColorChange:r}){let[o,a]=(0,us.useState)(!1),s=(0,us.useRef)(null);return(0,Y.jsxs)("div",{className:"se-field se-fieldInline",children:[(0,Y.jsxs)("label",{className:"se-ruleLook",children:[(0,Y.jsx)("input",{type:"checkbox",className:"se-checkbox",checked:t,onChange:l=>i(l.target.checked)}),e]}),t&&n!==void 0&&r?(0,Y.jsx)("span",{ref:s,style:{display:"inline-flex"},children:(0,Y.jsx)(ym.HexColorInput,{prefixed:!0,className:"se-swatch","aria-label":`${e} value`,onClick:()=>a(l=>!l),style:{background:n,color:aa(n)},color:n,onChange:r})}):null,o?(0,Y.jsx)(bd,{anchorRef:s,onClose:()=>a(!1),children:(0,Y.jsx)(ym.HexColorPicker,{color:n,onChange:r})}):null]})}function OR({title:e,open:t,onToggle:n,actions:i,children:r}){return(0,Y.jsxs)("section",{className:"se-panel",children:[(0,Y.jsxs)("div",{className:"se-ruleHeader",children:[(0,Y.jsx)("button",{type:"button",className:"se-panelHeader",onClick:n,"aria-expanded":t,children:(0,Y.jsxs)("span",{className:"se-panelHeaderMain",children:[(0,Y.jsx)(br.ChevronDown,{size:16,className:`se-panelChevron ${t?"se-panelChevron--open":""}`}),(0,Y.jsx)("span",{className:"se-panelTitle",children:e})]})}),(0,Y.jsx)("span",{className:"se-ruleActions",children:i})]}),t?(0,Y.jsx)("div",{className:"se-panelBody",children:r}):null]})}function zg({config:e,onChange:t,objectBindings:n}){let i=e.styleRules??[],[r,o]=(0,us.useState)(i[0]?.id??null),a=(0,us.useMemo)(()=>{let u=Object.values(n);return{groups:wd(u.map(m=>m.group)),tags:wd(u.flatMap(m=>m.tags??[])),types:wd(u.map(m=>m.type??"other")),objects:u.map(m=>({id:m.id,label:m.label||m.id})).sort((m,f)=>m.label.localeCompare(f.label)),metrics:wd(u.flatMap(m=>Object.keys(m.metrics??{}))),metadata:wd(u.flatMap(m=>nM(m.metadata)))}},[n]),s=u=>t({...e,styleRules:u}),l=(u,m)=>s(i.map(f=>f.id===u?m(f):f)),c=()=>{let u=crypto.randomUUID();s([...i,{id:u,label:`Rule ${i.length+1}`,when:[{status:["disabled"]}],material:{baseColor:"#9ca3af"}}]),o(u)},h=(u,m)=>{let f=[...i],[g]=f.splice(u,1);f.splice(u+m,0,g),s(f)},p=u=>{let m=u.target?rs(n,u.target):Object.keys(n),f=u.when?Array.isArray(u.when)?u.when:[u.when]:[];return m.filter(g=>f.every(b=>og(n[g],b))).length};return(0,Y.jsxs)(wo,{title:"Style rules",children:[(0,Y.jsx)("div",{className:"se-helperCard se-ruleIntro",children:"Restyle objects from their data while the app runs: a colour from a metric, grey when disabled, a pulse for an alarm. Set an object's metrics, status, and metadata in the Object tab to try a rule here. Later rules win over earlier ones."}),(0,Y.jsx)("datalist",{id:"se-ruleMetrics",children:a.metrics.map(u=>(0,Y.jsx)("option",{value:u},u))}),(0,Y.jsx)("datalist",{id:"se-ruleMetadata",children:a.metadata.map(u=>(0,Y.jsx)("option",{value:u},u))}),i.map((u,m)=>{let f=u.when?Array.isArray(u.when)?u.when:[u.when]:[],g=LR(u.target),b=u.material??{},x=u.pulse===!0?{}:u.pulse||void 0,v=u.target?rs(n,u.target).length:Object.keys(n).length,w=d=>l(u.id,S=>({...S,when:d.length>0?d:void 0})),M=(d,S)=>w(f.map((C,T)=>T===d?S:C)),_=d=>l(u.id,S=>{let C={...S.material,...d};for(let T of Object.keys(C))C[T]===void 0&&delete C[T];return{...S,material:Object.keys(C).length>0?C:void 0}}),y=d=>l(u.id,S=>({...S,colorScale:d})),P=g==="group"?a.groups:g==="tag"?a.tags:g==="type"?a.types:[];return(0,Y.jsxs)(OR,{title:u.label||`Rule ${m+1}`,open:r===u.id,onToggle:()=>o(d=>d===u.id?null:u.id),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)("button",{type:"button",className:"se-iconButton",onClick:()=>h(m,-1),disabled:m===0,"aria-label":"Move rule up",title:"Move up",children:(0,Y.jsx)(br.ArrowUp,{size:14})}),(0,Y.jsx)("button",{type:"button",className:"se-iconButton",onClick:()=>h(m,1),disabled:m===i.length-1,"aria-label":"Move rule down",title:"Move down",children:(0,Y.jsx)(br.ArrowDown,{size:14})}),(0,Y.jsx)("button",{type:"button",className:"se-iconButton",onClick:()=>s(i.filter(d=>d.id!==u.id)),"aria-label":"Delete rule",title:"Delete rule",children:(0,Y.jsx)(br.Trash2,{size:14})})]}),children:[(0,Y.jsx)(Gi,{label:"Name",children:(0,Y.jsx)("input",{className:"se-textInput",value:u.label??"",placeholder:`Rule ${m+1}`,onChange:d=>l(u.id,S=>({...S,label:d.target.value}))})}),(0,Y.jsxs)("div",{className:"se-ruleGrid",children:[(0,Y.jsx)(Gi,{label:"Applies to",children:(0,Y.jsx)("select",{className:"se-select",value:g,onChange:d=>{let S=d.target.value,C=S==="object"?a.objects[0]?.id:S==="group"?a.groups[0]:S==="tag"?a.tags[0]:S==="type"?a.types[0]:"";l(u.id,T=>({...T,target:eM(S,C??"")}))},children:Object.keys(Bg).map(d=>(0,Y.jsx)("option",{value:d,children:Bg[d]},d))})}),g!=="all"?(0,Y.jsx)(Gi,{label:Bg[g],children:(0,Y.jsxs)("select",{className:"se-select",value:yd(u.target),onChange:d=>l(u.id,S=>({...S,target:eM(g,d.target.value)})),children:[g==="object"?a.objects.map(d=>(0,Y.jsx)("option",{value:d.id,children:d.label},d.id)):P.map(d=>(0,Y.jsx)("option",{value:d,children:d},d)),(g==="object"?a.objects.some(d=>d.id===yd(u.target)):P.includes(yd(u.target)))?null:(0,Y.jsx)("option",{value:yd(u.target),children:yd(u.target)||"None in this model"})]})}):null]}),(0,Y.jsx)("div",{className:"se-fieldLabel",children:"When"}),f.length===0?(0,Y.jsx)("div",{className:"se-ruleHint",children:"Always applies."}):null,f.map((d,S)=>{let C=DR(d);return(0,Y.jsxs)("div",{className:"se-ruleCondition",children:[(0,Y.jsxs)("div",{className:"se-ruleConditionHeader",children:[(0,Y.jsx)("select",{className:"se-select","aria-label":"Condition type",value:C,onChange:T=>M(S,tM(T.target.value)),children:Object.keys(Q_).map(T=>(0,Y.jsx)("option",{value:T,children:Q_[T]},T))}),(0,Y.jsx)("button",{type:"button",className:"se-iconButton","aria-label":"Remove condition",title:"Remove condition",onClick:()=>w(f.filter((T,E)=>E!==S)),children:(0,Y.jsx)(br.X,{size:14})})]}),"metric"in d?(0,Y.jsxs)("div",{className:"se-ruleGrid se-ruleGrid--three",children:[(0,Y.jsx)(Gi,{label:"Metric",children:(0,Y.jsx)("input",{className:"se-textInput",list:"se-ruleMetrics",value:d.metric,placeholder:"temperature",onChange:T=>M(S,{...d,metric:T.target.value})})}),(0,Y.jsx)(Gi,{label:"Above",children:(0,Y.jsx)("input",{className:"se-numberInput",type:"number",value:d.above??"",placeholder:"any",onChange:T=>M(S,{...d,above:Ig(T.target.value)})})}),(0,Y.jsx)(Gi,{label:"Below",children:(0,Y.jsx)("input",{className:"se-numberInput",type:"number",value:d.below??"",placeholder:"any",onChange:T=>M(S,{...d,below:Ig(T.target.value)})})})]}):"status"in d?(0,Y.jsx)("div",{className:"se-ruleStatuses",children:xm.map(T=>{let E=[].concat(d.status).includes(T);return(0,Y.jsxs)("label",{className:"se-ruleStatus",children:[(0,Y.jsx)("input",{type:"checkbox",className:"se-checkbox",checked:E,onChange:()=>{let k=[].concat(d.status),D=E?k.filter(I=>I!==T):[...k,T];M(S,{status:D})}}),T]},T)})}):(0,Y.jsxs)("div",{className:"se-ruleGrid",children:[(0,Y.jsx)(Gi,{label:"Key",children:(0,Y.jsx)("input",{className:"se-textInput",list:"se-ruleMetadata",value:d.metadata,placeholder:"alarm.state",onChange:T=>M(S,{...d,metadata:T.target.value})})}),(0,Y.jsx)(Gi,{label:"Equals",children:(0,Y.jsx)("input",{className:"se-textInput",value:d.equals===null?"null":String(d.equals),placeholder:"fault",onChange:T=>M(S,{...d,equals:NR(T.target.value)})})})]})]},S)}),(0,Y.jsxs)("button",{type:"button",className:"se-animationButton",onClick:()=>w([...f,tM("metric")]),children:[(0,Y.jsx)(br.Plus,{size:14})," Add condition"]}),(0,Y.jsx)("div",{className:"se-fieldLabel",children:"Look"}),(0,Y.jsx)(Sd,{label:"Colour",checked:b.baseColor!==void 0,color:b.baseColor,onToggle:d=>_({baseColor:d?"#9ca3af":void 0}),onColorChange:d=>_({baseColor:d})}),(0,Y.jsx)(Sd,{label:"Opacity",checked:b.opacity!==void 0,onToggle:d=>_({opacity:d?.4:void 0})}),b.opacity!==void 0?(0,Y.jsx)(q,{label:"Opacity",value:b.opacity,min:0,max:1,step:.05,formatValue:d=>`${Math.round(d*100)}%`,onChange:d=>_({opacity:d})}):null,(0,Y.jsx)(Sd,{label:"Glow",checked:b.emissive!==void 0,color:b.emissive,onToggle:d=>_({emissive:d?"#ff3b30":void 0,emissiveIntensity:d?b.emissiveIntensity??1:void 0}),onColorChange:d=>_({emissive:d})}),(0,Y.jsx)(Sd,{label:"Colour from a metric",checked:u.colorScale!==void 0,onToggle:d=>y(d?{...kR,metric:a.metrics[0]??""}:void 0)}),u.colorScale?(0,Y.jsxs)("div",{className:"se-ruleCondition",children:[(0,Y.jsxs)("div",{className:"se-ruleGrid",children:[(0,Y.jsx)(Gi,{label:"Metric",children:(0,Y.jsx)("input",{className:"se-textInput",list:"se-ruleMetrics",value:u.colorScale.metric,placeholder:"temperature",onChange:d=>y({...u.colorScale,metric:d.target.value})})}),(0,Y.jsx)(Gi,{label:"Sets",children:(0,Y.jsxs)("select",{className:"se-select",value:u.colorScale.channel??"baseColor",onChange:d=>y({...u.colorScale,channel:d.target.value}),children:[(0,Y.jsx)("option",{value:"baseColor",children:"Colour"}),(0,Y.jsx)("option",{value:"emissive",children:"Glow colour"})]})})]}),u.colorScale.stops.map(([d,S],C)=>{let T=E=>y({...u.colorScale,stops:u.colorScale.stops.map((k,D)=>D===C?E:k)});return(0,Y.jsxs)("div",{className:"se-ruleStop",children:[(0,Y.jsx)("input",{className:"se-numberInput",type:"number","aria-label":"Stop value",value:d,onChange:E=>T([Ig(E.target.value)??0,S])}),(0,Y.jsx)(kr,{label:`At ${d}`,value:S,onChange:E=>T([d,E])}),(0,Y.jsx)("button",{type:"button",className:"se-iconButton","aria-label":"Remove stop",title:"Remove stop",disabled:u.colorScale.stops.length<=1,onClick:()=>y({...u.colorScale,stops:u.colorScale.stops.filter((E,k)=>k!==C)}),children:(0,Y.jsx)(br.X,{size:14})})]},C)}),(0,Y.jsxs)("button",{type:"button",className:"se-animationButton",onClick:()=>{let d=u.colorScale.stops,S=d[d.length-1];y({...u.colorScale,stops:[...d,[(S?.[0]??0)+10,S?.[1]??"#ffffff"]]})},children:[(0,Y.jsx)(br.Plus,{size:14})," Add stop"]})]}):null,(0,Y.jsx)(Sd,{label:"Pulse",checked:x!==void 0,color:x?.color??"#ff3b30",onToggle:d=>l(u.id,S=>({...S,pulse:d?{color:"#ff3b30",speed:1}:void 0})),onColorChange:d=>l(u.id,S=>({...S,pulse:{...x,color:d}}))}),x?(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(q,{label:"Pulses per second",value:x.speed??1,min:.2,max:4,step:.1,formatValue:d=>d.toFixed(1),onChange:d=>l(u.id,S=>({...S,pulse:{...x,speed:d}}))})}):null,(0,Y.jsxs)("div",{className:"se-ruleHint se-ruleMatches",children:["Matches ",p(u)," of ",v," ",v===1?"object":"objects"," right now."]})]},u.id)}),(0,Y.jsxs)("button",{type:"button",className:"se-animationButton",onClick:c,children:[(0,Y.jsx)(br.Plus,{size:14})," Add rule"]})]})}var Lr=require("lucide-react");var ln=require("react/jsx-runtime"),BR=[{label:"General",icon:(0,ln.jsx)(Lr.Box,{})},{label:"Lighting",icon:(0,ln.jsx)(Lr.Spotlight,{})},{label:"Animations",icon:(0,ln.jsx)(Lr.Clapperboard,{})},{label:"Post Processing",icon:(0,ln.jsx)(Lr.Sparkles,{})},{label:"Annotations",icon:(0,ln.jsx)(Lr.MessageSquareText,{})},{label:"Cinematic",icon:(0,ln.jsx)(Lr.Video,{})},{label:"Rules",icon:(0,ln.jsx)(Lr.Palette,{})}],rM={active:[],play:()=>{},pause:()=>{},stop:()=>{},setSpeed:()=>{},seek:()=>{}},IR=[],zR={};function Ug({config:e,onChange:t,activeSubTab:n,onActiveSubTabChange:i,cameraState:r=null,onPreviewWaypoint:o,animationClipDetails:a=[],materialVariantGroups:s=IR,objectBindings:l=zR,animationPlayback:c=rM}){let[h,p]=(0,wm.useState)("General"),u=n??h,m=c??rM,{tier:f}=Rr(),g=Ai(f,"starter"),b=Ai(f,"growth");(0,wm.useEffect)(()=>{n!==void 0&&p(n)},[n]);let x=v=>{n===void 0&&p(v),i?.(v)};return(0,ln.jsxs)("div",{className:"se-tabContent",children:[(0,ln.jsx)("div",{className:"se-subTabRow",children:BR.map(v=>(0,ln.jsx)("button",{type:"button",title:v.label,"aria-label":v.label,"aria-pressed":u===v.label,className:`se-subTab ${u===v.label?"se-subTab--active":""}`,onClick:()=>x(v.label),children:v.icon},v.label))}),u==="General"&&(0,ln.jsx)(Rg,{config:e,onChange:t,materialVariantGroups:s}),u==="Lighting"&&(0,ln.jsx)(Lg,{config:e,onChange:t}),u==="Animations"&&(g?(0,ln.jsx)(Dg,{config:e,onChange:t,clipDetails:a,active:m.active,play:m.play,pause:m.pause,stop:m.stop,setSpeed:m.setSpeed,seek:m.seek}):(0,ln.jsx)(ir,{requiredTier:"starter",feature:"Animation configuration"})),u==="Post Processing"&&(b?(0,ln.jsx)(kg,{config:e,onChange:t}):(0,ln.jsx)(ir,{requiredTier:"growth",feature:"Post-processing effects"})),u==="Annotations"&&(g?(0,ln.jsx)(Ng,{config:e,onChange:t,cameraState:r,onPreviewView:o}):(0,ln.jsx)(ir,{requiredTier:"starter",feature:"Annotations"})),u==="Cinematic"&&(g?(0,ln.jsx)(Og,{config:e,onChange:t,cameraState:r,onPreviewWaypoint:o}):(0,ln.jsx)(ir,{requiredTier:"starter",feature:"Cinematic camera"})),u==="Rules"&&(g?(0,ln.jsx)(zg,{config:e,onChange:t,objectBindings:l}):(0,ln.jsx)(ir,{requiredTier:"starter",feature:"Style rules"}))]})}var Rl=require("lucide-react"),cn=require("react/jsx-runtime");function iM({title:e,trailing:t,children:n,disabled:i,open:r,onToggle:o,tooltip:a}){let s=a?`${a}`:e;return(0,cn.jsxs)("div",{className:"bb-materialPanel",children:[(0,cn.jsxs)("button",{type:"button",className:"bb-materialPanelHeader",onClick:o,"aria-expanded":r,title:s,children:[(0,cn.jsxs)("div",{className:"bb-materialPanelTitleWrap",children:[(0,cn.jsx)(Rl.ChevronDown,{size:14,className:`bb-materialPanelChevron ${r?"bb-materialPanelChevron--open":""}`}),(0,cn.jsx)("span",{className:"bb-materialPanelTitle",children:e}),a?(0,cn.jsx)("span",{className:"bb-materialPanelHelp",title:s,"aria-label":s,role:"img",onClick:l=>l.stopPropagation(),children:(0,cn.jsx)(Rl.Info,{size:12})}):null]}),t?(0,cn.jsx)("div",{onClick:l=>l.stopPropagation(),children:t}):null]}),r?(0,cn.jsx)("div",{className:"bb-materialPanelBody",style:i?{opacity:.45,pointerEvents:"none"}:void 0,children:n}):null]})}function dr({title:e,open:t,onToggle:n,trailing:i,children:r,tooltip:o}){let a=o?`${e}: ${o}`:e;return(0,cn.jsxs)("div",{className:"bb-section",children:[(0,cn.jsxs)("button",{type:"button",className:"bb-sectionHeaderButton",onClick:n,"aria-expanded":t,title:a,children:[(0,cn.jsxs)("span",{className:"bb-sectionHeaderMain",children:[(0,cn.jsx)(Rl.ChevronDown,{size:15,className:`bb-sectionChevron ${t?"bb-sectionChevron--open":""}`}),(0,cn.jsx)("h2",{className:"bb-sectionTitle",children:e}),o?(0,cn.jsx)("span",{className:"bb-sectionHelp",title:a,"aria-label":a,role:"img",onClick:s=>s.stopPropagation(),children:(0,cn.jsx)(Rl.Info,{size:13})}):null]}),i?(0,cn.jsx)("span",{onClick:s=>s.stopPropagation(),children:i}):null]}),t?(0,cn.jsx)("div",{className:"bb-sectionBody",children:r}):null]})}function oM({checked:e,onChange:t,label:n}){return(0,cn.jsxs)("label",{className:"se-switch","aria-label":n,children:[(0,cn.jsx)("input",{type:"checkbox",checked:e,onChange:i=>t(i.target.checked)}),(0,cn.jsx)("span",{className:"se-switchTrack",children:(0,cn.jsx)("span",{className:"se-switchThumb"})})]})}var jg=require("react"),dM=require("lucide-react");var aM=["front","back","double"],sM=["normal","additive"];var Sm=require("react/jsx-runtime");function Hr({panelKey:e,title:t,tooltip:n,toggleLabel:i,controls:r,children:o,requiredTier:a}){let{openMaterialPanels:s,materialPanelEnabled:l,onToggleMaterialPanel:c,onSetMaterialPanelState:h}=r,p=a?.locked??!1;return(0,Sm.jsx)(iM,{title:t,tooltip:n,disabled:p||!l[e],open:s[e],onToggle:()=>c(e),trailing:(0,Sm.jsx)(oM,{checked:!p&&l[e],onChange:p?()=>{}:u=>h(e,u),label:i??`Toggle ${t}`}),children:p&&a?(0,Sm.jsx)(ir,{requiredTier:a.tier,feature:t}):o})}var So=require("react"),_m=require("react-colorful"),kl=require("lucide-react");var rt=require("react/jsx-runtime"),Vg=(0,So.createContext)(null);function Rn({label:e,value:t,placeholder:n,onChange:i}){let r=(0,So.useRef)(null),o=(0,So.useContext)(Vg);return(0,rt.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,rt.jsx)("label",{className:"bb-label",children:e}),(0,rt.jsxs)("div",{className:"bb-fileField",title:o??void 0,children:[(0,rt.jsx)("input",{className:"bb-input bb-fileField-input",placeholder:n,value:t,disabled:!!o&&!t,onChange:a=>{let s=a.target.value;!s&&t&&yc(t),i(s)}}),(0,rt.jsx)("button",{type:"button",className:"bb-fileFieldButton",disabled:!!o,onClick:()=>r.current?.click(),"aria-label":`Select file for ${e}`,title:`Select file for ${e}`,children:(0,rt.jsx)(kl.FileUp,{size:20})}),(0,rt.jsx)("input",{ref:r,type:"file",accept:"image/png,image/jpeg,image/webp,image/avif",className:"bb-hiddenInput",onChange:a=>{let s=a.target.files?.[0];if(!s)return;let l=_u(s);t&&t!==l&&yc(t),za(l,URL.createObjectURL(s)),i(l),a.target.value=""}})]})]})}function _o({label:e,value:t,fallback:n="#ffffff",variant:i="swatch",onChange:r}){let[o,a]=(0,So.useState)(!1),s=t||n,l=(0,So.useRef)(null);return(0,rt.jsxs)("div",{className:"bb-field",children:[(0,rt.jsx)("span",{className:"bb-label",children:e}),(0,rt.jsx)("div",{className:"se-fieldInline",children:(0,rt.jsx)("span",{ref:l,className:i==="input"?"bb-colorFieldAnchor":void 0,style:i==="swatch"?{display:"inline-flex"}:void 0,children:(0,rt.jsx)(_m.HexColorInput,{prefixed:!0,className:i==="input"?"bb-input bb-colorInput":"se-swatch","aria-label":e,onClick:()=>a(c=>!c),style:{background:s,color:aa(s)},color:s,onChange:r})})}),o?(0,rt.jsx)(bd,{anchorRef:l,onClose:()=>a(!1),children:(0,rt.jsx)(_m.HexColorPicker,{color:s,onChange:r})}):null]})}function _d({label:e,checked:t,onChange:n}){return(0,rt.jsxs)("label",{className:"bb-checkbox",children:[(0,rt.jsx)("input",{type:"checkbox",checked:t,onChange:i=>n(i.target.checked)}),e]})}function lM({label:e,value:t,min:n,max:i,step:r,placeholder:o,disabled:a,onChange:s}){return(0,rt.jsxs)("div",{className:"bb-field",children:[(0,rt.jsx)("label",{className:"bb-label",children:e}),(0,rt.jsx)("input",{className:"bb-input",type:"number",min:n,max:i,step:r,placeholder:o,disabled:a,value:t??"",onChange:l=>s(l.target.value===""?void 0:Number(l.target.value))})]})}function UR(e,t){let n=t<1?Math.ceil(-Math.log10(t)):0,i=10**Math.max(n,0);return Math.round(e*i)/i}function Fg({label:e,value:t,min:n,max:i,step:r=.01,disabled:o,onChange:a}){let s=t??0,l=h=>{let p=h;return n!==void 0&&(p=Math.max(n,p)),i!==void 0&&(p=Math.min(i,p)),p},c=h=>{a(l(UR(s+h*r,r)))};return(0,rt.jsxs)("div",{className:"bb-field",children:[(0,rt.jsx)("label",{className:"bb-label",children:e}),(0,rt.jsxs)("div",{className:"bb-numberStepper",children:[(0,rt.jsx)("button",{type:"button",className:"bb-numberStepper-btn",disabled:o,onClick:()=>c(-1),"aria-label":`Decrease ${e}`,title:`Decrease ${e}`,children:(0,rt.jsx)(kl.Minus,{size:12})}),(0,rt.jsx)("input",{className:"bb-input bb-numberStepper-input",type:"number",min:n,max:i,step:r,disabled:o,value:s,onChange:h=>{h.target.value!==""&&a(l(Number(h.target.value)))}}),(0,rt.jsx)("button",{type:"button",className:"bb-numberStepper-btn",disabled:o,onClick:()=>c(1),"aria-label":`Increase ${e}`,title:`Increase ${e}`,children:(0,rt.jsx)(kl.Plus,{size:12})})]})]})}function Ll({label:e,value:t,options:n,onChange:i}){return(0,rt.jsxs)("div",{className:"bb-field",children:[(0,rt.jsx)("label",{className:"bb-label",children:e}),(0,rt.jsx)("select",{className:"bb-select",value:t,onChange:r=>i(r.target.value),children:n.map(r=>(0,rt.jsx)("option",{value:r,children:r},r))})]})}function Ot({label:e,value:t,min:n,max:i,step:r,onChange:o}){return(0,rt.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,rt.jsx)("label",{className:"bb-label",children:e}),(0,rt.jsxs)("div",{className:"bb-sliderField",children:[(0,rt.jsx)("input",{className:`bb-slider ${t===void 0?"bb-slider--unset":""}`,type:"range",min:n,max:i,step:r,value:t??n,onChange:s=>o(Number(s.target.value))}),(0,rt.jsx)("input",{className:"bb-input bb-input--compact",type:"number",min:n,max:i,step:r,value:t??"",onChange:s=>o(s.target.value===""?void 0:Number(s.target.value))})]})]})}var W=require("react/jsx-runtime"),cM="This object has no texture coordinates (UVs), so image maps can't be placed on it. Colors and the other settings work, and Decals can put an image on it.";function uM({selectedItem:e,selectedMaterial:t,pbrWorkflow:n,onPbrWorkflowChange:i,openMaterialPanels:r,materialPanelEnabled:o,onToggleMaterialPanel:a,onSetMaterialPanelState:s,updateSelectedMaterial:l,setSelectedTexturePath:c,isTexturePositioningEnabled:h,onConfirmTexturePosition:p,takesImage:u=!0}){let m={openMaterialPanels:r,materialPanelEnabled:o,onToggleMaterialPanel:a,onSetMaterialPanelState:s},{tier:f}=Rr(),g=Ai(f,"starter"),b={tier:"starter",locked:!g},[x,v]=(0,jg.useState)("roughness"),[w,M]=(0,jg.useState)("factor"),_=(d,S)=>{l(e,C=>{if(!C?.texture?.path)return C??{};let T=C.texture.offset??[0,0],E=[T[0],T[1]];return E[d]=S,{...C,texture:{...C.texture,offset:E}}})},y=d=>{l(e,S=>{if(!S?.texture?.path)return S??{};let C=(d%360+360)%360;return{...S,texture:{...S.texture,rotation:C*Math.PI/180}}})},P=()=>{c(e,"texture","")};return(0,W.jsxs)(Vg.Provider,{value:u?null:cM,children:[u?null:(0,W.jsx)("p",{className:"bb-note bb-materialNotice",children:cM}),(0,W.jsx)(Hr,{panelKey:"pbr",title:"PBR Maps",tooltip:"Controls the base color and workflow used for physically based shading.",controls:m,children:g?(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Ll,{label:"Workflow",value:n,options:["metalness","specular"],onChange:i}),(0,W.jsx)("div",{className:"bb-field bb-field--full",children:(0,W.jsx)("p",{className:"bb-note",style:{margin:0},children:n==="metalness"?"Metalness workflow maps directly to the underlying physical material.":"Specular workflow exposes the same physical material with non-metal specular controls; it does not switch to a separate spec/gloss shader."})}),(0,W.jsx)(Rn,{label:n==="specular"?"Albedo texture path":"Base color texture path",placeholder:"materials/oak-wood.jpg",value:t?.texture?.path??"",onChange:d=>c(e,"texture",d)}),t?.texture?.path?(0,W.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,W.jsxs)("div",{className:"bb-fieldLabel",style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,W.jsx)("span",{className:"bb-label",children:"Texture position"}),(0,W.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:P,title:"Remove the base color texture and its position offset",children:[(0,W.jsx)(dM.Trash2,{size:14,style:{marginRight:4,verticalAlign:"-2px"}}),"Remove texture"]})]}),(0,W.jsxs)("div",{className:"bb-grid",style:{marginTop:6},children:[(0,W.jsx)(Fg,{label:"Offset X",value:t?.texture?.offset?.[0]??0,step:.01,onChange:d=>_(0,d)}),(0,W.jsx)(Fg,{label:"Offset Y",value:t?.texture?.offset?.[1]??0,step:.01,onChange:d=>_(1,d)})]}),(0,W.jsx)(Ot,{label:"Rotation",value:((t?.texture?.rotation??0)*180/Math.PI%360+360)%360,min:0,max:360,step:1,onChange:d=>y(d??0)}),h?(0,W.jsx)("button",{type:"button",className:"bb-button bb-button--primary",style:{marginTop:8},onClick:p,title:"Confirm this texture position and exit positioning mode",children:"Done positioning"}):(0,W.jsx)("p",{className:"bb-note",style:{margin:"6px 0 0"},children:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically once positioning."})]}):null,(0,W.jsx)(_o,{label:n==="specular"?"Albedo color":"Base color",value:t?.baseColor??"#ffffff",onChange:d=>l(e,S=>({...S,baseColor:d}))}),n==="metalness"?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ot,{label:"Metalness",value:t?.metalness,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,metalness:d}))}),(0,W.jsx)(Rn,{label:"Metalness map path",placeholder:"materials/body-metalness.jpg",value:t?.metalnessMap?.path??"",onChange:d=>c(e,"metalnessMap",d)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ot,{label:"Specular intensity",value:t?.specularIntensity,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,specularIntensity:d}))}),(0,W.jsx)(_o,{label:"Specular color",value:t?.specularColor??"#ffffff",onChange:d=>l(e,S=>({...S,specularColor:d}))}),(0,W.jsx)(Rn,{label:"Specular intensity map path",placeholder:"materials/body-specular-intensity.jpg",value:t?.specularIntensityMap?.path??"",onChange:d=>c(e,"specularIntensityMap",d)}),(0,W.jsx)(Rn,{label:"Specular color map path",placeholder:"materials/body-specular-color.jpg",value:t?.specularColorMap?.path??"",onChange:d=>c(e,"specularColorMap",d)})]}),(0,W.jsx)(Ot,{label:"Specular F0 / reflectivity",value:t?.reflectivity,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,reflectivity:d}))})]}):(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(_o,{label:"Base color",value:t?.baseColor??"#ffffff",onChange:d=>l(e,S=>({...S,baseColor:d}))}),(0,W.jsx)(Ot,{label:"Metalness",value:t?.metalness,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,metalness:d}))}),(0,W.jsx)("div",{className:"bb-field bb-field--full",children:(0,W.jsx)(ir,{requiredTier:"starter",feature:"Texture maps, the specular workflow, and reflectivity"})})]})}),(0,W.jsx)(Hr,{panelKey:"roughness",requiredTier:b,title:"Roughness / Glossiness",tooltip:"Adjusts how matte or shiny the surface appears.",toggleLabel:"Toggle Roughness and Glossiness",controls:m,children:(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Ll,{label:"Mode",value:x,options:["roughness","glossiness"],onChange:v}),(0,W.jsx)("div",{className:"bb-field bb-field--full",children:(0,W.jsx)("p",{className:"bb-note",style:{margin:0},children:x==="roughness"?"Roughness: 0 is glossy, 1 is matte.":"Glossiness is the inverse of roughness (glossiness = 1 \u2212 roughness)"})}),x==="roughness"?(0,W.jsx)(Ot,{label:"Roughness",value:t?.roughness,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,roughness:d}))}):(0,W.jsx)(Ot,{label:"Glossiness",value:t?.roughness===void 0?void 0:1-t.roughness,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,roughness:d===void 0?void 0:1-d}))}),(0,W.jsx)(Rn,{label:x==="glossiness"?"Glossiness map path (applied as roughness)":"Roughness map path",placeholder:"materials/body-roughness.jpg",value:t?.roughnessMap?.path??"",onChange:d=>c(e,"roughnessMap",d)})]})}),(0,W.jsx)(Hr,{panelKey:"emission",requiredTier:b,title:"Emission",tooltip:"Makes the material self-illuminated with emissive color and intensity.",controls:m,children:(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(_o,{label:"Emissive color",value:t?.emissive??"#000000",fallback:"#000000",onChange:d=>l(e,S=>({...S,emissive:d}))}),(0,W.jsx)(Ot,{label:"Emissive intensity",value:t?.emissiveIntensity,min:0,max:10,step:.1,onChange:d=>l(e,S=>({...S,emissiveIntensity:d}))}),(0,W.jsx)(Rn,{label:"Emissive map path",placeholder:"materials/body-emissive.jpg",value:t?.emissiveMap?.path??"",onChange:d=>c(e,"emissiveMap",d)})]})}),(0,W.jsx)(Hr,{panelKey:"opacity",requiredTier:b,title:"Opacity",tooltip:"Controls transparency, alpha testing, and blending behavior.",controls:m,children:(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Ot,{label:"Opacity",value:t?.opacity,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,opacity:d}))}),(0,W.jsx)(Ot,{label:"Alpha test",value:t?.alphaTest,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,alphaTest:d}))}),(0,W.jsx)(Rn,{label:"Alpha map path",placeholder:"materials/body-alpha.png",value:t?.alphaMap?.path??"",onChange:d=>c(e,"alphaMap",d)}),(0,W.jsx)(Ll,{label:"Blending mode",value:t?.blendingMode??"normal",options:sM,onChange:d=>l(e,S=>({...S,blendingMode:d}))}),(0,W.jsxs)("div",{className:"bb-field",children:[(0,W.jsx)("label",{className:"bb-label",children:"Alpha hash"}),(0,W.jsx)("div",{className:"bb-checkboxRow",children:(0,W.jsx)(_d,{label:"Use alpha hash",checked:t?.alphaHash??!1,onChange:d=>l(e,S=>({...S,alphaHash:d}))})})]}),(0,W.jsxs)("div",{className:"bb-field",children:[(0,W.jsx)("label",{className:"bb-label",children:"Dithering"}),(0,W.jsx)("div",{className:"bb-checkboxRow",children:(0,W.jsx)(_d,{label:"Use dithering",checked:t?.dithering??!1,onChange:d=>l(e,S=>({...S,dithering:d}))})})]})]})}),(0,W.jsxs)(Hr,{panelKey:"normalBump",requiredTier:b,title:"Normal & Bump",tooltip:"Adds surface detail without changing the actual mesh shape.",toggleLabel:"Toggle Normal and Bump",controls:m,children:[(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Rn,{label:"Normal map path",placeholder:"materials/body-normal.jpg",value:t?.normalMap?.path??"",onChange:d=>c(e,"normalMap",d)}),(0,W.jsx)(Ot,{label:"Normal scale",value:t?.normalScale,min:0,max:5,step:.01,onChange:d=>l(e,S=>({...S,normalScale:d}))}),(0,W.jsx)(Rn,{label:"Bump map path",placeholder:"materials/body-bump.jpg",value:t?.bumpMap?.path??"",onChange:d=>c(e,"bumpMap",d)}),(0,W.jsx)(Ot,{label:"Bump scale",value:t?.bumpScale,min:0,max:5,step:.01,onChange:d=>l(e,S=>({...S,bumpScale:d}))})]}),(0,W.jsx)("div",{className:"bb-checkboxRow",style:{marginTop:12},children:(0,W.jsx)(_d,{label:"Flip normal Y",checked:t?.flipNormalY??!1,onChange:d=>l(e,S=>({...S,flipNormalY:d}))})})]}),(0,W.jsx)(Hr,{panelKey:"displacement",requiredTier:b,title:"Displacement",tooltip:"Offsets geometry using a texture to create real surface height.",controls:m,children:(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Rn,{label:"Displacement map path",placeholder:"materials/body-displacement.jpg",value:t?.displacementMap?.path??"",onChange:d=>c(e,"displacementMap",d)}),(0,W.jsx)(Ot,{label:"Displacement scale",value:t?.displacementScale,min:-5,max:5,step:.01,onChange:d=>l(e,S=>({...S,displacementScale:d}))}),(0,W.jsx)(Ot,{label:"Displacement bias",value:t?.displacementBias,min:-5,max:5,step:.01,onChange:d=>l(e,S=>({...S,displacementBias:d}))})]})}),(0,W.jsx)(Hr,{panelKey:"ao",requiredTier:b,title:"Ambient Occlusion",tooltip:"Darkens creases and contact areas to add depth.",controls:m,children:(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Rn,{label:"AO map path",placeholder:"materials/body-ao.jpg",value:t?.aoMap?.path??"",onChange:d=>c(e,"aoMap",d)}),(0,W.jsx)(Ot,{label:"AO intensity",value:t?.aoMapIntensity,min:0,max:5,step:.01,onChange:d=>l(e,S=>({...S,aoMapIntensity:d}))})]})}),(0,W.jsxs)(Hr,{panelKey:"clearcoat",requiredTier:b,title:"Clearcoat",tooltip:"Adds a glossy protective layer on top of the base material.",controls:m,children:[(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Rn,{label:"Clearcoat map path",placeholder:"materials/body-clearcoat.jpg",value:t?.clearcoatMap?.path??"",onChange:d=>c(e,"clearcoatMap",d)}),(0,W.jsx)(Ot,{label:"Clearcoat",value:t?.clearcoat,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,clearcoat:d}))}),(0,W.jsx)(Rn,{label:"Clearcoat roughness map path",placeholder:"materials/body-clearcoat-roughness.jpg",value:t?.clearcoatRoughnessMap?.path??"",onChange:d=>c(e,"clearcoatRoughnessMap",d)}),(0,W.jsx)(Ot,{label:"Clearcoat roughness",value:t?.clearcoatRoughness,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,clearcoatRoughness:d}))}),(0,W.jsx)(Rn,{label:"Clearcoat normal map path",placeholder:"materials/body-clearcoat-normal.jpg",value:t?.clearcoatNormalMap?.path??"",onChange:d=>c(e,"clearcoatNormalMap",d)}),(0,W.jsx)(Ot,{label:"Clearcoat normal scale",value:t?.clearcoatNormalScale,min:0,max:5,step:.01,onChange:d=>l(e,S=>({...S,clearcoatNormalScale:d}))})]}),(0,W.jsx)("div",{className:"bb-checkboxRow",style:{marginTop:12},children:(0,W.jsx)(_d,{label:"Flip clearcoat normal Y",checked:t?.flipClearcoatNormalY??!1,onChange:d=>l(e,S=>({...S,flipClearcoatNormalY:d}))})})]}),(0,W.jsx)(Hr,{panelKey:"sheen",requiredTier:b,title:"Sheen",tooltip:"Adds a soft fabric-like sheen on grazing angles.",controls:m,children:(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Ot,{label:"Sheen",value:t?.sheen,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,sheen:d}))}),(0,W.jsx)(_o,{label:"Sheen color",value:t?.sheenColor??"#ffffff",onChange:d=>l(e,S=>({...S,sheenColor:d}))}),(0,W.jsx)(Rn,{label:"Sheen color map path",placeholder:"materials/body-sheen-color.jpg",value:t?.sheenColorMap?.path??"",onChange:d=>c(e,"sheenColorMap",d)}),(0,W.jsx)(Ot,{label:"Sheen roughness",value:t?.sheenRoughness,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,sheenRoughness:d}))}),(0,W.jsx)(Rn,{label:"Sheen roughness map path",placeholder:"materials/body-sheen-roughness.jpg",value:t?.sheenRoughnessMap?.path??"",onChange:d=>c(e,"sheenRoughnessMap",d)})]})}),(0,W.jsx)(Hr,{panelKey:"anisotropy",requiredTier:b,title:"Anisotropy",tooltip:"Stretches reflections in one direction for brushed or fiber-like surfaces.",controls:m,children:(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Ot,{label:"Intensity",value:t?.anisotropy,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,anisotropy:d}))}),(0,W.jsx)(Ll,{label:"Tilt direction",value:w,options:["factor","texture"],onChange:M}),w==="factor"?(0,W.jsx)(Ot,{label:"Rotation (rad)",value:t?.anisotropyRotation,min:0,max:6.28,step:.01,onChange:d=>l(e,S=>({...S,anisotropyRotation:d}))}):(0,W.jsx)(Rn,{label:"Anisotropy map path",placeholder:"materials/body-anisotropy.jpg",value:t?.anisotropyMap?.path??"",onChange:d=>c(e,"anisotropyMap",d)})]})}),(0,W.jsx)(Hr,{panelKey:"transmission",requiredTier:b,title:"Transmission & Volume",tooltip:"Controls glass-like transmission and how light travels through volume.",toggleLabel:"Toggle Transmission and Volume",controls:m,children:(0,W.jsxs)("div",{className:"bb-grid",children:[(0,W.jsx)(Ot,{label:"Transmission",value:t?.transmission,min:0,max:1,step:.01,onChange:d=>l(e,S=>({...S,transmission:d}))}),(0,W.jsx)(Rn,{label:"Transmission map path",placeholder:"materials/body-transmission.jpg",value:t?.transmissionMap?.path??"",onChange:d=>c(e,"transmissionMap",d)}),(0,W.jsx)(Ot,{label:"Thickness",value:t?.thickness,min:0,max:5,step:.01,onChange:d=>l(e,S=>({...S,thickness:d}))}),(0,W.jsx)(Rn,{label:"Thickness map path",placeholder:"materials/body-thickness.jpg",value:t?.thicknessMap?.path??"",onChange:d=>c(e,"thicknessMap",d)}),(0,W.jsx)(_o,{label:"Volume tint",value:t?.attenuationColor??"#ffffff",onChange:d=>l(e,S=>({...S,attenuationColor:d}))}),(0,W.jsx)(lM,{label:"Attenuation distance",value:t?.attenuationDistance,min:0,step:.01,placeholder:"Infinity when unset",onChange:d=>l(e,S=>({...S,attenuationDistance:d}))})]})}),(0,W.jsx)(Hr,{panelKey:"faces",requiredTier:b,title:"Faces Rendering",tooltip:"Chooses which side of the mesh renders and how backfaces are handled.",controls:m,children:(0,W.jsx)("div",{className:"bb-grid",children:(0,W.jsx)(Ll,{label:"Side",value:t?.side??"front",options:aM,onChange:d=>l(e,S=>({...S,side:d}))})})})]})}var pM=[{id:"wood",label:"Wood",swatch:"#8b5a2b",material:{baseColor:"#8b5a2b",metalness:0,roughness:.75,reflectivity:.04}},{id:"brushed-metal",label:"Brushed Metal",swatch:"linear-gradient(135deg, #cfcfcf, #8a8a8a)",material:{baseColor:"#c8c8c8",metalness:1,roughness:.35}},{id:"chrome",label:"Polished Chrome",swatch:"linear-gradient(135deg, #ffffff, #9aa0a6)",material:{baseColor:"#e8e8e8",metalness:1,roughness:.05}},{id:"gold",label:"Gold",swatch:"linear-gradient(135deg, #ffe9a8, #c89b2c)",material:{baseColor:"#e6b325",metalness:1,roughness:.2}},{id:"copper",label:"Copper",swatch:"linear-gradient(135deg, #e3a576, #8a4a26)",material:{baseColor:"#b87333",metalness:1,roughness:.3}},{id:"glass",label:"Glass",swatch:"linear-gradient(135deg, rgba(255,255,255,0.9), rgba(180,210,230,0.4))",material:{baseColor:"#ffffff",metalness:0,roughness:.02,reflectivity:.5,opacity:1,transmission:1,thickness:.5,attenuationColor:"#ffffff",attenuationDistance:1}},{id:"frosted-glass",label:"Frosted Glass",swatch:"linear-gradient(135deg, rgba(255,255,255,0.85), rgba(210,225,235,0.6))",material:{baseColor:"#ffffff",metalness:0,roughness:.4,reflectivity:.3,opacity:1,transmission:.9,thickness:.5}},{id:"plastic-glossy",label:"Glossy Plastic",swatch:"#dadada",material:{baseColor:"#dadada",metalness:0,roughness:.25,reflectivity:.5,clearcoat:.3,clearcoatRoughness:.1}},{id:"plastic-matte",label:"Matte Plastic",swatch:"#9a9a9a",material:{baseColor:"#9a9a9a",metalness:0,roughness:.85,reflectivity:.04}},{id:"rubber",label:"Rubber",swatch:"#1a1a1a",material:{baseColor:"#1a1a1a",metalness:0,roughness:.9,reflectivity:.02}},{id:"fabric",label:"Fabric",swatch:"#9c8a6b",material:{baseColor:"#9c8a6b",metalness:0,roughness:.95,sheen:.4,sheenColor:"#ffffff",sheenRoughness:.6}},{id:"ceramic",label:"Ceramic",swatch:"#f5f5f0",material:{baseColor:"#f5f5f0",metalness:0,roughness:.15,clearcoat:.6,clearcoatRoughness:.1}},{id:"concrete",label:"Concrete",swatch:"#9b9b93",material:{baseColor:"#9b9b93",metalness:0,roughness:.95,reflectivity:.03}}];var Dl=require("react/jsx-runtime");function mM({disabled:e,onApply:t}){return(0,Dl.jsx)("div",{className:"bb-presetGallery",children:pM.map(n=>(0,Dl.jsxs)("button",{type:"button",className:"bb-presetSwatch",disabled:e,title:`Apply ${n.label} preset`,onClick:()=>t(n.material),children:[(0,Dl.jsx)("span",{className:"bb-presetSwatchColor",style:{background:n.swatch}}),(0,Dl.jsx)("span",{className:"bb-presetSwatchLabel",children:n.label})]},n.id))})}var ai=require("react/jsx-runtime");function hM({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r,idError:o}){return(0,ai.jsx)(dr,{title:"Identity",open:n,onToggle:i,children:(0,ai.jsxs)("div",{className:"bb-grid",children:[(0,ai.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,ai.jsx)("label",{className:"bb-label",children:"Model Node ID"}),(0,ai.jsx)("span",{className:"bb-note",children:"This is the exact mesh name from the imported model and stays locked."}),(0,ai.jsx)("input",{className:"bb-input bb-readonly",value:t.modelObjectId,readOnly:!0})]}),(0,ai.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,ai.jsx)("label",{className:"bb-label",children:"ID"}),(0,ai.jsx)("input",{className:`bb-input ${o?"bb-input--error":""}`,value:t.id,onChange:a=>r(e,s=>({...s,id:a.target.value}))}),o?(0,ai.jsx)("span",{className:"bb-status bb-status--error",children:o}):null]})]})})}var Md=require("react");var Bt=require("react/jsx-runtime");function fM({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r}){let[o,a]=(0,Md.useState)(t.group??""),[s,l]=(0,Md.useState)(t.tags?.join(", ")??"");(0,Md.useEffect)(()=>{a(t.group??""),l(t.tags?.join(", ")??"")},[e,t.group,t.tags]);let c=()=>{r(e,p=>({...p,group:o.trim()||void 0}))},h=()=>{let p=[...new Set(s.split(",").map(u=>u.trim()).filter(Boolean))];r(e,u=>({...u,tags:p.length>0?p:void 0}))};return(0,Bt.jsxs)(dr,{title:"Basics",open:n,onToggle:i,children:[(0,Bt.jsxs)("div",{className:"bb-grid",children:[(0,Bt.jsxs)("div",{className:"bb-field",children:[(0,Bt.jsx)("label",{className:"bb-label",children:"Label"}),(0,Bt.jsx)("input",{className:"bb-input",value:t.label??"",onChange:p=>r(e,u=>({...u,label:p.target.value}))})]}),(0,Bt.jsxs)("div",{className:"bb-field",children:[(0,Bt.jsx)("label",{className:"bb-label",children:"Type"}),(0,Bt.jsx)("input",{className:"bb-input",list:"binding-type-suggestions",value:t.type??"other",onChange:p=>r(e,u=>({...u,type:p.target.value}))}),(0,Bt.jsx)("datalist",{id:"binding-type-suggestions",children:J_.map(p=>(0,Bt.jsx)("option",{value:p},p))})]}),(0,Bt.jsxs)("div",{className:"bb-field",children:[(0,Bt.jsx)("label",{className:"bb-label",children:"Status"}),(0,Bt.jsx)("select",{className:"bb-select",value:t.status??"normal",onChange:p=>r(e,u=>({...u,status:p.target.value})),children:xm.map(p=>(0,Bt.jsx)("option",{value:p,children:p},p))})]}),(0,Bt.jsxs)("div",{className:"bb-field",children:[(0,Bt.jsx)("label",{className:"bb-label",children:"Group"}),(0,Bt.jsx)("input",{className:"bb-input",placeholder:"paint",value:o,onChange:p=>a(p.target.value),onBlur:c,onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})]}),(0,Bt.jsxs)("div",{className:"bb-field",children:[(0,Bt.jsx)("label",{className:"bb-label",children:"Tags"}),(0,Bt.jsx)("input",{className:"bb-input",placeholder:"exterior, configurable",value:s,onChange:p=>l(p.target.value),onBlur:h,onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})]})]}),(0,Bt.jsxs)("div",{className:"bb-checkboxRow",style:{marginTop:12},children:[(0,Bt.jsxs)("label",{className:"bb-checkbox",children:[(0,Bt.jsx)("input",{type:"checkbox",checked:t.selectable??!1,onChange:p=>r(e,u=>({...u,selectable:p.target.checked}))}),"selectable"]}),(0,Bt.jsxs)("label",{className:"bb-checkbox",children:[(0,Bt.jsx)("input",{type:"checkbox",checked:t.hoverable??!1,onChange:p=>r(e,u=>({...u,hoverable:p.target.checked}))}),"hoverable"]}),(0,Bt.jsxs)("label",{className:"bb-checkbox",children:[(0,Bt.jsx)("input",{type:"checkbox",checked:t.visible??!1,onChange:p=>r(e,u=>({...u,visible:p.target.checked}))}),"visible"]})]})]})}var Mm=require("react");var lt=require("react/jsx-runtime"),gM=Ba.filter(e=>e.handling==="viewer"),VR=Ba.filter(e=>e.handling==="host");function bM({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r,takesImage:o=!0}){let[a,s]=(0,Mm.useState)(new Set);(0,Mm.useEffect)(()=>{s(new Set)},[e]);let l=t.actions??[],c=(u,m)=>r(e,f=>({...f,actions:(f.actions??[]).map((g,b)=>b===u?m(g):g)})),h=u=>{r(e,m=>({...m,actions:(m.actions??[]).filter((f,g)=>g!==u)})),s(m=>{let f=new Set;return m.forEach(g=>{g<u?f.add(g):g>u&&f.add(g-1)}),f})},p=(u,m)=>s(f=>{let g=new Set(f);return m?g.add(u):g.delete(u),g});return(0,lt.jsxs)(dr,{title:"Actions",open:n,onToggle:i,children:[(0,lt.jsx)("div",{className:"bb-actionList",children:l.map((u,m)=>{let f=fc(u.id),g=a.has(m)||!f,b=u.id.trim(),x=f?null:Ax(u.id),v=b.length>0&&l.some((w,M)=>M!==m&&w.id.trim()===b);return(0,lt.jsxs)("div",{className:"bb-actionCard",children:[(0,lt.jsxs)("div",{className:"bb-actionCardHeader",children:[(0,lt.jsxs)("div",{className:"bb-actionCardTitle",children:["Action ",m+1]}),(0,lt.jsx)("div",{className:"bb-actionCardMeta",children:u.type})]}),(0,lt.jsxs)("div",{className:"bb-actionGrid",children:[(0,lt.jsxs)("div",{className:"bb-field",children:[(0,lt.jsx)("label",{className:"bb-label",children:"Action ID"}),(0,lt.jsxs)("select",{className:"bb-select",value:g?gu:u.id,onChange:w=>{let M=w.target.value;if(M===gu){p(m,!0);return}p(m,!1);let _=fc(M);c(m,y=>({...y,id:M,label:_&&kh(y.label)?_.label:y.label}))},children:[(0,lt.jsx)("optgroup",{label:"Handled by the viewer",children:gM.map(w=>(0,lt.jsx)("option",{value:w.id,children:w.id},w.id))}),(0,lt.jsx)("optgroup",{label:"Handled by your app",children:VR.map(w=>(0,lt.jsx)("option",{value:w.id,children:w.id},w.id))}),(0,lt.jsx)("option",{value:gu,children:"Custom\u2026"})]})]}),g?(0,lt.jsxs)("div",{className:"bb-field",children:[(0,lt.jsx)("label",{className:"bb-label",children:"Custom action ID"}),(0,lt.jsx)("input",{className:"bb-input",value:u.id,placeholder:"open-datasheet",onChange:w=>{p(m,!0),c(m,M=>({...M,id:w.target.value}))}})]}):null,(0,lt.jsxs)("div",{className:"bb-field",children:[(0,lt.jsx)("label",{className:"bb-label",children:"Label"}),(0,lt.jsx)("input",{className:"bb-input",value:u.label,onChange:w=>c(m,M=>({...M,label:w.target.value}))})]}),f?.id==="change-material"&&!o?(0,lt.jsx)("span",{className:"bb-note",style:{color:"#fcd34d"},children:"This object has no texture coordinates, so an image picked here can't be placed on it, and the viewer says so. Change Color and Add Image work."}):f?(0,lt.jsx)("span",{className:"bb-note",children:f.description}):b.length===0?(0,lt.jsx)("span",{className:"bb-note",style:{color:"#fca5a5"},children:"An action ID is required, the button renders but can never be identified in onAction."}):(0,lt.jsxs)("span",{className:"bb-note",style:{color:"#fcd34d"},children:["Unrecognised ID, the viewer has no built-in behavior for it. Add declarative effects and execute them with useViewerActions, or handle it in onAction.",x?(0,lt.jsxs)(lt.Fragment,{children:[" Did you mean ",(0,lt.jsx)("button",{type:"button",className:"bb-linkButton",onClick:()=>{p(m,!1);let w=fc(x);c(m,M=>({...M,id:x,label:w&&kh(M.label)?w.label:M.label}))},children:x}),"?"]}):null]}),u.effects?.length?(0,lt.jsxs)("span",{className:"bb-note",children:[u.effects.length," declarative effect",u.effects.length===1?"":"s",", execute with useViewerActions."]}):null,v?(0,lt.jsx)("span",{className:"bb-note",style:{color:"#fcd34d"},children:"Another action on this binding uses the same ID, they will render as two identical buttons."}):null]}),(0,lt.jsx)("div",{className:"bb-actionFooter",children:(0,lt.jsx)("button",{type:"button",className:"bb-button bb-button--ghost bb-actionRemove",onClick:()=>h(m),children:"Remove Action"})})]},m)})}),(0,lt.jsx)("div",{style:{marginTop:10},children:(0,lt.jsx)("button",{type:"button",className:"bb-button",onClick:()=>{let u=gM.find(m=>!l.some(f=>f.id===m.id));r(e,m=>({...m,actions:[...m.actions??[],{id:u?.id??"",label:u?.label??"New Action",type:"command"}]})),u||p(l.length,!0)},children:"Add Action"})})]})}var xM=require("react"),da=require("lucide-react");var it=require("react/jsx-runtime"),vM=()=>`decal-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function yM({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r,placement:o,onPlacementChange:a,defaultSize:s,onImageFile:l,onNudge:c}){let{tier:h}=Rr(),p=(0,xM.useRef)(null),u=t.decals??[],m=o?.nodeKey===e?o:null,f=x=>r(e,v=>({...v,decals:x.length>0?x:void 0})),g=(x,v)=>f(u.map(w=>w.id===x?{...w,...v}:w)),b=x=>{x.image&&yc(x.image),m?.decal.id===x.id&&a(null),f(u.filter(v=>v.id!==x.id))};return(0,it.jsx)(dr,{title:"Decals",open:n,onToggle:i,tooltip:"Print a logo, image, or text on the selected object's surface.",children:Ai(h,"starter")?(0,it.jsxs)(it.Fragment,{children:[(0,it.jsxs)("div",{className:"bb-decalActions",children:[(0,it.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:()=>p.current?.click(),children:[(0,it.jsx)(da.ImagePlus,{size:15})," Add image"]}),(0,it.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:()=>a({nodeKey:e,decal:{id:vM(),text:"Your text",color:"#ffffff",size:s}}),children:[(0,it.jsx)(da.Type,{size:15})," Add text"]}),(0,it.jsx)("input",{ref:p,type:"file",accept:"image/png,image/jpeg,image/webp,image/avif,image/svg+xml",className:"bb-hiddenInput",onChange:x=>{let v=x.target.files?.[0];if(x.target.value="",!v)return;let w=_u(v);za(w,URL.createObjectURL(v)),l?.(w,v),a({nodeKey:e,decal:{id:vM(),image:w,size:s}})}})]}),u.length===0&&!m?(0,it.jsx)("div",{className:"bb-decalEmpty",children:"No decals on this object yet."}):null,u.map(x=>(0,it.jsxs)("div",{className:"bb-decalCard",children:[(0,it.jsxs)("div",{className:"bb-decalCardHeader",children:[(0,it.jsx)("span",{className:"bb-decalKind",children:x.image?"Image":"Text"}),(0,it.jsx)("span",{className:"bb-decalName",title:x.image??x.text,children:x.image??x.text}),(0,it.jsx)("button",{type:"button",className:"bb-iconButton",title:"Move: drag the decal in the preview","aria-label":"Move decal","aria-pressed":m?.decal.id===x.id,onClick:()=>{let{position:v,normal:w,...M}=x;a(m?.decal.id===x.id?null:{nodeKey:e,decal:M,moving:!0})},children:(0,it.jsx)(da.Move,{size:15})}),(0,it.jsx)("button",{type:"button",className:"bb-iconButton bb-iconButton--danger",title:"Delete decal","aria-label":"Delete decal",onClick:()=>b(x),children:(0,it.jsx)(da.Trash2,{size:15})})]}),(0,it.jsx)(bu,{onNudge:v=>c(x.id,v)}),(0,it.jsxs)("div",{className:"bb-grid",children:[x.image?null:(0,it.jsxs)(it.Fragment,{children:[(0,it.jsxs)("div",{className:"bb-field bb-field--full",children:[(0,it.jsx)("label",{className:"bb-label",children:"Text"}),(0,it.jsx)("input",{className:"bb-input",value:x.text??"",onChange:v=>g(x.id,{text:v.target.value})})]}),(0,it.jsx)(_o,{label:"Colour",variant:"input",value:x.color??"#ffffff",onChange:v=>g(x.id,{color:v})}),(0,it.jsxs)("div",{className:"bb-field",children:[(0,it.jsx)("label",{className:"bb-label",children:"Weight"}),(0,it.jsxs)("select",{className:"bb-input bb-decalWeight",value:x.fontWeight??"bold",onChange:v=>g(x.id,{fontWeight:v.target.value}),children:[(0,it.jsx)("option",{value:"bold",children:"Bold"}),(0,it.jsx)("option",{value:"normal",children:"Regular"})]})]})]}),(0,it.jsx)(Ot,{label:"Size",value:Number(x.size.toFixed(4)),min:Number((s/20).toPrecision(2)),max:Number((s*6).toPrecision(2)),step:Number((s/50).toPrecision(1)),onChange:v=>v!==void 0&&v>0&&g(x.id,{size:v})}),(0,it.jsx)(Ot,{label:"Rotation (\xB0)",value:Math.round((x.rotation??0)*180/Math.PI),min:-180,max:180,step:1,onChange:v=>g(x.id,{rotation:(v??0)*Math.PI/180})}),(0,it.jsx)(Ot,{label:"Opacity",value:x.opacity??1,min:0,max:1,step:.05,onChange:v=>g(x.id,{opacity:v??1})})]})]},x.id))]}):(0,it.jsx)(ir,{requiredTier:"starter",feature:"Decals"})})}var Cm=require("lucide-react");var It=require("react/jsx-runtime");function wM({selectedBinding:e,open:t,onToggle:n,cameraState:i,formattedCameraState:r,savedCameraPosition:o,onSaveCameraPosition:a,onGoToSavedCamera:s,onClearSavedCamera:l,onResetView:c,onFitScene:h}){return(0,It.jsxs)(dr,{title:"Camera Position",open:t,onToggle:n,children:[(0,It.jsxs)("div",{className:"se-waypointCard bb-cameraWaypoint",children:[(0,It.jsx)("span",{className:"bb-cameraLiveBadge",children:"LIVE"}),(0,It.jsxs)("div",{className:"se-waypointBody",children:[(0,It.jsx)("div",{className:"bb-cameraWaypointLabel",children:"Current view"}),i?(0,It.jsxs)(It.Fragment,{children:[(0,It.jsxs)("div",{className:"se-waypointCoords",children:["pos ",r?.position]}),(0,It.jsxs)("div",{className:"se-waypointCoords",children:["look ",r?.target]})]}):(0,It.jsx)("div",{className:"se-waypointCoords",children:"Move the camera to see live position"})]})]}),(0,It.jsxs)("div",{className:"bb-cameraControls bb-cameraControls--centered",children:[(0,It.jsx)("button",{type:"button",className:"bb-button bb-button--primary",onClick:a,disabled:!i,children:"Save"}),(0,It.jsx)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:c,children:"Reset View"}),(0,It.jsx)("button",{type:"button",className:"bb-button bb-button--ghost",onClick:h,children:"Fit Scene"})]}),o?.position&&o?.target&&(0,It.jsxs)("div",{className:"se-waypointCard bb-cameraWaypoint",children:[(0,It.jsx)("span",{className:"bb-cameraSavedBadge",children:"SAVED"}),(0,It.jsxs)("div",{className:"se-waypointBody",children:[(0,It.jsxs)("div",{className:"bb-cameraWaypointLabel",children:["For ",e.label]}),(0,It.jsxs)("div",{className:"se-waypointCoords",children:["pos [",o.position.map(p=>p.toFixed(1)).join(", "),"]"]}),(0,It.jsxs)("div",{className:"se-waypointCoords",children:["look [",o.target.map(p=>p.toFixed(1)).join(", "),"]"]})]}),(0,It.jsxs)("div",{className:"se-waypointActions",children:[(0,It.jsx)("button",{className:"se-waypointAction",onClick:s,title:"Fly camera to the saved position",children:(0,It.jsx)(Cm.MapPin,{size:15})}),(0,It.jsx)("button",{className:"se-waypointAction se-waypointAction--delete",onClick:l,title:"Delete saved position",children:(0,It.jsx)(Cm.Trash2,{size:15})})]})]}),(0,It.jsx)("span",{className:"bb-note",children:'Tip: Position the camera how you want, then click "Save" to store this position for the selected object. The camera position updates in real-time as you navigate.'})]})}var Nl=require("react"),Tm=require("lucide-react");var ct=require("react/jsx-runtime"),SM=["X","Y","Z"];var FR=.1;function Gg(e){let t=e%360;return t<0?t+360:t}function _M(e){return Gg(e*180/Math.PI)}function MM(e){return e*Math.PI/180}function jR(e,t,n){let i=[...e],r=_M(e[t]);return i[t]=MM(Gg(r+n)),i}function CM({value:e,min:t=-1/0,max:n=1/0,step:i=.1,disabled:r=!1,onChange:o,formatValue:a=c=>Number(c.toFixed(3)),ariaLabel:s,className:l}){let c=a(e),[h,p]=(0,Nl.useState)(String(c)),u=(0,Nl.useRef)(!1);return(0,Nl.useLayoutEffect)(()=>{u.current||p(String(c))},[c]),(0,ct.jsx)("input",{type:"number",className:l,step:i,min:t===-1/0?void 0:t,max:n===1/0?void 0:n,value:h,disabled:r,"aria-label":s,onFocus:()=>{u.current=!0},onChange:m=>{let f=m.target.value;if(p(f),f===""||f==="-")return;let g=Number(f);if(Number.isFinite(g)){let b=Math.max(t,Math.min(n,g));o(b)}},onBlur:()=>{u.current=!1,p(String(a(e)))}})}function GR({value:e,min:t=-1/0,max:n=1/0,step:i=.1,disabled:r=!1,onChange:o,formatValue:a=l=>Number(l.toFixed(3)),label:s}){return(0,ct.jsx)("div",{className:"bb-transformAxesGrid",children:SM.map((l,c)=>(0,ct.jsxs)("div",{className:"bb-transformAxis",children:[(0,ct.jsx)("span",{className:"se-axisStepperLabel bb-transformAxisLabel",children:l}),(0,ct.jsx)("div",{className:"bb-transformAxisControl",children:(0,ct.jsx)(CM,{className:"se-numberInput bb-transformNumberInput",step:i,min:t,max:n,value:e[c],disabled:r,formatValue:a,ariaLabel:`${l} ${s?.toLowerCase()||""}`,onChange:h=>{let p=[...e];p[c]=h,o(p)}})})]},l))})}function TM({selectedItem:e,selectedBinding:t,open:n,onToggle:i,updateBinding:r,moveModeEnabled:o,onToggleMoveMode:a,transformSpace:s,onTransformSpaceChange:l,originalTransform:c}){let h=t.transform?.rotation??c?.rotation??[0,0,0],p=t.transform?.position??c?.position??[0,0,0],u=(v,w)=>{let M=v.transform?.rotation??c?.rotation??[0,0,0],_=v.transform?.position??c?.position??[0,0,0],y=v.transform?.scale??c?.scale??[1,1,1],P=c?.pivotLocal??[0,0,0],d=pS(_,M,w,y,P,c?.rotationOrder??"XYZ");return{...v,transform:{...v.transform,position:d,rotation:w}}},m=(v,w)=>{e&&r(e,M=>{let _=M.transform?.rotation??c?.rotation??[0,0,0],y=jR(_,v,w);return u(M,y)})},f=(v,w)=>{e&&r(e,M=>{let y=[...M.transform?.rotation??c?.rotation??[0,0,0]];return y[v]=MM(Gg(w)),u(M,y)})},g=(v,w)=>{e&&r(e,M=>{let y=[...M.transform?.position??c?.position??[0,0,0]];return y[v]=w,{...M,transform:{...M.transform,position:y}}})},b=(v,w)=>{e&&g(v,p[v]+w)},x=()=>{!e||!c||r(e,v=>{let w={...v.transform};return delete w.position,delete w.rotation,{...v,transform:Object.keys(w).length>0?w:void 0}})};return(0,ct.jsxs)(dr,{title:"Move & Rotate",open:n,onToggle:i,tooltip:"Enable the transform gizmo to move or rotate the selected mesh on any axis. Rotation uses the object's visible center while exported position and rotation remain local GLTF transforms.",children:[(0,ct.jsxs)("div",{className:"se-field",children:[(0,ct.jsxs)("div",{className:"se-fieldLabel",children:[(0,ct.jsxs)("span",{children:[(0,ct.jsx)(Tm.Move3d,{size:14,style:{marginRight:6,verticalAlign:"-2px"}}),"Transform gizmo"]}),(0,ct.jsxs)("label",{className:"se-switch","aria-label":"Toggle move mode",children:[(0,ct.jsx)("input",{type:"checkbox",checked:o,onChange:v=>a(v.target.checked)}),(0,ct.jsx)("span",{className:"se-switchTrack",children:(0,ct.jsx)("span",{className:"se-switchThumb"})})]})]}),(0,ct.jsx)("span",{className:"bb-note",children:"Select a mesh \xB7 drag the colored arrows or planes to move"})]}),(0,ct.jsxs)("div",{className:"se-field",style:{marginTop:10},children:[(0,ct.jsx)("div",{className:"se-fieldLabel",children:(0,ct.jsx)("span",{children:"Axis space"})}),(0,ct.jsx)("div",{className:"se-segmentedControl",children:["world","local"].map(v=>(0,ct.jsx)("button",{type:"button",className:`se-segmentedOption ${s===v?"se-segmentedOption--active":""}`,onClick:()=>l(v),children:v},v))})]}),(0,ct.jsxs)("div",{className:"se-field",style:{marginTop:10},children:[(0,ct.jsx)("div",{className:"se-fieldLabel",children:(0,ct.jsx)("span",{children:"Rotation (degrees)"})}),(0,ct.jsx)("div",{className:"bb-transformAxesGrid",children:SM.map((v,w)=>{let M=Math.round(_M(h[w]));return(0,ct.jsxs)("div",{className:"bb-transformAxis",children:[(0,ct.jsx)("span",{className:"se-axisStepperLabel bb-transformAxisLabel",children:v}),(0,ct.jsx)("div",{className:"bb-transformAxisControl",children:(0,ct.jsx)(CM,{className:"se-numberInput bb-transformNumberInput",step:1,min:0,max:359,value:M,disabled:!e,formatValue:_=>Math.round(_),ariaLabel:`${v} rotation in degrees`,onChange:_=>f(w,_)})})]},v)})})]}),(0,ct.jsxs)("div",{className:"se-field",style:{marginTop:10},children:[(0,ct.jsx)("div",{className:"se-fieldLabel",children:(0,ct.jsx)("span",{children:"Position"})}),(0,ct.jsx)(GR,{value:p,min:-1/0,max:1/0,step:FR,disabled:!e,label:"position",onChange:v=>{e&&r(e,w=>({...w,transform:{...w.transform,position:v}}))}})]}),(0,ct.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",style:{marginTop:10,display:"inline-flex",alignItems:"center",gap:6},disabled:!e||!c,onClick:x,title:"Restore this node's position and rotation to what they were in the original model",children:[(0,ct.jsx)(Tm.RotateCcw,{size:14}),"Restore original position & rotation"]})]})}var ps=require("react"),PM=require("lucide-react");var wn=require("react/jsx-runtime"),AM=(0,ps.memo)(HR);function HR({bindings:e,selectedItem:t,onSelect:n,onHover:i,isOpen:r=!0,onToggle:o,isolatedItem:a=null,onIsolate:s}){let[l,c]=(0,ps.useState)(""),h=(0,ps.useMemo)(()=>Object.keys(e),[e]),p=(0,ps.useMemo)(()=>{let u=l.trim().toLowerCase();return u?h.filter(m=>{let f=e[m];return m.toLowerCase().includes(u)||f.label?.toLowerCase().includes(u)||(f.type??"other").toLowerCase().includes(u)}):h},[e,h,l]);return(0,wn.jsxs)("aside",{className:`bb-sidebar bb-sidebar--right ${r?"":"bb-sidebar--collapsed"}`,children:[(0,wn.jsxs)("div",{className:"bb-header bb-header--sidebar",children:[!r&&(0,wn.jsx)("button",{type:"button",className:"bb-sidebarToggle",onClick:()=>o?.(!0),"aria-label":"Open scene nodes sidebar",title:"Open scene nodes",children:"\u2190"}),r&&(0,wn.jsxs)(wn.Fragment,{children:[(0,wn.jsxs)("div",{children:[(0,wn.jsx)("div",{className:"bb-sectionKicker",children:"Scene Nodes"}),(0,wn.jsxs)("div",{className:"bb-sectionHeading",children:[p.length," visible entries"]})]}),(0,wn.jsx)("button",{type:"button",className:"bb-sidebarToggle",onClick:()=>o?.(!1),"aria-label":"Close scene nodes sidebar",title:"Close scene nodes",children:"\u2192"})]})]}),r&&(0,wn.jsxs)("section",{className:"bb-nodeList",children:[(0,wn.jsx)("div",{className:"bb-search",children:(0,wn.jsx)("input",{className:"bb-input",placeholder:"Search nodes, labels, or types",value:l,onChange:u=>c(u.target.value)})}),(0,wn.jsx)("div",{className:"bb-nodeItems",children:p.map(u=>{let m=e[u],f=u===t,g=u===a;return(0,wn.jsxs)("div",{className:`bb-nodeRow ${a&&!g?"bb-nodeRow--setAside":""}`,children:[(0,wn.jsxs)("button",{type:"button",className:`bb-nodeButton ${f?"bb-nodeButton--active":""}`,onClick:()=>n(u),onMouseEnter:()=>i?.(u),onMouseLeave:()=>i?.(null),children:[(0,wn.jsx)("span",{className:"bb-nodeName",children:u}),(0,wn.jsxs)("span",{className:"bb-nodeMeta",children:[m.type??"other",m.label===bg(u)?"":m.label||"\xB7 Untitled"]})]}),s?(0,wn.jsx)("button",{type:"button",className:`bb-nodeIsolate ${g?"bb-nodeIsolate--active":""}`,onClick:()=>s(g?null:u),title:g?"Show all":"Isolate in the preview","aria-label":`${g?"Show all":"Isolate"} ${u}`,"aria-pressed":g,children:(0,wn.jsx)(PM.Focus,{size:14,"aria-hidden":"true"})}):null]},u)})})]})]})}var ua=require("react/jsx-runtime");function Hg({title:e,label:t,open:n,onToggle:i,draft:r,error:o,example:a,onDraftChange:s,onCommit:l}){return(0,ua.jsx)(dr,{title:e,open:n,onToggle:i,children:(0,ua.jsxs)("div",{className:"bb-field",children:[(0,ua.jsx)("label",{className:"bb-label",children:t}),(0,ua.jsx)("textarea",{className:"bb-textarea",value:r,onChange:c=>s(c.target.value),onBlur:l}),o?(0,ua.jsx)("span",{className:"bb-status bb-status--error",children:o}):(0,ua.jsxs)("span",{className:"bb-note",children:["Use a JSON object like ",a,"."]})]})})}function EM(e,t){let n=new Map(e.animations.clips.map(o=>[o.sourceName,o])),i=t.map(({sourceName:o})=>n.get(o)??{sourceName:o,displayName:o,hidden:!1,loopMode:"repeat",speed:1}),r=e.animations.autoplayClip&&i.some(o=>o.sourceName===e.animations.autoplayClip&&!o.hidden)?e.animations.autoplayClip:null;return{clips:i,autoplayClip:r}}function Pm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Cd(e,t){if(!Pm(e)||!Pm(t))return t??e;let n={...e};for(let[i,r]of Object.entries(t)){let o=n[i];n[i]=Pm(o)&&Pm(r)?Cd(o,r):r}return n}var Hi=require("react"),WR=100;function XR(e,t){switch(t.type){case"set":{let n=typeof t.updater=="function"?t.updater(e.present):t.updater;if(n===e.present)return e;let i=t.track?e.edits+1:e.edits,r=!t.track&&e.edits===0?n:e.baseline;return t.coalesce?{...e,present:n,future:[],edits:i,baseline:r}:{past:[...e.past,e.present].slice(-WR),present:n,future:[],edits:i,baseline:r}}case"undo":{if(e.past.length===0)return e;let n=e.past[e.past.length-1];return{...e,past:e.past.slice(0,-1),present:n,future:[e.present,...e.future],edits:e.edits+1}}case"redo":{if(e.future.length===0)return e;let[n,...i]=e.future;return{...e,past:[...e.past,e.present],present:n,future:i,edits:e.edits+1}}case"reset":return{past:[],present:t.value,future:[],edits:t.track?e.edits+1:0,baseline:t.track?e.baseline:t.value}}}function Wg(e,t=600){let[n,i]=(0,Hi.useReducer)(XR,{past:[],present:e,future:[],edits:0,baseline:e}),r=(0,Hi.useRef)(0),o=(0,Hi.useCallback)(h=>{let p=Date.now(),u=p-r.current<t;r.current=p,i({type:"set",updater:h,coalesce:u,track:!0})},[t]),a=(0,Hi.useCallback)(h=>{let p=Date.now()-r.current<t;i({type:"set",updater:h,coalesce:p,track:!1})},[t]),s=(0,Hi.useCallback)(()=>{r.current=0,i({type:"undo"})},[]),l=(0,Hi.useCallback)(()=>{r.current=0,i({type:"redo"})},[]),c=(0,Hi.useCallback)((h,p)=>{r.current=0,i({type:"reset",value:h,track:p?.asEdit??!1})},[]);return{value:n.present,setValue:o,setValueUntracked:a,undo:s,redo:l,reset:c,canUndo:n.past.length>0,canRedo:n.future.length>0,edits:n.edits,baseline:n.baseline}}var Ol=require("react");var qR=500;function RM({autosaveEnabled:e,hasEdits:t,modelUrl:n,bindings:i,sceneConfig:r,onTextureUpload:o,modelSourceRef:a,pendingLoadRef:s,storedModelKeyRef:l,pendingAutosaveRef:c,autosaveFailureShownRef:h,setStatusMessage:p,setStatusTone:u}){let m=(0,Ol.useCallback)(async(f,g)=>{if(o)return o(f,g);let b=URL.createObjectURL(f);if(e)try{await mm(b,f)}catch(x){console.warn("[BindingBuilder] Could not store texture file for autosave:",x)}return b},[o,e]);return(0,Ol.useEffect)(()=>{if(!e||!t||!n)return;let f=a.current;if(!f)return;let g=()=>{if(c.current===g&&(c.current=null),s.current)return;let{model:x,file:v}=f,w=x.kind==="file"&&l.current!==x.key?v:void 0;m_({model:x,bindings:i,sceneConfig:r},w).then(()=>{l.current=x.kind==="file"?x.key:null,h.current=!1}).catch(M=>{console.warn("[BindingBuilder] Autosave failed:",M),!h.current&&(h.current=!0,p("Couldn't autosave this session \u2014 the browser refused to store it, possibly for lack of space. Export your work to keep it."),u("error"))})};c.current=g;let b=window.setTimeout(g,qR);return()=>window.clearTimeout(b)},[e,t,n,i,r]),(0,Ol.useEffect)(()=>{if(!e)return;let f=()=>c.current?.(),g=()=>{document.visibilityState==="hidden"&&f()};return window.addEventListener("pagehide",f),document.addEventListener("visibilitychange",g),()=>{window.removeEventListener("pagehide",f),document.removeEventListener("visibilitychange",g),f()}},[e]),(0,Ol.useEffect)(()=>{if(!e||!n||!t)return;let f=g=>{c.current?.(),g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[e,n,t]),{handleTextureUpload:m}}var ma=require("lucide-react");var Bl=require("react"),pa=require("lucide-react"),Ei=require("react/jsx-runtime");function kM({disabled:e,exporting:t,onExportJson:n,onExportTs:i}){let[r,o]=(0,Bl.useState)(!1),a=(0,Bl.useRef)(null);return(0,Bl.useEffect)(()=>{if(!r)return;let s=l=>{a.current?.contains(l.target)||o(!1)};return window.addEventListener("pointerdown",s),()=>window.removeEventListener("pointerdown",s)},[r]),(0,Ei.jsxs)("div",{className:"bb-exportMenuWrapper",ref:a,children:[(0,Ei.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",disabled:e||t,onClick:()=>o(s=>!s),title:"Export",children:[(0,Ei.jsx)(pa.Download,{size:14}),t?"Exporting\u2026":"Export",(0,Ei.jsx)(pa.ChevronDown,{size:12})]}),r&&(0,Ei.jsxs)("div",{className:"bb-exportMenu",children:[(0,Ei.jsxs)("button",{type:"button",className:"bb-exportMenuItem",onClick:()=>{o(!1),n()},children:[(0,Ei.jsx)(pa.FileJson,{size:14}),"JSON"]}),(0,Ei.jsxs)("button",{type:"button",className:"bb-exportMenuItem",onClick:()=>{o(!1),i()},children:[(0,Ei.jsx)(pa.FileCode2,{size:14}),"TypeScript"]})]})]})}var vr=require("react/jsx-runtime");function Xg({canUndo:e,canRedo:t,onUndo:n,onRedo:i,onReset:r,resetDisabled:o,resetTitle:a,onImport:s,importDisabled:l,importTitle:c,exportDisabled:h,exporting:p,onExportJson:u,onExportTs:m}){return(0,vr.jsxs)("div",{className:"bb-toolbar",children:[(0,vr.jsxs)("div",{className:"bb-toolbarGroup",children:[(0,vr.jsx)("button",{type:"button",className:"bb-iconButton",disabled:!e,onClick:n,title:"Undo (Cmd/Ctrl+Z)",children:(0,vr.jsx)(ma.Undo2,{size:16})}),(0,vr.jsx)("button",{type:"button",className:"bb-iconButton",disabled:o,onClick:r,title:a,children:(0,vr.jsx)(ma.ListRestart,{size:16})}),(0,vr.jsx)("button",{type:"button",className:"bb-iconButton",disabled:!t,onClick:i,title:"Redo (Cmd/Ctrl+Shift+Z)",children:(0,vr.jsx)(ma.Redo2,{size:16})})]}),(0,vr.jsx)("div",{className:"bb-toolbarDivider"}),(0,vr.jsxs)("button",{type:"button",className:"bb-button bb-button--ghost",disabled:l,onClick:s,title:c,children:[(0,vr.jsx)(ma.Upload,{size:14}),"Import"]}),(0,vr.jsx)("div",{className:"bb-toolbarDivider"}),(0,vr.jsx)(kM,{disabled:h,exporting:p,onExportJson:u,onExportTs:m})]})}var ms=require("lucide-react"),Et=require("react/jsx-runtime");function $R(e){let t=new Date(e);return t.toDateString()===new Date().toDateString()?`today at ${t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}`:t.toLocaleString([],{dateStyle:"medium",timeStyle:"short"})}function LM({target:e,onCancel:t,onConfirm:n}){return(0,Et.jsx)("div",{className:"bb-reset-overlay",onClick:t,children:(0,Et.jsxs)("div",{className:"bb-reset-dialog",onClick:i=>i.stopPropagation(),children:[(0,Et.jsxs)("div",{className:"bb-reset-header",children:[(0,Et.jsxs)("h3",{className:"bb-reset-title",children:[(0,Et.jsx)(ms.AlertTriangle,{size:20,className:"bb-icon-warning"}),"Confirm Reset"]}),(0,Et.jsx)("button",{className:"bb-reset-close",onClick:t,children:(0,Et.jsx)(ms.X,{size:20})})]}),(0,Et.jsxs)("div",{className:"bb-reset-body",children:[(0,Et.jsxs)("p",{className:"bb-reset-message",children:["Are you sure you want to reset"," ",(0,Et.jsx)("strong",{children:e==="bindings"?"Object Bindings":"Scene Config"}),"?"]}),(0,Et.jsx)("p",{className:"bb-reset-details",children:e==="bindings"?"This will remove all your custom changes to object properties, groups, tags, transforms, materials, actions, camera positions, metrics, and metadata.":"This will restore all scene settings (camera, lighting, environment, background, animations, annotations, etc.) to their default values."}),(0,Et.jsx)("p",{className:"bb-reset-warning",children:"This action cannot be undone!"})]}),(0,Et.jsxs)("div",{className:"bb-reset-footer",children:[(0,Et.jsx)("button",{className:"bb-reset-btn",onClick:t,children:"Cancel"}),(0,Et.jsx)("button",{className:"bb-reset-btn-danger",onClick:n,children:"Reset"})]})]})})}function DM({modelName:e,savedAt:t,onCancel:n,onConfirm:i}){return(0,Et.jsx)("div",{className:"bb-reset-overlay",onClick:n,children:(0,Et.jsxs)("div",{className:"bb-reset-dialog",onClick:r=>r.stopPropagation(),children:[(0,Et.jsxs)("div",{className:"bb-reset-header",children:[(0,Et.jsxs)("h3",{className:"bb-reset-title",children:[(0,Et.jsx)(ms.History,{size:20,className:"bb-icon-restore"}),"Restore Last Session"]}),(0,Et.jsx)("button",{className:"bb-reset-close",onClick:n,children:(0,Et.jsx)(ms.X,{size:20})})]}),(0,Et.jsxs)("div",{className:"bb-reset-body",children:[(0,Et.jsxs)("p",{className:"bb-reset-message",children:["Restore ",(0,Et.jsx)("strong",{children:e}),", saved ",$R(t),"?"]}),(0,Et.jsx)("p",{className:"bb-reset-details",children:"This reloads that model with its object bindings and scene settings, replacing what's in the editor now."})]}),(0,Et.jsxs)("div",{className:"bb-reset-footer",children:[(0,Et.jsx)("button",{className:"bb-reset-btn",onClick:n,children:"Cancel"}),(0,Et.jsx)("button",{className:"bb-reset-btn-restore",onClick:i,children:"Restore"})]})]})})}var zM=require("fflate");function NM(e){return JSON.stringify(e,null,2)}function OM(e){return['import { defineObjectBindings } from "@liveroom-tech/react-immersive/utils";',"",`export const objectBindings = defineObjectBindings(${JSON.stringify(e,null,2)});`,""].join(`
|
|
3696
|
+
`)}function BM(e){return JSON.stringify(e,null,2)}function IM(e){return['import type { SceneConfig } from "@liveroom-tech/react-immersive/utils";',"",`export const sceneConfig: SceneConfig = ${JSON.stringify(e,null,2)};`,""].join(`
|
|
3697
|
+
`)}function Td(e,t,n){oo(new Blob([t],{type:n}),e)}function qg(e){return JSON.stringify(e??{},null,2)}function $g(e){return`[${e[0].toFixed(3)}, ${e[1].toFixed(3)}, ${e[2].toFixed(3)}]`}function YR(e){return(e.decals??[]).map(t=>t.image).filter(t=>!!t?.trim())}function KR(e){let t=e.style?.material;return t?Object.values(t).filter(n=>!!n&&typeof n=="object"&&typeof n.path=="string"&&n.path.trim().length>0).map(n=>n.path):[]}async function UM(e){let t=new Set;for(let r of Object.values(e)){for(let o of KR(r))t.add(o);for(let o of YR(r))t.add(o)}let n=[],i=[];return await Promise.all(Array.from(t).map(async r=>{let o=Mu(r);if(o)try{let a=await fetch(o);if(!a.ok)throw new Error(String(a.status));n.push({path:r,blob:await a.blob()});return}catch{i.push(r);return}try{let a=await gd(r);a&&n.push({path:r,blob:a})}catch{}})),{assets:n,failedPaths:i}}async function Yg(e,t,n,i,r){if(r.length===0){Td(e,t,n);return}let o={[e]:(0,zM.strToU8)(t)};for(let s of r)o[s.path]=new Uint8Array(await s.blob.arrayBuffer());let a=await ku(o);oo(new Blob([a],{type:"application/zip"}),i)}async function Am(e){return await Promise.all(Object.entries(e).map(async([t,n])=>{for(let r of n.decals??[])if(r.image)try{let o=await gd(r.image);o&&za(r.image,URL.createObjectURL(o))}catch(o){console.warn(`[BindingBuilder] Could not rehydrate a decal image on "${t}":`,o)}let i=n.style?.material;if(i)for(let r of Ii){let a=i[r]?.path;if(a)try{let s=await gd(a);if(!s){console.warn(`[BindingBuilder] No stored texture found for "${t}"'s ${r} ("${a}"). If this is meant to be an uploaded file rather than a hosted URL, it was uploaded before texture autosave existed (or this browser's storage was cleared) \u2014 re-upload it once so it's stored for future restores.`);continue}let l=URL.createObjectURL(s);za(a,l)}catch(s){console.warn(`[BindingBuilder] Could not rehydrate "${t}"'s ${r}:`,s)}}})),e}function VM({bindings:e,setBindings:t,setSceneConfig:n,nodeKeys:i,sceneConfigInputRef:r,setIsExporting:o,setStatusMessage:a,setStatusTone:s}){let l=async f=>{o(!0);try{let{assets:g,failedPaths:b}=await UM(e);f==="json"?await Yg("objectBindings.json",NM(e),"application/json","objectBindings.zip",g):await Yg("objectBindings.ts",OM(e),"text/typescript","objectBindings-ts.zip",g),b.length>0?(a(`Exported, but ${b.length} uploaded image${b.length===1?"":"s"} couldn't be bundled: ${b.join(", ")}.`),s("error")):g.length>0&&(a(`Exported with ${g.length} uploaded image${g.length===1?"":"s"} bundled into the zip.`),s("success"))}catch(g){let b=g instanceof Error?g.message:"Unknown export error.";a(`Failed to export bindings: ${b}`),s("error")}finally{o(!1)}},c=async f=>{if(!i.length){a("Load a model before importing bindings."),s("error");return}let g;try{g=JSON.parse(await f.text())}catch{a(`${f.name} is not valid JSON.`),s("error");return}if(g===null||typeof g!="object"||Array.isArray(g)){a("Expected a JSON object mapping object IDs to bindings."),s("error");return}let b=new Map;for(let y of Object.values(g))if(y!==null&&typeof y=="object"&&typeof y.id=="string"&&typeof y.type=="string"&&typeof y.modelObjectId=="string"){let P=y;b.set(P.modelObjectId,P)}if(b.size===0){a(`${f.name} doesn't look like an exported bindings file.`),s("error");return}let x={...e},v={},w=0;for(let y of Object.keys(x)){let P=b.get(y);P&&(x[y]=P,v[y]=P,w++)}if(w===0){a(`None of the object IDs in ${f.name} match this model \u2014 nothing imported.`),s("error");return}let M=await Am(v);Object.assign(x,M),t(x);let _=b.size-w;a(_>0?`Imported ${w} binding${w===1?"":"s"} from ${f.name} (${_} skipped \u2014 not in this model).`:`Imported ${w} binding${w===1?"":"s"} from ${f.name}.`),s("success")},h=async f=>{let g=f.target.files?.[0];g&&(await c(g),f.target.value="")},p=()=>{r.current?.click()},u=async f=>{let g;try{g=JSON.parse(await f.text())}catch{a(`${f.name} is not valid JSON.`),s("error");return}if(g===null||typeof g!="object"||Array.isArray(g)){a("Expected a JSON object with scene config sections."),s("error");return}let b=["model","camera","lighting","wireframe","shadows","environment","background","groundShadows","postProcessing","animations","annotations","cinematic","styleRules","section"],x=g,v=b.filter(w=>x[w]!==void 0);if(v.length===0){a(`${f.name} doesn't look like an exported scene config file.`),s("error");return}n(w=>{let M={...w};for(let _ of v)M[_]=Cd(w[_],x[_]);return M}),a(`Imported ${v.length} section${v.length===1?"":"s"} from ${f.name}.`),s("success")};return{handleExportBindings:l,importBindingsFile:c,handleImportBindingsChange:h,openSceneConfigImportPicker:p,importSceneConfigFile:u,handleImportSceneConfigChange:async f=>{let g=f.target.files?.[0];g&&(await u(g),f.target.value="")}}}var Kg={pbr:["texture","baseColor","metalness","metalnessMap","specularIntensity","specularIntensityMap","specularColor","specularColorMap","reflectivity"],roughness:["roughness","roughnessMap"],emission:["emissive","emissiveIntensity","emissiveMap"],opacity:["opacity","alphaMap","alphaTest","alphaHash","dithering","blendingMode"],normalBump:["normalMap","normalScale","flipNormalY","bumpMap","bumpScale"],displacement:["displacementMap","displacementScale","displacementBias"],ao:["aoMap","aoMapIntensity"],clearcoat:["clearcoat","clearcoatMap","clearcoatRoughness","clearcoatRoughnessMap","clearcoatNormalMap","clearcoatNormalScale","flipClearcoatNormalY"],sheen:["sheen","sheenColor","sheenColorMap","sheenRoughness","sheenRoughnessMap"],anisotropy:["anisotropy","anisotropyRotation","anisotropyMap"],transmission:["transmission","transmissionMap","thickness","thicknessMap","attenuationColor","attenuationDistance"],faces:["side"]},FM=Object.keys(Kg);function jM(e){if(e==null)return!1;if(typeof e=="string")return e.trim().length>0;if(typeof e=="number")return Number.isFinite(e);if(typeof e=="boolean")return e;if(typeof e=="object"&&"path"in e){let t=e.path;return typeof t=="string"&&t.trim().length>0}return!1}function Zg(e){if(e)return Object.values(e).some(jM)?e:void 0}function si(e,t){return e?Kg[t].some(n=>jM(e[n])):!1}function Jg(e){return{pbr:si(e,"pbr"),roughness:si(e,"roughness"),emission:si(e,"emission"),opacity:si(e,"opacity"),normalBump:si(e,"normalBump"),displacement:si(e,"displacement"),ao:si(e,"ao"),clearcoat:si(e,"clearcoat"),sheen:si(e,"sheen"),anisotropy:si(e,"anisotropy"),transmission:si(e,"transmission"),faces:si(e,"faces")}}function Qg(e,t){if(t)return{...e,style:{...e.style,material:t}};if(!e.style)return e;let{material:n,...i}=e.style;return{...e,style:Object.keys(i).length>0?i:void 0}}function GM(e,t){if(!e)return;let n={...e};for(let i of Kg[t])delete n[i];return n}var K=require("react/jsx-runtime"),HM="/room.glb";function ZR(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function WM(e){return`Couldn't reload ${e} from your last session. It's still saved in this browser.`}function eb({licenseKey:e,licenseValidationUrl:t,dracoDecoderPath:n,ktx2TranscoderPath:i,meshopt:r,project:o,onProjectChange:a,projectChangeDebounceMs:s=350,onModelUpload:l,onTextureUpload:c,onEditLeaseChange:h,allowModelChange:p=!0}){let u=(0,G.useRef)(null),m=(0,G.useRef)(null),f=(0,G.useRef)(null),[g,b]=(0,G.useState)(o?.model.url??null),[x,v]=(0,G.useState)(o?.model.name??""),[w,M]=(0,G.useState)(o?.model??null),[_,y]=(0,G.useState)(null),P=Wg(o?.objectBindings??{}),d=P.value,S=P.setValue,[C,T]=(0,G.useState)(!1),[E,k]=(0,G.useState)(null),D=(0,G.useMemo)(()=>E?{target:E}:null,[E]),[I,L]=(0,G.useState)(null);(0,G.useEffect)(()=>L(null),[_,g]),(0,G.useEffect)(()=>Cn(null),[g]);let[X,O]=(0,G.useState)([]),[B,re]=(0,G.useState)(()=>new Set),[ke,te]=(0,G.useState)(null),[We,wt]=(0,G.useState)(!1),[be,ue]=(0,G.useState)("Load the demo model or upload a GLB, GLTF, OBJ, FBX, USDZ, STL, or PLY model to generate bindings."),[Ne,Te]=(0,G.useState)("default"),[bn,Oe]=(0,G.useState)(!1),[ot,mt]=(0,G.useState)("{}"),[vn,de]=(0,G.useState)("{}"),[ur,jt]=(0,G.useState)(null),[Gt,ce]=(0,G.useState)(null),[Be,zt]=(0,G.useState)(!1),[gt,Ut]=(0,G.useState)(!1),[Ae,Ce]=(0,G.useState)(!1),[Pt,St]=(0,G.useState)({identity:!0,basics:!0,material:!1,decals:!1,actions:!1,camera:!1,transform:!1,metrics:!1,metadata:!1}),[dn,ae]=(0,G.useState)({pbr:!1,roughness:!1,emission:!1,opacity:!1,normalBump:!1,displacement:!1,ao:!1,clearcoat:!1,sheen:!1,anisotropy:!1,transmission:!1,faces:!1}),he=R=>St(j=>({...j,[R]:!j[R]})),Ee=R=>ae(j=>({...j,[R]:!j[R]})),[Ie,_t]=(0,G.useState)("object"),[Je,et]=(0,G.useState)("General"),[ve,Qe]=(0,G.useState)("metalness"),[bt,un]=(0,G.useState)(Jg()),or=(0,G.useRef)(null),[xn,Vn]=(0,G.useState)(!1),[xr,Fn]=(0,G.useState)(!0),[li,ha]=(0,G.useState)(!0),[kn,Dr]=(0,G.useState)(!1),[z,U]=(0,G.useState)(null),[H,oe]=(0,G.useState)(null),[Q,fe]=(0,G.useState)(!1),[we,pn]=(0,G.useState)("world"),tt=(0,G.useRef)({}),$e=Wg(o?.sceneConfig??ja),Ye=$e.value,Vt=$e.setValue,Se=$e.setValueUntracked,[Ht,Ln]=(0,G.useState)(!1),[jn,yr]=(0,G.useState)(.5),[mn,Cn]=(0,G.useState)(null),Xi=mn??{bindings:P.baseline,sceneConfig:$e.baseline},[hs,Il]=(0,G.useState)("orbit"),[Pd,Dn]=(0,G.useState)(!1),fs=(0,G.useRef)(void 0),Sn=(0,G.useCallback)(()=>{Dn(!0),clearTimeout(fs.current),fs.current=setTimeout(()=>Dn(!1),5e3)},[]);(0,G.useEffect)(()=>()=>clearTimeout(fs.current),[]),(0,G.useEffect)(()=>{g&&!C&&Sn()},[g,C,Sn]);let rn=hs==="pointerLock",[zl,fa]=(0,G.useState)(null),ga=(0,G.useRef)(null),Ul=zl?.objectKey===_&&zl?.textureKey==="texture",[Vl,Mo]=(0,G.useState)(null),[Em,Co]=(0,G.useState)(null),qi=zp(e,t),Ad=y_(qi.tier),gs=(0,G.useMemo)(()=>({isInsideEditor:!0,activeTab:Ie,activeSubTab:Je,tier:Ad,setActiveTab:_t,setActiveSubTab:et}),[Ie,Je,Ad]),wr=(0,G.useRef)(null),ci=(0,G.useRef)(0),Wr=(0,G.useRef)(0),at=(0,G.useRef)(o?`${o.id}:${o.revision}`:null),To=(0,G.useRef)(null),bs=(0,G.useRef)(!1),Po=(0,G.useRef)(!1),vs=(0,G.useRef)(o?{modelUrl:o.model.url,bindings:o.objectBindings,sceneConfig:o.sceneConfig}:null),ba=(0,G.useRef)(void 0),Ri=(0,G.useRef)(0),Tn=(0,G.useRef)(null),pr=(0,G.useRef)(o?{requestId:0,modelName:o.model.name??"model",modelUrl:o.model.url,storedBindings:o.objectBindings,streaming:!!o.model.tilesetUrl}:null),ki=(0,G.useRef)(null),va=(0,G.useRef)(null),Ao=(0,G.useRef)(null),Fl=(0,G.useRef)(!1),di=(0,G.useRef)(null),xa=(0,G.useRef)(null),{cameraState:Wt,resetView:jl,focusObject:Gl,fitScene:xs,setCameraState:ya,handleCameraChange:Ed,handleViewerReady:Rd}=Cw(),wa=(0,G.useCallback)(R=>{rn||ya({position:R.position,target:R.target,fov:R.fov??Wt?.fov??null,zoom:R.zoom??Wt?.zoom??1,azimuthAngle:R.azimuthAngle,polarAngle:R.polarAngle},!0)},[rn,ya,Wt]),Eo=p_(),Rt=_?d[_]??null:null,ys=Rt?.style?.material,Hl=!B.has(Rt?.modelObjectId??_??""),Li=Rt?.cameraState,pt=Wt?{position:$g(Wt.position),target:$g(Wt.target)}:null,kd=(0,G.useCallback)(R=>{Vt(j=>{let Z=j.annotations.map(Pe=>Pe.id).join(","),ne=R.map(Pe=>Pe.id).join(",");return Z===ne?j:{...j,annotations:R}})},[]),Rm=(0,G.useCallback)(R=>{Mo(R?{annotation:R}:null)},[]);(0,G.useEffect)(()=>{if(!Rt){mt("{}"),de("{}"),jt(null),ce(null);return}mt(qg(Rt.metrics)),de(qg(Rt.metadata)),jt(null),ce(null)},[Rt]),(0,G.useEffect)(()=>{let R=Jg(ys);if(or.current!==_){or.current=_,un(R);return}un(j=>{let Z=!1,ne={...j};for(let Pe of FM)R[Pe]&&!j[Pe]&&(ne[Pe]=!0,Z=!0);return Z?ne:j})},[_,ys]),(0,G.useEffect)(()=>()=>{wr.current?.cleanup(),Tn.current&&clearTimeout(Tn.current)},[]);let Sa=(0,G.useCallback)((R,j)=>{let Z=Xp(R);if(j){let ne=new Map(Object.values(j).map(Pe=>[Pe.modelObjectId,Pe]));for(let Pe of R){let Xe=ne.get(Pe);Xe&&(Z[Pe]=Xe)}}return Z},[]);(0,G.useEffect)(()=>{if(!o)return;let R=`${o.id}:${o.revision}`;if(at.current===R)return;at.current=R;let j=g!==o.model.url||w?.tilesetUrl!==o.model.tilesetUrl||w?.assetVersion!==o.model.assetVersion,Z=d!==o.objectBindings,ne=Ye!==o.sceneConfig;(j||Z||ne)&&(Po.current=!0),M(o.model),v(o.model.name??"model");let Pe=o.objectBindings;if(Z){let Xe=To.current;Pe=Xe?Sa(Xe,o.objectBindings):o.objectBindings,P.reset(Pe)}if(ne&&$e.reset(o.sceneConfig),j){let Xe=++Wr.current;pr.current={requestId:Xe,modelName:o.model.name??"model",modelUrl:o.model.url,storedBindings:o.objectBindings,streaming:!!o.model.tilesetUrl},di.current=null,y(null),T(!0),b(o.model.url)}vs.current={modelUrl:o.model.url,bindings:Pe,sceneConfig:o.sceneConfig}},[d,Sa,o,g,Ye,w,P,$e]);let ws=(0,G.useRef)(a);ws.current=a,(0,G.useEffect)(()=>{if(!o||!ws.current||!g)return;if(!bs.current){bs.current=!0;return}let R=vs.current;if(g===o.model.url&&d===o.objectBindings&&Ye===o.sceneConfig||R!==null&&g===R.modelUrl&&d===R.bindings&&Ye===R.sceneConfig){Po.current=!1;return}if(pr.current)return;if(Po.current){Po.current=!1;return}let j=window.setTimeout(()=>{ws.current?.({projectId:o.id,baseRevision:o.revision,model:{...w??o.model,url:g,name:x||o.model.name},objectBindings:d,sceneConfig:Ye},"local")},s);return()=>window.clearTimeout(j)},[d,x,g,o,s,w,Ye]),(0,G.useEffect)(()=>{let R=j=>{if(j.key.toLowerCase()!=="z"||!(j.metaKey||j.ctrlKey))return;let Z=j.target,ne=Z?.tagName;if(ne==="INPUT"||ne==="TEXTAREA"||Z?.isContentEditable)return;j.preventDefault();let Pe=Ie==="scene"?$e:P;j.shiftKey?Pe.redo():Pe.undo()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[Ie,P,$e]);let Ld=!o&&p,$i=P.edits>0||$e.edits>0,{handleTextureUpload:Ss}=RM({autosaveEnabled:Ld,hasEdits:$i,modelUrl:g,bindings:d,sceneConfig:Ye,onTextureUpload:c,modelSourceRef:ki,pendingLoadRef:pr,storedModelKeyRef:va,pendingAutosaveRef:Ao,autosaveFailureShownRef:Fl,setStatusMessage:ue,setStatusTone:Te});(0,G.useEffect)(()=>{if(C||Ne==="default"||Ne==="success")return;Oe(!0);let R=window.setTimeout(()=>Oe(!1),4e3);return()=>window.clearTimeout(R)},[be,Ne,C]);let mr=(0,G.useMemo)(()=>Object.keys(d),[d]),Dd=(0,G.useMemo)(()=>!_||!Rt?null:Rt.id.trim()?Object.entries(d).some(([Z,ne])=>Z!==_&&ne.id===Rt.id)?"Another binding already uses this ID.":null:"ID is required.",[d,_,Rt]),Ft=(R,j)=>{S(Z=>({...Z,[R]:j(Z[R])}))},Ro=(R,j)=>{Ft(R,Z=>{let ne=Zg(j(Z.style?.material));return Qg(Z,ne)})},_a=(R,j,Z)=>{Ro(R,ne=>({...ne,[j]:Z?{path:Z}:void 0}))},Nd=(R,j)=>{un(Z=>({...Z,[R]:j})),!j&&_&&Ft(_,Z=>{let ne=Zg(GM(Z.style?.material,R));return Qg(Z,ne)})},_s=(0,G.useCallback)((R,j,Z)=>{let ne=ld(R),Pe=Xp(ne,sd(R));if(Z){let Xt=new Map(Object.values(Z).map(Ge=>[Ge.modelObjectId,Ge]));for(let Ge of ne){let Jn=Xt.get(Ge);Jn&&(Pe[Ge]=Jn)}}R.updateMatrixWorld(!0);let Xe={};for(let Xt of ne){let Ge=xi(R,Xt);if(!Ge){Xe[Xt]={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivotLocal:[0,0,0],rotationOrder:"XYZ"};continue}let Jn=Jp(Ge);Xe[Xt]={position:[Ge.position.x,Ge.position.y,Ge.position.z],rotation:[Ge.rotation.x,Ge.rotation.y,Ge.rotation.z],scale:[Ge.scale.x,Ge.scale.y,Ge.scale.z],pivotLocal:[Jn.x,Jn.y,Jn.z],rotationOrder:Ge.rotation.order}}tt.current=Xe,P.reset(Pe),y(ne[0]??null),Z||Se(Xt=>({...Xt,annotations:[]})),ue(`Generated ${ne.length} bindings from ${j}.`),Te("success"),Ri.current=100,te(100),Tn.current&&clearTimeout(Tn.current),Tn.current=setTimeout(()=>{Tn.current=null,T(!1),te(null)},400)},[P,Se]),Ms=(R,j,Z,ne)=>{Ao.current?.();let Pe=++Wr.current;T(!0),te(null),Ri.current=0,Tn.current&&(clearTimeout(Tn.current),Tn.current=null),ba.current=Z;let Xe=Z?Z/1048576:0;ue(Xe>=100?`Reading ${j} (${Math.round(Xe)}MB \u2014 large file, this can take a while)...`:`Reading ${j} and generating starter bindings...`),Te("default"),v(j),M(ne??{url:R,name:j}),Mo(null);let Xt=di.current;if(R===g&&Xt?.url===R){pr.current=null,_s(Xt.scene,j);return}pr.current={requestId:Pe,modelName:j,modelUrl:R,streaming:!!ne?.tilesetUrl},b(R),P.reset({}),y(null)},Od=(0,G.useCallback)(R=>{let j=pr.current;if(!(!j||j.requestId!==Wr.current)){if(pr.current=null,di.current={url:j.modelUrl,scene:R},L(null),O(al(R)),re(j.streaming?new Set:sd(R)),k(null),j.streaming){ue(`Streaming ${j.modelName}.`),Te("success"),T(!1);return}j.storedBindings&&(Po.current=!0),_s(R,j.modelName,j.storedBindings),j.restoring&&ue(`Restored your last session with ${j.modelName}.`)}},[_s]),km=(0,G.useCallback)(R=>{let j=R.map(ne=>ne.name);if(j.length===0)return;To.current=j,Po.current=!0;let Z=Sa(j,o?.objectBindings);if(P.reset(Z),o){let ne=vs.current;vs.current={modelUrl:ne?.modelUrl??o.model.url,bindings:Z,sceneConfig:ne?.sceneConfig??o.sceneConfig}}y(ne=>ne??j[0]??null),ue(`Streaming ${j.length} bindable objects.`),Te("success"),T(!1)},[Sa,P,o]),Sr=(0,G.useCallback)(R=>{let j=pr.current;!j||j.requestId!==Wr.current||(pr.current=null,console.error(R),j.restoring?(ki.current=null,b(null),ue(WM(j.modelName))):ue(fu(R)?`${j.modelName} is a point cloud: it has points but no faces. Turn it into a mesh first, for example with MeshLab or Blender.`:`Could not read ${j.modelName}. Make sure the file is a valid GLB, GLTF, OBJ, FBX, USDZ, STL, or PLY asset.`),Te("error"),Tn.current&&(clearTimeout(Tn.current),Tn.current=null),Ri.current=0,T(!1),te(null))},[]),Bd=(0,G.useCallback)(R=>{let j=null;if(R.lengthComputable&&R.total>0)j=R.loaded/R.total*100;else{let ne=ba.current;ne&&ne>0&&(j=R.loaded/ne*100)}if(j===null)return;let Z=Math.min(90,Math.floor(j/10)*10);Z>Ri.current&&(Ri.current=Z,te(Z)),j>=99.5&&ue(ne=>ne.startsWith("Finalizing")?ne:"Finalizing model \u2014 parsing geometry and textures (large files can take a moment here)...")},[]),ar=(0,G.useCallback)(R=>{Eo.handleAnimationsReady(R);let j=R.clipDetails??R.clips.map(Z=>({sourceName:Z,duration:0}));Se(Z=>({...Z,animations:EM(Z,j)}))},[Eo,Se]),Ma=async()=>{wr.current?.cleanup(),wr.current=null,ki.current={model:{kind:"url",url:HM,name:"room.glb"}},await Ms(HM,"room.glb")},Id=async R=>{if(!p)return;if(l){try{T(!0),ue(`Uploading ${R.name}...`),Te("default");let Z=await l(R);ki.current={model:{kind:"url",url:Z.url,name:Z.name??R.name}},await Ms(Z.url,Z.name??R.name,R.size,Z)}catch(Z){T(!1),ue(Z instanceof Error?Z.message:`Could not upload ${R.name}.`),Te("error")}return}let j;try{j=await Ph(R)}catch(Z){ue(Z instanceof Error?Z.message:"Could not read model file. Upload a .glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, or .zip asset."),Te("error");return}wr.current?.cleanup(),wr.current=j,ki.current={model:{kind:"file",key:ZR(),name:j.name},file:R},await Ms(j.url,j.name,R.size,{url:j.url,name:j.name})},zd=async R=>{let j=R.target.files?.[0];j&&(await Id(j),R.target.value="")},Cs=()=>{Ao.current?.(),wr.current?.cleanup(),wr.current=null,di.current=null,pr.current=null,ki.current=null,tt.current={},ci.current=0,zt(!1),Tn.current&&(clearTimeout(Tn.current),Tn.current=null),Ri.current=0,te(null),ba.current=void 0,b(null),v(""),M(null),y(null),Mo(null),P.reset({}),mt("{}"),de("{}"),jt(null),ce(null),Co(null),fe(!1),Se(R=>({...R,animations:ja.animations,annotations:[]})),ue("Load the demo model or upload a GLB, GLTF, OBJ, FBX, USDZ, STL, or PLY model to generate bindings."),Te("default")},Ud=()=>{u.current?.click()},Ts=()=>{m.current?.click()},{handleExportBindings:Nr,handleImportBindingsChange:Wl,openSceneConfigImportPicker:Lm,handleImportSceneConfigChange:Dm}=VM({bindings:d,setBindings:S,setSceneConfig:Vt,nodeKeys:mr,sceneConfigInputRef:f,setIsExporting:wt,setStatusMessage:ue,setStatusTone:Te}),Xl=R=>{R.preventDefault(),R.stopPropagation(),!(C||g)&&(ci.current+=1,zt(!0))},Vd=R=>{R.preventDefault(),R.stopPropagation(),!(C||g)&&(R.dataTransfer.dropEffect="copy",zt(!0))},Fd=R=>{R.preventDefault(),R.stopPropagation(),!(C||g)&&(ci.current=Math.max(0,ci.current-1),ci.current===0&&zt(!1))},ko=async R=>{if(R.preventDefault(),R.stopPropagation(),ci.current=0,zt(!1),C||g)return;let j=R.dataTransfer.files?.[0];j&&await Id(j)},Ca=(R,j,Z)=>{if(!_)return;let ne;try{ne=JSON.parse(j)}catch{Z("Invalid JSON");return}if(ne===null||typeof ne!="object"||Array.isArray(ne)){Z("Expected a JSON object");return}if(R==="metrics"&&Object.values(ne).some(Xe=>typeof Xe!="number"||!Number.isFinite(Xe))){Z("Metrics values must be numbers");return}Ft(_,Pe=>({...Pe,[R]:ne})),Z(null)},jd=(0,G.useCallback)((R,j)=>{Ld&&mm(R,j).catch(Z=>console.warn("[BindingBuilder] Could not store decal image for autosave:",Z))},[Ld]),ql=(0,G.useMemo)(()=>{let R=di.current?.scene,Z=(R&&_?xi(R,_):null)?.geometry;if(!Z)return .2;Z.boundingBox||Z.computeBoundingBox();let ne=Z.boundingBox?.getSize(new XM.Vector3),Pe=ne?Math.max(ne.x,ne.y,ne.z):0;return Pe>0&&Number.isFinite(Pe)?Pe/3:.2},[_,g,C]),$l=(0,G.useMemo)(()=>{if(!I?.moving)return null;let{nodeKey:R,decal:j}=I,Z=d[R],ne=Z?.decals?.find(Pe=>Pe.id===j.id);return ne?{objectId:Z.modelObjectId??R,decal:ne,onCancel:()=>L(null),onCommit:Pe=>{S(Xe=>{let Xt=Xe[R];return Xt?{...Xe,[R]:{...Xt,decals:Xt.decals?.map(Ge=>Ge.id===ne.id?{...Ge,...Pe}:Ge)}}:Xe}),L(null)}}:null},[d,I,S]),Yl=(0,G.useCallback)((R,j)=>{if(!_)return;let Z=d[_],ne=Z?.decals?.find(Ge=>Ge.id===R);if(!ne)return;let Pe=xa.current,Xe=Pe?.raw.nodes[Z.modelObjectId??_],Xt=rm(Xe,Pe?.raw.controls.camera,ne,j);if(!Xt){ue("No visible surface in that direction. Try another arrow or rotate the view."),Te("error"),Oe(!0);return}L(null),Oe(!1),Ft(_,Ge=>({...Ge,decals:Ge.decals?.map(Jn=>Jn.id===R?{...Jn,...Xt}:Jn)}))},[d,_,Ft]),Nm=(0,G.useCallback)(R=>{if(!R||R.moving){L(R);return}let j=xa.current,Z=d[R.nodeKey],ne=j?.raw.nodes[Z?.modelObjectId??R.nodeKey],Pe=nm(ne,j?.raw.controls.camera);if(!Pe){ue("Could not find a surface on this object for the decal."),Te("error"),Oe(!0);return}let Xe={...R.decal,...Pe};S(Xt=>{let Ge=Xt[R.nodeKey];if(!Ge)return Xt;let Jn=(Ge.decals??[]).filter(Yi=>Yi.id!==Xe.id);return{...Xt,[R.nodeKey]:{...Ge,decals:[...Jn,Xe]}}}),L({...R,moving:!0})},[d,S]),Om=(0,G.useCallback)(R=>{if(rn){Il("orbit");return}if(!R){y(null);return}let j=Object.entries(d).find(([Z,ne])=>ne===R||Z===R.modelObjectId||ne.modelObjectId===R.modelObjectId)?.[0]??null;y(j)},[rn,d]),Bm=(0,G.useCallback)(async R=>{if(rn){Il("orbit");return}y(R),Co(null),await Gl(R)},[rn,Gl]),Im=(0,G.useCallback)(R=>{Co(R?d[R]??null:null)},[d]),Or=(0,G.useCallback)(R=>Ce(!R),[]),Gd=(0,G.useCallback)(()=>{if(rn){ue("Camera positions aren't available while Pointer Lock is the active camera controller."),Te("error");return}if(!_||!Wt)return;let R={position:Wt.position,target:Wt.target,...Wt.fov!=null?{fov:Wt.fov}:{},zoom:Wt.zoom};Ft(_,j=>({...j,cameraState:R}))},[rn,_,Wt]),zm=(0,G.useCallback)(()=>{if(rn){ue("Camera positions aren't available while Pointer Lock is the active camera controller."),Te("error");return}!Li?.position||!Li?.target||ya({position:Li.position,target:Li.target,fov:Li.fov??Wt?.fov??null,zoom:Li.zoom??Wt?.zoom??1},!0)},[rn,Li,ya,Wt]),Um=(0,G.useCallback)(()=>{rn||_&&Ft(_,R=>({...R,cameraState:void 0}))},[rn,_]),sr=(0,G.useCallback)(async()=>{if(rn){ue("Reset View isn't available while Pointer Lock is the active camera controller."),Te("error");return}await jl()},[rn,jl]),Ps=(0,G.useCallback)(async()=>{if(rn){ue("Fit Scene isn't available while Pointer Lock is the active camera controller."),Te("error");return}await xs()},[rn,xs]),Kl=(0,G.useCallback)(()=>{ue("Texture position saved."),Te("success"),ga.current?.()},[]),Zl=(0,G.useCallback)(R=>{U(R),Dr(!0)},[]),As=(0,G.useCallback)(()=>{Dr(!1),U(null)},[]),Vm=(0,G.useCallback)(()=>{if(z==="bindings"){if(!mr.length){As();return}let R=Xp(mr,B);P.reset(R,{asEdit:!0}),y(mr[0]??null),ue("Object bindings reset to default values."),Te("success")}else z==="scene"&&($e.reset(ja,{asEdit:!0}),ue("Scene config reset to default values."),Te("success"));As()},[z,mr,P,$e,As]),Xr=(0,G.useCallback)(()=>{oe(null)},[]),Ta=async()=>{let R;try{R=await h_()}catch(j){console.warn("[BindingBuilder] Could not read the saved session:",j),ue("Couldn't read the saved session from this browser."),Te("error");return}if(!R){ue("No saved session in this browser yet \u2014 one is saved as soon as you edit a model."),Te("error");return}oe(R)},Jl=async()=>{let R=H;if(oe(null),!R)return;let{session:j,file:Z}=R,{model:ne}=j;Ao.current=null;let Pe=Cd(ja,j.sceneConfig),Xe=Wr.current,Xt=await Am(j.bindings);if(Wr.current!==Xe)return;let Ge;if(ne.kind==="file"){if(!Z)return;let Yi=Wr.current,Lo;try{Lo=await Ph(Z)}catch(Fm){console.warn("[BindingBuilder] Could not read the saved model:",Fm),ue(WM(ne.name)),Te("error");return}if(Wr.current!==Yi){Lo.cleanup();return}wr.current?.cleanup(),wr.current=Lo,Ge=Lo.url}else{Ge=ne.url;let Yi=di.current;if(Ge===g&&Yi?.url===Ge&&!pr.current){ki.current={model:ne},va.current=null,P.reset(Sa(ld(Yi.scene),Xt)),$e.reset(Pe),ue(`Restored your last session with ${ne.name}.`),Te("success");return}wr.current?.cleanup(),wr.current=null}ki.current={model:ne,file:Z??void 0},va.current=ne.kind==="file"?ne.key:null;let Jn=++Wr.current;T(!0),te(null),Ri.current=0,Tn.current&&(clearTimeout(Tn.current),Tn.current=null),ba.current=Z?.size,ue(`Restoring your last session with ${ne.name}...`),Te("default"),v(ne.name),M({url:Ge,name:ne.name}),Mo(null),y(null),di.current=null,P.reset({}),$e.reset(Pe),pr.current={requestId:Jn,modelName:ne.name,modelUrl:Ge,storedBindings:Xt,restoring:!0},b(Ge)};if(qi.status==="checking")return(0,K.jsx)("div",{className:"bb-root bb-root--licenseChecking",children:(0,K.jsx)(Na,{title:"Verifying License",message:"Checking your license key..."})});if(qi.status==="invalid")return(0,K.jsx)("div",{className:"bb-root bb-root--licenseInvalid",children:(0,K.jsx)(Na,{tone:"error",title:"Invalid License",message:qi.isLocalDomain?qi.reason??"License has been revoked or has expired":"Failed to load. Please contact the site administrator."})});let _r=rn?(0,K.jsx)(K.Fragment,{children:"Click the preview to look around \xB7 Esc to release"}):Q?(0,K.jsx)(K.Fragment,{children:"Select a mesh \xB7 drag the colored arrows, planes, or rings"}):Pd&&li?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("kbd",{children:"W"}),(0,K.jsx)("kbd",{children:"A"}),(0,K.jsx)("kbd",{children:"S"}),(0,K.jsx)("kbd",{children:"D"})," move \xB7 ",(0,K.jsx)("kbd",{children:"Space"}),"/",(0,K.jsx)("kbd",{children:"C"})," up \xB7 down \xB7 drag to look"]}):null;return(0,K.jsxs)(gg.Provider,{value:gs,children:[(0,K.jsxs)("div",{className:"bb-root",children:[(0,K.jsx)("input",{ref:u,type:"file",accept:dx,className:"bb-hiddenInput",onChange:zd,disabled:C}),(0,K.jsx)("input",{ref:m,type:"file",accept:".json,application/json",className:"bb-hiddenInput",onChange:Wl,disabled:C}),(0,K.jsx)("input",{ref:f,type:"file",accept:".json,application/json",className:"bb-hiddenInput",onChange:Dm,disabled:C}),(0,K.jsxs)("aside",{className:`bb-sidebar bb-sidebar--left ${gt?"bb-sidebar--collapsed":""}`,children:[(0,K.jsxs)("div",{className:"bb-header bb-header--sidebar",children:[!gt&&(0,K.jsx)("h1",{className:"bb-title",children:"Binding Builder"}),(0,K.jsx)("button",{type:"button",className:"bb-sidebarToggle",onClick:()=>Ut(R=>!R),"aria-label":gt?"Open editor sidebar":"Collapse editor sidebar",title:gt?"Open editor":"Collapse editor",children:gt?"\u2192":"\u2190"})]}),!gt&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)("div",{className:"bb-tabRow",children:[(0,K.jsx)("button",{type:"button",className:`bb-tab ${Ie==="object"?"bb-tab--active":""}`,onClick:()=>_t("object"),children:"Object"}),(0,K.jsx)("button",{type:"button",className:`bb-tab ${Ie==="scene"?"bb-tab--active":""}`,onClick:()=>_t("scene"),children:"Scene"})]}),(0,K.jsx)("section",{className:"bb-editor",children:Ie==="scene"?(0,K.jsx)(K.Fragment,{children:g?(0,K.jsx)(Ug,{config:Ye,onChange:Vt,activeSubTab:Je,onActiveSubTabChange:et,cameraState:(Je==="Cinematic"||Je==="Annotations")&&Wt?{position:Wt.position,target:Wt.target,azimuthAngle:Wt.azimuthAngle,polarAngle:Wt.polarAngle,fov:Wt.fov,zoom:Wt.zoom}:null,onPreviewWaypoint:wa,animationClipDetails:Eo.clipDetails,animationPlayback:Eo,materialVariantGroups:X,objectBindings:d}):(0,K.jsx)("div",{className:"bb-emptyEditor",children:"Upload a model to edit its scene settings."})}):!Rt||!_?(0,K.jsx)("div",{className:"bb-emptyEditor",children:"Select a generated node binding to edit its values."}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("div",{className:"bb-editorHeader",children:(0,K.jsxs)("div",{children:[(0,K.jsx)("div",{className:"bb-sectionKicker",children:"Editing Binding"}),(0,K.jsx)("h2",{className:"bb-editorTitle",children:Rt.label||_}),(0,K.jsxs)("div",{className:"bb-editorMeta",children:[(0,K.jsx)("span",{children:Rt.type}),(0,K.jsx)("span",{children:Rt.modelObjectId})]})]})}),(0,K.jsx)(hM,{selectedItem:_,selectedBinding:Rt,open:Pt.identity,onToggle:()=>he("identity"),updateBinding:Ft,idError:Dd}),(0,K.jsx)(fM,{selectedItem:_,selectedBinding:Rt,open:Pt.basics,onToggle:()=>he("basics"),updateBinding:Ft}),(0,K.jsxs)(dr,{title:"Material",open:Pt.material,onToggle:()=>he("material"),tooltip:"Edit the selected object's base material, textures, and surface properties.",children:[(0,K.jsx)(mM,{disabled:!_,onApply:R=>_&&Ro(_,j=>({...j,...R}))}),(0,K.jsx)(uM,{selectedItem:_,selectedMaterial:ys,pbrWorkflow:ve,onPbrWorkflowChange:Qe,openMaterialPanels:dn,materialPanelEnabled:bt,onToggleMaterialPanel:Ee,onSetMaterialPanelState:Nd,updateSelectedMaterial:Ro,setSelectedTexturePath:_a,isTexturePositioningEnabled:Ul,onConfirmTexturePosition:Kl,takesImage:Hl})]}),(0,K.jsx)(yM,{selectedItem:_,selectedBinding:Rt,open:Pt.decals,onToggle:()=>he("decals"),updateBinding:Ft,placement:I,onPlacementChange:Nm,defaultSize:ql,onImageFile:jd,onNudge:Yl}),(0,K.jsx)(bM,{selectedItem:_,selectedBinding:Rt,open:Pt.actions,onToggle:()=>he("actions"),updateBinding:Ft,takesImage:Hl}),(0,K.jsx)(wM,{selectedBinding:Rt,open:Pt.camera,onToggle:()=>he("camera"),cameraState:Wt,formattedCameraState:pt,savedCameraPosition:Li,onSaveCameraPosition:Gd,onGoToSavedCamera:zm,onClearSavedCamera:Um,onResetView:sr,onFitScene:Ps}),(0,K.jsx)(TM,{selectedItem:_,selectedBinding:Rt,open:Pt.transform,onToggle:()=>he("transform"),updateBinding:Ft,moveModeEnabled:Q,onToggleMoveMode:fe,transformSpace:we,onTransformSpaceChange:pn,originalTransform:tt.current[_]??null}),(0,K.jsx)(Hg,{title:"Metrics",label:"Metrics JSON",open:Pt.metrics,onToggle:()=>he("metrics"),draft:ot,error:ur,example:'{"area": 42}',onDraftChange:mt,onCommit:()=>Ca("metrics",ot,jt)}),(0,K.jsx)(Hg,{title:"Metadata",label:"Metadata JSON",open:Pt.metadata,onToggle:()=>he("metadata"),draft:vn,error:Gt,example:'{"room": "kitchen"}',onDraftChange:de,onCommit:()=>Ca("metadata",vn,ce)})]})}),Ie==="object"&&(0,K.jsx)(Xg,{canUndo:P.canUndo,canRedo:P.canRedo,onUndo:P.undo,onRedo:P.redo,onReset:()=>Zl("bindings"),resetDisabled:!mr.length,resetTitle:"Reset object bindings to default",onImport:Ts,importDisabled:!mr.length||C,importTitle:"Re-apply a previously exported objectBindings.json onto this model",exportDisabled:!mr.length||We,exporting:We,onExportJson:()=>Nr("json"),onExportTs:()=>Nr("ts")}),Ie==="scene"&&(0,K.jsx)(Xg,{canUndo:$e.canUndo,canRedo:$e.canRedo,onUndo:$e.undo,onRedo:$e.redo,onReset:()=>Zl("scene"),resetTitle:"Reset scene config to default",onImport:Lm,importDisabled:!mr.length||C,importTitle:"Re-apply a previously exported sceneConfig.json",exportDisabled:!mr.length||C,onExportJson:()=>Td("sceneConfig.json",BM(Ye),"application/json"),onExportTs:()=>Td("sceneConfig.ts",IM(Ye),"text/typescript")})]})]}),(0,K.jsxs)("main",{className:"bb-previewShell",children:[(0,K.jsxs)("div",{className:"bb-previewHeader",children:[(0,K.jsx)(gh,{label:"View",icon:(0,K.jsx)(Wi.SlidersHorizontal,{size:14,"aria-hidden":"true"}),title:"Preview options",children:()=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)("label",{className:"bb-headerMenuItem",children:[(0,K.jsx)("input",{type:"checkbox",checked:xn,onChange:R=>Vn(R.target.checked)}),"Zoom on selected"]}),(0,K.jsxs)("label",{className:"bb-headerMenuItem",children:[(0,K.jsx)("input",{type:"checkbox",checked:xr,onChange:R=>Fn(R.target.checked)}),"Highlight on hover"]}),(0,K.jsxs)("label",{className:"bb-headerMenuItem",children:[(0,K.jsx)("input",{type:"checkbox",checked:li,onChange:R=>ha(R.target.checked)}),"Camera controller"]})]})}),(0,K.jsx)("div",{className:"bb-previewMeta",children:(0,K.jsx)("span",{title:_??void 0,children:_?`Focused: ${_}`:"Select a node to inspect it"})}),g&&(0,K.jsxs)("button",{type:"button",className:`bb-compareButton ${Ht?"bb-compareButton--active":""}`,onClick:()=>{Ln(R=>!R),Cn(null)},"aria-pressed":Ht,title:"Compare: drag a divider across the preview to see it before and after your changes",children:[(0,K.jsx)(Wi.SquareSplitHorizontal,{size:14}),"Compare"]}),p&&!o&&(0,K.jsx)(gh,{icon:(0,K.jsx)(Wi.Ellipsis,{size:16,"aria-hidden":"true"}),title:"More model actions",align:"right",children:R=>(0,K.jsx)(dv,{close:R,onRestore:Ta,restoreDisabled:C,onRemove:g?Cs:void 0})})]}),(0,K.jsxs)("div",{className:"bb-preview",onFocus:R=>{R.currentTarget.contains(R.relatedTarget)||Sn()},children:[(0,K.jsx)(Wp,{visible:C||bn,message:be,tone:Ne,progress:ke??void 0}),g&&(0,K.jsx)("div",{className:`bb-canvasHint ${_r?"bb-canvasHint--visible":""} ${Ht?"bb-canvasHint--belowCompare":""}`,"aria-hidden":!_r,children:_r}),g?(0,K.jsx)(Cl,{loading:"eager",modelUrl:g,tilesetUrl:w?.tilesetUrl,objectBindings:d,selectedObject:Rt,onObjectSelect:Om,onObjectBindingsChange:S,onTextureUpload:Ss,onObjectEditLeaseChange:(R,j)=>h?.(R.modelObjectId||R.id,j),showObjectBindingDataPanel:!1,showSceneObjectsPanel:!1,onCameraChange:Ed,onViewerReady:R=>{xa.current=R,Rd(R)},onAnnotationsChange:kd,activeAnnotation:Vl?.annotation??null,onActiveAnnotationChange:Rm,onAnimationsReady:ar,onSceneLoaded:Od,onLoadError:Sr,onObjectCatalog:w?.tilesetUrl?km:void 0,onProgress:Bd,onCameraControllerChange:Il,cameraControllerType:hs,onTexturePositioningChange:fa,endTexturePositioningRef:ga,licenseKey:e,licenseValidationUrl:t,dracoDecoderPath:n,ktx2TranscoderPath:i,meshopt:r,sceneConfig:Ye,onSceneConfigChange:Vt,preserveDrawingBuffer:!0,disableZoom:!1,zoomOnSelected:xn,highlightOnHover:xr,enableCameraControls:li,moveModeEnabled:Q,objectTransformSpace:we,enableKeyboardNavigation:!0,showViewGizmo:!0,showSectionTools:Ye.section?.enabled??!1,isolation:D,onIsolationChange:()=>k(null),showIsolateControls:!0,decalMove:$l,panelHoveredObject:xr?Em:null,showLoadingOverlay:!1,autoRotate:rn?!1:Ye.model.autoRotate??!1,autoRotateSpeed:Ye.model.autoRotateSpeed??1}):(0,K.jsx)("div",{className:`bb-previewPlaceholder ${Be?"bb-previewPlaceholder--dragActive":""}`,onDragEnter:Xl,onDragOver:Vd,onDragLeave:Fd,onDrop:ko,children:(0,K.jsxs)("div",{children:[(0,K.jsx)("div",{children:"Upload a GLB, GLTF, OBJ, FBX, USDZ, STL, or PLY model, or drag a supported model/ZIP bundle here to generate editable object bindings."}),p?(0,K.jsx)("button",{type:"button",className:"bb-previewPlaceholderButton",onClick:Ud,disabled:C,children:"Upload"}):null]})}),g&&Ht?(0,K.jsx)(d_,{liveViewerRef:xa,split:jn,onSplitChange:yr,labels:[mn?"Pinned":"Before","Now"],beforeAction:(0,K.jsxs)("button",{type:"button",className:"ri-compare__labelAction",onClick:()=>Cn(R=>R?null:{bindings:d,sceneConfig:Ye}),"aria-pressed":!!mn,title:mn?"Unpin: compare with the project as it was opened again":"Pin as before: compare later changes with how the preview looks now",children:[mn?(0,K.jsx)(Wi.PinOff,{size:12}):(0,K.jsx)(Wi.Pin,{size:12}),mn?"Unpin":"Pin"]}),renderBefore:R=>(0,K.jsx)(Cl,{loading:"eager",modelUrl:g,tilesetUrl:w?.tilesetUrl,objectBindings:Xi.bindings,sceneConfig:Xi.sceneConfig,licenseKey:e,licenseValidationUrl:t,dracoDecoderPath:n,ktx2TranscoderPath:i,meshopt:r,preset:"minimal",showLoadingOverlay:!1,showObjectNavigator:!1,selectedObject:null,zoomOnSelected:!1,highlightOnHover:!1,autoRotate:!1,cinematic:!1,onViewerReady:R})}):null]})]}),(0,K.jsx)(AM,{bindings:d,selectedItem:_,onSelect:Bm,onHover:Im,isOpen:!Ae,onToggle:Or,isolatedItem:E,onIsolate:k})]}),kn&&(0,K.jsx)(LM,{target:z,onCancel:As,onConfirm:Vm}),H&&(0,K.jsx)(DM,{modelName:H.session.model.name,savedAt:H.session.savedAt,onCancel:Xr,onConfirm:Jl})]})}var qM=require("react/jsx-runtime");function tb(e){return(0,qM.jsx)(Cl,{...e})}0&&(module.exports={ProjectBindingBuilder,ProjectModelViewer});
|