@splinetool/loader 1.0.60 → 1.0.62
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/build/SplineLoader.cjs +3 -3
- package/build/SplineLoader.js +3 -3
- package/package.json +1 -1
package/build/SplineLoader.cjs
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
----------`);var d=new Function("compile",t.join(`
|
|
16
16
|
`));return d(qI.bind(void 0,n))}RS.exports=WI});var GS=hr((Mie,zS)=>{"use strict";var $I=VS();function YI(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function XI(n){var t=new YI;t.pre=n.pre,t.body=n.body,t.post=n.post;var e=n.args.slice(0);t.argTypes=e;for(var r=0;r<e.length;++r){var o=e[r];if(o==="array"||typeof o=="object"&&o.blockIndices){if(t.argTypes[r]="array",t.arrayArgs.push(r),t.arrayBlockIndices.push(o.blockIndices?o.blockIndices:0),t.shimArgs.push("array"+r),r<t.pre.args.length&&t.pre.args[r].count>0)throw new Error("cwise: pre() block may not reference array args");if(r<t.post.args.length&&t.post.args[r].count>0)throw new Error("cwise: post() block may not reference array args")}else if(o==="scalar")t.scalarArgs.push(r),t.shimArgs.push("scalar"+r);else if(o==="index"){if(t.indexArgs.push(r),r<t.pre.args.length&&t.pre.args[r].count>0)throw new Error("cwise: pre() block may not reference array index");if(r<t.body.args.length&&t.body.args[r].lvalue)throw new Error("cwise: body() block may not write to array index");if(r<t.post.args.length&&t.post.args[r].count>0)throw new Error("cwise: post() block may not reference array index")}else if(o==="shape"){if(t.shapeArgs.push(r),r<t.pre.args.length&&t.pre.args[r].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(r<t.body.args.length&&t.body.args[r].lvalue)throw new Error("cwise: body() block may not write to array shape");if(r<t.post.args.length&&t.post.args[r].lvalue)throw new Error("cwise: post() block may not write to array shape")}else if(typeof o=="object"&&o.offset)t.argTypes[r]="offset",t.offsetArgs.push({array:o.array,offset:o.offset}),t.offsetArgIndex.push(r);else throw new Error("cwise: Unknown argument type "+e[r])}if(t.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(t.pre.args.length>e.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>e.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>e.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!n.printCode||!!n.debug,t.funcName=n.funcName||"cwise",t.blockSize=n.blockSize||64,$I(t)}zS.exports=XI});var sl=hr(je=>{"use strict";var Vr=GS(),Kd={body:"",args:[],thisVars:[],localVars:[]};function Gh(n){if(!n)return Kd;for(var t=0;t<n.args.length;++t){var e=n.args[t];t===0?n.args[t]={name:e,lvalue:!0,rvalue:!!n.rvalue,count:n.count||1}:n.args[t]={name:e,lvalue:!1,rvalue:!0,count:1}}return n.thisVars||(n.thisVars=[]),n.localVars||(n.localVars=[]),n}function QI(n){return Vr({args:n.args,pre:Gh(n.pre),body:Gh(n.body),post:Gh(n.proc),funcName:n.funcName})}function Ct(n){for(var t=[],e=0;e<n.args.length;++e)t.push("a"+e);var r=new Function("P",["return function ",n.funcName,"_ndarrayops(",t.join(","),") {P(",t.join(","),");return a0}"].join(""));return r(QI(n))}var FS={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};(function(){for(var n in FS){var t=FS[n];je[n]=Ct({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:n}),je[n+"eq"]=Ct({args:["array","array"],body:{args:["a","b"],body:"a"+t+"=b"},rvalue:!0,funcName:n+"eq"}),je[n+"s"]=Ct({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:n+"s"}),je[n+"seq"]=Ct({args:["array","scalar"],body:{args:["a","s"],body:"a"+t+"=s"},rvalue:!0,funcName:n+"seq"})}})();var kS={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var n in kS){var t=kS[n];je[n]=Ct({args:["array","array"],body:{args:["a","b"],body:"a="+t+"b"},funcName:n}),je[n+"eq"]=Ct({args:["array"],body:{args:["a"],body:"a="+t+"a"},rvalue:!0,count:2,funcName:n+"eq"})}})();var jS={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var n in jS){var t=jS[n];je[n]=Ct({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:n}),je[n+"s"]=Ct({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:n+"s"}),je[n+"eq"]=Ct({args:["array","array"],body:{args:["a","b"],body:"a=a"+t+"b"},rvalue:!0,count:2,funcName:n+"eq"}),je[n+"seq"]=Ct({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+t+"s"},rvalue:!0,count:2,funcName:n+"seq"})}})();var US=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var n=0;n<US.length;++n){var t=US[n];je[t]=Ct({args:["array","array"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:t}),je[t+"eq"]=Ct({args:["array"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:t+"eq"})}})();var HS=["max","min","atan2","pow"];(function(){for(var n=0;n<HS.length;++n){var t=HS[n];je[t]=Ct({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:t}),je[t+"s"]=Ct({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:t+"s"}),je[t+"eq"]=Ct({args:["array","array"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:t+"eq"}),je[t+"seq"]=Ct({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:t+"seq"})}})();var qS=["atan2","pow"];(function(){for(var n=0;n<qS.length;++n){var t=qS[n];je[t+"op"]=Ct({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:t+"op"}),je[t+"ops"]=Ct({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:t+"ops"}),je[t+"opeq"]=Ct({args:["array","array"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:t+"opeq"}),je[t+"opseq"]=Ct({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+t,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:t+"opseq"})}})();je.any=Vr({args:["array"],pre:Kd,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"});je.all=Vr({args:["array"],pre:Kd,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"});je.sum=Vr({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"});je.prod=Vr({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"});je.norm2squared=Vr({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"});je.norm2=Vr({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"});je.norminf=Vr({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"});je.norm1=Vr({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"});je.sup=Vr({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}});je.inf=Vr({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}});je.argmin=Vr({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}});je.argmax=Vr({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}});je.random=Ct({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"});je.assign=Ct({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"});je.assigns=Ct({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"});je.equals=Vr({args:["array","array"],pre:Kd,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})});var m1=hr((ile,h1)=>{h1.exports=function(t,e){for(var r=t.split("."),o=e.split("."),i=0;i<3;i++){var a=Number(r[i]),s=Number(o[i]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0}});var l3={};em(l3,{default:()=>tp});module.exports=k1(l3);var rp=require("three");function _c(n){for(let t of Object.keys(n))n[t]===void 0&&delete n[t];return n}function br(n,t){return Object.setPrototypeOf(n,t),n}function Pc(n){return Array.isArray(n)?n:[n]}function Oc(n,t){let e=0;for(;e<n.length&&e<t.length;){if(n[e]<t[e])return-1;if(n[e]>t[e])return 1;e+=1}return e!==t.length?-1:e!==n.length?1:0}var j1=typeof global=="object"&&global&&global.Object===Object&&global,Cc=j1;var U1=typeof self=="object"&&self&&self.Object===Object&&self,H1=Cc||U1||Function("return this")(),Gt=H1;var q1=Gt.Symbol,Jt=q1;var rm=Object.prototype,W1=rm.hasOwnProperty,$1=rm.toString,ul=Jt?Jt.toStringTag:void 0;function Y1(n){var t=W1.call(n,ul),e=n[ul];try{n[ul]=void 0;var r=!0}catch{}var o=$1.call(n);return r&&(t?n[ul]=e:delete n[ul]),o}var om=Y1;var X1=Object.prototype,Q1=X1.toString;function K1(n){return Q1.call(n)}var nm=K1;var Z1="[object Null]",J1="[object Undefined]",im=Jt?Jt.toStringTag:void 0;function ew(n){return n==null?n===void 0?J1:Z1:im&&im in Object(n)?om(n):nm(n)}var Gr=ew;function tw(n){return n!=null&&typeof n=="object"}var sr=tw;var rw="[object Symbol]";function ow(n){return typeof n=="symbol"||sr(n)&&Gr(n)==rw}var ea=ow;function nw(n,t){for(var e=-1,r=n==null?0:n.length,o=Array(r);++e<r;)o[e]=t(n[e],e,n);return o}var Tc=nw;var iw=Array.isArray,Mt=iw;var aw=1/0,am=Jt?Jt.prototype:void 0,sm=am?am.toString:void 0;function lm(n){if(typeof n=="string")return n;if(Mt(n))return Tc(n,lm)+"";if(ea(n))return sm?sm.call(n):"";var t=n+"";return t=="0"&&1/n==-aw?"-0":t}var cm=lm;function sw(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}var Fr=sw;function lw(n){return n}var um=lw;var cw="[object AsyncFunction]",uw="[object Function]",dw="[object GeneratorFunction]",pw="[object Proxy]";function fw(n){if(!Fr(n))return!1;var t=Gr(n);return t==uw||t==dw||t==cw||t==pw}var Mc=fw;var hw=Gt["__core-js_shared__"],Ic=hw;var dm=function(){var n=/[^.]+$/.exec(Ic&&Ic.keys&&Ic.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function mw(n){return!!dm&&dm in n}var pm=mw;var yw=Function.prototype,gw=yw.toString;function xw(n){if(n!=null){try{return gw.call(n)}catch{}try{return n+""}catch{}}return""}var Jo=xw;var bw=/[\\^$.*+?()[\]{}|]/g,vw=/^\[object .+?Constructor\]$/,Sw=Function.prototype,ww=Object.prototype,Aw=Sw.toString,_w=ww.hasOwnProperty,Pw=RegExp("^"+Aw.call(_w).replace(bw,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ow(n){if(!Fr(n)||pm(n))return!1;var t=Mc(n)?Pw:vw;return t.test(Jo(n))}var fm=Ow;function Cw(n,t){return n?.[t]}var hm=Cw;function Tw(n,t){var e=hm(n,t);return fm(e)?e:void 0}var Or=Tw;var Mw=Or(Gt,"WeakMap"),Nc=Mw;var mm=Object.create,Iw=function(){function n(){}return function(t){if(!Fr(t))return{};if(mm)return mm(t);n.prototype=t;var e=new n;return n.prototype=void 0,e}}(),ym=Iw;function Nw(n,t,e){switch(e.length){case 0:return n.call(t);case 1:return n.call(t,e[0]);case 2:return n.call(t,e[0],e[1]);case 3:return n.call(t,e[0],e[1],e[2])}return n.apply(t,e)}var gm=Nw;function Dw(n,t){var e=-1,r=n.length;for(t||(t=Array(r));++e<r;)t[e]=n[e];return t}var xm=Dw;var Ew=800,Bw=16,Lw=Date.now;function Rw(n){var t=0,e=0;return function(){var r=Lw(),o=Bw-(r-e);if(e=r,o>0){if(++t>=Ew)return arguments[0]}else t=0;return n.apply(void 0,arguments)}}var bm=Rw;function Vw(n){return function(){return n}}var vm=Vw;var zw=function(){try{var n=Or(Object,"defineProperty");return n({},"",{}),n}catch{}}(),ta=zw;var Gw=ta?function(n,t){return ta(n,"toString",{configurable:!0,enumerable:!1,value:vm(t),writable:!0})}:um,Sm=Gw;var Fw=bm(Sm),wm=Fw;function kw(n,t){for(var e=-1,r=n==null?0:n.length;++e<r&&t(n[e],e,n)!==!1;);return n}var Am=kw;var jw=9007199254740991,Uw=/^(?:0|[1-9]\d*)$/;function Hw(n,t){var e=typeof n;return t=t??jw,!!t&&(e=="number"||e!="symbol"&&Uw.test(n))&&n>-1&&n%1==0&&n<t}var ra=Hw;function qw(n,t,e){t=="__proto__"&&ta?ta(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):n[t]=e}var Dc=qw;function Ww(n,t){return n===t||n!==n&&t!==t}var oa=Ww;var $w=Object.prototype,Yw=$w.hasOwnProperty;function Xw(n,t,e){var r=n[t];(!(Yw.call(n,t)&&oa(r,e))||e===void 0&&!(t in n))&&Dc(n,t,e)}var na=Xw;function Qw(n,t,e,r){var o=!e;e||(e={});for(var i=-1,a=t.length;++i<a;){var s=t[i],l=r?r(e[s],n[s],s,e,n):void 0;l===void 0&&(l=n[s]),o?Dc(e,s,l):na(e,s,l)}return e}var To=Qw;var _m=Math.max;function Kw(n,t,e){return t=_m(t===void 0?n.length-1:t,0),function(){for(var r=arguments,o=-1,i=_m(r.length-t,0),a=Array(i);++o<i;)a[o]=r[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=r[o];return s[t]=e(a),gm(n,this,s)}}var Pm=Kw;var Zw=9007199254740991;function Jw(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=Zw}var ia=Jw;function e2(n){return n!=null&&ia(n.length)&&!Mc(n)}var Ec=e2;var t2=Object.prototype;function r2(n){var t=n&&n.constructor,e=typeof t=="function"&&t.prototype||t2;return n===e}var aa=r2;function o2(n,t){for(var e=-1,r=Array(n);++e<n;)r[e]=t(e);return r}var Om=o2;var n2="[object Arguments]";function i2(n){return sr(n)&&Gr(n)==n2}var hp=i2;var Cm=Object.prototype,a2=Cm.hasOwnProperty,s2=Cm.propertyIsEnumerable,l2=hp(function(){return arguments}())?hp:function(n){return sr(n)&&a2.call(n,"callee")&&!s2.call(n,"callee")},sa=l2;function c2(){return!1}var Tm=c2;var Nm=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mm=Nm&&typeof module=="object"&&module&&!module.nodeType&&module,u2=Mm&&Mm.exports===Nm,Im=u2?Gt.Buffer:void 0,d2=Im?Im.isBuffer:void 0,p2=d2||Tm,xi=p2;var f2="[object Arguments]",h2="[object Array]",m2="[object Boolean]",y2="[object Date]",g2="[object Error]",x2="[object Function]",b2="[object Map]",v2="[object Number]",S2="[object Object]",w2="[object RegExp]",A2="[object Set]",_2="[object String]",P2="[object WeakMap]",O2="[object ArrayBuffer]",C2="[object DataView]",T2="[object Float32Array]",M2="[object Float64Array]",I2="[object Int8Array]",N2="[object Int16Array]",D2="[object Int32Array]",E2="[object Uint8Array]",B2="[object Uint8ClampedArray]",L2="[object Uint16Array]",R2="[object Uint32Array]",gt={};gt[T2]=gt[M2]=gt[I2]=gt[N2]=gt[D2]=gt[E2]=gt[B2]=gt[L2]=gt[R2]=!0;gt[f2]=gt[h2]=gt[O2]=gt[m2]=gt[C2]=gt[y2]=gt[g2]=gt[x2]=gt[b2]=gt[v2]=gt[S2]=gt[w2]=gt[A2]=gt[_2]=gt[P2]=!1;function V2(n){return sr(n)&&ia(n.length)&&!!gt[Gr(n)]}var Dm=V2;function z2(n){return function(t){return n(t)}}var la=z2;var Em=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dl=Em&&typeof module=="object"&&module&&!module.nodeType&&module,G2=dl&&dl.exports===Em,mp=G2&&Cc.process,F2=function(){try{var n=dl&&dl.require&&dl.require("util").types;return n||mp&&mp.binding&&mp.binding("util")}catch{}}(),en=F2;var Bm=en&&en.isTypedArray,k2=Bm?la(Bm):Dm,Bc=k2;var j2=Object.prototype,U2=j2.hasOwnProperty;function H2(n,t){var e=Mt(n),r=!e&&sa(n),o=!e&&!r&&xi(n),i=!e&&!r&&!o&&Bc(n),a=e||r||o||i,s=a?Om(n.length,String):[],l=s.length;for(var u in n)(t||U2.call(n,u))&&!(a&&(u=="length"||o&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ra(u,l)))&&s.push(u);return s}var Lc=H2;function q2(n,t){return function(e){return n(t(e))}}var Rc=q2;var W2=Rc(Object.keys,Object),Lm=W2;var $2=Object.prototype,Y2=$2.hasOwnProperty;function X2(n){if(!aa(n))return Lm(n);var t=[];for(var e in Object(n))Y2.call(n,e)&&e!="constructor"&&t.push(e);return t}var Rm=X2;function Q2(n){return Ec(n)?Lc(n):Rm(n)}var ca=Q2;function K2(n){var t=[];if(n!=null)for(var e in Object(n))t.push(e);return t}var Vm=K2;var Z2=Object.prototype,J2=Z2.hasOwnProperty;function eA(n){if(!Fr(n))return Vm(n);var t=aa(n),e=[];for(var r in n)r=="constructor"&&(t||!J2.call(n,r))||e.push(r);return e}var zm=eA;function tA(n){return Ec(n)?Lc(n,!0):zm(n)}var ua=tA;var rA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,oA=/^\w*$/;function nA(n,t){if(Mt(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||ea(n)?!0:oA.test(n)||!rA.test(n)||t!=null&&n in Object(t)}var Gm=nA;var iA=Or(Object,"create"),tn=iA;function aA(){this.__data__=tn?tn(null):{},this.size=0}var Fm=aA;function sA(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}var km=sA;var lA="__lodash_hash_undefined__",cA=Object.prototype,uA=cA.hasOwnProperty;function dA(n){var t=this.__data__;if(tn){var e=t[n];return e===lA?void 0:e}return uA.call(t,n)?t[n]:void 0}var jm=dA;var pA=Object.prototype,fA=pA.hasOwnProperty;function hA(n){var t=this.__data__;return tn?t[n]!==void 0:fA.call(t,n)}var Um=hA;var mA="__lodash_hash_undefined__";function yA(n,t){var e=this.__data__;return this.size+=this.has(n)?0:1,e[n]=tn&&t===void 0?mA:t,this}var Hm=yA;function da(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}da.prototype.clear=Fm;da.prototype.delete=km;da.prototype.get=jm;da.prototype.has=Um;da.prototype.set=Hm;var yp=da;function gA(){this.__data__=[],this.size=0}var qm=gA;function xA(n,t){for(var e=n.length;e--;)if(oa(n[e][0],t))return e;return-1}var Cn=xA;var bA=Array.prototype,vA=bA.splice;function SA(n){var t=this.__data__,e=Cn(t,n);if(e<0)return!1;var r=t.length-1;return e==r?t.pop():vA.call(t,e,1),--this.size,!0}var Wm=SA;function wA(n){var t=this.__data__,e=Cn(t,n);return e<0?void 0:t[e][1]}var $m=wA;function AA(n){return Cn(this.__data__,n)>-1}var Ym=AA;function _A(n,t){var e=this.__data__,r=Cn(e,n);return r<0?(++this.size,e.push([n,t])):e[r][1]=t,this}var Xm=_A;function pa(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}pa.prototype.clear=qm;pa.prototype.delete=Wm;pa.prototype.get=$m;pa.prototype.has=Ym;pa.prototype.set=Xm;var Tn=pa;var PA=Or(Gt,"Map"),Mn=PA;function OA(){this.size=0,this.__data__={hash:new yp,map:new(Mn||Tn),string:new yp}}var Qm=OA;function CA(n){var t=typeof n;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?n!=="__proto__":n===null}var Km=CA;function TA(n,t){var e=n.__data__;return Km(t)?e[typeof t=="string"?"string":"hash"]:e.map}var In=TA;function MA(n){var t=In(this,n).delete(n);return this.size-=t?1:0,t}var Zm=MA;function IA(n){return In(this,n).get(n)}var Jm=IA;function NA(n){return In(this,n).has(n)}var ey=NA;function DA(n,t){var e=In(this,n),r=e.size;return e.set(n,t),this.size+=e.size==r?0:1,this}var ty=DA;function fa(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}fa.prototype.clear=Qm;fa.prototype.delete=Zm;fa.prototype.get=Jm;fa.prototype.has=ey;fa.prototype.set=ty;var bi=fa;var EA="Expected a function";function gp(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new TypeError(EA);var e=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=e.cache;if(i.has(o))return i.get(o);var a=n.apply(this,r);return e.cache=i.set(o,a)||i,a};return e.cache=new(gp.Cache||bi),e}gp.Cache=bi;var ry=gp;var BA=500;function LA(n){var t=ry(n,function(r){return e.size===BA&&e.clear(),r}),e=t.cache;return t}var oy=LA;var RA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,VA=/\\(\\)?/g,zA=oy(function(n){var t=[];return n.charCodeAt(0)===46&&t.push(""),n.replace(RA,function(e,r,o,i){t.push(o?i.replace(VA,"$1"):r||e)}),t}),ny=zA;function GA(n){return n==null?"":cm(n)}var iy=GA;function FA(n,t){return Mt(n)?n:Gm(n,t)?[n]:ny(iy(n))}var Yr=FA;var kA=1/0;function jA(n){if(typeof n=="string"||ea(n))return n;var t=n+"";return t=="0"&&1/n==-kA?"-0":t}var Nn=jA;function UA(n,t){t=Yr(t,n);for(var e=0,r=t.length;n!=null&&e<r;)n=n[Nn(t[e++])];return e&&e==r?n:void 0}var Vc=UA;function HA(n,t){for(var e=-1,r=t.length,o=n.length;++e<r;)n[o+e]=t[e];return n}var ha=HA;var ay=Jt?Jt.isConcatSpreadable:void 0;function qA(n){return Mt(n)||sa(n)||!!(ay&&n&&n[ay])}var sy=qA;function ly(n,t,e,r,o){var i=-1,a=n.length;for(e||(e=sy),o||(o=[]);++i<a;){var s=n[i];t>0&&e(s)?t>1?ly(s,t-1,e,r,o):ha(o,s):r||(o[o.length]=s)}return o}var cy=ly;function WA(n){var t=n==null?0:n.length;return t?cy(n,1):[]}var uy=WA;function $A(n){return wm(Pm(n,void 0,uy),n+"")}var zc=$A;var YA=Rc(Object.getPrototypeOf,Object),ma=YA;var XA="[object Object]",QA=Function.prototype,KA=Object.prototype,dy=QA.toString,ZA=KA.hasOwnProperty,JA=dy.call(Object);function e_(n){if(!sr(n)||Gr(n)!=XA)return!1;var t=ma(n);if(t===null)return!0;var e=ZA.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&dy.call(e)==JA}var py=e_;function t_(n,t,e){var r=-1,o=n.length;t<0&&(t=-t>o?0:o+t),e=e>o?o:e,e<0&&(e+=o),o=t>e?0:e-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=n[r+t];return i}var fy=t_;function r_(){this.__data__=new Tn,this.size=0}var hy=r_;function o_(n){var t=this.__data__,e=t.delete(n);return this.size=t.size,e}var my=o_;function n_(n){return this.__data__.get(n)}var yy=n_;function i_(n){return this.__data__.has(n)}var gy=i_;var a_=200;function s_(n,t){var e=this.__data__;if(e instanceof Tn){var r=e.__data__;if(!Mn||r.length<a_-1)return r.push([n,t]),this.size=++e.size,this;e=this.__data__=new bi(r)}return e.set(n,t),this.size=e.size,this}var xy=s_;function ya(n){var t=this.__data__=new Tn(n);this.size=t.size}ya.prototype.clear=hy;ya.prototype.delete=my;ya.prototype.get=yy;ya.prototype.has=gy;ya.prototype.set=xy;var ga=ya;function l_(n,t){return n&&To(t,ca(t),n)}var by=l_;function c_(n,t){return n&&To(t,ua(t),n)}var vy=c_;var _y=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Sy=_y&&typeof module=="object"&&module&&!module.nodeType&&module,u_=Sy&&Sy.exports===_y,wy=u_?Gt.Buffer:void 0,Ay=wy?wy.allocUnsafe:void 0;function d_(n,t){if(t)return n.slice();var e=n.length,r=Ay?Ay(e):new n.constructor(e);return n.copy(r),r}var Py=d_;function p_(n,t){for(var e=-1,r=n==null?0:n.length,o=0,i=[];++e<r;){var a=n[e];t(a,e,n)&&(i[o++]=a)}return i}var Oy=p_;function f_(){return[]}var Gc=f_;var h_=Object.prototype,m_=h_.propertyIsEnumerable,Cy=Object.getOwnPropertySymbols,y_=Cy?function(n){return n==null?[]:(n=Object(n),Oy(Cy(n),function(t){return m_.call(n,t)}))}:Gc,xa=y_;function g_(n,t){return To(n,xa(n),t)}var Ty=g_;var x_=Object.getOwnPropertySymbols,b_=x_?function(n){for(var t=[];n;)ha(t,xa(n)),n=ma(n);return t}:Gc,Fc=b_;function v_(n,t){return To(n,Fc(n),t)}var My=v_;function S_(n,t,e){var r=t(n);return Mt(n)?r:ha(r,e(n))}var kc=S_;function w_(n){return kc(n,ca,xa)}var pl=w_;function A_(n){return kc(n,ua,Fc)}var jc=A_;var __=Or(Gt,"DataView"),Uc=__;var P_=Or(Gt,"Promise"),Hc=P_;var O_=Or(Gt,"Set"),qc=O_;var Iy="[object Map]",C_="[object Object]",Ny="[object Promise]",Dy="[object Set]",Ey="[object WeakMap]",By="[object DataView]",T_=Jo(Uc),M_=Jo(Mn),I_=Jo(Hc),N_=Jo(qc),D_=Jo(Nc),vi=Gr;(Uc&&vi(new Uc(new ArrayBuffer(1)))!=By||Mn&&vi(new Mn)!=Iy||Hc&&vi(Hc.resolve())!=Ny||qc&&vi(new qc)!=Dy||Nc&&vi(new Nc)!=Ey)&&(vi=function(n){var t=Gr(n),e=t==C_?n.constructor:void 0,r=e?Jo(e):"";if(r)switch(r){case T_:return By;case M_:return Iy;case I_:return Ny;case N_:return Dy;case D_:return Ey}return t});var rn=vi;var E_=Object.prototype,B_=E_.hasOwnProperty;function L_(n){var t=n.length,e=new n.constructor(t);return t&&typeof n[0]=="string"&&B_.call(n,"index")&&(e.index=n.index,e.input=n.input),e}var Ly=L_;var R_=Gt.Uint8Array,ba=R_;function V_(n){var t=new n.constructor(n.byteLength);return new ba(t).set(new ba(n)),t}var va=V_;function z_(n,t){var e=t?va(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}var Ry=z_;var G_=/\w*$/;function F_(n){var t=new n.constructor(n.source,G_.exec(n));return t.lastIndex=n.lastIndex,t}var Vy=F_;var zy=Jt?Jt.prototype:void 0,Gy=zy?zy.valueOf:void 0;function k_(n){return Gy?Object(Gy.call(n)):{}}var Fy=k_;function j_(n,t){var e=t?va(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.length)}var ky=j_;var U_="[object Boolean]",H_="[object Date]",q_="[object Map]",W_="[object Number]",$_="[object RegExp]",Y_="[object Set]",X_="[object String]",Q_="[object Symbol]",K_="[object ArrayBuffer]",Z_="[object DataView]",J_="[object Float32Array]",eP="[object Float64Array]",tP="[object Int8Array]",rP="[object Int16Array]",oP="[object Int32Array]",nP="[object Uint8Array]",iP="[object Uint8ClampedArray]",aP="[object Uint16Array]",sP="[object Uint32Array]";function lP(n,t,e){var r=n.constructor;switch(t){case K_:return va(n);case U_:case H_:return new r(+n);case Z_:return Ry(n,e);case J_:case eP:case tP:case rP:case oP:case nP:case iP:case aP:case sP:return ky(n,e);case q_:return new r;case W_:case X_:return new r(n);case $_:return Vy(n);case Y_:return new r;case Q_:return Fy(n)}}var jy=lP;function cP(n){return typeof n.constructor=="function"&&!aa(n)?ym(ma(n)):{}}var Uy=cP;var uP="[object Map]";function dP(n){return sr(n)&&rn(n)==uP}var Hy=dP;var qy=en&&en.isMap,pP=qy?la(qy):Hy,Wy=pP;var fP="[object Set]";function hP(n){return sr(n)&&rn(n)==fP}var $y=hP;var Yy=en&&en.isSet,mP=Yy?la(Yy):$y,Xy=mP;var yP=1,gP=2,xP=4,Qy="[object Arguments]",bP="[object Array]",vP="[object Boolean]",SP="[object Date]",wP="[object Error]",Ky="[object Function]",AP="[object GeneratorFunction]",_P="[object Map]",PP="[object Number]",Zy="[object Object]",OP="[object RegExp]",CP="[object Set]",TP="[object String]",MP="[object Symbol]",IP="[object WeakMap]",NP="[object ArrayBuffer]",DP="[object DataView]",EP="[object Float32Array]",BP="[object Float64Array]",LP="[object Int8Array]",RP="[object Int16Array]",VP="[object Int32Array]",zP="[object Uint8Array]",GP="[object Uint8ClampedArray]",FP="[object Uint16Array]",kP="[object Uint32Array]",ht={};ht[Qy]=ht[bP]=ht[NP]=ht[DP]=ht[vP]=ht[SP]=ht[EP]=ht[BP]=ht[LP]=ht[RP]=ht[VP]=ht[_P]=ht[PP]=ht[Zy]=ht[OP]=ht[CP]=ht[TP]=ht[MP]=ht[zP]=ht[GP]=ht[FP]=ht[kP]=!0;ht[wP]=ht[Ky]=ht[IP]=!1;function Wc(n,t,e,r,o,i){var a,s=t&yP,l=t&gP,u=t&xP;if(e&&(a=o?e(n,r,o,i):e(n)),a!==void 0)return a;if(!Fr(n))return n;var c=Mt(n);if(c){if(a=Ly(n),!s)return xm(n,a)}else{var d=rn(n),p=d==Ky||d==AP;if(xi(n))return Py(n,s);if(d==Zy||d==Qy||p&&!o){if(a=l||p?{}:Uy(n),!s)return l?My(n,vy(a,n)):Ty(n,by(a,n))}else{if(!ht[d])return o?n:{};a=jy(n,d,s)}}i||(i=new ga);var f=i.get(n);if(f)return f;i.set(n,a),Xy(n)?n.forEach(function(y){a.add(Wc(y,t,e,y,n,i))}):Wy(n)&&n.forEach(function(y,g){a.set(g,Wc(y,t,e,g,n,i))});var h=u?l?jc:pl:l?ua:ca,m=c?void 0:h(n);return Am(m||n,function(y,g){m&&(g=y,y=n[g]),na(a,g,Wc(y,t,e,g,n,i))}),a}var $c=Wc;var jP=1,UP=4;function HP(n){return $c(n,jP|UP)}var on=HP;var qP="__lodash_hash_undefined__";function WP(n){return this.__data__.set(n,qP),this}var Jy=WP;function $P(n){return this.__data__.has(n)}var eg=$P;function Yc(n){var t=-1,e=n==null?0:n.length;for(this.__data__=new bi;++t<e;)this.add(n[t])}Yc.prototype.add=Yc.prototype.push=Jy;Yc.prototype.has=eg;var tg=Yc;function YP(n,t){for(var e=-1,r=n==null?0:n.length;++e<r;)if(t(n[e],e,n))return!0;return!1}var rg=YP;function XP(n,t){return n.has(t)}var og=XP;var QP=1,KP=2;function ZP(n,t,e,r,o,i){var a=e&QP,s=n.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var u=i.get(n),c=i.get(t);if(u&&c)return u==t&&c==n;var d=-1,p=!0,f=e&KP?new tg:void 0;for(i.set(n,t),i.set(t,n);++d<s;){var h=n[d],m=t[d];if(r)var y=a?r(m,h,d,t,n,i):r(h,m,d,n,t,i);if(y!==void 0){if(y)continue;p=!1;break}if(f){if(!rg(t,function(g,b){if(!og(f,b)&&(h===g||o(h,g,e,r,i)))return f.push(b)})){p=!1;break}}else if(!(h===m||o(h,m,e,r,i))){p=!1;break}}return i.delete(n),i.delete(t),p}var Xc=ZP;function JP(n){var t=-1,e=Array(n.size);return n.forEach(function(r,o){e[++t]=[o,r]}),e}var ng=JP;function eO(n){var t=-1,e=Array(n.size);return n.forEach(function(r){e[++t]=r}),e}var ig=eO;var tO=1,rO=2,oO="[object Boolean]",nO="[object Date]",iO="[object Error]",aO="[object Map]",sO="[object Number]",lO="[object RegExp]",cO="[object Set]",uO="[object String]",dO="[object Symbol]",pO="[object ArrayBuffer]",fO="[object DataView]",ag=Jt?Jt.prototype:void 0,xp=ag?ag.valueOf:void 0;function hO(n,t,e,r,o,i,a){switch(e){case fO:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case pO:return!(n.byteLength!=t.byteLength||!i(new ba(n),new ba(t)));case oO:case nO:case sO:return oa(+n,+t);case iO:return n.name==t.name&&n.message==t.message;case lO:case uO:return n==t+"";case aO:var s=ng;case cO:var l=r&tO;if(s||(s=ig),n.size!=t.size&&!l)return!1;var u=a.get(n);if(u)return u==t;r|=rO,a.set(n,t);var c=Xc(s(n),s(t),r,o,i,a);return a.delete(n),c;case dO:if(xp)return xp.call(n)==xp.call(t)}return!1}var sg=hO;var mO=1,yO=Object.prototype,gO=yO.hasOwnProperty;function xO(n,t,e,r,o,i){var a=e&mO,s=pl(n),l=s.length,u=pl(t),c=u.length;if(l!=c&&!a)return!1;for(var d=l;d--;){var p=s[d];if(!(a?p in t:gO.call(t,p)))return!1}var f=i.get(n),h=i.get(t);if(f&&h)return f==t&&h==n;var m=!0;i.set(n,t),i.set(t,n);for(var y=a;++d<l;){p=s[d];var g=n[p],b=t[p];if(r)var w=a?r(b,g,p,t,n,i):r(g,b,p,n,t,i);if(!(w===void 0?g===b||o(g,b,e,r,i):w)){m=!1;break}y||(y=p=="constructor")}if(m&&!y){var A=n.constructor,S=t.constructor;A!=S&&"constructor"in n&&"constructor"in t&&!(typeof A=="function"&&A instanceof A&&typeof S=="function"&&S instanceof S)&&(m=!1)}return i.delete(n),i.delete(t),m}var lg=xO;var bO=1,cg="[object Arguments]",ug="[object Array]",Qc="[object Object]",vO=Object.prototype,dg=vO.hasOwnProperty;function SO(n,t,e,r,o,i){var a=Mt(n),s=Mt(t),l=a?ug:rn(n),u=s?ug:rn(t);l=l==cg?Qc:l,u=u==cg?Qc:u;var c=l==Qc,d=u==Qc,p=l==u;if(p&&xi(n)){if(!xi(t))return!1;a=!0,c=!1}if(p&&!c)return i||(i=new ga),a||Bc(n)?Xc(n,t,e,r,o,i):sg(n,t,l,e,r,o,i);if(!(e&bO)){var f=c&&dg.call(n,"__wrapped__"),h=d&&dg.call(t,"__wrapped__");if(f||h){var m=f?n.value():n,y=h?t.value():t;return i||(i=new ga),o(m,y,e,r,i)}}return p?(i||(i=new ga),lg(n,t,e,r,o,i)):!1}var pg=SO;function fg(n,t,e,r,o){return n===t?!0:n==null||t==null||!sr(n)&&!sr(t)?n!==n&&t!==t:pg(n,t,e,r,fg,o)}var hg=fg;function wO(n,t){return n!=null&&t in Object(n)}var mg=wO;function AO(n,t,e){t=Yr(t,n);for(var r=-1,o=t.length,i=!1;++r<o;){var a=Nn(t[r]);if(!(i=n!=null&&e(n,a)))break;n=n[a]}return i||++r!=o?i:(o=n==null?0:n.length,!!o&&ia(o)&&ra(a,o)&&(Mt(n)||sa(n)))}var yg=AO;function _O(n,t){return n!=null&&yg(n,t,mg)}var gg=_O;function PO(n){var t=n==null?0:n.length;return t?n[t-1]:void 0}var xg=PO;function OO(n,t){return t.length<2?n:Vc(n,fy(t,0,-1))}var bg=OO;function CO(n,t){return hg(n,t)}var bp=CO;function TO(n,t){return t=Yr(t,n),n=bg(n,t),n==null||delete n[Nn(xg(t))]}var vg=TO;function MO(n){return py(n)?void 0:n}var Sg=MO;var IO=1,NO=2,DO=4,EO=zc(function(n,t){var e={};if(n==null)return e;var r=!1;t=Tc(t,function(i){return i=Yr(i,n),r||(r=i.length>1),i}),To(n,jc(n),e),r&&(e=$c(e,IO|NO|DO,Sg));for(var o=t.length;o--;)vg(e,t[o]);return e}),Sa=EO;function BO(n,t,e,r){if(!Fr(n))return n;t=Yr(t,n);for(var o=-1,i=t.length,a=i-1,s=n;s!=null&&++o<i;){var l=Nn(t[o]),u=e;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(o!=a){var c=s[l];u=r?r(c,l,s):void 0,u===void 0&&(u=Fr(c)?c:ra(t[o+1])?[]:{})}na(s,l,u),s=s[l]}return n}var wg=BO;function LO(n,t,e){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],s=Vc(n,a);e(s,a)&&wg(i,Yr(a,n),s)}return i}var Ag=LO;function RO(n,t){return Ag(n,t,function(e,r){return gg(n,r)})}var _g=RO;var VO=zc(function(n,t){return n==null?{}:_g(n,t)}),uo=VO;var be=class{modifyById(t,e){let r=this;if(r[t]===void 0)throw new Error("not expected");{let i={...r,[t]:e};return Object.setPrototypeOf(i,be.prototype),i}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let r=e[t.id],o;r===void 0?o={type:2,id:t.id}:o={type:1,id:t.id,data:r};let{id:i,data:a}=t,s={...e,[i]:a};return Object.setPrototypeOf(s,be.prototype),{data:s,actual:t,reverse:o}}else if(t.type===2){let{id:r}=t,o=e[r];if(o===void 0)return null;{let i={...e};return Object.setPrototypeOf(i,be.prototype),delete i[r],{data:i,actual:t,reverse:{type:1,id:r,data:o}}}}return null}};function fl(n){if(n.deepFreeze!==void 0){n.deepFreeze(n);return}let t=Object.getOwnPropertyNames(n);for(let e of t){let r=n[e];r&&typeof r=="object"&&fl(r)}return Object.freeze(n)}function Pg(n,t){let e=0;for(;e<n.length&&e<t.length;){if(n[e]<t[e])return-1;if(n[e]>t[e])return 1;e+=1}return e!==t.length?-1:e!==n.length?1:0}var wa=class extends Error{};function Kc(n){let t={...n};return Object.setPrototypeOf(t,Object.getPrototypeOf(n)),t}function Mo(n,t,e){if(n===void 0?t===void 0?(n=0,t=10):n=t-10:t===void 0&&(t=n+10),n>t){let i=n;n=t,t=i}let r=[],o=1/(e+1);for(let i=0;i<e;i++){let a=n+(t-n)*(i+.75+Math.random()*.5)*o;r.push(a)}return r}function Aa(n){return n instanceof Uint8Array||n instanceof Uint16Array||n instanceof Uint32Array||n instanceof Int8Array||n instanceof Int16Array||n instanceof Int32Array||n instanceof Float32Array||n instanceof Float64Array}function Og(){return typeof process<"u"}function Cg(n,t){for(let e of n)t(e.id,e.data)!==!0&&Cg(e.children,t)}function Tg(n,t){if(t(n.id,n.data)!==!0)for(let e of n.children)Tg(e,t)}var ut=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,ut.prototype)}deepFreeze(){let e=0;for(;e<this.length;)fl(this[e]),e++}fillCaches0(e,r){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,r);for(let o of e.children)this.fillCaches0(o,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,r){if(!this.has(e))return!0;for(;e;){let o=this.parent(e);if(o===r)return!0;e=o}return!1}rootAcestor(e){for(;e;){let r=this.parent(e);if(r)e=r;else return e}return e}isDescendantOf(e,r){for(;e;){let o=this.parent(e);if(o===r)return!0;e=o}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,r){if(e===null)this.traverse(r);else{let o=this.get(e);o&&Tg(o,r)}}traverse(e){Cg(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,r){if(this.get(e)===void 0)throw new Error("not expected");{let i=this.parent(e),a=this.childrenArray(i),s=a.findIndex(c=>c.id===e);if(s<0)throw new Error("not expected");let l=a[s];return a=[...a],a[s]={...l,data:r},this.modifyArrayBy(i,a)}}modifyArrayBy(e,r){let o=e,i=r;for(;o!==null;){let s=i,l=o;if(o=this.parent(o),o===void 0)throw new Error;i=this.childrenArray(o);let u=i.findIndex(c=>c.id===l);if(u<0)throw new Error;i=[...i],i[u]={...i[u],children:s}}Object.setPrototypeOf(i,ut.prototype);let a=i;return a.fillCaches(),a}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:r}){if(this.get(e)!==void 0)return!0;for(let o of r)if(this.checkDuplicatedIdRec(o))return!0;return!1}addOp(e){let{parent:r,fi:o,id:i,data:a,children:s}=e;if(r!==null&&this.get(r)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=r,u=this.childrenArray(l),c={fi:o,id:i,data:a,children:s};return u=[...u,c],u.sort((p,f)=>p.fi-f.fi),e.localIndex=u.indexOf(c),{data:this.modifyArrayBy(l,u),actual:e,reverse:{type:8,id:i}}}}deleteOp(e){let{id:r}=e;if(this.get(r)===null)return null;{let o=this.parent(r);if(o===void 0)return null;let i=this.childrenArray(o),a=i.findIndex(u=>u.id===r);e.localIndex=a,i=[...i];let s=i.splice(a,1)[0];return{data:this.modifyArrayBy(o,i),actual:e,reverse:{type:7,...s,parent:o}}}}moveOp(e){let{parent:r,fi:o,id:i}=e;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:i});if(r!==null){let f=r;for(;f!==null;){if(f===void 0)throw new Error;if(f===i)throw new wa("cyclic tree");f=this.parent(f)}}let a=this.parent(i);if(a===void 0)return null;let s=a,l=this.childrenArray(a),u=l.findIndex(f=>f.id===i);l=[...l];let c=l.splice(u,1)[0],d=this.modifyArrayBy(a,l);a=r,l=d.childrenArray(a);let p=c.fi;return c={...c,fi:o},l=[...l,c],l.sort((f,h)=>f.fi-h.fi),e.localIndex=l.indexOf(c),d=d.modifyArrayBy(a,l),{data:d,actual:e,reverse:{type:9,parent:s,fi:p,id:i}}}previous(e,r){if(r===null){let i=this.childrenArray(e);return i.length===0?null:i[i.length-1].id}let o=null;for(let i of this.childrenArray(e)){if(i.id===r)return o;o=i.id}return null}traverseSortNext(e){let r=this.parent(e);if(r!==void 0){let o=this.childrenArray(r),i=o.findIndex(a=>a.id===e)+1;if(i<o.length)return o[i].id;if(r)return this.traverseSortNext(r)}}sortNext(e){let r=this.childrenArray(e);return r.length>0?r[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let r=this.childrenArray(e);return r.length>0?this.traverseSortPrevious(r[r.length-1].id):e}sortPrevious(e){let r=this.parent(e);if(r!==void 0){let o=this.childrenArray(r),i=o.findIndex(a=>a.id===e)-1;return i>=0?this.traverseSortPrevious(o[i].id):r}}getAllSorted(e){let r=[];for(let o of e){let i=this.getWithSortKey(o.id);i!==void 0&&r.push({...o,...i})}r.sort((o,i)=>Pg(o.sortKey,i.sortKey));for(let o of r)delete o.sortKey;return r}getWithSortKey(e){var r=e;let o=[],i=this.get(r),a=i;if(i!==void 0){for(;r;)o.splice(0,0,i.fi),r=this.parent(r),r!==null&&(i=this.get(r));return{...a,sortKey:o}}}insertBeforeHelper(e,r,o){return this.insertAfterHelper(e,this.previous(e,r),o)}insertAfterHelper(e,r,o){let i=this.childrenArray(e);if(r===null){if(i.length===0)return Mo(0,o,o);{let a=i[0].fi;return Mo(a-o,a,o)}}else{let a=this.get(r);if(a===void 0||this.parent(r)!==e)throw new Error("illegal args");let s=i.find(l=>l.fi>a.fi);if(s===void 0){let l=i[i.length-1].fi;return Mo(l,l+o,o)}else return Mo(a.fi,s.fi,o)}}};var _a;(t=>{function n(e,r){if(r.type!==0)return null;if(Array.isArray(e)){let o=r.props,i={},a=[...e],s=!1;if(o)for(let l of Object.keys(o)){let u=parseInt(l);if(isNaN(u))throw new Error("wrong index");i[l]=a[u],a[u]=o[l],s=!0}return s?{data:a,actual:r,reverse:{type:0,props:i}}:null}else{let o=r.props,i={},a={...e},s=!1;if(o)for(let l of Object.keys(o)){i[l]=a[l];let u=o[l];u===void 0?delete a[l]:a[l]=u,s=!0}return s?{data:a,actual:r,reverse:{type:0,props:i}}:null}}t.runOp=n})(_a||(_a={}));var we=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,we.prototype)}deepFreeze(){let e=0;for(;e<this.length;)fl(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,r){if(this.get(e)===void 0)throw new Error("not expected");{let i=this,a=i.findIndex(u=>u.id===e);if(a<0)throw new Error("not expected");let s=i[a];return i=[...i],i[a]={...s,data:r},this.modifyArrayBy(i)}}modifyArrayBy(e){Object.setPrototypeOf(e,we.prototype);let r=e;return Og()||r.fillCaches(),r}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:r,id:o,data:i}=e,a=this,s={fi:r,id:o,data:i};return a=[...a,s],a.sort((u,c)=>u.fi-c.fi),e.localIndex=a.indexOf(s),{data:this.modifyArrayBy(a),actual:e,reverse:{type:5,id:o}}}deleteOp(e){let{id:r}=e,o=this,i=o.findIndex(l=>l.id===r);if(i===-1)return null;e.localIndex=i,o=[...o];let a=o.splice(i,1)[0];return{data:this.modifyArrayBy(o),actual:e,reverse:{type:4,...a}}}moveOp(e){let{fi:r,id:o}=e,i=this;i=[...i];let a=i.findIndex(c=>c.id===o);if(a===-1)return null;let s=i[a].fi,l={...i[a],fi:r};return i[a]=l,i.sort((c,d)=>c.fi-d.fi),e.localIndex=i.indexOf(l),{data:this.modifyArrayBy(i),actual:e,reverse:{type:6,fi:s,id:o}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let o of this){if(o.id===e)return r;r=o.id}return null}insertBeforeHelper(e,r){return this.insertAfterHelper(this.previous(e),r)}insertAfterHelper(e,r){let o=this;if(e===null){if(o.length===0)return Mo(0,r,r);{let i=o[0].fi;return Mo(i-r,i,r)}}else{let i=this.get(e);if(i===void 0)throw new Error("illegal args");let a=o.find(s=>s.fi>i.fi);if(a===void 0){let s=o[o.length-1].fi;return Mo(s,s+r,r)}else return Mo(i.fi,a.fi,r)}}};function Pa(n){return n&&typeof n=="object"&&n instanceof dt}var dt=class{unusedFunOverridesTable(t){}runOp(t){let e=[],r=this,o=0,i={};for(;o<t.path.length;){if(e.push(r),r=r===void 0?void 0:r[t.path[o]],r!==void 0&&!Pa(r))return null;o+=1}r=r?Kc(r):new dt;for(let[l,u]of Object.entries(t.props)){let c=r[l];i[l]=c,u===void 0?delete r[l]:r[l]=u}for(;o>0;){if(Object.keys(r).length===0){let l=e[o-1];l&&(r=Kc(l),delete r[t.path[o-1]])}else{let l=e[o-1];if(l){let u=Kc(l);u[t.path[o-1]]=r,r=u}else{let u=new dt;u[t.path[o-1]]=r,r=u}}o-=1}let a=Object.setPrototypeOf(r,dt.prototype),s={...t,props:i};return{data:a,actual:t,reverse:s}}},Io;(r=>{function n(o,i){return hl(o,i)??o}r.apply=n;function t(o,i){return Sp(o,i)}r.merge=t;function e(o,i){let a=0,s=i.path,l=o;for(;a<s.length&&l!==void 0;){if(l=St.zoomOnce(l,s[a]),l===void 0)return i;if(!Pa(l))return;a+=1}if(l===void 0)return i;if(!!Pa(l))if(i.type===0){let u={...i.props};for(let c of Object.keys(l))delete u[c];return{...i,props:u}}else if(i.type===1||i.type===4||i.type===7){let u=vp([i],l);return u?(console.log(u),u):i}else return i}r.filterOp=e})(Io||(Io={}));function vp(n,t){if(t===void 0)return;let e=!1,r=n.map(o=>{let i=o.id,a=hl(o.data,t[i]);if(e=e||a!==void 0,a===void 0&&(a=o.data),o.children){let s=vp(o.children,t);return s!==void 0?e=!0:s=o.children,{...o,id:i,data:a,children:s}}else return{...o,id:i,data:a}});if(e)return r}function zO(n,t){if(t===void 0)return;let e=!1,r=n.map(o=>{let i=o.id,a=hl(o.data,t[i]);return e=e||a!==void 0,a===void 0&&(a=o.data),{...o,id:i,data:a}});if(e)return Object.setPrototypeOf(r,Object.getPrototypeOf(n)),r}function hl(n,t){if(!Pa(t))return t;if(n instanceof ut){let e=vp(n,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(n)),e}else{if(n instanceof we)return zO(n,t);if(Array.isArray(n)){let e=!1,r=n.map((o,i)=>{let a=hl(o,t[i]);return e=e||a!==void 0,a===void 0&&(a=o),a});return e?(Object.setPrototypeOf(r,Object.getPrototypeOf(n)),r):void 0}else{if(n instanceof dt)return Sp(n,t);if(n&&typeof n=="object"){let e={},r=!1;for(let[o,i]of Object.entries(n)){let a=hl(i,t[o]);r=r||a!==void 0,a===void 0&&(a=i),e[o]=a}return r?(Object.setPrototypeOf(e,Object.getPrototypeOf(n)),e):void 0}}}}function Sp(n,t){if(n===void 0)return t;if(t===void 0)return n;if(!Pa(t))return t;if(!Pa(n))return Io.apply(n,t);let e=new Set;for(let o of Object.keys(n))e.add(o);for(let o of Object.keys(t))e.add(o);let r=new dt;for(let o of e){let i=Sp(n===void 0?void 0:n[o],t===void 0?void 0:t[o]);r[o]=i}return r}function Mg(n,t){let e={cur:[],result:[],len:0};return n=ml(n,t,e)??n,[n,e.result]}function Zc(n,t){return n===null?null:(n.cur[n.len]=t,n.len+=1,n)}function Jc(n){n&&(n.len-=1)}function GO(n){if(n===null)return null;n.result.push(n.cur.slice(0,n.len))}function Ig(n,t,e){let r=!1,o=n.map(i=>{let a=i.id,s=t[a];if(s!==void 0&&typeof s=="string"&&(r=!0,a=s,e!==null))throw new Error("not supported");let l=ml(i.data,t,Zc(e,a));Jc(e),r=r||l!==void 0,l===void 0&&(l=i.data);let u=Ig(i.children,t,e);return u!==void 0?r=!0:u=i.children,{...i,id:a,data:l,children:u}});if(r)return o}function FO(n,t,e){let r=!1,o=n.map(i=>{let a=i.id,s=t[a];if(s!==void 0&&typeof s=="string"&&(r=!0,a=s,e!==null))throw new Error("not supported");let l=ml(i.data,t,Zc(e,a));return Jc(e),r=r||l!==void 0,l===void 0&&(l=i.data),{...i,id:a,data:l}});if(r)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}function ml(n,t,e){if(n instanceof ut){let r=Ig(n,t,e);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(n)),r}else{if(n instanceof we)return FO(n,t,e);if(Array.isArray(n)){let r=!1,o=n.map((i,a)=>{let s=ml(i,t,Zc(e,a));return Jc(e),r=r||s!==void 0,s===void 0&&(s=i),s});return r?(Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o):void 0}else if(n&&typeof n=="object"&&!Aa(n)){let r={},o=!1;for(let[i,a]of Object.entries(n))if(i!=="name"){let s=t[i];if(typeof s=="string"){if(e!==null)throw new Error("not supported");o=!0,i=s}let l=ml(a,t,Zc(e,i));Jc(e),o=o||l!==void 0,l===void 0&&(l=a),r[i]=l}else r[i]=a;return o?(Object.setPrototypeOf(r,Object.getPrototypeOf(n)),r):void 0}else if(typeof n=="string"){let r=t[n];return r!==void 0&&GO(e),r}else return}}var Oa;(t=>{function n(e,r){let o=St.zoom(r,e.path);if(typeof o=="object"){let i={};for(let a of Object.keys(e.props))i[a]=o[a];return{...e,props:i}}else return{...e,props:{}}}t.replaceProps=n})(Oa||(Oa={}));var wt;(s=>{function n(l,u){return{...l,path:l.path.slice(u)}}s.drop=n;function t(l,u){return e(l,u)?.data??l}s.applySimple=t;function e(l,u){let c=u.path;for(var d=[];;){let p;if(l instanceof dt&&u.type===0&&(p=l.runOp({...u,path:c.slice(d.length)}),p===null&&(p=void 0)),p===void 0&&d.length===c.length&&(l instanceof ut||l instanceof we||l instanceof be?p=l.runOp(u):p=_a.runOp(l,u)),p!==void 0)if(p!==null){let m=p.data;for(let y=d.length-1;y>=0;y--){let g=c[y],b=d[y];if(b instanceof ut){if(typeof g=="number")throw new Error("illegal arg");m=b.modifyById(g,m)}else if(b instanceof we){if(typeof g=="number")throw new Error("illegal arg");m=b.modifyById(g,m)}else if(b instanceof be){if(typeof g=="number")throw new Error("illegal arg");m=b.modifyById(g,m)}else if(b instanceof dt){let w={...b,[g]:m};m=Object.setPrototypeOf(w,dt.prototype)}else if(typeof b=="object")if(Array.isArray(b)){if(typeof g=="string"&&(g=parseInt(g),isNaN(g)))throw new Error("Invalid path");let w=m;m=[...b],m[g]=w}else m={...b,[g]:m};else return null}return{data:m,actual:{...p.actual,path:c},reverse:{...p.reverse,path:c}}}else return null;let f=c[d.length],h;if(l instanceof ut){if(typeof f=="number")throw new Error("");h=l.get(f)?.data}else if(l instanceof we){if(typeof f=="number")throw new Error("");h=l.get(f)?.data}else l!==null&&(h=l[f]);if(h!==void 0)d.push(l),l=h;else return null}}s.apply=e;function r(l,u){for(let c=0;c<l.length&&c<u.length;c++)if(l[c]!==u[c])return!0;return!1}s.pathDisjoint=r;function o(l,u){if(l.length!==u.length)return!1;for(let c=0;c<l.length;c++)if(l[c]!==u[c])return!1;return!0}s.pathEq=o;function i(l,u){return r(l.path,u.path)}s.commutative=i;function a(l,u){return l.type===0&&u.type===0&&o(l.path,u.path)?Object.keys(l.props).every(c=>u.props[c]!==void 0):!1}s.subsumed=a})(wt||(wt={}));var yl;(l=>{function n(){return[]}l.empty=n;function t(u,c){let d=[];for(let p of u){let[f,...h]=p.path;f===c&&d.push({...p,path:h})}return d}l.removePrefix=t;function e(u,c){return u.map(d=>({...d,path:[c,...d.path]}))}l.addPrefix=e;function r(u,c){return[...u,...c]}l.concat=r;function o(u,c){return[...u.filter(p=>!c.some(f=>wt.subsumed(p,f))),...c]}l.compress=o;function i(u,c){return u.every(d=>c.every(p=>wt.commutative(d,p)))}l.commutative=i;function a(u,c){for(let d of c){let p=s(u,d);p!==null&&(u=p.data)}return u}l.applyAll=a;function s(u,c){var d=u;let p=[],f=[];for(let h of c)try{if(h.type===3||h.type===5&&h.path[h.path.length-1]==="variables"){let m,y,g;if(h.type===3?(m=St.zoom(d,[...h.path,h.id]),g=wt.apply(d,{...h,type:2})):(m=St.zoom(d,[...h.path,h.id,"value"]),g=wt.apply(d,h)),g!==null){d=g.data;let[b,w]=Mg(d,{[h.id]:m});d=b;for(let A=0;A<w.length;A++){let S=w[A],P=S.pop();if(typeof P=="number"){let O=[P];for(let D=A+1;D<w.length;D++){let N=w[D],T=N[N.length-1];if(typeof T=="number"&&St.equal(S,N.slice(0,N.length-1)))O.push(T),w.splice(D,1);else break}let x=St.zoom(d,S);y=x.map((D,N)=>O.includes(N)?h.id:D),m=x,P=S.pop()}else{if(P==="alphaOverride"||P==="alpha"){m/=100;let O=m,x=St.zoom(d,S.slice(0,S.length-2)),D=x.layers.map(N=>N.id===S[S.length-1]?{...N,data:{...N.data,[P]:O}}:N);Object.setPrototypeOf(D,Object.getPrototypeOf(x.layers)),x.layers=D}y=h.id}p.push({type:0,path:S,props:{[P]:m}}),f.push({type:0,path:S,props:{[P]:y}})}f.push(g.reverse),p.push(g.actual)}}else{let m=wt.apply(d,h);m!==null&&(p.push(m.actual),d=m.data,f.push(m.reverse))}}catch(m){if(m instanceof wa)return null;throw m}return{data:d,actual:p,reverse:f.reverse()}}l.apply=s})(yl||(yl={}));var Ng=Symbol(),kO=Symbol(),tu=Symbol(),Si=class{reportOp(t,e,r=[]){let o=this;if(e===null)return;o._current=e.data;let i=r;for(;!(o instanceof eu);){let a=o._path,s=o._current;if(a!==""&&i.splice(0,0,a),o=o._parent,o===null)return;o.update(a,s)}o.push(i,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let r=e[tu];r&&r(),delete this._children[t]}}}},Ap=class extends Si{constructor(t,e,r){super(),this._parent=t,this._path=e,this._current=r}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current={...this._current,[t]:e}}runOp(t){this.reportOp(t,_a.runOp(this._current,t),t.path)}},_p=class extends Si{constructor(t,e,r){super(),this._parent=t,this._path=e,this._current=r}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,be.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},Dg={get(n,t){if(t===tu)return()=>{n._parent=null};if(t===Ng)return n._current;if(t===kO)return n;let{_current:e,_children:r}=n;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let o=r===void 0?void 0:r[t];if(o!==void 0)return o;let i=e[t],a=ru(n,t,i);return a!==i?(r===void 0&&(r={},n._children=r),r[t]=a,a):i},has(n,t){return t in n._current},ownKeys(n){return Reflect.ownKeys(n._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(n){return Object.getPrototypeOf(n._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(n,t){let e=n._current,r=Reflect.getOwnPropertyDescriptor(e,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:e[t]}}},jO={...Dg,set(n,t,e){let r={type:0,props:{[t]:At(e)??e}};return n.deleteChildren(t),n.runOp(r),!0},deleteProperty(n,t){let e={type:0,props:{[t]:void 0}};return n.deleteChildren(t),n.runOp(e),!0}},UO={...Dg,set(n,t,e){return e===void 0?this.deleteProperty(n,t):(n.deleteChildren(t),n.runOp({type:1,id:t,data:e})),!0},deleteProperty(n,t){return n.runOp({type:2,id:t}),!0}},Ca=class extends Si{constructor(t,e,r){super(),this._children={},this._parent=t,this._path=e,this._current=r,this[tu]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}traverse(t){return this._current.traverse(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,r)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:r}=this,o=r===void 0?void 0:r[t];if(o!==void 0)return o;let i=e.get(t)?.data,a=ru(this,t,i);return a!==i?(r===void 0&&(r={},this._children=r),r[t]=a,a):i}add(t,e,r,o,i){this.runOp({type:7,parent:t,fi:e,id:r,data:o,children:i})}move(t,e,r){this.runOp({type:9,parent:t,fi:e,id:r})}insertAfter(t,e,r){let o=this._current.insertAfterHelper(t,e,r.length);for(let i=0;i<r.length;i++){let a=r[i];this.add(t,o[i],a.id,a.data,a.children)}}insertBefore(t,e,r){let o=this._current.insertBeforeHelper(t,e,r.length);for(let i=0;i<r.length;i++){let a=r[i];this.add(t,o[i],a.id,a.data,a.children)}}moveAfter(t,e,r){let o=this._current.insertAfterHelper(t,e,r.length);for(let i=0;i<r.length;i++){let a=r[i];this.move(t,o[i],a)}}moveBefore(t,e,r){let o=this._current.insertBeforeHelper(t,e,r.length);for(let i=0;i<r.length;i++){let a=r[i];this.move(t,o[i],a)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Ta=class extends Si{constructor(t,e,r){super(),this._children={},this._parent=t,this._path=e,this._current=r,this[tu]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let r=0;r<e;r++){let o=this._current[r].id,i=this._current[r].fi;t(this.data(this._current[r].id),o,i)}}find(t){let e=this.length;for(let r=0;r<e;r++){let o=this._current[r].id;if(t(this.data(o),o))return this.get(o)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}data(t){let{_current:e,_children:r}=this,o=r===void 0?void 0:r[t];if(o!==void 0)return o;let i=e.get(t)?.data,a=ru(this,t,i);return a!==i?(r===void 0&&(r={},this._children=r),r[t]=a,a):i}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,r){this.runOp({type:4,fi:t,id:e,data:r})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let r=this._current.insertAfterHelper(t,e.length);for(let o=0;o<e.length;o++){let i=e[o];this.add(r[o],i.id,i.data)}}insertBefore(t,e){let r=this._current.insertBeforeHelper(t,e.length);for(let o=0;o<e.length;o++){let i=e[o];this.add(r[o],i.id,i.data)}}moveAfter(t,e){let r=this._current.insertAfterHelper(t,e.length);for(let o=0;o<e.length;o++){let i=e[o];this.move(r[o],i)}}moveBefore(t,e){let r=this._current.insertBeforeHelper(t,e.length);for(let o=0;o<e.length;o++){let i=e[o];this.move(r[o],i)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};function wp(n,t,e){if(n.length>0){let r=n[n.length-1];if(r.type===0&&t.type===0&&St.equal(r.path,e)){Object.assign(r.props,t.props);return}}n.push({...t,path:e})}var eu=class extends Si{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,r,o){wp(this.ts,e,t),wp(this.actual,r,t),wp(this.reverse,o,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function ru(n,t,e){return e instanceof ut?new Ca(n,t,e):e instanceof we?new Ta(n,t,e):e instanceof be?new Proxy(new _p(n,t,e),UO):e!==null&&typeof e=="object"?Aa(e)?e:new Proxy(new Ap(n,t,e),jO):e}function Pp(n){let t=new eu(n);return[ru(t,"",n),t]}function Dn(n,t){let[e,r]=Pp(n);return t(e),r.result()}function At(n){return n instanceof Ca||n instanceof Ta?n._current:n!==null&&typeof n=="object"?n[Ng]:n}var St;(o=>{function n(i,a){if(a.length===i.length)for(var s=0;s<i.length;){if(i[s]!==a[s])return!1;s+=1}else return!1;return!0}o.equal=n;function t(i,a,s){let l=r(s,i);if(l!==void 0&&typeof l=="object"&&l!==null){let u={...a};return Object.keys(l).forEach(c=>{delete u[c]}),u}else return a}o.removeOverridden=t;function e(i,a){if((i instanceof ut||i instanceof Ca)&&typeof a=="string")return i.data(a);if((i instanceof we||i instanceof Ta)&&typeof a=="string")return i.data(a);if(typeof a=="number"&&Array.isArray(i))return i[a];if(typeof a=="string"&&typeof i=="object"&&i!==null)return i[a]}o.zoomOnce=e;function r(i,a,s=0){for(;s<a.length&&i!==void 0;)i=e(i,a[s]),s+=1;return i}o.zoom=r})(St||(St={}));function Eg(n,t){let e=[];if(t.length===n.length)for(var r=0;r<n.length;){if(t[r]==="*")e.push(n[r]);else if(n[r]!==t[r])return null;r+=1}else return null;return e}function Fe(n,t){let e=[];if(t.length<=n.length)for(var r=0;r<t.length;){if(t[r]==="*")e.push(n[r]);else if(n[r]!==t[r])return null;r+=1}else return null;return e}var ou=class{},gl=class extends ou{constructor(e){super();this.id=e}},xl=class extends ou{constructor(e){super();this.data=e}};var Cp;try{Cp=new TextDecoder}catch{}var de,Bn,G=0;var kg=[],Tp=kg,Mp=0,Cr={},Je,En,Xr=0,No=0,kr,nn,vr=[],rt,Bg={useRecords:!1,mapsAsObjects:!0},bl=class{},Np=new bl;Np.name="MessagePack 0xC1";var Ma=!1,Do=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0)),Object.assign(this,t)}unpack(t,e){if(de)return Wg(()=>(iu(),this?this.unpack(t,e):Do.prototype.unpack.call(Bg,t,e)));Bn=e>-1?e:t.length,G=0,Mp=0,No=0,En=null,Tp=kg,kr=null,de=t;try{rt=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(r){throw de=null,t instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof Do){if(Cr=this,this.structures)return Je=this.structures,nu();(!Je||Je.length>0)&&(Je=[])}else Cr=Bg,(!Je||Je.length>0)&&(Je=[]);return nu()}unpackMultiple(t,e){let r,o=0;try{Ma=!0;let i=t.length,a=this?this.unpack(t,i):lu.unpack(t,i);if(e){for(e(a);G<i;)if(o=G,e(nu())===!1)return}else{for(r=[a];G<i;)o=G,r.push(nu());return r}}catch(i){throw i.lastPosition=o,i.values=r,i}finally{Ma=!1,iu()}}_mergeStructures(t,e){t=t||[];for(let r=0,o=t.length;r<o;r++){let i=t[r];i&&(i.isShared=!0,r>=32&&(i.highByte=r-32>>5))}t.sharedLength=t.length;for(let r in e||[])if(r>=0){let o=t[r],i=e[r];i&&(o&&((t.restoreStructures||(t.restoreStructures=[]))[r]=o),t[r]=i)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};function nu(){try{if(!Cr.trusted&&!Ma){let t=Je.sharedLength||0;t<Je.length&&(Je.length=t)}let n=It();if(G==Bn)Je.restoreStructures&&Lg(),Je=null,de=null,nn&&(nn=null);else if(G>Bn){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}else if(!Ma)throw new Error("Data read, but end of buffer not reached");return n}catch(n){throw Je.restoreStructures&&Lg(),iu(),(n instanceof RangeError||n.message.startsWith("Unexpected end of buffer"))&&(n.incomplete=!0),n}}function Lg(){for(let n in Je.restoreStructures)Je[n]=Je.restoreStructures[n];Je.restoreStructures=null}function It(){let n=de[G++];if(n<160)if(n<128){if(n<64)return n;{let t=Je[n&63]||Cr.getStructures&&jg()[n&63];return t?(t.read||(t.read=Dp(t,n&63)),t.read()):n}}else if(n<144)if(n-=128,Cr.mapsAsObjects){let t={};for(let e=0;e<n;e++)t[Hg()]=It();return t}else{let t=new Map;for(let e=0;e<n;e++)t.set(It(),It());return t}else{n-=144;let t=new Array(n);for(let e=0;e<n;e++)t[e]=It();return t}else if(n<192){let t=n-160;if(No>=G)return En.slice(G-Xr,(G+=t)-Xr);if(No==0&&Bn<140){let e=t<16?Ep(t):Ug(t);if(e!=null)return e}return Ip(t)}else{let t;switch(n){case 192:return null;case 193:return kr?(t=It(),t>0?kr[1].slice(kr.position1,kr.position1+=t):kr[0].slice(kr.position0,kr.position0-=t)):Np;case 194:return!1;case 195:return!0;case 196:return Op(de[G++]);case 197:return t=rt.getUint16(G),G+=2,Op(t);case 198:return t=rt.getUint32(G),G+=4,Op(t);case 199:return wi(de[G++]);case 200:return t=rt.getUint16(G),G+=2,wi(t);case 201:return t=rt.getUint32(G),G+=4,wi(t);case 202:if(t=rt.getFloat32(G),Cr.useFloat32>2){let e=su[(de[G]&127)<<1|de[G+1]>>7];return G+=4,(e*t+(t>0?.5:-.5)>>0)/e}return G+=4,t;case 203:return t=rt.getFloat64(G),G+=8,t;case 204:return de[G++];case 205:return t=rt.getUint16(G),G+=2,t;case 206:return t=rt.getUint32(G),G+=4,t;case 207:return Cr.int64AsNumber?(t=rt.getUint32(G)*4294967296,t+=rt.getUint32(G+4)):t=rt.getBigUint64(G),G+=8,t;case 208:return rt.getInt8(G++);case 209:return t=rt.getInt16(G),G+=2,t;case 210:return t=rt.getInt32(G),G+=4,t;case 211:return Cr.int64AsNumber?(t=rt.getInt32(G)*4294967296,t+=rt.getUint32(G+4)):t=rt.getBigInt64(G),G+=8,t;case 212:if(t=de[G++],t==114)return Fg(de[G++]&63);{let e=vr[t];if(e)return e.read?(G++,e.read(It())):e.noBuffer?(G++,e()):e(de.subarray(G,++G));throw new Error("Unknown extension "+t)}case 213:return t=de[G],t==114?(G++,Fg(de[G++]&63,de[G++])):wi(2);case 214:return wi(4);case 215:return wi(8);case 216:return wi(16);case 217:return t=de[G++],No>=G?En.slice(G-Xr,(G+=t)-Xr):qO(t);case 218:return t=rt.getUint16(G),G+=2,No>=G?En.slice(G-Xr,(G+=t)-Xr):WO(t);case 219:return t=rt.getUint32(G),G+=4,No>=G?En.slice(G-Xr,(G+=t)-Xr):$O(t);case 220:return t=rt.getUint16(G),G+=2,Vg(t);case 221:return t=rt.getUint32(G),G+=4,Vg(t);case 222:return t=rt.getUint16(G),G+=2,zg(t);case 223:return t=rt.getUint32(G),G+=4,zg(t);default:if(n>=224)return n-256;if(n===void 0){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+n)}}}var HO=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Dp(n,t){function e(){if(e.count++>2){let o=n.read=new Function("r","return function(){return {"+n.map(i=>HO.test(i)?i+":r()":"["+JSON.stringify(i)+"]:r()").join(",")+"}}")(It);return n.highByte===0&&(n.read=Rg(t,n.read)),o()}let r={};for(let o=0,i=n.length;o<i;o++){let a=n[o];r[a]=It()}return r}return e.count=0,n.highByte===0?Rg(t,e):e}var Rg=(n,t)=>function(){let e=de[G++];if(e===0)return t();let r=n<32?-(n+(e<<5)):n+(e<<5),o=Je[r]||jg()[r];if(!o)throw new Error("Record id is not defined for "+r);return o.read||(o.read=Dp(o,n)),o.read()};function jg(){let n=Wg(()=>(de=null,Cr.getStructures()));return Je=Cr._mergeStructures(n,Je)}var Ip=au,qO=au,WO=au,$O=au;function au(n){let t;if(n<16&&(t=Ep(n)))return t;if(n>64&&Cp)return Cp.decode(de.subarray(G,G+=n));let e=G+n,r=[];for(t="";G<e;){let o=de[G++];if((o&128)===0)r.push(o);else if((o&224)===192){let i=de[G++]&63;r.push((o&31)<<6|i)}else if((o&240)===224){let i=de[G++]&63,a=de[G++]&63;r.push((o&31)<<12|i<<6|a)}else if((o&248)===240){let i=de[G++]&63,a=de[G++]&63,s=de[G++]&63,l=(o&7)<<18|i<<12|a<<6|s;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(o);r.length>=4096&&(t+=er.apply(String,r),r.length=0)}return r.length>0&&(t+=er.apply(String,r)),t}function Vg(n){let t=new Array(n);for(let e=0;e<n;e++)t[e]=It();return t}function zg(n){if(Cr.mapsAsObjects){let t={};for(let e=0;e<n;e++)t[Hg()]=It();return t}else{let t=new Map;for(let e=0;e<n;e++)t.set(It(),It());return t}}var er=String.fromCharCode;function Ug(n){let t=G,e=new Array(n);for(let r=0;r<n;r++){let o=de[G++];if((o&128)>0){G=t;return}e[r]=o}return er.apply(String,e)}function Ep(n){if(n<4)if(n<2){if(n===0)return"";{let t=de[G++];if((t&128)>1){G-=1;return}return er(t)}}else{let t=de[G++],e=de[G++];if((t&128)>0||(e&128)>0){G-=2;return}if(n<3)return er(t,e);let r=de[G++];if((r&128)>0){G-=3;return}return er(t,e,r)}else{let t=de[G++],e=de[G++],r=de[G++],o=de[G++];if((t&128)>0||(e&128)>0||(r&128)>0||(o&128)>0){G-=4;return}if(n<6){if(n===4)return er(t,e,r,o);{let i=de[G++];if((i&128)>0){G-=5;return}return er(t,e,r,o,i)}}else if(n<8){let i=de[G++],a=de[G++];if((i&128)>0||(a&128)>0){G-=6;return}if(n<7)return er(t,e,r,o,i,a);let s=de[G++];if((s&128)>0){G-=7;return}return er(t,e,r,o,i,a,s)}else{let i=de[G++],a=de[G++],s=de[G++],l=de[G++];if((i&128)>0||(a&128)>0||(s&128)>0||(l&128)>0){G-=8;return}if(n<10){if(n===8)return er(t,e,r,o,i,a,s,l);{let u=de[G++];if((u&128)>0){G-=9;return}return er(t,e,r,o,i,a,s,l,u)}}else if(n<12){let u=de[G++],c=de[G++];if((u&128)>0||(c&128)>0){G-=10;return}if(n<11)return er(t,e,r,o,i,a,s,l,u,c);let d=de[G++];if((d&128)>0){G-=11;return}return er(t,e,r,o,i,a,s,l,u,c,d)}else{let u=de[G++],c=de[G++],d=de[G++],p=de[G++];if((u&128)>0||(c&128)>0||(d&128)>0||(p&128)>0){G-=12;return}if(n<14){if(n===12)return er(t,e,r,o,i,a,s,l,u,c,d,p);{let f=de[G++];if((f&128)>0){G-=13;return}return er(t,e,r,o,i,a,s,l,u,c,d,p,f)}}else{let f=de[G++],h=de[G++];if((f&128)>0||(h&128)>0){G-=14;return}if(n<15)return er(t,e,r,o,i,a,s,l,u,c,d,p,f,h);let m=de[G++];if((m&128)>0){G-=15;return}return er(t,e,r,o,i,a,s,l,u,c,d,p,f,h,m)}}}}}function Op(n){return Cr.copyBuffers?Uint8Array.prototype.slice.call(de,G,G+=n):de.subarray(G,G+=n)}function wi(n){let t=de[G++];if(vr[t])return vr[t](de.subarray(G,G+=n));throw new Error("Unknown extension type "+t)}var Gg=new Array(4096);function Hg(){let n=de[G++];if(n>=160&&n<192){if(n=n-160,No>=G)return En.slice(G-Xr,(G+=n)-Xr);if(!(No==0&&Bn<180))return Ip(n)}else return G--,It();let t=(n<<5^(n>1?rt.getUint16(G):n>0?de[G]:0))&4095,e=Gg[t],r=G,o=G+n-3,i,a=0;if(e&&e.bytes==n){for(;r<o;){if(i=rt.getUint32(r),i!=e[a++]){r=1879048192;break}r+=4}for(o+=3;r<o;)if(i=de[r++],i!=e[a++]){r=1879048192;break}if(r===o)return G=r,e.string;o-=3,r=G}for(e=[],Gg[t]=e,e.bytes=n;r<o;)i=rt.getUint32(r),e.push(i),r+=4;for(o+=3;r<o;)i=de[r++],e.push(i);let s=n<16?Ep(n):Ug(n);return s!=null?e.string=s:e.string=Ip(n)}var Fg=(n,t)=>{var e=It();let r=n;t!==void 0&&(n=n<32?-((t<<5)+n):(t<<5)+n,e.highByte=t);let o=Je[n];return o&&o.isShared&&((Je.restoreStructures||(Je.restoreStructures=[]))[n]=o),Je[n]=e,e.read=Dp(e,r),e.read()},qg=typeof self=="object"?self:global;vr[0]=()=>{};vr[0].noBuffer=!0;vr[101]=()=>{let n=It();return(qg[n[0]]||Error)(n[1])};vr[105]=n=>{let t=rt.getUint32(G-4);nn||(nn=new Map);let e=de[G],r;e>=144&&e<160||e==220||e==221?r=[]:r={};let o={target:r};nn.set(t,o);let i=It();return o.used?Object.assign(r,i):(o.target=i,i)};vr[112]=n=>{let t=rt.getUint32(G-4),e=nn.get(t);return e.used=!0,e.target};vr[115]=()=>new Set(It());var Bp=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(n=>n+"Array");vr[116]=n=>{let t=n[0],e=Bp[t];if(!e)throw new Error("Could not find typed array for code "+t);return new qg[e](Uint8Array.prototype.slice.call(n,1).buffer)};vr[120]=()=>{let n=It();return new RegExp(n[0],n[1])};vr[98]=n=>{let t=(n[0]<<24)+(n[1]<<16)+(n[2]<<8)+n[3],e=G;G+=t-4,kr=[It(),It()],kr.position0=0,kr.position1=0;let r=G;G=e;try{return It()}finally{G=r}};vr[255]=n=>n.length==4?new Date((n[0]*16777216+(n[1]<<16)+(n[2]<<8)+n[3])*1e3):n.length==8?new Date(((n[0]<<22)+(n[1]<<14)+(n[2]<<6)+(n[3]>>2))/1e6+((n[3]&3)*4294967296+n[4]*16777216+(n[5]<<16)+(n[6]<<8)+n[7])*1e3):n.length==12?new Date(((n[0]<<24)+(n[1]<<16)+(n[2]<<8)+n[3])/1e6+((n[4]&128?-281474976710656:0)+n[6]*1099511627776+n[7]*4294967296+n[8]*16777216+(n[9]<<16)+(n[10]<<8)+n[11])*1e3):new Date("invalid");function Wg(n){let t=Bn,e=G,r=Mp,o=Xr,i=No,a=En,s=Tp,l=nn,u=kr,c=new Uint8Array(de.slice(0,Bn)),d=Je,p=Je.slice(0,Je.length),f=Cr,h=Ma,m=n();return Bn=t,G=e,Mp=r,Xr=o,No=i,En=a,Tp=s,nn=l,kr=u,de=c,Ma=h,Je=d,Je.splice(0,Je.length,...p),Cr=f,rt=new DataView(de.buffer,de.byteOffset,de.byteLength),m}function iu(){de=null,nn=null,Je=null}function $g(n){n.unpack?vr[n.type]=n.unpack:vr[n.type]=n}var su=new Array(147);for(let n=0;n<256;n++)su[n]=+("1e"+Math.floor(45.15-n*.30103));var lu=new Do({useRecords:!1}),YO=lu.unpack,XO=lu.unpackMultiple,QO=lu.unpack,cu={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},KO=new Float32Array(1),CG=new Uint8Array(KO.buffer,0,4);var uu;try{uu=new TextEncoder}catch{}var du,Rp,pu=typeof Buffer<"u",Lp=pu?Buffer.allocUnsafeSlow:Uint8Array,Kg=pu?Buffer:Uint8Array,Yg=pu?4294967296:2144337920,K,Lt,j=0,Eo,Bo=null,ZO=/[\u0080-\uFFFF]/,vl=Symbol("record-id"),Ai=class extends Do{constructor(t){super(t),this.offset=0;let e,r,o,i,a,s,l=0,u=Kg.prototype.utf8Write?function(x,D,N){return K.utf8Write(x,D,N)}:uu&&uu.encodeInto?function(x,D){return uu.encodeInto(x,K.subarray(D)).written}:!1,c=this;t||(t={});let d=t&&t.sequential,p=t.structures||t.saveStructures,f=t.maxSharedStructures;if(f==null&&(f=p?32:0),f>8160)throw new Error("Maximum maxSharedStructure is 8160");let h=t.maxOwnStructures;h==null&&(h=p?32:64),d&&!t.saveStructures&&(this.structures=[]);let m=f>32||h+f>64,y=f+64,g=f+h+64;if(g>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let b=[],w=0,A=0;this.pack=this.encode=function(x,D){if(K||(K=new Lp(8192),Lt=new DataView(K.buffer,0,8192),j=0),Eo=K.length-10,Eo-j<2048?(K=new Lp(K.length),Lt=new DataView(K.buffer,0,K.length),Eo=K.length-10,j=0):j=j+7&2147483640,r=j,s=c.structuredClone?new Map:null,c.bundleStrings?(Bo=["",""],K[j++]=214,K[j++]=98,Bo.position=j-r,j+=4):Bo=null,o=c.structures,o){o.uninitialized&&(o=c._mergeStructures(c.getStructures()));let N=o.sharedLength||0;if(N>f)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+o.sharedLength);if(!o.transitions){o.transitions=Object.create(null);for(let T=0;T<N;T++){let I=o[T];if(!I)continue;let E,B=o.transitions;for(let R=0,F=I.length;R<F;R++){let V=I[R];E=B[V],E||(E=B[V]=Object.create(null)),B=E}B[vl]=T+64}l=N}d||(o.nextId=N+64)}i&&(i=!1),a=o||[];try{if(S(x),Bo){Lt.setUint32(Bo.position+r,j-Bo.position-r);let N=Bo;Bo=null,S(N[0]),S(N[1])}if(c.offset=j,s&&s.idsToInsert){j+=s.idsToInsert.length*6,j>Eo&&O(j),c.offset=j;let N=eC(K.subarray(r,j),s.idsToInsert);return s=null,N}return D&Jg?(K.start=r,K.end=j,K):K.subarray(r,j)}finally{if(o){if(A<10&&A++,w>1e4)o.transitions=null,A=0,w=0,b.length>0&&(b=[]);else if(b.length>0&&!d){for(let N=0,T=b.length;N<T;N++)b[N][vl]=0;b=[]}if(i&&c.saveStructures){let N=o.sharedLength||f;o.length>N&&(o=o.slice(0,N));let T=K.subarray(r,j);return c.saveStructures(o,l)===!1?(c._mergeStructures(c.getStructures()),c.pack(x)):(l=N,T)}}D&sC&&(j=r)}};let S=x=>{j>Eo&&(K=O(j));var D=typeof x,N;if(D==="string"){let T=x.length;if(Bo&&T>=8&&T<4096){let B=ZO.test(x);Bo[B?0:1]+=x,K[j++]=193,S(B?-T:T);return}let I;T<32?I=1:T<256?I=2:T<65536?I=3:I=5;let E=T*3;if(j+E>Eo&&(K=O(j+E)),T<64||!u){let B,R,F,V=j+I;for(B=0;B<T;B++)R=x.charCodeAt(B),R<128?K[V++]=R:R<2048?(K[V++]=R>>6|192,K[V++]=R&63|128):(R&64512)===55296&&((F=x.charCodeAt(B+1))&64512)===56320?(R=65536+((R&1023)<<10)+(F&1023),B++,K[V++]=R>>18|240,K[V++]=R>>12&63|128,K[V++]=R>>6&63|128,K[V++]=R&63|128):(K[V++]=R>>12|224,K[V++]=R>>6&63|128,K[V++]=R&63|128);N=V-j-I}else N=u(x,j+I,E);N<32?K[j++]=160|N:N<256?(I<2&&K.copyWithin(j+2,j+1,j+1+N),K[j++]=217,K[j++]=N):N<65536?(I<3&&K.copyWithin(j+3,j+2,j+2+N),K[j++]=218,K[j++]=N>>8,K[j++]=N&255):(I<5&&K.copyWithin(j+5,j+3,j+3+N),K[j++]=219,Lt.setUint32(j,N),j+=4),j+=N}else if(D==="number")if(x>>>0===x)x<64?K[j++]=x:x<256?(K[j++]=204,K[j++]=x):x<65536?(K[j++]=205,K[j++]=x>>8,K[j++]=x&255):(K[j++]=206,Lt.setUint32(j,x),j+=4);else if(x>>0===x)x>=-32?K[j++]=256+x:x>=-128?(K[j++]=208,K[j++]=x+256):x>=-32768?(K[j++]=209,Lt.setInt16(j,x),j+=2):(K[j++]=210,Lt.setInt32(j,x),j+=4);else{let T;if((T=this.useFloat32)>0&&x<4294967296&&x>=-2147483648){K[j++]=202,Lt.setFloat32(j,x);let I;if(T<4||(I=x*su[(K[j]&127)<<1|K[j+1]>>7])>>0===I){j+=4;return}else j--}K[j++]=203,Lt.setFloat64(j,x),j+=8}else if(D==="object")if(!x)K[j++]=192;else{if(s){let I=s.get(x);if(I){if(!I.id){let E=s.idsToInsert||(s.idsToInsert=[]);I.id=E.push(I)}K[j++]=214,K[j++]=112,Lt.setUint32(j,I.id),j+=4;return}else s.set(x,{offset:j-r})}let T=x.constructor;if(T===Object)P(x,!0);else if(T===Array){N=x.length,N<16?K[j++]=144|N:N<65536?(K[j++]=220,K[j++]=N>>8,K[j++]=N&255):(K[j++]=221,Lt.setUint32(j,N),j+=4);for(let I=0;I<N;I++)S(x[I])}else if(T===Map){N=x.size,N<16?K[j++]=128|N:N<65536?(K[j++]=222,K[j++]=N>>8,K[j++]=N&255):(K[j++]=223,Lt.setUint32(j,N),j+=4);for(let[I,E]of x)S(I),S(E)}else{for(let I=0,E=du.length;I<E;I++){let B=Rp[I];if(x instanceof B){let R=du[I];if(R.write){R.type&&(K[j++]=212,K[j++]=R.type,K[j++]=0),S(R.write.call(this,x));return}let F=K,V=Lt,q=j;K=null;let k;try{k=R.pack.call(this,x,U=>(K=F,F=null,j+=U,j>Eo&&O(j),{target:K,targetView:Lt,position:j-U}),S)}finally{F&&(K=F,Lt=V,j=q,Eo=K.length-10)}k&&(k.length+j>Eo&&O(k.length+j),j=JO(k,K,j,R.type));return}}P(x,!x.hasOwnProperty)}}else if(D==="boolean")K[j++]=x?195:194;else if(D==="bigint"){if(x<BigInt(1)<<BigInt(63)&&x>=-(BigInt(1)<<BigInt(63)))K[j++]=211,Lt.setBigInt64(j,x);else if(x<BigInt(1)<<BigInt(64)&&x>0)K[j++]=207,Lt.setBigUint64(j,x);else if(this.largeBigIntToFloat)K[j++]=203,Lt.setFloat64(j,Number(x));else throw new RangeError(x+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");j+=8}else if(D==="undefined")this.encodeUndefinedAsNil?K[j++]=192:(K[j++]=212,K[j++]=0,K[j++]=0);else if(D==="function")S(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+D)},P=this.useRecords===!1?this.variableMapSize?x=>{let D=Object.keys(x),N=D.length;N<16?K[j++]=128|N:N<65536?(K[j++]=222,K[j++]=N>>8,K[j++]=N&255):(K[j++]=223,Lt.setUint32(j,N),j+=4);let T;for(let I=0;I<N;I++)S(T=D[I]),S(x[T])}:(x,D)=>{K[j++]=222;let N=j-r;j+=2;let T=0;for(let I in x)(D||x.hasOwnProperty(I))&&(S(I),S(x[I]),T++);K[N+++r]=T>>8,K[N+r]=T&255}:x=>{let D=Object.keys(x),N,T=a.transitions||(a.transitions=Object.create(null)),I=0;for(let B=0,R=D.length;B<R;B++){let F=D[B];N=T[F],N||(N=T[F]=Object.create(null),I++),T=N}let E=T[vl];if(E)E>=96&&m?(K[j++]=((E-=96)&31)+96,K[j++]=E>>5):K[j++]=E;else{E=a.nextId,E||(E=64),E<y&&this.shouldShareStructure&&!this.shouldShareStructure(D)?(E=a.nextOwnId,E<g||(E=y),a.nextOwnId=E+1):(E>=g&&(E=y),a.nextId=E+1);let B=D.highByte=E>=96&&m?E-96>>5:-1;T[vl]=E,a[E-64]=D,E<y?(D.isShared=!0,a.sharedLength=E-63,i=!0,B>=0?(K[j++]=(E&31)+96,K[j++]=B):K[j++]=E):(B>=0?(K[j++]=213,K[j++]=114,K[j++]=(E&31)+96,K[j++]=B):(K[j++]=212,K[j++]=114,K[j++]=E),I&&(w+=A*I),b.length>=h&&(b.shift()[vl]=0),b.push(T),S(D))}for(let B=0,R=D.length;B<R;B++)S(x[D[B]])},O=x=>{let D;if(x>16777216){if(x-r>Yg)throw new Error("Packed buffer would be larger than maximum buffer size");D=Math.min(Yg,Math.round(Math.max((x-r)*(x>67108864?1.25:2),4194304)/4096)*4096)}else D=(Math.max(x-r<<2,K.length-1)>>12)+1<<12;let N=new Lp(D);return Lt=new DataView(N.buffer,0,D),K.copy?K.copy(N,0,r,x):N.set(K.slice(r,x)),j-=r,r=0,Eo=N.length-10,K=N}}useBuffer(t){K=t,Lt=new DataView(K.buffer,K.byteOffset,K.byteLength),j=0}};Rp=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,bl];du=[{pack(n,t,e){let r=n.getTime()/1e3;if((this.useTimestamp32||n.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:o,targetView:i,position:a}=t(6);o[a++]=214,o[a++]=255,i.setUint32(a,r)}else if(r>0&&r<17179869184){let{target:o,targetView:i,position:a}=t(10);o[a++]=215,o[a++]=255,i.setUint32(a,n.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),e(this.onInvalidDate());let{target:o,targetView:i,position:a}=t(3);o[a++]=212,o[a++]=255,o[a++]=255}else{let{target:o,targetView:i,position:a}=t(15);o[a++]=199,o[a++]=12,o[a++]=255,i.setUint32(a,n.getMilliseconds()*1e6),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(n,t,e){let r=Array.from(n),{target:o,position:i}=t(this.structuredClone?3:0);this.structuredClone&&(o[i++]=212,o[i++]=115,o[i++]=0),e(r)}},{pack(n,t,e){let{target:r,position:o}=t(this.structuredClone?3:0);this.structuredClone&&(r[o++]=212,r[o++]=101,r[o++]=0),e([n.name,n.message])}},{pack(n,t,e){let{target:r,position:o}=t(this.structuredClone?3:0);this.structuredClone&&(r[o++]=212,r[o++]=120,r[o++]=0),e([n.source,n.flags])}},{pack(n,t){this.structuredClone?Xg(n,16,t):Qg(pu?Buffer.from(n):new Uint8Array(n),t)}},{pack(n,t){let e=n.constructor;e!==Kg&&this.structuredClone?Xg(n,Bp.indexOf(e.name),t):Qg(n,t)}},{pack(n,t){let{target:e,position:r}=t(1);e[r]=193}}];function Xg(n,t,e,r){let o=n.byteLength;if(o+1<256){var{target:i,position:a}=e(4+o);i[a++]=199,i[a++]=o+1}else if(o+1<65536){var{target:i,position:a}=e(5+o);i[a++]=200,i[a++]=o+1>>8,i[a++]=o+1&255}else{var{target:i,position:a,targetView:s}=e(7+o);i[a++]=201,s.setUint32(a,o+1),a+=4}i[a++]=116,i[a++]=t,i.set(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),a)}function Qg(n,t){let e=n.byteLength;var r,o;if(e<256){var{target:r,position:o}=t(e+2);r[o++]=196,r[o++]=e}else if(e<65536){var{target:r,position:o}=t(e+3);r[o++]=197,r[o++]=e>>8,r[o++]=e&255}else{var{target:r,position:o,targetView:i}=t(e+5);r[o++]=198,i.setUint32(o,e),o+=4}r.set(n,o)}function JO(n,t,e,r){let o=n.length;switch(o){case 1:t[e++]=212;break;case 2:t[e++]=213;break;case 4:t[e++]=214;break;case 8:t[e++]=215;break;case 16:t[e++]=216;break;default:o<256?(t[e++]=199,t[e++]=o):o<65536?(t[e++]=200,t[e++]=o>>8,t[e++]=o&255):(t[e++]=201,t[e++]=o>>24,t[e++]=o>>16&255,t[e++]=o>>8&255,t[e++]=o&255)}return t[e++]=r,t.set(n,e),e+=o,e}function eC(n,t){let e,r=t.length*6,o=n.length-r;for(t.sort((i,a)=>i.offset>a.offset?1:-1);e=t.pop();){let i=e.offset,a=e.id;n.copyWithin(i+r,i,o),r-=6;let s=i+r;n[s++]=214,n[s++]=105,n[s++]=a>>24,n[s++]=a>>16&255,n[s++]=a>>8&255,n[s++]=a&255,o=i}return n}function Ln(n){if(n.Class){if(!n.pack&&!n.write)throw new Error("Extension has no pack or write function");if(n.pack&&!n.type)throw new Error("Extension has no type (numeric code to identify the extension)");Rp.unshift(n.Class),du.unshift(n)}$g(n)}var Zg=new Ai({useRecords:!1}),tC=Zg.pack,rC=Zg.pack;var{NEVER:oC,ALWAYS:nC,DECIMAL_ROUND:iC,DECIMAL_FIT:aC}=cu,Jg=512,sC=1024;var e0=new Ai({structuredClone:!0});Ln({Class:be.prototype.constructor,type:1,write(n){return{...n}},read(n){return Object.setPrototypeOf(n,be.prototype),n}});Ln({Class:we.prototype.constructor,type:2,write(n){return[...n]},read(n){return Object.setPrototypeOf(n,we.prototype),n}});Ln({Class:ut.prototype.constructor,type:3,write(n){return[...n]},read(n){return Object.setPrototypeOf(n,ut.prototype),n}});Ln({Class:gl.prototype.constructor,type:4,write(n){return n.id},read(n){return new gl(n)}});Ln({Class:xl.prototype.constructor,type:5,write(n){return n.data},read(n){return new xl(n)}});Ln({Class:dt.prototype.constructor,type:6,write(n){return{...n}},read(n){return Object.setPrototypeOf(n,dt.prototype),n}});function lC(n){var t=0;if(n.length===0)return t;for(let e=0;e<n.length;e++){let r=n[e];t=(t<<5)-t+r,t=t&t}return t}function Vp(n){if(Aa(n))return n;if(Array.isArray(n))return n.map(Vp);if(typeof n=="object"&&n!==null){let t={};for(let e of Object.keys(n).sort())t[e]=Vp(n[e]);return Object.setPrototypeOf(t,Object.getPrototypeOf(n)),t}else return n}var fu;(r=>{function n(o){return e0.pack(o)}r.serialize=n;function t(o){return e0.unpack(o)}r.deserialize=t;function e(o){return lC(n(Vp(o))).toString()}r.checksum=e})(fu||(fu={}));var zn="personal camera",Gn="a218fcc3-276b-49b9-b485-49037fd14f5f",i0=2960946,Rt=5526619;var Ia;(f=>{function n(h,m){return h[0]===m[0]&&h[1]===m[1]}f.isEqual=n;function t(h,m,y){return[h[0]+(m[0]-h[0])*y,h[1]+(m[1]-h[1])*y]}f.lerp=t;function e(h,m){return[h[0]+m[0],h[1]+m[1]]}f.add=e;function r(h,m){return[h[0]-m[0],h[1]-m[1]]}f.sub=r;function o(h,m){return[h[0]*m[0],h[1]*m[1]]}f.multiply=o;function i(h,m){return[h[0]/m[0],h[1]/m[1]]}f.divide=i;function a(h,m){return Math.pow(m[0]-h[0],2)+Math.pow(m[1]-h[1],2)}f.distanceSquared=a;function s(h,m){return Math.sqrt(a(h,m))}f.distance=s;function l(h,m){return h[0]*m[0]+h[1]*m[1]}f.dot=l;function u(h,m){return[h[0]*m,h[1]*m]}f.scalarMultiply=u;function c(h,m,y){let g=f.sub(m,h),b=f.sub(y,h),w=f.dot(g,b)/f.dot(g,g),A=f.scalarMultiply(g,w);return f.add(h,A)}f.projectionOnto=c;function d(h,m,y){return s(h,c(h,m,y))}f.projectionOntoDistance=d;function p(h,m){return[(h[0]+m[0])*.5,(h[1]+m[1])*.5]}f.center=p})(Ia||(Ia={}));var Rn;(s=>{function n(l,u){return l[0]===u[0]&&l[1]===u[1]&&l[2]===u[2]}s.isEqual=n;function t(l,u){return[l[0]+u[0],l[1]+u[1],l[2]+u[2]]}s.add=t;function e(l,u){return[l[0]-u[0],l[1]-u[1],l[2]-u[2]]}s.sub=e;function r(l,u){return[l[0]/u[0],l[1]/u[1],l[2]/u[2]]}s.div=r;function o(l,u){return[l[0]*u[0],l[1]*u[1],l[2]*u[2]]}s.mul=o;function i(l,u){return Math.hypot(l[0]-u[0],l[1]-u[1],l[2]-u[2])}s.dist=i;function a(l,u,c){return[l[0]+(u[0]-l[0])*c,l[1]+(u[1]-l[1])*c,l[2]+(u[2]-l[2])*c]}s.lerp=a})(Rn||(Rn={}));var t0;(e=>{function n(r,o){return r[0]===o[0]&&r[1]===o[1]&&r[2]===o[2]&&r[3]===o[3]}e.isEqual=n;function t(r,o,i){return[r[0]+(o[0]-r[0])*i,r[1]+(o[1]-r[1])*i,r[2]+(o[2]-r[2])*i,r[3]+(o[3]-r[3])*i]}e.lerp=t})(t0||(t0={}));var Vn;(o=>{o.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(i,a){for(let s=0;s<16;s++)if(i[s]!==a[s])return!1;return!0}o.isEqual=t;function e(i){return i??o.identity}o.simplify=e;function r(i,a){let s=a.slice(0);for(var l=0,u=a.length;l<u;l+=3){let c=i[3]*a[l]+i[7]*a[l+1]+i[11]*a[l+2]+i[15];s[l]=(i[0]*a[l]+i[4]*a[l+1]+i[8]*a[l+2]+i[12])/c,s[l+1]=(i[1]*a[l]+i[5]*a[l+1]+i[9]*a[l+2]+i[13])/c,s[l+2]=(i[2]*a[l]+i[6]*a[l+1]+i[10]*a[l+2]+i[14])/c}return s}o.applyMatrix4=r})(Vn||(Vn={}));var Ht;(d=>{function n(p){return typeof p=="object"&&typeof p.r=="number"&&typeof p.g=="number"&&typeof p.b=="number"}d.isRGB=n,d.white={r:1,g:1,b:1},d.red={r:1,g:0,b:0},d.black={r:0,g:0,b:0};function o(p){return{r:Math.round(p.r*255),g:Math.round(p.g*255),b:Math.round(p.b*255),a:1}}d.toRgb255a1=o;function i(p){return{r:p.r,g:p.g,b:p.b}}d.clone=i;function a(p){return p=Math.floor(p),{r:(p>>16&255)/255,g:(p>>8&255)/255,b:(p&255)/255}}d.fromHex=a;function s(p){return Math.round(p.r*255)*65536+Math.round(p.g*255)*256+Math.round(p.b*255)}d.toHex=s;function l(p,f){return p.r===f.r&&p.g===f.g&&p.b===f.b}d.equals=l;function u(p,f){return p.r.toFixed(2)===f.r.toFixed(2)&&p.g.toFixed(2)===f.g.toFixed(2)&&p.b.toFixed(2)===f.b.toFixed(2)}d.equalsFixed=u;function c(p,f,h){return{r:p.r+(f.r-p.r)*h,g:p.g+(f.g-p.g)*h,b:p.b+(f.b-p.b)*h}}d.lerp=c})(Ht||(Ht={}));var Be;(u=>{u.white={...Ht.white,a:1},u.transparent={...Ht.white,a:0};function e(c){return{r:c[0],g:c[1],b:c[2],a:c[3]}}u.from0to1=e;function r(c,d){return{...Ht.fromHex(c),a:d}}u.fromHexAndA=r;function o(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:c.a}}u.toRgb255a1=o;function i(c,d){return Ht.equals(c,d)&&c.a===d.a}u.equals=i;function a(c,d){return Ht.equalsFixed(c,d)&&c.a.toFixed(2)===d.a.toFixed(2)}u.equalsFixed=a;function s(c,d,p){return{r:c.r+(d.r-c.r)*p,g:c.g+(d.g-c.g)*p,b:c.b+(d.b-c.b)*p,a:c.a+(d.a-c.a)*p}}u.lerp=s;function l({r:c,g:d,b:p,a:f}=u.white){return`rgba(${c*255}, ${d*255}, ${p*255}, ${f})`}u.toStyle=l})(Be||(Be={}));var hu;(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(hu||(hu={}));var r0;(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(r0||(r0={}));var o0;(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})(o0||(o0={}));var n0;(i=>(i.linear=[0,0,1,1],i.ease=[.25,.1,.25,1],i.easeIn=[.42,0,1,1],i.easeOut=[0,0,.58,1],i.easeInOut=[.42,0,.58,1]))(n0||(n0={}));function zp(n){return typeof n=="string"&&n.length===36?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n):!1}var po;(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(r){return e.all.includes(r)}e.is=t})(po||(po={}));var Fn;(o=>{o.DefaultUp=[0,1,0],o.DefaultTargetOffset=1e3,o.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:o.DefaultUp,isUpVectorFlipped:!1,targetOffset:o.DefaultTargetOffset};function r(i){return i.type==="PerspectiveCamera"?i.perspective?.zoom??1:i.orthographic?.zoom??1}o.getZoom=r})(Fn||(Fn={}));var Lo;(e=>{function n(r,o=.1){return{disabled:!1,type:"linear",hideBase:!1,count:3,radial:{radius:Math.max(r[0],r[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},linear:{scale:[1,1,1],rotation:[0,0,0],position:[r[0]+r[0]*o,0,0]},grid:{count:[2,2,2],size:r.map(i=>i*(1+o)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}}e.defaultData=n;function t(r,o){let i={...r};if(cC.forEach(a=>{Object.assign(i,{[a]:o[a]??r[a]})}),i.radial={...r.radial},o.radial){let a=r.radial,s=o.radial;uC.forEach(l=>{Object.assign(i.radial,{[l]:s[l]??a[l]})})}if(i.linear={...r.linear},o.linear){let a=r.linear,s=o.linear;dC.forEach(l=>{Object.assign(i.linear,{[l]:s[l]??a[l]})})}if(i.grid={...r.grid},o.grid){let a=r.grid,s=o.grid;pC.forEach(l=>{Object.assign(i.grid,{[l]:s[l]??a[l]})})}if(i.toObject={...r.toObject},o.toObject){let a=r.toObject,s=o.toObject;fC.forEach(l=>{Object.assign(i.toObject,{[l]:s[l]??a[l]})})}if(i.randomnessObject={...r.randomnessObject},o.randomnessObject){let a=r.randomnessObject,s=o.randomnessObject;hC.forEach(l=>{Object.assign(i.randomnessObject,{[l]:s[l]??a[l]})})}return i}e.merge=t})(Lo||(Lo={}));var mu;(r=>{r.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(o,i){let a=[];o.count!==void 0&&a.push({type:0,path:i,props:{count:o.count}});for(let s of t){let l=o[s];l&&Object.keys(l).length>0&&a.push({type:0,path:[...i,s],props:l})}return a}r.toOps=e})(mu||(mu={}));var cC=["count"],uC=["radius","start","end","position","scale","rotation"],dC=["position","scale","rotation"],pC=["count","size"],fC=["count","position","scale","rotation"],hC=["strength","scale","rotation","position","movement","seed","freqScale"];var yu;(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(r){return e.all.includes(r)}e.is=t})(yu||(yu={}));var gu;(e=>{function n(r){return t(r)}e.defaultData=n;function t(r){if(r==="PointLight")return{type:r,color:Be.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(r==="SpotLight")return{type:r,color:Be.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(r==="DirectionalLight")return{type:r,color:Be.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(gu||(gu={}));var Na;(r=>(r.defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},r.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},r.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:r.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeLoopDelayStart:"end",emitTimeDuration:1,...r.defaultCollisionData}))(Na||(Na={}));var kn;(t=>t.defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]})(kn||(kn={}));var Gp;(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(r,o){return r.castShadow===o.castShadow&&r.receiveShadow===o.receiveShadow}e.equals=t})(Gp||(Gp={}));var Fp;(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0};function t(r,o){return r.flatShading===o.flatShading&&r.side===o.side&&r.wireframe===o.wireframe}e.equals=t})(Fp||(Fp={}));var xu;(t=>t.defaultData={...Fp.defaultData,...Gp.defaultData})(xu||(xu={}));var a0;(t=>{function n(e,r){let o=[];if("material"in e){let i=typeof e.material=="string"?r.materials[e.material]??r.lib.materials[e.material]?.asset:e.material;i&&o.push(i)}else if("materials"in e)for(let i of e.materials){let a=typeof i=="string"?r.materials[i]??r.lib.materials[i]?.asset:i;a&&o.push(a)}return o}t.getMaterialData=n})(a0||(a0={}));var Da;(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(Da||(Da={}));var s0;(t=>{function n(e){return e==="texture"||e==="video"||e==="color"||e==="depth"||e==="normal"||e==="gradient"||e==="noise"||e==="fresnel"||e==="rainbow"||e==="toon"||e==="outline"||e==="particle"||e==="transmission"||e==="matcap"||e==="displace"||e==="pattern"||e==="light"}t.is=n})(s0||(s0={}));function c0(n){return n.type!=="displace"}var l0;(t=>{function n(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=n})(l0||(l0={}));var u0=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],d0=["wrapping","image","video","name","minFilter"],Ft;(o=>{function n(i,a){let{texture:s,...l}=a;if(Object.assign(i,l),s){let u=i.texture;u&&Object.assign(u,s)}}o.patch=n;function t(i,a){return i==="light"&&a?e(a):r(i)}o.defaultData=t;function e(i){let a={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(i){case"phong":return{...a,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...a,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...a,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...a,category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0,occlusion:!0}}}function r(i){let a={alpha:1,mode:0,isMask:!1,visible:!0};switch(i){case"texture":return{...a,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008},crop:!1};case"video":return{...a,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Da.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008},crop:!1};case"color":return{...a,type:"color",color:Ht.fromHex(Rt)};case"depth":return{...a,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...a,type:"normal",cnormal:[1,1,1]};case"gradient":return{...a,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...a,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Ht.fromHex(6710886),a:1},colorB:{...Ht.fromHex(6710886),a:1},colorC:{...Ht.fromHex(16777215),a:1},colorD:{...Ht.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"fresnel":return{...a,type:"fresnel",color:Be.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{...a,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...a,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Be.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...a,type:"outline",outlineColor:Be.fromHexAndA(0,1),contourColor:Be.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...a,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008}};case"transmission":return{...a,type:"transmission",thickness:10,ior:1.5,roughness:1};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...a,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Ht.fromHex(0),a:1},colorB:{...Ht.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}})(Ft||(Ft={}));var lr;(u=>{function n(c){return!c.layers.some(p=>p.data.type==="texture"&&p.data.projection!==0||p.data.type==="depth"&&!p.data.isWorldSpace||p.data.type==="noise"||p.data.type==="displace")}u.isMergable=n;function t(c){let d="";return c.layers.forEach(p=>{Object.entries(p.data).forEach(([f,h])=>{d+=`${f}${h}`,Array.isArray(h)?h.forEach(m=>d+=`${m}`):typeof h=="object"?Object.values(h).forEach(m=>{typeof m=="number"?d+=`${m.toFixed(4)}`:d+=`${m}`}):d+=`${h}`})}),d}u.getHash=t;function e(){return{layers:new we}}u.defaultEmptyData=e;function r(c="layer1",d="layer2"){return i("phong",c,d)}u.defaultData=r;function o(c,d){return{...c,name:d}}u.withName=o;function i(c,d="layer1",p="layer2"){let f=new we;return f.push({fi:0,data:Ft.defaultData("light",c),id:d}),f.push({fi:1,data:Ft.defaultData("color"),id:p}),{layers:f}}u.defaultTwoLayerData=i;function a(c){let d=Ft.defaultData("texture");c&&Object.assign(d.texture,{image:c});let p=new we;return p.push({fi:0,data:d,id:"layer1"}),p.push({fi:1,data:{...Ft.defaultData("transmission"),alpha:1},id:"layer2"}),p.push({fi:2,data:{...Ft.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:p}}u.defaultUIObjectMaterial=a;function s(c,d="phong",p="layer1",f="layer2"){let h=Ft.defaultData("texture");Object.assign(h.texture,{image:c});let m=new we;return m.push({fi:0,data:h,id:p}),m.push({fi:1,data:Ft.defaultData("light",d),id:f}),{layers:m}}u.defaultTwoLayerTextureData=s;function l(c,d="phong",p="layer1",f="layer2"){let h=Ft.defaultData("video");Object.assign(h.texture,{video:c});let m=new we;return m.push({fi:0,data:h,id:p}),m.push({fi:1,data:Ft.defaultData("light",d),id:f}),{layers:m}}u.defaultTwoLayerVideoTextureData=l})(lr||(lr={}));var Ea;(t=>{function n(){return{points:new we,roundness:0,shapeHoles:[],isClosed:!1}}t.defaultData=n})(Ea||(Ea={}));var Ba;(t=>{function n(){return{points:new we,lastInsertionPlane:null,subdivisions:12,isClosed:!1}}t.defaultData=n})(Ba||(Ba={}));var kp={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};var bu;(t=>{function n(e,r){let o={...e};return mC.forEach(i=>{Object.assign(o,{[i]:r[i]??e[i]})}),o}t.merge=n})(bu||(bu={}));var vu={shape:kp,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},mC=["depth","offset","angle","twist","startScale","endScale"];var Sl;(e=>{function n(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="UIGeometry"}e.is2DParametricMesh=n;function t(r){return r==="PolygonGeometry"||r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="BooleanGeometry"||r==="TextGeometry"}e.isParametricMesh=t})(Sl||(Sl={}));var Su;(t=>{function n(e,r){let o={...e};return Object.assign(o,r),o.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(o.extrusion={...e.extrusion},Object.assign(o.extrusion,bu.merge(o.extrusion,r.extrusion))),o}t.merge=n})(Su||(Su={}));var jn;(t=>{function n(e){if(e==="RectangleGeometry")return{width:320,height:320,type:e,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="UIGeometry")return{type:e,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(e==="PathGeometry")return{type:e,width:1,height:1,depth:1,path:Ba.defaultData(),extrusion:vu};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:Ea.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="BooleanGeometry")return{type:e,operation:2,width:0,height:0,depth:0,phongAngle:35};if(e==="TextGeometry")return{type:e,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")}t.defaultData=n})(jn||(jn={}));var wu;(t=>t.defaultData={enabled:!1,useBackgroundColor:!1,color:Ht.white,near:.1,far:2e3})(wu||(wu={}));var Au;(e=>{let n={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...n,blendFunction:16,granularity:15},bloom:{...n,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...n,offset:[2,2]},vignette:{...n,darkness:1,offset:0},hueSaturation:{...n,hue:3,saturation:0},brightnessContrast:{...n,brightness:.25,contrast:0},depthOfField:{...n,focalLength:2,focusDistance:2,bokehScale:2},noise:{...n,blendFunction:16}}})(Au||(Au={}));var jp;(t=>t.defaultData={softShadowQuality:"low"})(jp||(jp={}));var Up;(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(Up||(Up={}));var Hp;(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(Hp||(Hp={}));var wl;(t=>t.defaultData={usePhysics:!1,gravity:-10})(wl||(wl={}));var qp;(t=>t.defaultData={playCamera:zn,gameControlObject:null})(qp||(qp={}));var _u;(t=>t.defaultData={backgroundColor:Be.fromHexAndA(i0,1),postprocessing:Au.defaultData,fog:wu.defaultData,globalPhysics:wl.defaultData,ambient:Up.defaultData,ao:Hp.defaultData,shadow:jp.defaultData,publish:qp.defaultData})(_u||(_u={}));var Pu;(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(Pu||(Pu={}));var p0;(e=>{function n(r){return r==="Component"||r==="Instance"}e.isComponentRelated=n;function t(r){return r==="Empty"||r==="Instance"}e.isEmptyOrComponent=t})(p0||(p0={}));var La;(o=>{o.identity={...hu.identity,hiddenMatrix:Vn.identity};function t(i){return{position:i.position,rotation:i.rotation,scale:i.scale,hiddenMatrix:i.hiddenMatrix}}o.fromObject=t;function e(i,a){return{position:a?.position||i.position,rotation:a?.rotation||i.rotation,scale:a?.scale||i.scale,hiddenMatrix:a?.hiddenMatrix||i.hiddenMatrix}}o.merge=e;function r(i,a){return _c({position:Rn.isEqual(i.position,a.position)?void 0:a.position,rotation:Rn.isEqual(i.rotation,a.rotation)?void 0:a.rotation,scale:Rn.isEqual(i.scale,a.scale)?null:a.scale,hiddenMatrix:Vn.isEqual(i.hiddenMatrix,a.hiddenMatrix)?void 0:a.hiddenMatrix})}o.diff=r})(La||(La={}));var qt;(t=>t.defaultData={states:new we,events:new we,visible:!0,raycastLock:!1,physics:kn.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...La.identity,cloner:null})(qt||(qt={}));var Ou;(t=>t.defaultData={type:"Empty",...qt.defaultData})(Ou||(Ou={}));var f0;(t=>t.defaultData={type:"ParticleCollider",...Pu.defaultData,...qt.defaultData})(f0||(f0={}));var h0;(t=>t.defaultData={type:"Component",...qt.defaultData})(h0||(h0={}));var m0;(t=>t.defaultData={type:"Particle",...qt.defaultData,...Na.defaultData})(m0||(m0={}));var _i;(t=>t.defaultData={type:"Mesh",...qt.defaultData,...xu.defaultData})(_i||(_i={}));var Pi;(t=>t.defaultData={...qt.defaultData,...La.identity,position:[0,0,Fn.DefaultTargetOffset],...Fn.defaultData})(Pi||(Pi={}));var Cu;(e=>{function n(r){return{...qt.defaultData,...gu.defaultData(r)}}e.defaultData=n,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(Cu||(Cu={}));var Ra;(e=>{function n(r,o,i=0){for(;i<o.length;){let a=r?r[o[i]]:void 0;if(o.length===i+1)return a;if(a)r=a.descendants,i+=1;else return}}e.resolveWithDes=n;function t(r,o,i=0){let a=n(r,o,i);if(a){let s=Object.keys(a);if(s.length===1&&s[0]==="descendants")return}return a}e.resolve=t})(Ra||(Ra={}));var Ro;(i=>{i.rootOverrideProps=["physics","events"],i.compositeNonOptionalOverrideProps=["geometry"],i.compositeEntireOverrideOverrideProps=["material"];function r(a,s){return{...qt.defaultData,...s,component:a,overrides:new dt,physics:void 0,events:void 0,type:"Instance"}}i.ofComponent=r;function o(a){let s=La.fromObject(a.data);return r(a.id,s)}i.fromComponentData=o})(Ro||(Ro={}));var an;(e=>{e.defaultData={type:"Page",...qt.defaultData,physics:{...kn.defaultData,fusedBody:!1},..._u.defaultData,camera:Pi.defaultData};function t(r){return r.uiScene!==void 0}e.isUIPage=t})(an||(an={}));var Tu;(i=>(i.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:Vn.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:kn.defaultData,states:new we,events:new we,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Fn.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...qt.defaultData,..._i.defaultData,geometry:jn.defaultData("RectangleGeometry"),material:lr.defaultTwoLayerData("phong","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...qt.defaultData,..._i.defaultData,geometry:jn.defaultData("BooleanGeometry"),material:lr.defaultTwoLayerData("phong","layer1","layer2")},i.defaultTextObject={name:"Text",...qt.defaultData,..._i.defaultData,geometry:jn.defaultData("TextGeometry"),material:lr.defaultTwoLayerData("phong","layer1","layer2")}))(Tu||(Tu={}));var Oi;(o=>{function n(i,a){let s={name:a};return i.type==="Mesh"?(s.geometry={},"material"in i&&(s.material={layers:new dt}),"materials"in i&&(s.materials=i.materials.map(l=>({layers:new dt})))):po.is(i.type)&&(s.perspective={},s.orthographic={}),s}o.newEmpty=n;function t(i,a){if(a===void 0)return i;let s={...i};return"material"in s&&"material"in a&&a.material&&(s.material=Dn(s.material,l=>{if(typeof l!="string")for(let[u,c]of Object.entries(a.material.layers)){let d=l.layers.data(u);d&&Ft.patch(d,c)}}).data),s.materials&&a.materials&&(s.materials=Dn(s.materials,l=>{for(let u=0;u<s.materials.length;u++){let c=a.materials[u];if(typeof c!="string")for(let[d,p]of Object.entries(c.layers)){let f=l[u]?.layers?.data(d);f&&Ft.patch(f,p)}}}).data),s}function e(i,a){let s,l=[],u={orthographic:0,perspective:0,geometry:0};function c(d,p){for(let[f,h]of Object.entries(p.layers)){let{texture:m,...y}=h;if(m!==void 0&&Object.keys(m).length>0){let g={path:[...d,"layers",f,"texture"],props:m,type:0};l.push(g)}if(Object.keys(y).length>0){let g={path:[...d,"layers",f],props:y,type:0};l.push(g)}}}for(let[d,p]of Object.entries(a))if(d!=="name")if(d==="cloner")l.push(...mu.toOps(p,["cloner"]));else if(d==="pathSnapping")l.push({path:[d],props:{slide:p.slide,offset:p.offset},type:0});else if(d==="material")c(["material"],p);else if(d==="materials")for(let[f,h]of Object.entries(p))c(["materials",f],h);else if(u[d]===0){if(d==="geometry"&&p.extrusion!==void 0){let f={path:[d,"extrusion"],props:p.extrusion,type:0};l.push(f),p={...p},delete p.extrusion}if(Object.keys(p).length>0){let f={path:[d],props:p,type:0};l.push(f)}}else s===void 0&&(s={path:[],props:{},type:0},l.push(s)),s.props[d]=p;return l}o.toOps=e;function r(i,a){if(a===void 0)return i;let s={...i};if(Object.assign(s,La.merge(s,a)),Object.assign(s,{pathSnapping:Object.assign({},s.pathSnapping,{slide:a.pathSnapping?.slide??s.pathSnapping?.slide??0,offset:a.pathSnapping?.offset??s.pathSnapping?.offset??0})}),po.is(i.type)){s.orthographic={...s.orthographic},s.perspective={...s.perspective};let l=a;l.orthographic?.zoom!==void 0&&(s.orthographic.zoom=l.orthographic.zoom),l.perspective?.zoom!==void 0&&(s.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(s.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(s.targetOffset=l.targetOffset)}else if(i.type==="Mesh")"geometry"in a&&Object.assign(s,{geometry:Su.merge(s.geometry,a.geometry)}),(a.material||a.materials)&&(s=t(s,a)),s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Lo.merge(s.cloner,a.cloner)});else if(i.type==="Empty")s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Lo.merge(s.cloner,a.cloner)});else if(yu.is(i.type)){let l=a;l.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?s.color=l.color:s.color=Ht.clone(l.color))}return s}o.patch=r})(Oi||(Oi={}));var Va;(t=>t.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0})(Va||(Va={}));var fo;(t=>t.defaultData={orbitControls:Va.defaultData,playPage:Gn,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,r)=>{let o=0,i=0;return r<5?i=-30:r<10&&(i=30),r===0||r===10||r===5?o=30:(r===4||r===11||r===9)&&(o=-30),[120,[o,i],"show"]}),settings:{image:{format:"jpg",ratio:1},video:{format:"mp4",imageFormat:"jpg",fps:30,mbps:80,ratio:Math.max(1,typeof window<"u"?Math.floor(window.devicePixelRatio):1),stopMode:"manual",duration:5e3},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1}},stopRaycast:!0,hdTransmission:!1})(fo||(fo={}));var Wp;(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(Wp||(Wp={}));var $p;(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})($p||($p={}));var sn;(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...Wp.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:$p.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(sn||(sn={}));var y0;(e=>{function n(r){return r.find(o=>o.data.type==="Page"&&o.data.globalPhysics.usePhysics)!==void 0}e.physicsEnabled=n;function t(r,o,i){r.scene.objects.traverseFrom(o,(a,s)=>{if(s.type==="Instance"){let l=za.getComponentData(r,s.component)?.data;l&&i(a,s,l.events)}else i(a,s,s.events)})}e.traverseModuleInstances=t})(y0||(y0={}));var ln;(l=>{l.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222";function t(u={withLight:!0,withSquare:!0}){let c=[],d=Tu.defaultMeshObject;u.withLight===!0&&c.push({fi:-1,data:Cu.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]}),u.withSquare===!0&&c.push({fi:1,id:"7ba78968-2a55-48f2-b14c-5191da3e075e",data:d,children:[]});let p=new ut;return p.push({fi:1,id:Gn,data:{...an.defaultData,name:"Scene 1"},children:c}),p}l.defaultData={objects:t(),publish:fo.defaultData,styles:sn.defaultData()},l.emptyDataWithoutPage=function(){return{objects:new ut,publish:fo.defaultData,styles:sn.defaultData()}},l.emptyDataWithPage=function(u){return{objects:t(u),publish:fo.defaultData,styles:sn.defaultData()}},l.emptyData=function(){return{objects:new ut,publish:{...fo.defaultData},styles:sn.defaultData()}};function a(u){return{...l.defaultData,objects:br(u,ut.prototype)}}l.withObjs=a;function s(u,c){return a([{id:u,data:c,children:[],fi:0}])}l.withObj=s})(ln||(ln={}));var Ga;(t=>t.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})(Ga||(Ga={}));var Fa;(t=>t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(Fa||(Fa={}));var Mu;(i=>{function n(a){return a.textValue!==void 0}i.isTextValue=n;function t(a){return typeof a=="number"}i.isNumber=t;function e(a){return typeof a=="boolean"}i.isBoolean=e;function r(a){return n(a)?"string":e(a)?"boolean":"number"}i.typeOfVariable=r;function o(a){return i.isTextValue(a)?Array.isArray(a.textValue)?a.textValue.map(s=>s.toString().padStart(a.padding??2,"0")).join(a.deliminator??":")+(a.suffix!==void 0?" "+a.suffix:""):a.textValue.toString():i.isBoolean(a)?a?"True":"False":i.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}i.getDisplayedValue=o})(Mu||(Mu={}));var Yp;(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(Yp||(Yp={}));var g0;(t=>t.all=[...Yp.all,"components"])(g0||(g0={}));var x0;(t=>{function n(){return{images:new be,videos:new be,colors:new be,audios:new be,particles:new be,fonts:new be,materials:new be,components:new be,variables:new be}}t.defaultData=n})(x0||(x0={}));var cn;(t=>{function n(){return{images:new be,videos:new be,colors:new be,audios:new be,particles:new be,fonts:new be,materials:new be,components:new be,variables:new be}}t.defaultData=n})(cn||(cn={}));var Kr;(i=>{function n(){let a={};return a["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},br(a,be.prototype)}i.defaultColors=n;function t(a){let s={};return a?.withAITexture&&(s["a1b10010-844c-a8a3-11ec-0242ac2011ec"]={...Fa.emptyImage,name:"AI generated image"}),br(s,be.prototype)}i.defaultImages=t;function e(){return{catelogs:new be,materials:new be,images:new be,videos:new be,colors:new be,audios:new be,particles:new be,fonts:new be,variables:new we,lib:cn.defaultData()}}i.emptyData=e;function r(a){switch(a){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":let s=[0,0,0];return{name:"Time",value:{textValue:s,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:s,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1};case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",a)}}i.defaultVariables=r;function o(a,s){if(s.format==="HH:mm:ss"){let l=Math.floor(a/3600),u=Math.floor((a-l*3600)/60),c=Math.round(a-l*3600-u*60);return{textValue:[l,u,c]}}else if(s.format==="mm:ss"){let l=Math.floor(a/60),u=Math.round(a-l*60);return{textValue:[l,u]}}else return s.format==="number"?a=Math.round(a):a=Math.round(a*1e3)/1e3,a}i.getFormattedTimerTime=o})(Kr||(Kr={}));var Al=require("three");var Iu;(t=>t.list=["idle","move","jump","run"])(Iu||(Iu={}));var Nu;(e=>(e.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:e.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new we,move:new we,jump:new we,run:new we},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Be.fromHexAndA(3728051,1)}}))(Nu||(Nu={}));function b0(n){n.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,r=t.colorB,o=[[e.r,e.g,e.b,e.a],[r.r,r.g,r.b,r.a]],i=[0,1];for(let s=2;s<10;s++)o.push(o[1]),i.push(1);let a={...uo(At(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:o,steps:i,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,a)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let e={...At(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,e)}})}function un(n,t){Object.values(n.shared.materials).forEach(e=>t(e))}function dn(n,t){n.scene.objects.traverse((e,r)=>{"materials"in r?r.materials.forEach((o,i)=>{o===void 0&&(r.materials[i]=lr.defaultData(),o=r.materials[i]),typeof o!="string"&&t(o)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=lr.defaultData()),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=lr.defaultData()),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(o=>{o.material&&typeof o.material!="string"&&Object.getPrototypeOf(o.material)!==dt.prototype&&t(o.material)})})}function yC(n){Object.assign(n.scene.publish,{orbitControls:{...Va.defaultData,...At(n.scene.publish.orbitControls)}})}function gC(n){Object.assign(n.scene.publish.settings,{video:{...fo.defaultData.settings.video,...At(n.scene.publish.settings.video)}})}function xC(n){function t(e){if(e.layers){for(let r of Object.values(e.layers))if(r){for(let[o,i]of Object.entries(r))if((u0.includes(o)||typeof i=="boolean")&&delete r[o],o==="texture")for(let[a,s]of Object.entries(i))(d0.includes(a)||typeof s=="boolean")&&delete i[a]}}}n.scene.objects.traverse((e,r)=>{r.states.forEach(o=>{let i=o;i.material?t(i.material):i.materials&&i.materials.forEach(a=>{t(a)})})})}function bC(n){n.scene.publish.withBackground=!0}function vC(n){n.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function SC(n){n.scene.objects.traverse((t,e)=>{let r=e.cloner;r&&(r.radial.scale=r.radial.scale.map(o=>o+1),r.linear.scale=r.linear.scale.map(o=>o+1))})}function wC(n){n.scene.objects.traverse((t,e)=>{let r=e.geometry;r&&(r.type==="DodecahedronGeometry"||r.type==="IcosahedronGeometry")&&(r.detail=Math.round(r.detail))})}function AC(n){n.scene.objects.traverse((t,e)=>{let r=n.scene.objects.unproxy().parent(t);if(r){let o=At(n.scene.objects.data(r));o&&o.type==="Mesh"&&o.geometry.type==="BooleanGeometry"&&e.type==="Mesh"&&(e.visible=At(e).booleanExclude!==!0)}})}function _C(n){n.scene.objects.traverse((t,e)=>{if(e.type==="Mesh"){let r=e;e.geometry.type==="NonParametricGeometry"?r.material!==void 0&&delete r.material:r.materials!==void 0&&delete r.materials}})}function PC(n){function t(r){Object.setPrototypeOf(r,dt.prototype),r.texture&&Object.setPrototypeOf(r.texture,dt.prototype)}function e(r){Object.setPrototypeOf(r,dt.prototype);for(let o in r)t(r[o])}n.scene.objects.traverse((r,o)=>{o.states.forEach(i=>{let a=i;if(a.material){let s=At(a.material).layers;e(s),a.material.layers=s}if(a.materials)for(let s=0;s<a.materials.length;s++){let l=a.materials[s],u=At(l).layers;e(u),l.layers=u}})})}function v0(n){n.layers===void 0&&Object.assign(n,lr.defaultTwoLayerData("lambert"))}function Xp(n){!n.layers||n.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let e=[...t.colors];e.push(t.colors[9]);let r=[...t.steps];r.push(t.steps[9]);let o={...At(t),colors:e,steps:r};Object.assign(t,o)}})}function OC(n){n.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function S0(n){n.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(r=>{typeof r!="string"&&Xp(r)}):"material"in e&&typeof e.material!="string"&&Xp(e.material)}),Object.values(n.shared.materials).forEach(t=>Xp(t))}function CC(n){n.scene.environment.ambientLight.softShadows=!1,n.scene.environment.ambientLight.softShadowQuality="low",n.scene.objects.traverse((t,e)=>{(e.type==="DirectionalLight"||e.type==="SpotLight")&&(e.shadowResolution=1024,e.shadowRadius=1,e.depth=1e5)}),n.shared.penumbraSize=new Array(5).fill(.5)}function TC(n){n.shared.audios=br({},be.prototype)}function MC(n){n.shared.videos=br({},be.prototype)}function IC(n){let t=n.shared.materials;Object.entries(t).forEach(([e,r])=>{if(!r.layers){let o={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(t,{[e]:o})}})}function NC(n){Object.entries(At(n.shared.images)).filter(r=>r[1].asset===!1).map(r=>r[0]).forEach(r=>{delete n.shared.images[r]}),Object.entries(At(n.shared.audios)).filter(r=>r[1].asset===!1).map(r=>r[0]).forEach(r=>{delete n.shared.audios[r]})}function DC(n){n.scene.publish.settings.web.preload=!1}function w0(n){n.layers&&n.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function A0(n){n.layers&&n.layers.forEach(t=>{c0(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function EC(n){n.shared.fonts=br({},be.prototype)}function BC(n){return n.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function LC(n){let t=[];n.scene.objects.traverse((e,r)=>{let o=r;if(o.type==="TextFrame"){let i=lr.defaultTwoLayerData("phong"),a=typeof o.color=="string"?n.shared.colors[o.color]:o.color;i.layers[1].data.color={r:a.r,g:a.g,b:a.b},i.layers[1].data.alpha=o.alpha;let s=BC(o.font);n.shared.fonts[s]===void 0&&(n.shared.fonts[s]={name:s});let l={name:o.name,...qt.defaultData,..._i.defaultData,flatShading:!1,wireframe:!1,geometry:{...jn.defaultData("TextGeometry"),width:o.width,height:o.height,font:s,depth:0,horizontalAlign:o.horizontalAlign,verticalAlign:o.verticalAlign,fontSize:o.fontSize*1.40625,lineHeight:o.lineHeight/1.40625,letterSpacing:o.letterSpacing-1,text:o.text,textTransform:o.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:i,states:At(o.states),events:At(o.events),visible:o.visible,raycastLock:o.raycastLock,position:o.position,rotation:o.rotation,scale:o.scale,hiddenMatrix:o.hiddenMatrix},u=At(n.scene.objects).parent(e);n.scene.objects.insertAfter(u??null,e,[{id:e+"new",data:l,children:[]}]),t.push(e)}}),t.forEach(e=>{n.scene.objects.delete(e)})}function RC(n){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};n.scene.objects.traverse((e,r)=>{r.events.forEach(o=>{if(!!t[Number(o.type)])if(Object.assign(o,{type:t[Number(o.type)]}),o.type==="Audio"&&"audioEvent"in o&&(Object.assign(o,{playAudio:o.audioEvent}),delete o.audioEvent),o.type==="GameControl")Object.assign(o,{gameActions:{idle:new we,move:new we,jump:new we}});else{let i=new we;Object.assign(o,{actions:i}),(o.type==="MouseDown"||o.type==="MouseUp"||o.type==="KeyDown"||o.type==="KeyUp")&&"url"in o&&i.push({fi:0,id:Al.MathUtils.generateUUID(),data:{type:"Link",url:o.url,delay:0}}),"targets"in o&&(o.targets.forEach((a,s,l)=>{let u={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},c={easing:a.easing,duration:a.duration};a.easing===6?Object.assign(c,uo(a,"mass","stiffness","damping","velocity")):a.easing===5&&Object.assign(c,{control1:{...a.control1},control2:{...a.control2}});let d={repeat:a.repeat?-1:0,delay:a.delay,delayDirection:a.delayDirection,direction:a.cycle&&a.rewind?"pingpong-rewind":a.cycle?"pingpong":"normal"},p={state:a.state,...d,...c},f={allowSlerp:!0,type:"Transition",object:a.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new we({fi:0,id:Al.MathUtils.generateUUID(),data:u},{fi:1,id:Al.MathUtils.generateUUID(),data:p})};i.push({fi:l,id:s,data:f})}),delete o.targets)}})})}function VC(n){n.scene.objects.traverse((t,e)=>{function r(o,i){let a=new we,s=[];if(e.events.forEach((l,u,c)=>{if(l.type==="Audio"&&l.trigger===i){let d;s.push(u),l.interaction==="play"?d={...uo(l,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in l?l.after:void 0,toggle:"after"in l?l.toggle:void 0,type:"Audio"}:(l.interaction==="pause"||l.interaction==="stop")&&(d={...uo(l,"interaction","delay","object","playAudio"),type:"Audio"}),d&&a.push({fi:c,id:u,data:d})}}),s.forEach(l=>e.events.delete(l)),a.length){let l=e.events.find(u=>u.type===o)?.data;l?"actions"in l&&l.actions.insertBefore(null,a):e.events.insertBefore(null,[{id:Al.MathUtils.generateUUID(),data:{type:o,actions:a}}])}}r("Start","start"),r("MouseDown","mouseDown"),r("MouseUp","mouseUp"),r("KeyDown","keyDown"),r("KeyUp","keyUp")})}function _0(n){let t=n.layers.find(e=>e.type==="light")?.data;if(t?.category==="basic"){let e=Ft.defaultData("light","phong"),r=t;Object.assign(r,e),r.visible=!1}}function P0(n){un(n,_0),dn(n,_0)}function zC(n){n.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function GC(n){n.scene.objects.traverse((t,e)=>{(e.type==="Empty"||e.type==="Mesh")&&e.cloner&&!e.cloner.randomnessObject&&!e.cloner.toObject&&!e.cloner.randomness&&(e.cloner={...e.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}function FC(n){n.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="NonParametricGeometry"&&!("material"in e)&&!("materials"in e)&&(e.material=lr.defaultTwoLayerData("phong"))})}function kC(n){n.scene.publish.orbitControls.autoZoom===void 0&&(n.scene.publish.orbitControls.autoZoom=!1),n.scene.objects.traverse((t,e)=>{(e.type==="OrthographicCamera"||e.type==="PerspectiveCamera")&&(e.orthographic.autoZoom===void 0&&(e.orthographic.autoZoom=!1),e.orthographic.autoZoomFrustumSize===void 0&&(e.orthographic.autoZoomFrustumSize=790))})}function jC(n){n.scene.objects.traverse((t,e)=>{e.pathSnapping===void 0&&(e.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),e.pathSnapping.offset===void 0&&(e.pathSnapping.offset=0)})}function UC(n){n.scene.publish.mouseEventTarget===void 0&&(n.scene.publish.mouseEventTarget="canvas"),n.scene.publish.settings.web.hint===void 0&&(n.scene.publish.settings.web.hint=!1)}function HC(n){let{video:t}=n.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function qC(n){n.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.resetYPosition=Math.abs(r.resetYPosition-e.position[1]))})})}function WC(n){let t=n.scene.environment.usePhysics;n.scene.objects.traverse((e,r)=>{t&&r.physics===null?r.collision=!1:r.collision="visibility"})}function $C(n){n.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.navmesh=Nu.defaultDataThirdPerson.navmesh)})})}function YC(n){n.scene.styles||(n.scene.styles=sn.defaultData())}function O0(n){n.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function XC(n){n.scene.environment.ambientLight.occlusion===void 0&&(n.scene.environment.ambientLight.occlusion=!1),n.scene.environment.ambientLight.aoFullRes===void 0&&(n.scene.environment.ambientLight.aoFullRes=!1),n.scene.environment.ambientLight.radius===void 0&&(n.scene.environment.ambientLight.radius=256),n.scene.environment.ambientLight.bias===void 0&&(n.scene.environment.ambientLight.bias=.5),n.scene.environment.ambientLight.aoColor===void 0&&(n.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),dn(n,O0),un(n,O0)}function QC(n){n.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&Object.assign(r.gameActions,{run:new we})})})}function KC(n){n.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.keyAssignments=[...r.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function C0(n){n.layers&&n.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function T0(n,t){if(t<1&&(dn(n,b0),un(n,b0),n.schema=1),t<2&&(yC(n),n.schema=2),t<3&&(xC(n),n.schema=3),t<4&&(bC(n),n.schema=4),t<5&&(vC(n),n.schema=5),t<6&&(SC(n),n.schema=6),t<7&&(wC(n),n.schema=7),t<8&&(n.schema=8),t<9&&(S0(n),n.schema=9),t<10&&(OC(n),n.schema=10),t<11&&(CC(n),n.schema=11),t<12&&(S0(n),n.schema=12),t<13&&(TC(n),n.schema=13),t<14&&(IC(n),n.schema=14),t<15&&(NC(n),n.schema=15),t<16&&(DC(n),n.schema=16),t<17&&(dn(n,w0),un(n,w0),n.schema=17),t<18&&(dn(n,v0),un(n,v0),n.schema=18),t<19&&(gC(n),n.schema=19),t<20&&(EC(n),LC(n),n.schema=20),t<21&&(RC(n),VC(n),n.schema=21),t<22&&(P0(n),n.schema=22),t<23&&(zC(n),n.schema=23),t<24&&(GC(n),n.schema=24),(t<25||n.shared.videos===void 0)&&(MC(n),t<25&&(n.schema=25)),t<26&&(AC(n),n.schema=26),t<27&&(_C(n),n.schema=27),t<28&&(P0(n),n.schema=28),t<29&&(PC(n),n.schema=29),t<30&&(FC(n),n.schema=30),t<31&&(kC(n),n.schema=31),t<33&&(jC(n),n.schema=33),t<34&&(UC(n),n.schema=34),t<35&&(HC(n),n.schema=35),t<36&&(qC(n),n.schema=36),t<37&&(WC(n),n.schema=37),t<38&&(dn(n,A0),un(n,A0),n.schema=38),t<39&&($C(n),n.schema=39),t<40&&(YC(n),n.schema=40),t<41&&(XC(n),n.schema=41),t<42&&(QC(n),n.schema=42),t<43&&(KC(n),n.schema=43),t<99){dn(n,C0),un(n,C0),n.scene.publish.playCamera===null&&(n.scene.publish.playCamera=zn);let e=At(n.scene.objects),r=n.scene.objects;n.scene.publish.playPage=Gn,r.insertBefore(null,null,[{id:Gn,data:{...an.defaultData,backgroundColor:n.scene.backgroundColor,fog:n.scene.fog,postprocessing:n.scene.postprocessing,ao:uo(n.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:n.scene.publish.playCamera,gameControlObject:n.scene.publish.gameControlObject},shadow:uo(n.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...wl.defaultData,...uo(n.scene.environment,"usePhysics","gravity")},camera:At(n.scene.ownerCamera)??an.defaultData.camera,name:"Scene"},children:[]}]);for(let a of e)a.id!==ln.TRASH_CAN_ID&&r.move(Gn,a.fi,a.id);let o=0,i=0;n.shared.penumbraSize&&n.scene.objects.traverse((a,s)=>{s.type==="DirectionalLight"?(s.penumbraSize=n.shared.penumbraSize[Math.min(o,2)],o+=1):s.type==="SpotLight"&&(s.penumbraSize=n.shared.penumbraSize[3+Math.min(i,1)],i+=1),(s.physics===void 0||s.physics===null)&&s.type!=="Instance"&&(s.physics={},Object.assign(s.physics,kn.defaultData)),s.physics!==void 0&&s.physics!==null&&(s.physics.enabled=s.collision??"visibility",delete s.collision)}),n.schema=99}}function M0(n){n.layers&&n.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function ZC(n){n.scene.objects.traverse((t,e)=>{let r=e.geometry;r&&r.type==="PathGeometry"&&(r.extrusion.capType="flat",r.extrusion.bevel=50,r.extrusion.bevelSides=6,r.extrusion.shape.type==="Custom"&&(r.extrusion.shape.shapeQuality="low"))})}function JC(n){Array.isArray(At(n.events))&&n.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),(t.type==="MouseDown"||t.type==="MouseUp"||t.type==="MousePress")&&(t.mode=t.mode||"Object")})}var ka=180/Math.PI;function I0(n){n.rotation=n.rotation.slice(0,3).map(t=>t*ka)}function N0(n){I0(n),n.type==="Page"&&I0(n.camera),n.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(r=>r*ka))});let t=n.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*ka),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*ka),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=ka,t.extrusion.twist*=ka),n.type==="Mesh"&&n.geometry.type==="TextGeometry"&&(n.geometry.text={textValue:n.geometry.text}),Array.isArray(At(n.events))&&n.events?.forEach(e=>{(e.type==="MouseDown"||e.type==="MouseUp"||e.type==="MousePress"||e.type==="KeyDown"||e.type==="KeyUp"||e.type==="KeyPress"||e.type==="Collision"||e.type==="Trigger")&&(e.runMode=e.toggle?"Toggle":"Repeat")})}function eT(n){n.shared.variables=br({},be.prototype)}function tT(n){let t=At(n.shared.variables);n.shared.variables=br(Object.entries(t??{}).map(([e,r],o)=>({fi:o,id:e,data:r})),we.prototype)}var Vo=111;function D0(n,t){t(n.data);for(let e of n.children)D0(e,t)}function rT(n){let t=n.schema??104;t!==Vo&&t<105&&(D0(n.asset,N0),n.schema=105)}function oT(n){n.shared.particles=br({},be.prototype),n.shared.lib&&(n.shared.lib.particles=cn.defaultData().particles)}function nT(n){n.scene.objects.traverse((t,e)=>{e.type==="Particle"&&typeof e.renderMaterial.size=="number"&&Object.assign(e.renderMaterial,{size:[e.renderMaterial.size,e.renderMaterial.size]})})}function Du(n){let t=n.schema??0;if(t!==Vo){console.warn("updating from ",t,"to ",Vo),T0(n,t),t<100&&(n.scene.publish.joystickSizeAndXYOffset===void 0&&(n.scene.publish.joystickSizeAndXYOffset=fo.defaultData.joystickSizeAndXYOffset),n.schema=100),t<101&&(dn(n,M0),un(n,M0),n.schema=101),t<102&&(ZC(n),n.schema=102),t<104&&(n.shared.catelogs=new be,n.shared.lib=cn.defaultData(),n.schema=104),t<105&&(eT(n),n.scene.objects.traverse((e,r)=>{N0(r)}),n.schema=105);for(let e of Object.values(n.shared.lib.components))rT(e);t<106&&(tT(n),n.schema=106),t<107&&(n.shared.lib.variables=cn.defaultData().variables,n.schema=107),t<109&&(oT(n),n.schema=109),t<110&&(nT(n),n.schema=110),t<111&&(n.scene.objects.traverse((e,r)=>{JC(r)}),n.schema=111)}}var za;(l=>{l.defaultData={schema:Vo,scene:ln.defaultData,frames:new be().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Ga.defaultData),shared:{...Kr.emptyData(),colors:Kr.defaultColors()}},l.emptyDataForImports=function(u){let c=ln.emptyDataWithPage(u);return{schema:Vo,scene:c,frames:new be().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Ga.defaultData),shared:{...Kr.emptyData(),colors:Kr.defaultColors(),images:Kr.defaultImages(u)}}},l.emptyData=function(){return{schema:Vo,scene:ln.emptyDataWithPage(),frames:new be().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Ga.defaultData),shared:Kr.emptyData()}},l.clipboard2dData=function(){return{schema:Vo,scene:ln.emptyData(),frames:new be,shared:Kr.emptyData()}},l.collabHelper={...yl,updateSchema(u){return(u.schema??0)<Vo?Dn(u,Du):(u.schema??0)-Vo}};function i(u){let c=l.collabHelper.updateSchema(u);return typeof c=="number"?c===0?u:null:c.data}l.updateSchemaDirectly=i;function a(u){return{...u,shared:{...u.shared,lib:cn.defaultData()}}}l.withoutLib=a;function s(u,c){let d=u.scene.objects.get(c);if(d&&d.data.type==="Component")return d;{let p=u.shared.lib.components[c];if(p)return p.asset}}l.getComponentData=s})(za||(za={}));var E0;(t=>{function n(e){return!0}t.is=n})(E0||(E0={}));var Eu;(r=>{r.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(o,i){return{position:i?.position??o.position,rotation:i?.rotation??o.rotation,scale:i?.scale??o.scale,shear:i?.shear??o.shear}}r.merge=t;function e(o,i){return _c({position:Ia.isEqual(o.position,i.position)?void 0:i.position,rotation:o.rotation===i.rotation?void 0:i.rotation,scale:Ia.isEqual(o.scale,i.scale)?void 0:i.scale,shear:o.shear&&i.shear&&Ia.isEqual(o.shear,i.shear)?void 0:i.shear})}r.diff=e})(Eu||(Eu={}));var Qp;(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(Qp||(Qp={}));var Bu;(t=>t.defaultData={opacity:1,fill:{color:Be.fromHexAndA(Rt,1),enabled:!0},stroke:{color:Be.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Be.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Be.from0to1([0,0,0,1]),enabled:!1,spread:0}})(Bu||(Bu={}));var Ci;(i=>{function n(a,s){return{name:s}}i.newEmpty=n;function t(a,s){if(s===void 0)return a;let l={...a},u=["width","height","cornerRadius"];for(let c of u)c in l&&c in s&&s[c]!==void 0&&Object.assign(l,{[c]:s[c]});return l}function e(a,s){if(s===void 0)return a;let l={...a};return"fill"in l&&"fill"in s&&s.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...s.fill}}),"stroke"in l&&"stroke"in s&&s.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...s.stroke}}),"layerBlur"in l&&"layerBlur"in s&&s.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...s.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in s&&s.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...s.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in s&&s.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...s.dropShadow}}),"innerShadow"in l&&"innerShadow"in s&&s.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...s.innerShadow}}),l}function r(a,s){if(s===void 0)return a;let l={...a};return Object.assign(l,Eu.merge(l,s)),l=t(l,s),l=e(l,s),l}i.patch=r;function o(a,s){let l,u=[];for(let[c,d]of Object.entries(s))c!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},u.push(l)),l.props[c]=d);return u}i.toOps=o})(Ci||(Ci={}));var _l;(t=>t.defaultData={...Eu.defaultData,...Qp.defaultData,states:new we,events:new we,visible:!0,raycastLock:!1})(_l||(_l={}));var ja;(t=>t.defaultData={..._l.defaultData,...Bu.defaultData})(ja||(ja={}));var Lu;(t=>t.defaultData={cornerRadius:[0,0,0,0]})(Lu||(Lu={}));var Kp;(t=>t.defaultData={...ja.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(Kp||(Kp={}));var Ua;(t=>t.defaultData={...ja.defaultData,...Lu.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(Ua||(Ua={}));var Zp;(t=>t.defaultData={...ja.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"})(Zp||(Zp={}));var Jp;(t=>t.defaultData={...ja.defaultData,type:"path2d",path:"",name:"Path"})(Jp||(Jp={}));var B0;(t=>{function n(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=n})(B0||(B0={}));var Pl;(t=>t.defaultData={..._l.defaultData,name:"Group",type:"group2d"})(Pl||(Pl={}));var ef;(t=>t.defaultData={..._l.defaultData,...Lu.defaultData,...Bu.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Be.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Be.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}})(ef||(ef={}));var pn;(o=>{function n(i){switch(i){case"rectangle2d":return{...Ua.defaultData};case"ellipse2d":return{...Kp.defaultData};case"text2d":return{...Zp.defaultData};case"vector2d":return{...Ua.defaultData};case"path2d":return{...Jp.defaultData};case"frame2d":return{...ef.defaultData};case"group2d":return{...Pl.defaultData}}}o.defaultData=n;function t(i){return"width"in i&&"height"in i?[typeof i.width=="number"?i.width*.5:0,typeof i.height=="number"?i.height*.5:0]:[0,0]}o.getPivot=t;function e(i){return i.type==="rectangle2d"||i.type==="ellipse2d"||i.type==="text2d"||i.type==="frame2d"}o.isResizeable=e;function r(i){return i.type==="rectangle2d"||i.type==="frame2d"}o.hasCorners=r})(pn||(pn={}));var Ru;(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new ut},e.emptyData=function(){return{type:"scene2d",objects:new ut}}))(Ru||(Ru={}));var tt=require("three"),js=ar(R0());var iT=.5*(Math.sqrt(3)-1),Ol=(3-Math.sqrt(3))/6,aT=1/3,zo=1/6,bU=(Math.sqrt(5)-1)/4,vU=(5-Math.sqrt(5))/20,Cl=n=>Math.floor(n)|0,V0=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),rf=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function Vu(n=Math.random){let t=G0(n),e=new Float64Array(t).map(o=>V0[o%12*2]),r=new Float64Array(t).map(o=>V0[o%12*2+1]);return function(i,a){let s=0,l=0,u=0,c=(i+a)*iT,d=Cl(i+c),p=Cl(a+c),f=(d+p)*Ol,h=d-f,m=p-f,y=i-h,g=a-m,b,w;y>g?(b=1,w=0):(b=0,w=1);let A=y-b+Ol,S=g-w+Ol,P=y-1+2*Ol,O=g-1+2*Ol,x=d&255,D=p&255,N=.5-y*y-g*g;if(N>=0){let E=x+t[D],B=e[E],R=r[E];N*=N,s=N*N*(B*y+R*g)}let T=.5-A*A-S*S;if(T>=0){let E=x+b+t[D+w],B=e[E],R=r[E];T*=T,l=T*T*(B*A+R*S)}let I=.5-P*P-O*O;if(I>=0){let E=x+1+t[D+1],B=e[E],R=r[E];I*=I,u=I*I*(B*P+R*O)}return 70*(s+l+u)}}function z0(n=Math.random){let t=G0(n),e=new Float64Array(t).map(i=>rf[i%12*3]),r=new Float64Array(t).map(i=>rf[i%12*3+1]),o=new Float64Array(t).map(i=>rf[i%12*3+2]);return function(a,s,l){let u,c,d,p,f=(a+s+l)*aT,h=Cl(a+f),m=Cl(s+f),y=Cl(l+f),g=(h+m+y)*zo,b=h-g,w=m-g,A=y-g,S=a-b,P=s-w,O=l-A,x,D,N,T,I,E;S>=P?P>=O?(x=1,D=0,N=0,T=1,I=1,E=0):S>=O?(x=1,D=0,N=0,T=1,I=0,E=1):(x=0,D=0,N=1,T=1,I=0,E=1):P<O?(x=0,D=0,N=1,T=0,I=1,E=1):S<O?(x=0,D=1,N=0,T=0,I=1,E=1):(x=0,D=1,N=0,T=1,I=1,E=0);let B=S-x+zo,R=P-D+zo,F=O-N+zo,V=S-T+2*zo,q=P-I+2*zo,k=O-E+2*zo,U=S-1+3*zo,H=P-1+3*zo,Y=O-1+3*zo,J=h&255,Z=m&255,X=y&255,te=.6-S*S-P*P-O*O;if(te<0)u=0;else{let W=J+t[Z+t[X]];te*=te,u=te*te*(e[W]*S+r[W]*P+o[W]*O)}let $=.6-B*B-R*R-F*F;if($<0)c=0;else{let W=J+x+t[Z+D+t[X+N]];$*=$,c=$*$*(e[W]*B+r[W]*R+o[W]*F)}let ee=.6-V*V-q*q-k*k;if(ee<0)d=0;else{let W=J+T+t[Z+I+t[X+E]];ee*=ee,d=ee*ee*(e[W]*V+r[W]*q+o[W]*k)}let Q=.6-U*U-H*H-Y*Y;if(Q<0)p=0;else{let W=J+1+t[Z+1+t[X+1]];Q*=Q,p=Q*Q*(e[W]*U+r[W]*H+o[W]*Y)}return 32*(u+c+d+p)}}function G0(n){let e=new Uint8Array(512);for(let r=0;r<512/2;r++)e[r]=r;for(let r=0;r<512/2-1;r++){let o=r+~~(n()*(256-r)),i=e[r];e[r]=e[o],e[o]=i}for(let r=256;r<512;r++)e[r]=e[r-256];return e}var F0=require("three"),ho=new F0.Triangle,zu=class{constructor(t){this.weightAttribute=null;let e=t.geometry;if(!e.isBufferGeometry||e.attributes.position.itemSize!==3)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");e.index&&(e=e.toNonIndexed()),this.geometry=e,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let t=this.positionAttribute,e=new Float32Array(t.count/3);for(let o=0;o<t.count;o+=3){let i=1;ho.a.fromBufferAttribute(t,o),ho.b.fromBufferAttribute(t,o+1),ho.c.fromBufferAttribute(t,o+2),i*=ho.getArea(),e[o/3]=i}this.distribution=new Float32Array(t.count/3);let r=0;for(let o=0;o<e.length;o++)r+=e[o],this.distribution[o]=r;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let r=this.distribution[this.distribution.length-1],o=this.binarySearch(this.randomFunction()*r);return this.sampleFace(o,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,r=0,o=e.length-1,i=-1;for(;r<=o;){let a=Math.ceil((r+o)/2);if(a===0||e[a-1]<=t&&e[a]>t){i=a;break}else t<e[a]?o=a-1:r=a+1}return i}sampleFace(t,e,r){let o=this.randomFunction(),i=this.randomFunction();return o+i>1&&(o=1-o,i=1-i),ho.a.fromBufferAttribute(this.positionAttribute,t*3),ho.b.fromBufferAttribute(this.positionAttribute,t*3+1),ho.c.fromBufferAttribute(this.positionAttribute,t*3+2),e.set(0,0,0).addScaledVector(ho.a,o).addScaledVector(ho.b,i).addScaledVector(ho.c,1-(o+i)),ho.getNormal(r),this}};var H0=require("three");var jr=require("three"),U0=ar(j0()),sT=new jr.Matrix4,lT=new jr.Matrix4,cT=new jr.Matrix4,Ha;(t=>{function n(e){return e&&e.__isSPEObject}t.is=n})(Ha||(Ha={}));var qa=n=>class extends n{constructor(){super(...arguments);this.previousModelViewMatrix=new jr.Matrix4;this.copyPreviousMatrix=!0;this.hiddenMatrix=new jr.Matrix4;this.matrixWorldRigid=new jr.Matrix4;this.shearScale=new jr.Matrix4;this.shearScaleInv=new jr.Matrix4}get __isSPEObject(){return!0}isDescendantOf(r){r instanceof jr.Object3D&&(r=r.uuid);let o=this;for(;o.parent;){if(o.parent.uuid===r)return!0;o=o.parent}return!1}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0);for(let o of this.children)o.updateMatrixWorld(r)}updateWorldMatrix(r,o){let i=this.parent;if(r&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),o)for(let a of this.children)a.updateWorldMatrix(!1,!0)}traverseChildren(r,o=0){for(let i of this.children)Ha.is(i)&&i.traverseObject(r,o+1)}traverseObject(r,o=0){if(r(this,o)!==!0)for(let a of this.children)Ha.is(a)&&a.traverseObject(r,o+1)}updateMatrixWorldSVD(){let r=this.matrixWorld.elements,o=[[r[0],r[4],r[8]],[r[1],r[5],r[9]],[r[2],r[6],r[10]]],{u:i,v:a,q:s}=(0,U0.SVD)(o),l=sT.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),u=lT.set(a[0][0],a[0][1],a[0][2],0,a[1][0],a[1][1],a[1][2],0,a[2][0],a[2][1],a[2][2],0,0,0,0,1),c=cT.copy(u).transpose();this.shearScale.makeScale(s[0],s[1],s[2]).multiply(c).premultiply(u),this.shearScaleInv.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(l,c).copyPosition(this.matrixWorld),s.every(d=>Math.abs(s[0]-d)<.01)?this.hasNonUniformScale=!1:this.hasNonUniformScale=!0}attach(r,o){this.updateWorldMatrix(!0,!1);let i=new jr.Matrix4().copy(this.matrixWorld).invert();return r.parent!==null&&(r.parent.updateWorldMatrix(!0,!1),i.multiply(r.parent.matrixWorld)),"hiddenMatrix"in r&&r.hiddenMatrix instanceof jr.Matrix4?r.hiddenMatrix.premultiply(i):r.applyMatrix4(i),r.updateWorldMatrix(!1,!1),this.add(r),o!==void 0&&(this.children.pop(),this.children.splice(o,0,r)),this}copy(r,o=!1){return super.copy(r,o),this.hasNonUniformScale=r.hasNonUniformScale,this}onAfterRender(r,o,i,a,s,l){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}};var of=class extends qa(H0.Object3D){},uT=n=>n.type==="Mesh",fn=class extends of{constructor(e){super();this.object=e;this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,r){}expand(){let e=0,r=this.object.entityChildren(e);for(;r;){let o=this.children[e];o?.object!==r&&(o&&this.remove(o),o=new fn(r),this.add(o),this.children.splice(e,0,this.children.pop()),o.matrixWorldNeedsUpdate=!0,o.matrixAutoUpdate=!1,o.matrix=r.matrix,o.hiddenMatrix=r.hiddenMatrix),o.expand(),e+=1,r=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e])}get visible(){return this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return uT(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}};var ps=require("three");var nd=require("three");var mr=require("three");var Nt=require("three"),Ti=new Nt.Vector3,Mi=new Nt.Vector3,Wa=new Nt.Matrix4,W0=[new Nt.Vector3(-1,1,1),new Nt.Vector3(-1,-1,1),new Nt.Vector3(1,-1,1),new Nt.Vector3(1,1,1),new Nt.Vector3(-1,1,-1),new Nt.Vector3(-1,-1,-1),new Nt.Vector3(1,-1,-1),new Nt.Vector3(1,1,-1)],dT=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],pT=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],q0=(n,t,e)=>{n.updateEntityBoxSize(Ti,Mi),Wa.copy(t).multiply(n.matrixWorld),Mi.x===0&&Mi.y===0&&Mi.z===0?e.push(new Nt.Vector3(Ti.x,Ti.y,Ti.z).applyMatrix4(Wa)):W0.forEach(r=>{e.push(r.clone().multiply(Mi).add(Ti).applyMatrix4(Wa))})},Tl=class extends Nt.Box3{constructor(){super(...arguments);this.matrix=new Nt.Matrix4;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(r=>r.clone()),this.faces=e.faces.map(r=>r.clone()),this.edges=e.edges.map(r=>r.clone()),this.centerEdges=e.centerEdges.map(r=>r.clone()),this}setFromObjectSize(e,r=!1){e.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let o=new Nt.Matrix4().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,o,r)}expandByObjectSize(e,r,o=!1){let i=[];return o===!0?e.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a)){i.push(new Nt.Vector3);return}q0(a,r,i)}}):q0(e,r,i),this.setFromPoints(i)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(Wa.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(Mi).multiplyScalar(.5),this.getCenter(Ti),Wa.copy(this.matrix).setPosition(Ti),this.vertices=W0.map(e=>e.clone().multiply(Mi).applyMatrix4(Wa))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=dT.map(([e,r])=>new Nt.Line3(this.vertices[e],this.vertices[r])),this.centerEdges=this.edges.map(e=>e.getCenter(new Nt.Vector3))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=pT.map(([e,r])=>this.vertices[e].clone().add(this.vertices[r]).multiplyScalar(.5))}};var mo={Cloner:()=>{},changeEntityProptotype:()=>{},createEntity:()=>{}};var tr=require("three"),af=class extends tr.CurvePath{constructor(){super()}getPoints(t=12){let e=[],r,o=this.getCurveLengths(),a=o[o.length-1]/o.length;for(let s=0,l=this.curves;s<l.length;s++){let u=l[s],c=s===0?o[s]:o[s]-o[s-1],d=Math.ceil(t*c/a),p=u.getPoints(d);for(let f=0;f<p.length;f++){let h=p[f];r&&r.equals(h)||(e.push(h),r=h)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}};var sf=.001;function lf(n,t,e){return t.clone().sub(n).cross(t.clone().sub(e)).length()<=sf}function nf(n,t){let e=new tr.Vector3(...n.position),r=new tr.Vector3(...n.controlNext.position),o=new tr.Vector3(...t.controlPrevious.position),i=new tr.Vector3(...t.position);return lf(e,r,i)&&lf(e,o,i)}function Fu(n){let t=n.points.map(c=>new tr.Vector3(...c.data.position)),e=[n.points[0]],r=new tr.Vector3(...e[0].data.position);for(let c=0;c<n.points.length-1;c++)lf(r,t[c],t[c+1])||(e.push(n.points[c]),r=t[c]);e.push(n.points[n.points.length-1]);let o=n.isClosed,i=e.length-(o?0:1),a=e.length,s=[];for(let c=0;c<a;c++){let d=e[c].data,p=new tr.Vector3(...d.position),f=new tr.Vector3(...d.controlPrevious.position),h=new tr.Vector3(...d.controlNext.position),m={position:p,baseRoundness:d.roundness,controlPrevious:f,controlNext:h};if(d.roundness===0||!n.isClosed&&(c===0||c===a-1)){s[c]={...m,removedLength:0};continue}let y=o&&c==0?a-1:c-1,g=o&&c==a-1?0:c+1,b=e[y].data,w=e[g].data,A=new tr.Vector3(...b.position),S=new tr.Vector3(...w.position),P=A.clone().sub(p).normalize(),O=S.clone().sub(p).normalize();Object.assign(m,{prevDir:P,nextDir:O});let x=nf(b,d),D=nf(d,w);if(!x||!D)s[c]={...m,removedLength:0};else{let N=P.clone().add(O).normalize(),T=N.clone().cross(P).length()/P.dot(N);s[c]={...m,tan:T,removedLength:d.roundness/T}}}for(let c=0;c<i;c++){let d=c,p=o&&c===a-1?0:c+1,f=s[d],h=s[p];if(f.removedLength!==0||h.removedLength!==0){let m=f.position.distanceTo(h.position);f.removedLength=Math.min(f.removedLength,m/2),h.removedLength=Math.min(h.removedLength,m/2)}}let l=[];for(let c=0;c<i;c++){let d=c,p=o&&c===a-1?0:c+1,f=s[d],h=s[p],m=null;if(!nf(e[d].data,e[p].data))f.position.distanceTo(h.position)>sf&&(m=new tr.CubicBezierCurve3(f.position,f.controlNext,h.controlPrevious,h.position));else{let y=f.position.clone(),g=h.position.clone();(f.removedLength!==0||h.removedLength!==0)&&(f.nextDir&&y.add(f.nextDir.clone().setLength(f.removedLength)),h.prevDir&&g.add(h.prevDir.clone().setLength(h.removedLength))),y.distanceTo(g)>sf&&(m=new tr.CubicBezierCurve3(y,y.clone().lerp(g,.3),g.clone().lerp(y,.3),g))}l[2*c+1]=m}for(let c=0;c<a;c++){let d=s[c];if(d.removedLength===0){l[2*c]=null;continue}let p=d.position,f=d.prevDir.clone().multiplyScalar(d.removedLength).add(p),h=d.nextDir.clone().multiplyScalar(d.removedLength).add(p),m=d.tan*d.removedLength,y=d.prevDir.clone().add(d.nextDir).normalize(),g=f.clone().lerp(h,.5),b=f.distanceTo(h)/2,w=y.clone().multiplyScalar(Math.sqrt(Math.pow(m,2)-Math.pow(b,2))).add(g),A=y.clone().multiplyScalar(-m).add(w),S=p.distanceTo(A)/p.distanceTo(g),P=d.prevDir.clone().multiplyScalar(S*p.distanceTo(f)).add(p),O=P.clone().lerp(A,2),x=f.clone().lerp(P,4/3),D=h.clone().lerp(O,4/3);l[2*c]=new tr.CubicBezierCurve3(f,x,D,h)}let u=new af;return l.forEach(c=>{c&&u.add(c)}),u}var ke;(t=>{function n(e){return e&&e.__isEntity}t.is=n})(ke||(ke={}));var $a=n=>ke.is(n),fT={type:"completeState",isfromEntity:!0},hT=["x","y","z"],cf=new mr.Vector3,mT=new mr.Vector3().set(0,1,0),Ya=n=>class extends qa(n){constructor(){super(...arguments);this.raycastLock=!1;this.scaleLock=!1;this.disposed=!1;this.stateSelection=null;this.destroyedInAction=!1;this.instances=[];this.prevState=null;this.currentState=null;this.reversibleToState=null;this.currentTransitionEvent=null;this.previousAction=null;this._singleBBox=new Tl;this._recursiveBBox=new Tl;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this._needApplyPathSnapping=!0;this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(r){let o=this.children[r];if(ke.is(o))return o}entityChildrenCount(){let r=this.children.length;for(;r--;)if(ke.is(this.children[r]))return r+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let r=this;for(;r.data.type!=="Instance";){let o=r.parent;if(ke.is(o))r=o;else return}return r}forInstancesRec(r){this.instances.forEach(o=>{o.disposed||r(o),o.forInstancesRec(r)})}super_Entity(r,o){typeof r=="string"&&(this.uuid=r),this.identity=r,this.data=o,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(r,o,i=!1){if(!(this.data.states.length===0&&!i)){for(let a of this.data.states)Oi.toOps(this.data,a.data).forEach(l=>{let u=Oa.replaceProps(l,this.data);this.dataPatched=this.data,this.updateByPatchedOp(u,this.data,o)});if(r!==null){let a=this.data.states.data(r);a&&(this.dataPatched=Oi.patch(this.data,a),Oi.toOps(this.data,a).forEach(l=>{this.updateByPatchedOp(l,this.dataPatched,o)}))}i&&this.updateTransformState(this.dataPatched,o),this.stateSelection=r,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(r,o){r.setScalar(0),o.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(r=>{$a(r)&&r.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(r=>{r.resetBBoxNeedsUpdateSelf()})}find(r){let o;return this.traverseEntity(i=>{i.uuid===r&&(o=i)}),o}traverseSortNextHelper(){let r=this.parent;if(r){let o=r.children,i=o.indexOf(this)+1;if(ke.is(o[i]))return o[i];if(ke.is(r))return r.traverseSortNextHelper()}}sortNext(){let r=this.children;return this.children.length>0&&ke.is(this.children[0])?r[0]:this.traverseSortNextHelper()}goUp(r){let o=this;for(;r>0&&o!==null;)o=o.parent,r-=1;return o}hasAnccestorOrSelf(r){return this===r||this.hasAnccestor(r)}hasAnccestor(r){let o=this.parent;for(;o;){if(r===o)return!0;o=o.parent}return!1}countToAccestor(r){let o=0,i=this;for(;i!==r;){if(i===null)return-1;i=i.parent,o+=1}return o}forEachEntity(r){for(let o of this.children)$a(o)&&r(o)}traverseEntityAncestors(r){this.traverseAncestors(o=>{ke.is(o)&&r(o)})}traverseConcreteEntity(r,o=0){if(r(this,o)!==!0)for(let a of this.children)$a(a)&&a.isConcreteEntity&&a.traverseEntity(r,o+1)}traverseEntity(r,o=0){if(r(this,o)!==!0)for(let a of this.children)$a(a)&&a.traverseEntity(r,o+1)}traverseVisibleEntity(r){r(this);for(let o of this.children)$a(o)&&o.visible&&o.traverseVisibleEntity(r)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(r){super.updateMatrixWorld(r),this.dispatchEvent({type:"updateMatrixWorld"})}copy(r,o=!1){return super.copy(r,o),this.dataPatched=r.dataPatched,this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),this}hasEntityChild(){return this.children.some(r=>$a(r))}isAncestorOf(r){if(this.uuid===r)return!1;let o=!1;return this.traverseEntity(i=>{i.uuid===r&&(o=!0)}),o}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let o={position:this.position.toArray(),rotation:[this.rotation.x*mr.MathUtils.RAD2DEG,this.rotation.y*mr.MathUtils.RAD2DEG,this.rotation.z*mr.MathUtils.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return Sa(o,r)}getTransformValues(r,o,i){return o[r].map((a,s)=>i?.shared.getVariable(a,[this.uuid,r,hT[s]])??a)}updateTransformState(r,o){let i=!1;return r.position&&(this.position.fromArray(this.getTransformValues("position",r,o)),i=!0),r.rotation&&(cf.fromArray(this.getTransformValues("rotation",r,o)).multiplyScalar(mr.MathUtils.DEG2RAD),this.rotation.setFromVector3(cf),i=!0),r.scale&&(this.scale.fromArray(this.getTransformValues("scale",r,o)),i=!0),r.hiddenMatrix!==void 0&&(i=!0,this.hiddenMatrix.fromArray(r.hiddenMatrix??Vn.identity)),i&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(a=>{a.invalidateClonerTransform(this)})),r.position&&r.rotation&&r.scale&&r.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),i}onVariableUpdate(r=!1){if(r){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(o=>{o.invalidateClonerTransform(this)})}dispose(){this.disposed=!0,this.cloner&&(this.cloner.removeFromParent(),this.cloner=void 0)}disposeChildrenRecursively(){for(let r of this.children)ke.is(r)&&r.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(r=>{ke.is(r)&&r.disposeRecursively()})}toState(r=[]){let o={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(r)};return Sa(o,r)}updateByObjUpdateOp(r,o){r!==void 0&&this.updateByOp({type:0,props:r,path:[]},{...this.data,...r},o,!1)}updateByOp(r,o,i,a){let s=this.data;this.data=o;let l=r,u=Fe(r.path,["states","*"]);if(u!==null){if(r.type===0){let[c]=u;if(this?.stateSelection===c){let d={...r.props};if(delete d.name,Object.values(r.props).some(p=>p===void 0)){let p=this.data;if(p!==void 0){let f=St.zoom(p,r.path.slice(2));if(f)for(let h in r.props)r.props[h]===void 0&&h in f&&(d[h]=f[h])}}l={...r,props:d,path:r.path.slice(2)}}}}else if(r.type===0){let c=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(c!==void 0){if(r.props.name!==void 0&&c.name){let{name:p,...f}=c;c=f}if(r.props.material!==void 0&&"material"in c){let{material:p,...f}=c;c=f}let d=St.removeOverridden(r.path,r.props,c);l={...r,props:d}}}if(this.updateByPatchedOpBase(l,Oi.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i),Fe(r.path,["overrides"])){let c=[],d=[...r.path];for(c.push(d[1]),d.splice(0,2);d.length>0&&d[0]==="descendants";)c.push(d[1]),d.splice(0,2);if(c[c.length-1]===void 0){if(r.type===0)for(let p of Object.keys(r.props)){c[c.length-1]=p;let f=i.scene.findInstance([this.uuid,...c]);f&&(f.overrideData=r.props[p],f.updateState(Io.apply(f.component.data,f.overrideData),i))}}else{let p=i.scene.findInstance([this.uuid,...c]);if(p){let f=St.zoom(p.component.data,d);if(r={...r,path:d},r.type===0){let h=r.props;if(f)for(let[m,y]of Object.entries(r.props))y===void 0&&(h===r.props&&(h={...r.props}),h[m]=f[m]);r={...r,props:h}}p.overrideData=Ra.resolve(o.overrides,c),p.updateByOp(r,wt.applySimple(p.data,r),i,!1)}}}else if(this.instances.length>0){let c;if(r.path.length===0&&r.type===0){let d;for(let p of Ro.rootOverrideProps)p in r.props&&(d===void 0&&(d={}),d[p]=r.props[p]);d&&(c={...r,props:d})}else for(let d of Ro.rootOverrideProps)if(Fe(r.path,[d])){c=r;break}c!==void 0&&this.instances.forEach(d=>{if(d.isInstanceRoot){let p=Io.filterOp(d.overrideData,c);p&&d.updateByOp(p,wt.applySimple(d.data,p),i,!0)}}),this.instances.forEach(d=>{if(!d.isInstanceRoot){let p=Io.filterOp(d.overrideData,r);if(p){let f;s===d.data&&r===p?f=o:f=wt.applySimple(d.data,p),d.updateByOp(p,f,i,!0)}}})}}updateByPatchedOpBase(r,o,i){if(this.dataPatched=o,r.path.length===0&&r.type===0)r.props.type!==void 0&&!po.is(r.props.type)&&mo.changeEntityProptotype(this,o,i);else if(r.path.length===1&&r.path[0]==="geometry"&&r.type===0&&"type"in r.props){mo.changeEntityProptotype(this,o,i);for(let a of this.children)ke.is(a)&&a.updateVisible(i.scene)}this.updateByPatchedOp(r,o,i)}updateByPatchedOp(r,o,i){if(r.path.length===0&&r.type===0&&this.updateState(r.props,i),Fe(r.path,["pathSnapping"])!==null&&this.updatePathSnapping(o.pathSnapping),Fe(r.path,["cloner"])!==null){let a=wt.drop(r,1);a.path.length===0&&a.type===0&&a.props.disabled===!0?this.setFromClonerState(null,i):this.cloner?this.cloner.updateState(o.cloner,i.scene):(this.setFromClonerState(o.cloner,i),this.expandCloner(i.scene)),this.updateVisible(i.scene)}}updatePathSnapping(r=this.dataPatched.pathSnapping){this._updatedPathSnapping=r,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(r){let o=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,i=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,a=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(o===null)return;let l=r.find(o);if(!l||this._needApplyPathSnapping===!1)return;this._needApplyPathSnapping=!1;let u=l.data;if(u.geometry.path.points.length<=1)return;let c=Fu(u.geometry.path),d=(i+a)%1;i+a===1&&d===0&&(d=1);let p=c.getPointAt(d);if(p===null)return;let f=this.parent?this.parent?.matrixWorld:new mr.Matrix4;l.updateMatrixWorld();let h=new mr.Matrix4().multiplyMatrices(f.clone().invert(),l.matrixWorld);p.applyMatrix4(h);let m={position:p.toArray(),rotation:u.rotation};if(s==="tangential"){let y=new mr.Matrix4().extractRotation(l.matrixWorld),g=c.getTangentAt(d).applyMatrix4(y).add(p),b=new mr.Matrix4().lookAt(p,g,mT),w=cf.setFromEuler(new mr.Euler().setFromRotationMatrix(b)).multiplyScalar(mr.MathUtils.RAD2DEG);m={...m,rotation:w.toArray()}}this.updateTransformState(m),this.traverseEntity(y=>{y._cameraType&&y.dispatchEvent(fT)})}updateVisible(r){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!r)return;let o=!1;this.traverseEntity(i=>{if(i.data.type==="Splat")return o=!0,!0}),o&&r.reloadSplats()}updateState_Entity(r,o){r.name!==void 0&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.visible!==void 0&&(this.updateVisible(o?.scene),this.resetBBoxNeedsUpdate()),o&&"cloner"in r&&r.cloner!==void 0&&(this.setFromClonerState(r.cloner,o),this.updateVisible(o.scene)),this.updateTransformState(r,o)}get attachedSurfaceCloners(){return this.children.filter(r=>r instanceof mo.Cloner&&r.parameters.type==="toObject")}setFromClonerState(r,o){this.disposed||(r===null||r.disabled?(this.cloner&&this.cloner.removeFromParent(),this.cloner=void 0):this.cloner===void 0?(this.cloner=new mo.Cloner(this,r),o.scene.addPendingExpandCloner(this)):this.cloner.updateState(r,o.scene))}expandCloner(r){!this.disposed&&this.cloner&&this.cloner.expandClones(r)}invalidateClonerTransform(r){this.cloner&&this.cloner.invalidateTransform(r)}requestRender(){this.dispatchEvent({type:"requestRender"})}};var Hn=require("three");var st=require("three"),Y0=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},n.parameters);e.thetaLength=st.MathUtils.clamp(e.thetaLength,0,360);let r=e.width/2,o=e.radiusTop??r,i=e.radiusBottom??r;return o===i?(o=r,i=r):o>i?(o=r,i=i*r/o):(o=o*r/i,i=r),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width),radiusTop:o,radiusBottom:i})}}static build(n){let{width:t,depth:e,height:r,radialSegments:o,heightSegments:i,openEnded:a,thetaStart:s,thetaLength:l,radiusTop:u,radiusBottom:c,cornerRadius:d,cornerSegments:p,hollow:f}=n.parameters,h;return l===0?(h=new st.BufferGeometry,h.setAttribute("position",new st.Float32BufferAttribute([],3))):d||f?h=new Ml(u,c,r,o,i,a,s,l*Math.PI/180,d,d,p,f):h=new st.CylinderGeometry(u,c,r,o,i,a,s,l*Math.PI/180),h.scale(1,1,e/t),Object.assign(h,{userData:{...n,type:"CylinderGeometry"}})}};function Un(n,t,e){e.x=n.x*t.x,e.y=n.y,e.z=n.x*t.y}function $0(n){return new st.Vector2(n.y,-n.x)}var Ml=class extends st.BufferGeometry{constructor(t,e,r,o,i,a,s,l,u,c,d,p,f=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,r=r||1,o=Math.floor(o)||8,i=Math.floor(i)||1,a=a!==void 0?a:!1,s=s!==void 0?s:0,l=l!==void 0?l:Math.PI*2,a&&(u=0,c=0);let h=[],m=[],y=[],g=[],b=0,w=r/2,A=new st.Vector3,S=new st.Vector3;f&&t==0&&(t=u),f&&e==0&&(e=c);let P=new st.Vector2(t,w),O=new st.Vector2(e,-w),x=null,D=null,N=null,T=null,I=P.clone().sub(O),E=0,B=0,R=0;p>0&&(E=Math.min(t,e)*(1-p),B=t-E,R=e-E);let F=P.clone();F.x-=E;let V=Math.PI-I.angle(),q=I.angle(),k=Math.tan(q/2),U=Math.tan(V/2),H=k+U,Y=p?H:U,J=p?H:k;if(u=Math.min(u,(t-B)/Y,I.length()/H),c=Math.min(c,(e-R)/J,I.length()/H),u>0){let Q=u/k;x=P.clone().sub(new st.Vector2(Q,u)),p&&(N=x.clone(),N.x-=E-H*u),P.sub(I.clone().setLength(Q))}if(c>0){let Q=c/U;D=O.clone().sub(new st.Vector2(Q,-c)),O.add(I.clone().setLength(Q)),p&&(T=D.clone(),T.x-=E-H*c,F.sub(I.clone().setLength(Q)))}I=P.clone().sub(O);let Z=I.length()<.5,X=[];for(let Q=0;Q<=o;Q++){let W=[],ue=Q/o,le=ue*l+s,ne=new st.Vector2(Math.sin(le),Math.cos(le));T&&D?(te(W,ue,ne,V,c,T,-1,!0),te(W,ue,ne,q,c,D,-1,!1)):D?($(W,ne,D.x,0,-1),te(W,ue,ne,q,c,D,-1,!1)):a||$(W,ne,e,R,-1);let ce=$0(I).normalize();if(Un(ce,ne,A),!Z)for(let ae=0;ae<=i;ae++){let me=ae/i,fe=I.clone().multiplyScalar(me).add(O);Un(fe,ne,S),m.push(S.x,S.y,S.z),y.push(A.x,A.y,A.z),g.push(ue,.5+S.y/r),W.push(b++)}if(N&&x?(te(W,ue,ne,V,u,x,1,!1),te(W,ue,ne,q,u,N,1,!0)):x?(te(W,ue,ne,V,u,x,1,!1),$(W,ne,x.x,0,1)):a||$(W,ne,t,B,1),p&&!Z){let ae=$0(I).multiplyScalar(-1).normalize();Un(ae,ne,A);for(let me=0;me<=i;me++){let fe=me/i,he=I.clone().multiplyScalar(-fe).add(F);Un(he,ne,S),m.push(S.x,S.y,S.z),y.push(A.x,A.y,A.z),g.push(ue,.5+S.y/r),W.push(b++)}}p&&!a&&W.push(W[0]),X.push(W)}for(let Q=0;Q<X.length-1;Q++)for(let W=0;W<X[0].length-1;W++){if(a&&p&&W==i)continue;let ue=X[Q][W],le=X[Q+1][W],ne=X[Q+1][W+1],ce=X[Q][W+1],ae=m[ne*3+0],me=m[ne*3+2];h.push(ue,le,ce),(ae!=0||me!=0)&&h.push(le,ne,ce)}l<Math.PI*2&&(ee(-1,X[0],s),ee(1,X[X.length-1],s+l)),this.setIndex(h),this.setAttribute("position",new st.Float32BufferAttribute(m,3)),this.setAttribute("normal",new st.Float32BufferAttribute(y,3)),this.setAttribute("uv",new st.Float32BufferAttribute(g,2));function te(Q,W,ue,le,ne,ce,ae,me){for(let fe=0;fe<d+1;fe++){let he=fe/d,xe=ae<0?he:1-he;me&&(xe-=1),xe*=le;let ye=new st.Vector2(Math.sin(xe),Math.cos(xe)*ae),C=ye.clone().multiplyScalar(ne).add(ce);Un(C,ue,S),m.push(S.x,S.y,S.z),Un(ye,ue,A),y.push(A.x,A.y,A.z),g.push(W,.5+S.y/r),Q.push(b++)}}function $(Q,W,ue,le,ne){let ce=new st.Vector3,ae=new st.Vector2,me=[ue,le];ne<0&&me.reverse();for(let fe of me)ae.set(fe,w*ne),Un(ae,W,ce),m.push(ce.x,ce.y,ce.z),y.push(0,ne,0),g.push(.5,.5),Q.push(b++)}function ee(Q,W,ue){let le=new st.Vector2(Math.sin(ue),Math.cos(ue)),ne=new st.Vector2(-Math.cos(ue),Math.sin(ue)),ce=new st.Vector3,ae=Q<0?(he,xe,ye)=>h.push(he,xe,ye):(he,xe,ye)=>h.push(he,ye,xe),me=new st.Vector2((t+e+B+R)/4,0);Un(me,le,ce),m.push(ce.x,ce.y,ce.z),y.push(ne.x,0,ne.y),g.push(.5,.5);let fe=b++;for(let he of W){let xe=m.slice(he*3,he*3+3);m.push(...xe),y.push(ne.x,0,ne.y);let ye=g.slice(he*2,he*2+2);g.push(...ye),b++}for(let he=fe+1;he<b-1;he++)ae(fe,he,he+1);ae(fe,b-1,fe+1)}}};var X0=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},n.parameters);return e.thetaLength=Hn.MathUtils.clamp(e.thetaLength,0,360),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(n){let{width:t,depth:e,height:r,radialSegments:o,heightSegments:i,openEnded:a,thetaStart:s,thetaLength:l,cornerRadiusTop:u,cornerRadiusBottom:c,cornerSegments:d}=n.parameters,p;return l===0?(p=new Hn.BufferGeometry,p.setAttribute("position",new Hn.Float32BufferAttribute([],3))):u>0||c>0||l<360?p=new Ml(0,t/2,r,o,i,a,s,l*Math.PI/180,u,c,d,0,!0):p=new Hn.ConeGeometry(t/2,r,o,i,a),p.scale(1,1,e/t),Object.assign(p,{userData:{...n,type:"ConeGeometry"}})}};var Tr=require("three"),Q0=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(n){let{width:t,height:e,depth:r,widthSegments:o,heightSegments:i,depthSegments:a,cornerRadius:s,cornerSegments:l}=n.parameters,u;return s==0?u=new Tr.BoxGeometry(t,e,r,o,i,a):u=new df(t,e,r,o,i,a,s,l),Object.assign(u,{userData:{...n,type:"CubeGeometry"}})}},uf=Math.PI/2,df=class extends Tr.BufferGeometry{constructor(t=1,e=1,r=1,o=1,i=1,a=1,s=0,l=4){super(),this.type="BoxGeometry";let u=this;o=Math.floor(o),i=Math.floor(i),a=Math.floor(a),l=Math.floor(l),s=Math.min(s,t/2,e/2,r/2);let c=[],d=[],p=[],f=[],h=0,m=0;y("z","y","x",-1,-1,r,e,t,a,i,0),y("z","y","x",1,-1,r,e,-t,a,i,1),y("x","z","y",1,1,t,r,e,o,a,2),y("x","z","y",1,-1,t,r,-e,o,a,3),y("x","y","z",1,-1,t,e,r,o,i,4),y("x","y","z",-1,-1,t,e,-r,o,i,5),s>0&&(g("z","y","x",-1,-1,1,r,e,t,a,0),g("z","y","x",1,-1,-1,r,e,t,a,1),g("z","y","x",-1,1,-1,r,e,t,a,1),g("z","y","x",1,1,1,r,e,t,a,0),g("x","y","z",-1,-1,-1,t,e,r,o,0),g("x","y","z",1,-1,1,t,e,r,o,1),g("x","y","z",-1,1,1,t,e,r,o,0),g("x","y","z",1,1,-1,t,e,r,o,1),g("y","x","z",-1,-1,1,e,t,r,i,0),g("y","x","z",1,-1,-1,e,t,r,i,1),g("y","x","z",1,1,1,e,t,r,i,1),g("y","x","z",-1,1,-1,e,t,r,i,0),b(1,1,1),b(-1,1,1),b(1,-1,1),b(-1,-1,1),b(1,1,-1),b(-1,1,-1),b(1,-1,-1),b(-1,-1,-1)),this.setIndex(c),this.setAttribute("position",new Tr.Float32BufferAttribute(d,3)),this.setAttribute("normal",new Tr.Float32BufferAttribute(p,3)),this.setAttribute("uv",new Tr.Float32BufferAttribute(f,2));function y(w,A,S,P,O,x,D,N,T,I,E){let B=(x-2*s)/T,R=(D-2*s)/I,F=x/2-s,V=D/2-s,q=N/2,k=T+1,U=I+1,H=0,Y=0,J=new Tr.Vector3;for(let Z=0;Z<U;Z++){let X=Z*R-V;for(let te=0;te<k;te++){let $=te*B-F;J[w]=$*P,J[A]=X*O,J[S]=q,d.push(J.x,J.y,J.z),J[w]=0,J[A]=0,J[S]=N>0?1:-1,p.push(J.x,J.y,J.z),f.push(te/T),f.push(1-Z/I),H+=1}}for(let Z=0;Z<I;Z++)for(let X=0;X<T;X++){let te=h+X+k*Z,$=h+X+k*(Z+1),ee=h+(X+1)+k*(Z+1),Q=h+(X+1)+k*Z;c.push(te,$,Q),c.push($,ee,Q),Y+=6}u.addGroup(m,Y,E),m+=Y,h+=H}function g(w,A,S,P,O,x,D,N,T,I,E){let B=(D-2*s)/I,R=D/2-s,F=N/2-s,V=T/2,q=I+1,k=0,U=0,H=new Tr.Vector3,Y=new Tr.Vector3;for(let J=0;J<l+1;J++){let Z=J/l*uf,X=Math.sin(Z)*s,te=(1-Math.cos(Z))*s,$=Math.sin(Z),ee=Math.cos(Z);H[A]=(F+X)*O,H[S]=(V-te)*x,Y[w]=0,Y[A]=$*Math.sign(H[A]),Y[S]=ee*Math.sign(H[S]);for(let Q=0;Q<q;Q++){let W=Q*B-R;H[w]=W*P,d.push(H.x,H.y,H.z),p.push(Y.x,Y.y,Y.z),f.push(Q/I),f.push(0),k+=1}}for(let J=0;J<l;J++)for(let Z=0;Z<I;Z++){let X=h+Z+q*J,te=h+Z+q*(J+1),$=h+(Z+1)+q*(J+1),ee=h+(Z+1)+q*J;c.push(X,te,ee),c.push(te,$,ee),U+=6}u.addGroup(m,U,E),m+=U,h+=k}function b(w,A,S){let P=new Tr.Vector3,O=new Tr.Vector3(t/2,e/2,r/2);O.subScalar(s);let x=[],D=w*A*S>0?(T,I,E)=>c.push(T,I,E):(T,I,E)=>c.push(T,E,I);for(let T=0;T<=l;T++){let I=[],E=uf*(1-T/l),B=Math.cos(E),R=Math.sin(E),F=0;for(let V=0;V<=T;V++){let q=Math.cos(F),k=Math.sin(F);P.x=B*q,P.y=R,P.z=B*k;let U=O.clone().addScaledVector(P,s);d.push(w*U.x,A*U.y,S*U.z),p.push(w*P.x,A*P.y,S*P.z),f.push(0,0),I.push(h++),F+=uf/T}x.push(I)}let N=x.length-1;for(let T=0;T<N;T++){let I=x[T],E=x[T+1],B=I.length-1;D(I[0],E[1],E[0]);for(let R=1;R<=B;R++)D(I[R-1],I[R],E[R]),D(I[R],E[R+1],E[R])}}}};var Dt=require("three"),qn=class extends Dt.BufferGeometry{constructor(t=[],e=[],r="",o=1,i=.2,a=4){super(),this.type="PolyhedronGeometryRound";let s=[],l=[],u=[];c(),d(),this.setAttribute("position",new Dt.Float32BufferAttribute(s,3)),this.setAttribute("normal",new Dt.Float32BufferAttribute(u,3)),this.setAttribute("uv",new Dt.Float32BufferAttribute(l,2));return;function c(){i=Math.min(1-1e-5,i),i==0&&(a=0);let f={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],h=new Dt.Vector3,m=h.clone(),y=new Dt.Triangle,g=i*o,b=o-g,w=a+1,A=new Dt.Vector3,S=(k,U)=>A.subVectors(k,U).normalize(),P=(k,U)=>Array(k).fill(void 0).map(U),O=P(t.length/3,(k,U)=>new Dt.Vector3().fromArray(t,U*3).setLength(o)),x=[],D=1e6;for(let k=0;k<O.length;k++){let U=O[k],H=[],Y,J,Z,X=1e10,te=-1;for(;(te=e.indexOf(k,te+1))!=-1;){let W=te-te%3;Y=e[W+(te+1)%3],J=e[W+(te+2)%3],Z=U.distanceToSquared(O[Y]),X=Math.min(X,Z),H.push([Y,J,Z])}X+=1e-6;let $=[],ee=0,Q=H.length;for(let W=0;W<Q;W++){[Y,J,Z]=H[ee];let ue=x[Y]?.includes(k)==!0;Z<=X&&$.push(Y+ +ue*D),ee=H.findIndex(le=>le[0]==J)}x.push($)}let N=[];{let k=0,U=0,H,Y,J=f==3;for(let Z=0;Z<=a;Z++){H=Z*(Z+1)/2,Y=(Z+1)*(Z+2)/2;for(let X=0;X<a-Z;X++)[k,U]=[H+X+Z+2,Y+X+Z+3],N.push(H,Y,...J?[U,H]:[k,Y],U,k),[H,Y]=[k,U];N.push(H,Y,H+a+2)}}let T=h.clone(),I=h.clone(),E=h.clone(),B=h.clone(),R=h.clone(),F=[],V=P(O.length,()=>P(f,()=>h.clone()));for(let k=0;k<O.length;k++){h.copy(O[k]).normalize(),T.copy(h).multiplyScalar(b);let U=x[k];for(let $=0;$<U.length;$++){let ee=U[$],Q=U[($+1)%f];y.setFromPointsAndIndices(O,k,ee%D,Q%D),y.b.sub(y.a).setLength(1e10).add(y.a),y.c.sub(y.a).setLength(1e10).add(y.a),y.closestPointToPoint(T,V[k][$])}let H=[],Y=[],J=[],Z=new Dt.Vector3;a==0&&[...V[k]].reduce(($,ee)=>$.add(ee),Z).multiplyScalar(1/f);for(let $=0;$<f;$++){let ee=[],Q=($-1+f)%f,W=V[k][Q],ue=V[k][$];h.copy(W).sub(T),m.copy(ue).sub(T);let le=T.angleTo(h),ne=h.angleTo(m),ce=Math.cos(le)*g;a==0?I.copy(Z):I.copy(T).setLength(b+ce),Y.push(ce);let ae=[I,W,ue];for(let me=0;me<2;me++){let fe=ae[me],he=ae[me+1];B.subVectors(fe,T),R.subVectors(he,T),E.crossVectors(B,R).normalize();for(let xe=0;xe<w;xe++){let ye=[le,ne][me]*xe/w;h.copy(B).applyAxisAngle(E,ye).add(T),H.push(h.clone()),me&&(S(h,T),ee.push([xe==0?fe:h.clone(),A.clone()]))}me&&(S(he,T),ee.push([he,A.clone()]))}J.push(ee)}F.push(J);let X=2*w,te=2;for(let $=0;$<f;$++){let ee=X*$,Q=X*(($+1)%f),W=[H[ee]];for(let le=1;le<w;le++){B=H[ee+le],R=H[Q+le],W.push(B);for(let ne=1,ce=le-te+1;ne<=ce;ne++)h.lerpVectors(B,R,ne/(ce+1)),h.sub(T).setLength(Y[$]).add(T),W.push(h.clone());W.push(R)}for(let le=0;le<w;le++)W.push(H[le+w+ee]);W.push(H[Q+w]);let ue=N.map(le=>W[le]);s.push(...ue.map(le=>[le.x,le.y,le.z]).flat()),u.push(...ue.map(le=>(S(le,T),[A.x,A.y,A.z])).flat())}}let q=[];for(let k=0;k<x.length;k++)for(let U=0;U<f;U++){let H=x[k][U];if(H<D){let Y=x[H].findIndex(X=>X%D==k),J=F[k][U],Z=F[H][Y];for(let X=0;X<w;X++){let te=J[X],$=Z[w-X],ee=J[X+1],Q=Z[w-(X+1)];[te,$,ee,ee,$,Q].forEach(W=>{s.push(W[0].x,W[0].y,W[0].z),u.push(W[1].x,W[1].y,W[1].z)})}q.push(J[0][0],Z[w][0],J[w][0],Z[0][0])}}for(;q.length;){let k,U,H,Y;[k,U]=q.splice(0,2);let J=[k];for(;k!=U;)J.push(U),H=q.indexOf(U),Y=H%2,U=q.splice(H-Y,2)[1-Y];A.subVectors(J[0],J[1]).cross(h.subVectors(J[0],J[2])).normalize();let Z=A.dot(J[0])<0;Z&&A.negate();for(let X=1;X<=J.length-2;X++)[J[X+ +Z],J[X+1-+Z],J[0]].forEach(te=>{s.push(te.x,te.y,te.z),u.push(A.x,A.y,A.z)})}}function d(){let p=new Dt.Vector3;for(let O=0;O<s.length;O+=3){p.x=s[O+0],p.y=s[O+1],p.z=s[O+2];let x=S(p)/2/Math.PI+.5,D=P(p)/Math.PI+.5;l.push(x,1-D)}let f=new Dt.Vector3,h=new Dt.Vector3,m=new Dt.Vector3,y=new Dt.Vector3,g=new Dt.Vector2,b=new Dt.Vector2,w=new Dt.Vector2,A=(O,x,D,N)=>{N<0&&O.x===1&&(l[x]=O.x-1),D.x===0&&D.z===0&&(l[x]=N/2/Math.PI+.5)};for(let O=0,x=0;O<s.length;O+=9,x+=6){f.set(s[O+0],s[O+1],s[O+2]),h.set(s[O+3],s[O+4],s[O+5]),m.set(s[O+6],s[O+7],s[O+8]),g.set(l[x+0],l[x+1]),b.set(l[x+2],l[x+3]),w.set(l[x+4],l[x+5]),y.copy(f).add(h).add(m).divideScalar(3);let D=S(y);A(g,x+0,f,D),A(b,x+2,h,D),A(w,x+4,m,D)}for(let O=0;O<l.length;O+=6){let x=l[O+0],D=l[O+2],N=l[O+4],T=Math.max(x,D,N),I=Math.min(x,D,N);T>.9&&I<.1&&(x<.2&&(l[O+0]+=1),D<.2&&(l[O+2]+=1),N<.2&&(l[O+4]+=1))}function S(O){return Math.atan2(O.z,-O.x)}function P(O){return Math.atan2(-O.y,Math.sqrt(O.x*O.x+O.z*O.z))}}}static fromJSON(t){return new qn(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}};var K0=require("three"),Z0=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(n){let{width:t,height:e,depth:r,detail:o,corner:i,cornerSides:a}=n.parameters,s=o===0&&i!==0?new Il(t*.5,i,a):new K0.DodecahedronGeometry(t*.5,o);return s.scale(1,e/t,r/t),Object.assign(s,{userData:{...n,type:"DodecahedronGeometry"}})}},Il=class extends qn{constructor(t=1,e=.2,r=4){let o=(1+Math.sqrt(5))/2,i=1/o,a=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-o,0,-i,o,0,i,-o,0,i,o,-i,-o,0,-i,o,0,i,-o,0,i,o,0,-o,0,-i,o,0,-i,-o,0,i,o,0,i],s=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(a,s,l,t,e,r),this.type=l}static fromJSON(t){return new Il(t.radius,t.corner,t.cornerSides)}};var Ke=require("three");var Ne=require("three"),Nl=1e-12,Xa=class{constructor(t){this.position=new Ne.Vector2;this.startPosition=new Ne.Vector2;this.uuid=Ne.MathUtils.generateUUID();this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new Xa(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Qa=class extends Xa{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new Qa(this.parent).copy(this)}},yo=class extends Xa{constructor(e,r){super(r);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new Qa(this),new Qa(this))}static create(e,r){let o=new yo(e,new Ne.Vector2(...r.position));return o.controls[0].position.set(...r.controlPrevious.position),o.controls[1].position.set(...r.controlNext.position),o.roundness=r.roundness,o.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored,o}getOppositeControl(e){let r=this.controls.indexOf(e);return r===0?this.controls[1]:r===1?this.controls[0]:null}applyOffsetToControls(e,r=1){for(let o=0,i=this.controls.length;o<i;o++){let a=this.controls[o];this.position.distanceTo(a.position)<=r?a.position.copy(this.position):a.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new yo(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let e=this.curveBefore?.getTangentAt(1),r=this.curveAfter?.getTangentAt(0);return[e,r]}computeNormals(e=new Ne.Vector2,r=new Ne.Vector2){let[o,i]=this.computeTangents();return o&&i&&(J0(o,e),J0(i,r)),[e,r]}computeTangent(e=new Ne.Vector2){let[r,o]=this.computeTangents();return r&&o&&e.copy(r).add(o).normalize(),e}computeNormal(e=new Ne.Vector2){let[r,o]=this.computeNormals();return e.copy(r).add(o).normalize(),e}};function J0(n,t=new Ne.Vector2){let e=n.length();return t.set(-n.y/e,n.x/e)}var ff=n=>n,Ka=new Ne.Vector2,ku=new Ne.Vector2,yT=new Ne.Vector2,gT=new Ne.Vector2,xT=new Ne.Vector2,bT=new Ne.Vector2,tx=new Ne.Vector3,rx=new Ne.Vector3;function ox(n){let t=new Ne.Vector2;t.addVectors(n.v0,Ka.subVectors(n.v1,n.v0).multiplyScalar(2/3));let e=new Ne.Vector2;return e.addVectors(n.v2,ku.subVectors(n.v1,n.v2).multiplyScalar(2/3)),new Ne.CubicBezierCurve(n.v0,t,e,n.v2)}function Dl(n,t,e=Number.EPSILON){return Math.abs(n-t)<e}function vT(n,t,e=Number.EPSILON){return n.distanceTo(t)<e}function ST(n,t,e=Number.EPSILON){return n.distanceTo(t)<e}function hf(n,t,e){let r=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)),o=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),i=Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2));return Math.acos((o*o+r*r-i*i)/(2*o*r))}function nx(n,t,e){return ex(n,t)&&ex(t,e)&&pf(n.position,t.position,e.position)}function pf(n,t,e){return Ka.copy(t).sub(n).cross(ku.copy(e).sub(n))===0}function ix(n,t,e,r,o){let i=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)),a=(n.y+t.y)/2,s=(n.x+t.x)/2,l=Math.sqrt(Math.pow(e,2)-Math.pow(i/2,2))*(n.y-t.y)/i,u=Math.sqrt(Math.pow(e,2)-Math.pow(i/2,2))*(t.x-n.x)/i;return r.set(s+l,a+u),o.set(s-l,a-u),[r,o]}function ax(n,t,e){let r=n.distanceTo(e),o=t.distanceTo(e);return r<o?t:n}function sx(n,t,e,r,o,i){let a=t.x-n.x,s=t.y-n.y,l=e.x-n.x,u=e.y-n.y,c=Math.sqrt((a+l)*(a+l)+(s+u)*(s+u)),d;return hf(t,n,e)>Math.PI&&(c*=-1),Dl(u,s)?d=(s+u)*(r/c-.5)*8/3/(a-l):d=(a+l)*(r/c-.5)*8/3/(u-s),o.set(t.x-d*s,t.y+d*a),i.set(e.x+d*u,e.y-d*l),[o,i]}function mf(n,t){return n.position.equals(n.controls[1].position)&&t.position.equals(t.controls[0].position)}function ex(n,t){return pf(n.position,n.controls[1].position,t.position)&&pf(n.position,t.controls[0].position,t.position)}function lx(n,t,e,r,o=.5){let i=Ka.subVectors(t,n).multiplyScalar(o).add(n),a=ku.subVectors(e,t).multiplyScalar(o).add(t),s=yT.subVectors(r,e).multiplyScalar(o).add(e),l=i,u=gT.subVectors(a,i).multiplyScalar(o).add(i),c=xT.subVectors(s,a).multiplyScalar(o).add(a),d=s,p=bT.subVectors(c,u).multiplyScalar(o).add(u);return[n.x,n.y,l.x,l.y,u.x,u.y,p.x,p.y,c.x,c.y,d.x,d.y,r.x,r.y]}function cx(n,t,e=12,r=!0){let o=rx.set(0,0,0),i,a=0,s=[];for(let l=0;l<t.length;l++){let u=ff(t[l]),c=Ka,d=Wn(u,e);s.push(d);for(let p=0;p<=d;p++)if(u instanceof Ne.CubicBezierCurve||u instanceof Ne.QuadraticBezierCurve||u instanceof Ne.LineCurve){if(u.getPoint(p/d,c),o.set(c.x,c.y,0),i!==void 0&&ST(i,o))continue;i===void 0&&(i=tx),i.copy(o),n.setXYZ(a,o.x,o.y,o.z),a++}}return r&&a>1&&!(n.getX(a-1)===n.getX(0)&&n.getY(a-1)===n.getY(0)&&n.getZ(a-1)===n.getZ(0))&&(n.setXYZ(a,n.getX(0),n.getY(0),n.getZ(0)),a++),n}function ux(n,t,e,r=12,o=!0){let i=rx.set(0,0,0),a=0,s=[];for(let l=0;l<t.length;l++){if(e[l]===!1)continue;let u,c=ff(t[l]),d=Ka,p=Wn(c,r);s.push(p);for(let f=0;f<=p;f++)if(c instanceof Ne.CubicBezierCurve||c instanceof Ne.QuadraticBezierCurve||c instanceof Ne.LineCurve){if(c.getPoint(f/p,d),i.set(d.x,d.y,0),u?.equals(i))continue;u===void 0?u=tx:(n.setXYZ(a,u.x,u.y,u.z),a++,n.setXYZ(a,i.x,i.y,i.z),a++),u.copy(i)}}return o&&a>1&&!(n.getX(a-1)===n.getX(0)&&n.getY(a-1)===n.getY(0)&&n.getZ(a-1)===n.getZ(0))&&(n.setXYZ(a,n.getX(0),n.getY(0),n.getZ(0)),a++),s}function yf(n,t=12,e=!1){let r=[];for(let o=0,i=n.length;o<i;o++){let a=n[o],s=0;if(e&&a.roundedCurveCorner!==void 0){let l=Wn(a.roundedCurveCorner,t)*.5;o>0&&(r[o-1]+=l),s+=l}a.curveAfter!==void 0&&(s+=Wn(a.curveAfter,t)),r.push(s)}return n.length>0&&e&&n[0].roundedCurveCorner!==void 0&&(r[n.length-1]+=Wn(n[0].roundedCurveCorner,t)*.5),r}function Wn(n,t=12){return n&&n instanceof Ne.EllipseCurve?t*2:n&&(n instanceof Ne.LineCurve||n instanceof Ne.LineCurve3)?1:n&&n instanceof Ne.SplineCurve?t*n.points.length:t}function dx(n,t,e=12,r=!0){let o,i=0;for(let a=0;a<t.length;a++){let s=ff(t[a]),l=Wn(s,e),u=Ka;for(let c=0;c<=l;c++)if(s instanceof Ne.CubicBezierCurve||s instanceof Ne.QuadraticBezierCurve||s instanceof Ne.LineCurve){if(s.getPoint(c/l,u),o!==void 0&&vT(o,u,Nl))continue;o===void 0&&(o=ku),o.copy(u),n.push(u.x,u.y),i++}}return Dl(n[0],n[n.length-2],Nl)&&Dl(n[1],n[n.length-1],Nl)&&(n.pop(),n.pop()),r&&i>1&&!(Dl(n[i-1],n[1],Nl)&&Dl(n[i-2],n[0],Nl))&&(n.push(n[0],n[1]),i++),n}var gf=new Ke.Vector2,wT=new Ke.Vector2,AT=new Ke.Vector2,_T=new Ke.Vector2,PT=new Ke.Vector2,OT=new Ke.Vector2,Qe=class extends Ke.Shape{constructor(e=100,r=100){super();this.points=[];this.shapeHoles=[];this.plane=new Ke.Plane(new Ke.Vector3(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this.isText=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=Ke.MathUtils.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=r}static createFromState(e,r,o){let i=new Qe;return i.isClosed=e.isClosed,i.points=e.points.map(a=>yo.create(a.id,a.data)),typeof e.roundness=="number"&&(i.roundness=e.roundness),i.shapeHoles=e.shapeHoles.map(a=>Qe.createFromState(a)),r!==void 0&&o!==void 0&&i.applySize(r,o),i.update(),i}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let r=0,o=this.points.length;r<o;r++)this.points[r].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(r=>this.getPointIndexById(r)).filter(r=>r>=0)}getPointIndexById(e){let r=this.points.length,o=this.points.findIndex(i=>i.uuid===e);if(o<0){let i=r;for(let a=0,s=this.shapeHoles.length;a<s;a++){let l=this.shapeHoles[a],u=l.points.length,c=l.getPointIndexById(e);if(c<0)i+=u;else return c+i}}return o}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let r=this.points.length;for(let o=0,i=this.shapeHoles.length;o<i;o++){let a=this.shapeHoles[o],s=e-r;if(s<=a.points.length-1)return a.points[s];r+=a.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let r=this.points.indexOf(e);if(r>=0)return r;if(r=this.points.length,this.shapeHoles.length>0)for(let o=0,i=this.shapeHoles.length;o<i;o++){let a=this.shapeHoles[o],s=a.points.indexOf(e);if(s>=0)return r+s;r+=a.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(r=>r.points));return[...this.points,...e]}applySize(e,r){e===0&&(e=.001),r===0&&(r=.001),this._width=e,this._height=r}applyScale(e,r){let o=gf.set(e,r);for(let i=0,a=this.points.length;i<a;i++){let s=this.points[i];s.position.multiply(o),s.controls[0].position.multiply(o),s.controls[1].position.multiply(o)}for(let i=0,a=this.shapeHoles.length;i<a;i++)this.shapeHoles[i].applyScale(e,r);this._update()}createPoint(e,r=0,o=Ke.MathUtils.generateUUID()){let i;e instanceof Ke.Vector2?i=e:i=new Ke.Vector2(e,r);let a=new yo(o,i);return a.roundness=this.roundness,a}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,r){this.points.splice(r,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let r=0,o=this.points.length;r<o;r++){let i=this.points[r];if(i.uuid===e)return i}for(let r=0,o=this.shapeHoles.length;r<o;r++){let a=this.shapeHoles[r].getPointByUuid(e);if(a)return a}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let r=this.points.indexOf(e);r>=0&&this.points.splice(r,1),this.needsUpdate=!0}removePointById(e){let r=this.points.find(o=>o.uuid===e);r&&this.removePoint(r)}update(){for(let e=0,r=this.shapeHoles.length;e<r;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,r=12,o=!1){this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r);let i=o?this.roundedCurveDivisions:this.curveDivisions;return cx(e,o?this.roundedCurves:this.curves,r,this.autoClose),i.reduce((a,s)=>a+s,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=yf(this.points,e,!1),this.roundedCurveDivisions=yf(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,r,o=12){return ux(e,this.curves,r,o,this.autoClose).reduce((a,s)=>a+s,0)*2}extractShapePointsToFlatArray(e,r=12){return this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r),dx(e,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(e,r=!1){let o=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let i=r?this.roundedCurveDivisions:this.curveDivisions,a=0;r&&this.points[0].roundedCurveCorner!==void 0&&(a=Wn(this.points[0].roundedCurveCorner,this.subdivision)*.5);let s=e-a;s<0&&(s+=i.reduce((l,u)=>l+u,0));for(let l=0,u=i.length;l<u;l++){let c=i[l];if(s<o+c)return[l,(s-o+1)/c];o+=c}return[0,1]}getCurveT(e,r,o){let i=this.points[e],a=this.points[e>=this.points.length-1?0:e+1],s=this.curveDivisions,l=s[e];if(mf(i,a)){let d=i.position.distanceTo(a.position);return i.position.distanceTo(gf.set(o.x,o.y))/d}let u=0;for(let d=0;d<e;d++)u+=s[d];return(r-u)/l}dispose(){}_applyCurveForPoint(e,r){mf(r,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(r.controls[1].position.x,r.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let o=this.curves[this.curves.length-1];e.curveBefore=o,r.curveAfter=o;let i=o.clone();e.roundedCurveBefore=i,r.roundedCurveAfter=i,e.roundedCurveCorner=void 0,this.roundedCurves.push(i)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let r=0,o=this.points.length;r<o;r++){let i=this.points[r];if(r===0)this.moveTo(i.position.x,i.position.y);else{let a=this.points[r-1];this._applyCurveForPoint(i,a)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let r=this.points[0],o=this.points[this.points.length-1];this._applyCurveForPoint(r,o)}if(this.points.length>2){let r=0;for(let o=0,i=this.points.length;o<i;o++){let a=this.points[o],s=this.points[o-1]??this.points[this.points.length-1],l=this.points[o+1]??this.points[0],u=a.roundness,c=s&&l&&nx(s,a,l);if(!a.controlsMoved()&&u>0&&!c){let d=a.curveBefore,p=a.curveAfter;if(d===void 0||p===void 0)continue;let f=a.roundedCurveBefore,h=a.roundedCurveAfter,m=d.getLength(),y=p.getLength(),g=Math.min(u,m*.499),b=Math.min(u,y*.499),w=Math.min(g,b),A=1-w/m,S=w/y,P=d.getPointAt(A,gf),O=p.getPointAt(S,wT);this._subSplitCurve(d,f,A,P,void 0),this._subSplitCurve(p,h,S,void 0,O);let x;if(this.useCubicForRoundedCorners){let D=hf(P,a.position,O)/2,N=Math.tan(D)*P.distanceTo(a.position),[T,I]=ix(P,O,N,AT,_T),E=ax(T,I,a.position),[B,R]=sx(E,P,O,N,PT,OT);x=new Ke.CubicBezierCurve(P.clone(),B.clone(),R.clone(),O.clone())}else x=new Ke.QuadraticBezierCurve(P.clone(),a.position.clone(),O.clone());a.roundedCurveCorner=x,this.roundedCurves.splice(o+r,0,x),r++}}}}_subSplitCurve(e,r,o,i,a){if(e instanceof Ke.LineCurve)i!==void 0&&r.v2.copy(i),a!==void 0&&r.v1.copy(a);else{let s=e,l=r,u=s.getUtoTmapping(o,0),c=lx(s.v0,s.v1,s.v2,s.v3,u);return i!==void 0&&(l.v0.set(c[0],c[1]),l.v1.set(c[2],c[3]),l.v2.set(c[4],c[5]),l.v3.set(c[6],c[7])),a!==void 0&&(l.v0.set(c[6],c[7]),l.v1.set(c[8],c[9]),l.v2.set(c[10],c[11]),l.v3.set(c[12],c[13])),l}return r}clone(){let e=new Qe(this._width,this._height);return e.points=this.points.map(r=>r.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(r=>r.clone()),e}toJSON(){return{points:this.points.reduce((e,r)=>e.concat(r.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let r=e.points.length/7;for(let o=0;o<r;o++){let i=o*7,a=e.points[i+0],s=e.points[i+1],l=e.points[i+2],u=e.points[i+3],c=e.points[i+4],d=e.points[i+5],p=e.points[i+6],f=new yo(Ke.MathUtils.generateUUID(),new Ke.Vector2(a,s));f.controls[0].position.set(l,u),f.controls[1].position.set(c,d),f.roundness=p,this.points.push(f)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(o=>{let i=new Qe;return i.fromJSON(o),i}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,r=!1){this.isText=r;let o=(a,s)=>{s instanceof Ke.CubicBezierCurve&&s.v3.equals(a.position)&&a.controls[0].position.copy(s.v2)},i=a=>{let s=[],l,u;for(l=0,u=a.length;l<u;l++)a[l]instanceof Ke.QuadraticBezierCurve&&(a[l]=ox(a[l]));for(l=0,u=a.length;l<u;l++){let p=a[l],f=l>0?a[l-1]:null,h;p instanceof Ke.CubicBezierCurve?(h=this.createPoint(p.v0),h.controls[1].position.copy(p.v1)):p instanceof Ke.LineCurve&&(h=this.createPoint(p.v1)),h!==void 0&&(f!==null&&o(h,f),s.push(h))}let c=a[a.length-1],d=!1;return c instanceof Ke.CubicBezierCurve?c.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(c.v2),d=!0):c instanceof Ke.LineCurve&&c.v2.equals(s[0].position)&&(d=!0),this.isClosed=d,s};return this.points=i(e.curves),e instanceof Ke.Shape&&(this.shapeHoles=e.holes.map(a=>{let s=new Qe;return s.fromShape(a),s})),this.update(),this}updatePoint(e,r){let o=this.getPointByUuid(e);o&&(r.position!==void 0&&o.position.fromArray(r.position),r.roundness!==void 0&&(o.roundness=r.roundness),r.areControlsDirectionsMirrored!==void 0&&(o.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,r){let i=this.getPointByUuid(e)?.controls[0];i&&(r.position&&i.position.fromArray(r.position),this.needsUpdate=!0)}updateNextControl(e,r){let i=this.getPointByUuid(e)?.controls[1];i&&(r.position&&i.position.fromArray(r.position),this.needsUpdate=!0)}};var bf=Math.PI*2;function xf({x:n,y:t},e,r,o,i){return{x:n*e+o,y:t*r+i}}function CT(n,t){let e=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(n),o=Math.sin(n),i=Math.cos(n+t),a=Math.sin(n+t);return[{x:r-o*e,y:o+r*e},{x:i+a*e,y:a-i*e},{x:i,y:a}]}function px(n,t,e,r){let o=n*r-t*e<0?-1:1,i=Math.min(1,Math.max(-1,n*e+t*r));return o*Math.acos(i)}function TT(n,t,e,r,o,i,a,s,l,u){let c=Math.pow(o,2),d=Math.pow(i,2),p=Math.pow(a,2),f=Math.pow(s,2),h=c*d-c*f-d*p;h<0&&(h=0),h/=c*f+d*p,h=Math.sqrt(h)*(l===u?-1:1);let m=h*o/i*s,y=h*-i/o*a,g=m+(n+e)/2,b=y+(t+r)/2,w=(a-m)/o,A=(s-y)/i,S=(-a-m)/o,P=(-s-y)/i,O=px(1,0,w,A),x=px(w,A,S,P);return!u&&x>0&&(x-=bf),u&&x<0&&(x+=bf),{centerx:g,centery:b,ang1:O,ang2:x}}function fx({px:n,py:t,cx:e,cy:r,rx:o,ry:i,largeArcFlag:a,sweepFlag:s}){let l=[];if(o===0||i===0)return[];let u=(n-e)/2,c=(t-r)/2;if(u===0&&c===0)return[];o=Math.abs(o),i=Math.abs(i);let d=Math.pow(u,2)/Math.pow(o,2)+Math.pow(c,2)/Math.pow(i,2);d>1&&(o*=Math.sqrt(d),i*=Math.sqrt(d));let p=TT(n,t,e,r,o,i,u,c,a,s),{ang1:f,ang2:h}=p,{centerx:m,centery:y}=p,g=Math.abs(h)/(bf/4);Math.abs(1-g)<1e-7&&(g=1);let b=Math.max(Math.ceil(g),1);h/=b;for(let w=0;w<b;w++)l.push(CT(f,h)),f+=h;return l.map(w=>{let{x:A,y:S}=xf(w[0],o,i,m,y),{x:P,y:O}=xf(w[1],o,i,m,y),{x,y:D}=xf(w[2],o,i,m,y);return{x1:A,y1:S,x2:P,y2:O,x,y:D}})}var Ii=require("three");var Ye;(function(n){n[n.ODD=0]="ODD",n[n.NONZERO=1]="NONZERO",n[n.POSITIVE=2]="POSITIVE",n[n.NEGATIVE=3]="NEGATIVE",n[n.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Ye||(Ye={}));var _t;(function(n){n[n.POLYGONS=0]="POLYGONS",n[n.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",n[n.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(_t||(_t={}));function _e(n,t){if(!n)throw t||"Assertion Failed!"}var Se=function(){function n(){}return n.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},n.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},n.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},n.edgeGoesLeft=function(t){return n.vertLeq(t.Dst,t.Org)},n.edgeGoesRight=function(t){return n.vertLeq(t.Org,t.Dst)},n.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},n.edgeEval=function(t,e,r){_e(n.vertLeq(t,e)&&n.vertLeq(e,r));var o=e.s-t.s,i=r.s-e.s;return o+i>0?o<i?e.t-t.t+(t.t-r.t)*(o/(o+i)):e.t-r.t+(r.t-t.t)*(i/(o+i)):0},n.edgeSign=function(t,e,r){_e(n.vertLeq(t,e)&&n.vertLeq(e,r));var o=e.s-t.s,i=r.s-e.s;return o+i>0?(e.t-r.t)*o+(e.t-t.t)*i:0},n.transEval=function(t,e,r){_e(n.transLeq(t,e)&&n.transLeq(e,r));var o=e.t-t.t,i=r.t-e.t;return o+i>0?o<i?e.s-t.s+(t.s-r.s)*(o/(o+i)):e.s-r.s+(r.s-t.s)*(i/(o+i)):0},n.transSign=function(t,e,r){_e(n.transLeq(t,e)&&n.transLeq(e,r));var o=e.t-t.t,i=r.t-e.t;return o+i>0?(e.s-r.s)*o+(e.s-t.s)*i:0},n.vertCCW=function(t,e,r){return t.s*(e.t-r.t)+e.s*(r.t-t.t)+r.s*(t.t-e.t)>=0},n.interpolate=function(t,e,r,o){return t=t<0?0:t,r=r<0?0:r,t<=r?r===0?(e+o)/2:e+(o-e)*(t/(t+r)):o+(e-o)*(r/(t+r))},n.intersect=function(t,e,r,o,i){var a,s,l;n.vertLeq(t,e)||(l=t,t=e,e=l),n.vertLeq(r,o)||(l=r,r=o,o=l),n.vertLeq(t,r)||(l=t,t=r,r=l,l=e,e=o,o=l),n.vertLeq(r,e)?n.vertLeq(e,o)?(a=n.edgeEval(t,r,e),s=n.edgeEval(r,e,o),a+s<0&&(a=-a,s=-s),i.s=n.interpolate(a,r.s,s,e.s)):(a=n.edgeSign(t,r,e),s=-n.edgeSign(t,o,e),a+s<0&&(a=-a,s=-s),i.s=n.interpolate(a,r.s,s,o.s)):i.s=(r.s+e.s)/2,n.transLeq(t,e)||(l=t,t=e,e=l),n.transLeq(r,o)||(l=r,r=o,o=l),n.transLeq(t,r)||(l=t,t=r,r=l,l=e,e=o,o=l),n.transLeq(r,e)?n.transLeq(e,o)?(a=n.transEval(t,r,e),s=n.transEval(r,e,o),a+s<0&&(a=-a,s=-s),i.t=n.interpolate(a,r.t,s,e.t)):(a=n.transSign(t,r,e),s=-n.transSign(t,o,e),a+s<0&&(a=-a,s=-s),i.t=n.interpolate(a,r.t,s,o.t)):i.t=(r.t+e.t)/2},n}(),El=function(){function n(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return n}(),ju=function(){function n(t){this.side=t,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(n.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(t){this.Sym.Lface=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(t){this.Sym.Org=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(t){this.Sym.Lnext=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(t){this.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(t){this.Lnext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(t){this.Sym.Onext=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(t){this.Sym.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(t){this.Sym.Lnext.Sym=t},enumerable:!0,configurable:!0}),n}(),Za=function(){function n(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return n}(),hx=function(){function n(){var t=new Za,e=new El,r=new ju(0),o=new ju(1);t.next=t.prev=t,t.anEdge=null,e.next=e.prev=e,r.next=r,r.Sym=o,o.next=o,o.Sym=r,this.vHead=t,this.fHead=e,this.eHead=r,this.eHeadSym=o}return n.prototype.makeEdge_=function(t){var e=new ju(0),r=new ju(1);t.Sym.side<t.side&&(t=t.Sym);var o=t.Sym.next;return r.next=o,o.Sym.next=e,e.next=t,t.Sym.next=r,e.Sym=r,e.Onext=e,e.Lnext=r,e.Org=null,e.Lface=null,e.winding=0,e.activeRegion=null,r.Sym=e,r.Onext=r,r.Lnext=e,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,e},n.prototype.splice_=function(t,e){var r=t.Onext,o=e.Onext;r.Sym.Lnext=e,o.Sym.Lnext=t,t.Onext=o,e.Onext=r},n.prototype.makeVertex_=function(t,e,r){var o=t;_e(o,"Vertex can't be null!");var i=r.prev;o.prev=i,i.next=o,o.next=r,r.prev=o,o.anEdge=e;var a=e;do a.Org=o,a=a.Onext;while(a!==e)},n.prototype.makeFace_=function(t,e,r){var o=t;_e(o,"Face can't be null");var i=r.prev;o.prev=i,i.next=o,o.next=r,r.prev=o,o.anEdge=e,o.trail=null,o.marked=!1,o.inside=r.inside;var a=e;do a.Lface=o,a=a.Lnext;while(a!==e)},n.prototype.killEdge_=function(t){t.Sym.side<t.side&&(t=t.Sym);var e=t.next,r=t.Sym.next;e.Sym.next=r,r.Sym.next=e},n.prototype.killVertex_=function(t,e){var r=t.anEdge,o=r;do o.Org=e,o=o.Onext;while(o!==r);var i=t.prev,a=t.next;a.prev=i,i.next=a},n.prototype.killFace_=function(t,e){var r=t.anEdge,o=r;do o.Lface=e,o=o.Lnext;while(o!==r);var i=t.prev,a=t.next;a.prev=i,i.next=a},n.prototype.makeEdge=function(){var t=new Za,e=new Za,r=new El,o=this.makeEdge_(this.eHead);return this.makeVertex_(t,o,this.vHead),this.makeVertex_(e,o.Sym,this.vHead),this.makeFace_(r,o,this.fHead),o},n.prototype.splice=function(t,e){var r=!1,o=!1;if(t!==e){if(e.Org!==t.Org&&(o=!0,this.killVertex_(e.Org,t.Org)),e.Lface!==t.Lface&&(r=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(e,t),!o){var i=new Za;this.makeVertex_(i,e,t.Org),t.Org.anEdge=t}if(!r){var a=new El;this.makeFace_(a,e,t.Lface),t.Lface.anEdge=t}}},n.prototype.delete=function(t){var e=t.Sym,r=!1;if(t.Lface!==t.Rface&&(r=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t)this.killVertex_(t.Org,null);else if(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),!r){var o=new El;this.makeFace_(o,t,t.Lface)}e.Onext===e?(this.killVertex_(e.Org,null),this.killFace_(e.Lface,null)):(t.Lface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev)),this.killEdge_(t)},n.prototype.addEdgeVertex=function(t){var e=this.makeEdge_(t),r=e.Sym;this.splice_(e,t.Lnext),e.Org=t.Dst;var o=new Za;return this.makeVertex_(o,r,e.Org),e.Lface=r.Lface=t.Lface,e},n.prototype.splitEdge=function(t){var e=this.addEdgeVertex(t),r=e.Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,r),t.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=t.Rface,r.winding=t.winding,r.Sym.winding=t.Sym.winding,r.idx=t.idx,r.Sym.idx=t.Sym.idx,r},n.prototype.connect=function(t,e){var r=!1,o=this.makeEdge_(t),i=o.Sym;if(e.Lface!==t.Lface&&(r=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(o,t.Lnext),this.splice_(i,e),o.Org=t.Dst,i.Org=e.Org,o.Lface=i.Lface=t.Lface,t.Lface.anEdge=i,!r){var a=new El;this.makeFace_(a,o,t.Lface)}return o},n.prototype.zapFace=function(t){var e=t.anEdge,r,o,i,a,s;o=e.Lnext;do r=o,o=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),i=r.Sym,i.Onext===i?this.killVertex_(i.Org,null):(i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev)),this.killEdge_(r));while(r!=e);a=t.prev,s=t.next,s.prev=a,a.next=s},n.prototype.countFaceVerts_=function(t){var e=t.anEdge,r=0;do r++,e=e.Lnext;while(e!==t.anEdge);return r},n.prototype.mergeConvexFaces=function(t){var e,r,o,i,a,s,l;for(e=this.fHead.next;e!==this.fHead;e=e.next)if(!!e.inside)for(r=e.anEdge,a=r.Org;o=r.Lnext,i=r.Sym,i&&i.Lface&&i.Lface.inside&&(s=this.countFaceVerts_(e),l=this.countFaceVerts_(i.Lface),s+l-2<=t&&Se.vertCCW(r.Lprev.Org,r.Org,i.Lnext.Lnext.Org)&&Se.vertCCW(i.Lprev.Org,i.Org,r.Lnext.Lnext.Org)&&(o=i.Lnext,this.delete(i),r=null,i=null)),!(r&&r.Lnext.Org===a);)r=o;return!0},n.prototype.check=function(){var t=this.fHead,e=this.vHead,r=this.eHead,o,i,a,s,l,u;for(i=t,i=t;(o=i.next)!==t;i=o){_e(o.prev===i),l=o.anEdge;do _e(l.Sym!==l),_e(l.Sym.Sym===l),_e(l.Lnext.Onext.Sym===l),_e(l.Onext.Sym.Lnext===l),_e(l.Lface===o),l=l.Lnext;while(l!==o.anEdge)}for(_e(o.prev===i&&o.anEdge===null),s=e,s=e;(a=s.next)!==e;s=a){_e(a.prev===s),l=a.anEdge;do _e(l.Sym!==l),_e(l.Sym.Sym===l),_e(l.Lnext.Onext.Sym===l),_e(l.Onext.Sym.Lnext===l),_e(l.Org===a),l=l.Onext;while(l!==a.anEdge)}for(_e(a.prev===s&&a.anEdge===null),u=r,u=r;(l=u.next)!==r;u=l)_e(l.Sym.next===u.Sym),_e(l.Sym!==l),_e(l.Sym.Sym===l),_e(l.Org!==null),_e(l.Dst!==null),_e(l.Lnext.Onext.Sym===l),_e(l.Onext.Sym.Lnext===l);_e(l.Sym.next===u.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},n}(),mx=function(){function n(){this.handle=null}return n}(),yx=function(){function n(){this.key=null,this.node=0}return n}(),MT=function(){function n(t,e){this.leq=e,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=t,this.nodes=[],this.handles=[];for(var r=0;r<t+1;r++)this.nodes[r]=new mx,this.handles[r]=new yx;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return n.prototype.floatDown_=function(t){var e=this.nodes,r=this.handles,o,i,a;for(o=e[t].handle;;){if(a=t<<1,a<this.size&&this.leq(r[e[a+1].handle].key,r[e[a].handle].key)&&++a,_e(a<=this.max),i=e[a].handle,a>this.size||this.leq(r[o].key,r[i].key)){e[t].handle=o,r[o].node=t;break}e[t].handle=i,r[i].node=t,t=a}},n.prototype.floatUp_=function(t){var e=this.nodes,r=this.handles,o,i,a;for(o=e[t].handle;;){if(a=t>>1,i=e[a].handle,a===0||this.leq(r[i].key,r[o].key)){e[t].handle=o,r[o].node=t;break}e[t].handle=i,r[i].node=t,t=a}},n.prototype.init=function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},n.prototype.min=function(){return this.handles[this.nodes[1].handle].key},n.prototype.insert=function(t){var e,r;if(e=++this.size,e*2>this.max){this.max*=2;var o,i;for(i=this.nodes.length,this.nodes.length=this.max+1,o=i;o<this.nodes.length;o++)this.nodes[o]=new mx;for(i=this.handles.length,this.handles.length=this.max+1,o=i;o<this.handles.length;o++)this.handles[o]=new yx}return this.freeList===0?r=e:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[e].handle=r,this.handles[r].node=e,this.handles[r].key=t,this.initialized&&this.floatUp_(e),r},n.prototype.extractMin=function(){var t=this.nodes,e=this.handles,r=t[1].handle,o=e[r].key;return this.size>0&&(t[1].handle=t[this.size].handle,e[t[1].handle].node=1,e[r].key=null,e[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),o},n.prototype.delete=function(t){var e=this.nodes,r=this.handles,o;_e(t>=1&&t<=this.max&&r[t].key!==null),o=r[t].node,e[o].handle=e[this.size].handle,r[e[o].handle].node=o,--this.size,o<=this.size&&(o<=1||this.leq(r[e[o>>1].handle].key,r[e[o].handle].key)?this.floatDown_(o):this.floatUp_(o)),r[t].key=null,r[t].node=this.freeList,this.freeList=t},n}(),vf=function(){function n(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return n}(),gx=function(){function n(){this.key=null,this.next=null,this.prev=null}return n}(),IT=function(){function n(t,e){this.frame=t,this.leq=e,this.head=new gx,this.head.next=this.head,this.head.prev=this.head}return n.prototype.min=function(){return this.head.next},n.prototype.max=function(){return this.head.prev},n.prototype.insert=function(t){return this.insertBefore(this.head,t)},n.prototype.search=function(t){var e=this.head;do e=e.next;while(e.key!==null&&!this.leq(this.frame,t,e.key));return e},n.prototype.insertBefore=function(t,e){do t=t.prev;while(t.key!==null&&!this.leq(this.frame,t.key,e));var r=new gx;return r.key=e,r.next=t.next,t.next.prev=r,r.prev=t,t.next=r,r},n.prototype.delete=function(t){t.next.prev=t.prev,t.prev.next=t.next},n}(),NT=function(){function n(){}return n.regionBelow=function(t){return t.nodeUp.prev.key},n.regionAbove=function(t){return t.nodeUp.next.key},n.debugEvent=function(t){},n.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},n.edgeLeq=function(t,e,r){var o=t.event,i=e.eUp,a=r.eUp;if(i.Dst===o)return a.Dst===o?Se.vertLeq(i.Org,a.Org)?Se.edgeSign(a.Dst,i.Org,a.Org)<=0:Se.edgeSign(i.Dst,a.Org,i.Org)>=0:Se.edgeSign(a.Dst,o,a.Org)<=0;if(a.Dst===o)return Se.edgeSign(i.Dst,o,i.Org)>=0;var s=Se.edgeEval(i.Dst,o,i.Org),l=Se.edgeEval(a.Dst,o,a.Org);return s>=l},n.deleteRegion=function(t,e){e.fixUpperEdge&&_e(e.eUp.winding===0),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},n.fixUpperEdge=function(t,e,r){_e(e.fixUpperEdge),t.mesh.delete(e.eUp),e.fixUpperEdge=!1,e.eUp=r,r.activeRegion=e},n.topLeftRegion=function(t,e){var r=e.eUp.Org,o;do e=n.regionAbove(e);while(e.eUp.Org===r);if(e.fixUpperEdge){if(o=t.mesh.connect(n.regionBelow(e).eUp.Sym,e.eUp.Lnext),o===null)return null;n.fixUpperEdge(t,e,o),e=n.regionAbove(e)}return e},n.topRightRegion=function(t){var e=t.eUp.Dst;do t=n.regionAbove(t);while(t.eUp.Dst===e);return t},n.addRegionBelow=function(t,e,r){var o=new vf;return o.eUp=r,o.nodeUp=t.dict.insertBefore(e.nodeUp,o),o.fixUpperEdge=!1,o.sentinel=!1,o.dirty=!1,r.activeRegion=o,o},n.isWindingInside=function(t,e){switch(t.windingRule){case Ye.ODD:return(e&1)!==0;case Ye.NONZERO:return e!==0;case Ye.POSITIVE:return e>0;case Ye.NEGATIVE:return e<0;case Ye.ABS_GEQ_TWO:return e>=2||e<=-2}throw new Error("Invalid winding rulle")},n.computeWinding=function(t,e){e.windingNumber=n.regionAbove(e).windingNumber+e.eUp.winding,e.inside=n.isWindingInside(t,e.windingNumber)},n.finishRegion=function(t,e){var r=e.eUp,o=r.Lface;o.inside=e.inside,o.anEdge=r,n.deleteRegion(t,e)},n.finishLeftRegions=function(t,e,r){for(var o,i=null,a=e,s=e.eUp;a!==r;){if(a.fixUpperEdge=!1,i=n.regionBelow(a),o=i.eUp,o.Org!=s.Org){if(!i.fixUpperEdge){n.finishRegion(t,a);break}o=t.mesh.connect(s.Lprev,o.Sym),n.fixUpperEdge(t,i,o)}s.Onext!==o&&(t.mesh.splice(o.Oprev,o),t.mesh.splice(s,o)),n.finishRegion(t,a),s=i.eUp,a=i}return s},n.addRightEdges=function(t,e,r,o,i,a){var s,l,u,c,d=!0;u=r;do _e(Se.vertLeq(u.Org,u.Dst)),n.addRegionBelow(t,e,u.Sym),u=u.Onext;while(u!==o);for(i===null&&(i=n.regionBelow(e).eUp.Rprev),l=e,c=i;s=n.regionBelow(l),u=s.eUp.Sym,u.Org===c.Org;)u.Onext!==c&&(t.mesh.splice(u.Oprev,u),t.mesh.splice(c.Oprev,u)),s.windingNumber=l.windingNumber-u.winding,s.inside=n.isWindingInside(t,s.windingNumber),l.dirty=!0,!d&&n.checkForRightSplice(t,l)&&(n.addWinding(u,c),n.deleteRegion(t,l),t.mesh.delete(c)),d=!1,l=s,c=u;l.dirty=!0,_e(l.windingNumber-u.winding===s.windingNumber),a&&n.walkDirtyRegions(t,l)},n.spliceMergeVertices=function(t,e,r){t.mesh.splice(e,r)},n.vertexWeights=function(t,e,r){var o=Se.vertL1dist(e,t),i=Se.vertL1dist(r,t),a=.5*i/(o+i),s=.5*o/(o+i);t.coords[0]+=a*e.coords[0]+s*r.coords[0],t.coords[1]+=a*e.coords[1]+s*r.coords[1],t.coords[2]+=a*e.coords[2]+s*r.coords[2]},n.getIntersectData=function(t,e,r,o,i,a){e.coords[0]=e.coords[1]=e.coords[2]=0,e.idx=-1,n.vertexWeights(e,r,o),n.vertexWeights(e,i,a)},n.checkForRightSplice=function(t,e){var r=n.regionBelow(e),o=e.eUp,i=r.eUp;if(Se.vertLeq(o.Org,i.Org)){if(Se.edgeSign(i.Dst,o.Org,i.Org)>0)return!1;Se.vertEq(o.Org,i.Org)?o.Org!==i.Org&&(t.pq.delete(o.Org.pqHandle),n.spliceMergeVertices(t,i.Oprev,o)):(t.mesh.splitEdge(i.Sym),t.mesh.splice(o,i.Oprev),e.dirty=r.dirty=!0)}else{if(Se.edgeSign(o.Dst,i.Org,o.Org)<0)return!1;n.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(o.Sym),t.mesh.splice(i.Oprev,o)}return!0},n.checkForLeftSplice=function(t,e){var r=n.regionBelow(e),o=e.eUp,i=r.eUp,a;if(_e(!Se.vertEq(o.Dst,i.Dst)),Se.vertLeq(o.Dst,i.Dst)){if(Se.edgeSign(o.Dst,i.Dst,o.Org)<0)return!1;n.regionAbove(e).dirty=e.dirty=!0,a=t.mesh.splitEdge(o),t.mesh.splice(i.Sym,a),a.Lface.inside=e.inside}else{if(Se.edgeSign(i.Dst,o.Dst,i.Org)>0)return!1;e.dirty=r.dirty=!0,a=t.mesh.splitEdge(i),t.mesh.splice(o.Lnext,i.Sym),a.Rface.inside=e.inside}return!0},n.checkForIntersect=function(t,e){var r=n.regionBelow(e),o=e.eUp,i=r.eUp,a=o.Org,s=i.Org,l=o.Dst,u=i.Dst,c,d,p=new Za,f,h;if(_e(!Se.vertEq(u,l)),_e(Se.edgeSign(l,t.event,a)<=0),_e(Se.edgeSign(u,t.event,s)>=0),_e(a!==t.event&&s!==t.event),_e(!e.fixUpperEdge&&!r.fixUpperEdge),a===s||(c=Math.min(a.t,l.t),d=Math.max(s.t,u.t),c>d))return!1;if(Se.vertLeq(a,s)){if(Se.edgeSign(u,a,s)>0)return!1}else if(Se.edgeSign(l,s,a)<0)return!1;return n.debugEvent(t),Se.intersect(l,a,u,s,p),_e(Math.min(a.t,l.t)<=p.t),_e(p.t<=Math.max(s.t,u.t)),_e(Math.min(u.s,l.s)<=p.s),_e(p.s<=Math.max(s.s,a.s)),Se.vertLeq(p,t.event)&&(p.s=t.event.s,p.t=t.event.t),f=Se.vertLeq(a,s)?a:s,Se.vertLeq(f,p)&&(p.s=f.s,p.t=f.t),Se.vertEq(p,a)||Se.vertEq(p,s)?(n.checkForRightSplice(t,e),!1):!Se.vertEq(l,t.event)&&Se.edgeSign(l,t.event,p)>=0||!Se.vertEq(u,t.event)&&Se.edgeSign(u,t.event,p)<=0?u===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(i.Sym,o),e=n.topLeftRegion(t,e),o=n.regionBelow(e).eUp,n.finishLeftRegions(t,n.regionBelow(e),r),n.addRightEdges(t,e,o.Oprev,o,o,!0),!0):l===t.event?(t.mesh.splitEdge(i.Sym),t.mesh.splice(o.Lnext,i.Oprev),r=e,e=n.topRightRegion(e),h=n.regionBelow(e).eUp.Rprev,r.eUp=i.Oprev,i=n.finishLeftRegions(t,r,null),n.addRightEdges(t,e,i.Onext,o.Rprev,h,!0),!0):(Se.edgeSign(l,t.event,p)>=0&&(n.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),Se.edgeSign(u,t.event,p)<=0&&(e.dirty=r.dirty=!0,t.mesh.splitEdge(i.Sym),i.Org.s=t.event.s,i.Org.t=t.event.t),!1):(t.mesh.splitEdge(o.Sym),t.mesh.splitEdge(i.Sym),t.mesh.splice(i.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=t.pq.insert(o.Org),n.getIntersectData(t,o.Org,a,l,s,u),n.regionAbove(e).dirty=e.dirty=r.dirty=!0,!1)},n.walkDirtyRegions=function(t,e){for(var r=n.regionBelow(e),o,i;;){for(;r.dirty;)e=r,r=n.regionBelow(r);if(!e.dirty&&(r=e,e=n.regionAbove(e),e===null||!e.dirty))return;if(e.dirty=!1,o=e.eUp,i=r.eUp,o.Dst!==i.Dst&&n.checkForLeftSplice(t,e)&&(r.fixUpperEdge?(n.deleteRegion(t,r),t.mesh.delete(i),r=n.regionBelow(e),i=r.eUp):e.fixUpperEdge&&(n.deleteRegion(t,e),t.mesh.delete(o),e=n.regionAbove(r),o=e.eUp)),o.Org!==i.Org)if(o.Dst!==i.Dst&&!e.fixUpperEdge&&!r.fixUpperEdge&&(o.Dst===t.event||i.Dst===t.event)){if(n.checkForIntersect(t,e))return}else n.checkForRightSplice(t,e);o.Org===i.Org&&o.Dst===i.Dst&&(n.addWinding(i,o),n.deleteRegion(t,e),t.mesh.delete(o),e=n.regionAbove(r))}},n.connectRightVertex=function(t,e,r){var o,i=r.Onext,a=n.regionBelow(e),s=e.eUp,l=a.eUp,u=!1;if(s.Dst!==l.Dst&&n.checkForIntersect(t,e),Se.vertEq(s.Org,t.event)&&(t.mesh.splice(i.Oprev,s),e=n.topLeftRegion(t,e),i=n.regionBelow(e).eUp,n.finishLeftRegions(t,n.regionBelow(e),a),u=!0),Se.vertEq(l.Org,t.event)&&(t.mesh.splice(r,l.Oprev),r=n.finishLeftRegions(t,a,null),u=!0),u){n.addRightEdges(t,e,r.Onext,i,i,!0);return}Se.vertLeq(l.Org,s.Org)?o=l.Oprev:o=s,o=t.mesh.connect(r.Lprev,o),n.addRightEdges(t,e,o,o.Onext,o.Onext,!1),o.Sym.activeRegion.fixUpperEdge=!0,n.walkDirtyRegions(t,e)},n.connectLeftDegenerate=function(t,e,r){var o,i,a,s,l;if(o=e.eUp,Se.vertEq(o.Org,r)){_e(!1),n.spliceMergeVertices(t,o,r.anEdge);return}if(!Se.vertEq(o.Dst,r)){t.mesh.splitEdge(o.Sym),e.fixUpperEdge&&(t.mesh.delete(o.Onext),e.fixUpperEdge=!1),t.mesh.splice(r.anEdge,o),n.sweepEvent(t,r);return}_e(!1),e=n.topRightRegion(e),l=n.regionBelow(e),a=l.eUp.Sym,i=s=a.Onext,l.fixUpperEdge&&(_e(i!==a),n.deleteRegion(t,l),t.mesh.delete(a),a=i.Oprev),t.mesh.splice(r.anEdge,a),Se.edgeGoesLeft(i)||(i=null),n.addRightEdges(t,e,a.Onext,s,i,!0)},n.connectLeftVertex=function(t,e){var r,o,i,a,s,l,u=new vf;if(u.eUp=e.anEdge.Sym,r=t.dict.search(u).key,o=n.regionBelow(r),!!o){if(a=r.eUp,s=o.eUp,Se.edgeSign(a.Dst,e,a.Org)===0){n.connectLeftDegenerate(t,r,e);return}if(i=Se.vertLeq(s.Dst,a.Dst)?r:o,r.inside||i.fixUpperEdge){if(i===r)l=t.mesh.connect(e.anEdge.Sym,a.Lnext);else{var c=t.mesh.connect(s.Dnext,e.anEdge);l=c.Sym}i.fixUpperEdge?n.fixUpperEdge(t,i,l):n.computeWinding(t,n.addRegionBelow(t,r,l)),n.sweepEvent(t,e)}else n.addRightEdges(t,r,e.anEdge,e.anEdge,null,!0)}},n.sweepEvent=function(t,e){t.event=e,n.debugEvent(t);for(var r=e.anEdge;r.activeRegion===null;)if(r=r.Onext,r===e.anEdge){n.connectLeftVertex(t,e);return}var o=n.topLeftRegion(t,r.activeRegion);_e(o!==null);var i=n.regionBelow(o),a=i.eUp,s=n.finishLeftRegions(t,i,null);s.Onext===a?n.connectRightVertex(t,o,s):n.addRightEdges(t,o,s.Onext,a,a,!0)},n.addSentinel=function(t,e,r,o){var i=new vf,a=t.mesh.makeEdge();a.Org.s=r,a.Org.t=o,a.Dst.s=e,a.Dst.t=o,t.event=a.Dst,i.eUp=a,i.windingNumber=0,i.inside=!1,i.fixUpperEdge=!1,i.sentinel=!0,i.dirty=!1,i.nodeUp=t.dict.insert(i)},n.initEdgeDict=function(t){t.dict=new IT(t,n.edgeLeq);var e=t.bmax[0]-t.bmin[0],r=t.bmax[1]-t.bmin[1],o=t.bmin[0]-e,i=t.bmax[0]+e,a=t.bmin[1]-r,s=t.bmax[1]+r;n.addSentinel(t,o,i,a),n.addSentinel(t,o,i,s)},n.doneEdgeDict=function(t){for(var e,r=0;(e=t.dict.min().key)!==null;)e.sentinel||(_e(e.fixUpperEdge),_e(++r===1)),_e(e.windingNumber===0),n.deleteRegion(t,e)},n.removeDegenerateEdges=function(t){var e,r,o,i=t.mesh.eHead;for(e=i.next;e!==i;e=r)r=e.next,o=e.Lnext,Se.vertEq(e.Org,e.Dst)&&e.Lnext.Lnext!==e&&(n.spliceMergeVertices(t,o,e),t.mesh.delete(e),e=o,o=e.Lnext),o.Lnext===e&&(o!==e&&((o===r||o===r.Sym)&&(r=r.next),t.mesh.delete(o)),(e===r||e===r.Sym)&&(r=r.next),t.mesh.delete(e))},n.initPriorityQ=function(t){var e,r,o,i=0;for(o=t.mesh.vHead,r=o.next;r!==o;r=r.next)i++;for(i+=8,e=t.pq=new MT(i,Se.vertLeq),o=t.mesh.vHead,r=o.next;r!==o;r=r.next)r.pqHandle=e.insert(r);return r!==o?!1:(e.init(),!0)},n.donePriorityQ=function(t){t.pq=null},n.removeDegenerateFaces=function(t,e){var r,o,i;for(r=e.fHead.next;r!==e.fHead;r=o)o=r.next,i=r.anEdge,_e(i.Lnext!==i),i.Lnext.Lnext===i&&(n.addWinding(i.Onext,i),t.mesh.delete(i));return!0},n.computeInterior=function(t,e){e===void 0&&(e=!0);var r,o;if(n.removeDegenerateEdges(t),!n.initPriorityQ(t))return!1;for(n.initEdgeDict(t);(r=t.pq.extractMin())!==null;){for(;o=t.pq.min(),!(o===null||!Se.vertEq(o,r));)o=t.pq.extractMin(),n.spliceMergeVertices(t,r.anEdge,o.anEdge);n.sweepEvent(t,r)}return t.event=t.dict.min().key.eUp.Org,n.debugEvent(t),n.doneEdgeDict(t),n.donePriorityQ(t),n.removeDegenerateFaces(t,t.mesh)?(e&&t.mesh.check(),!0):!1},n}(),DT=function(){function n(){this.mesh=new hx,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Ye.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return n.prototype.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},n.prototype.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];if(!e)throw"Zero-size vector!";e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},n.prototype.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},n.prototype.computeNormal_=function(t){var e,r,o,i,a,s,l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=[0,0,0],f=[null,null,null],h=[null,null,null],m=this.mesh.vHead;e=m.next;for(var y=0;y<3;++y)i=e.coords[y],u[y]=i,h[y]=e,l[y]=i,f[y]=e;for(e=m.next;e!==m;e=e.next)for(var g=0;g<3;++g)i=e.coords[g],i<u[g]&&(u[g]=i,h[g]=e),i>l[g]&&(l[g]=i,f[g]=e);var b=0;if(l[1]-u[1]>l[0]-u[0]&&(b=1),l[2]-u[2]>l[b]-u[b]&&(b=2),u[b]>=l[b]){t[0]=0,t[1]=0,t[2]=1;return}for(s=0,r=h[b],o=f[b],c[0]=r.coords[0]-o.coords[0],c[1]=r.coords[1]-o.coords[1],c[2]=r.coords[2]-o.coords[2],e=m.next;e!==m;e=e.next)d[0]=e.coords[0]-o.coords[0],d[1]=e.coords[1]-o.coords[1],d[2]=e.coords[2]-o.coords[2],p[0]=c[1]*d[2]-c[2]*d[1],p[1]=c[2]*d[0]-c[0]*d[2],p[2]=c[0]*d[1]-c[1]*d[0],a=p[0]*p[0]+p[1]*p[1]+p[2]*p[2],a>s&&(s=a,t[0]=p[0],t[1]=p[1],t[2]=p[2]);s<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(c)]=1)},n.prototype.checkOrientation_=function(){for(var t=this.mesh.fHead,e,r=this.mesh.vHead,o,i=0,a=t.next;a!==t;a=a.next)if(o=a.anEdge,!(o.winding<=0))do i+=(o.Org.s-o.Dst.s)*(o.Org.t+o.Dst.t),o=o.Lnext;while(o!==a.anEdge);if(i<0){for(e=r.next;e!==r;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},n.prototype.projectPolygon_=function(){var t=this.mesh.vHead,e=[0,0,0],r,o,i=!1;e[0]=this.normal[0],e[1]=this.normal[1],e[2]=this.normal[2],!e[0]&&!e[1]&&!e[2]&&(this.computeNormal_(e),i=!0),r=this.sUnit,o=this.tUnit;var a=this.longAxis_(e);r[a]=0,r[(a+1)%3]=1,r[(a+2)%3]=0,o[a]=0,o[(a+1)%3]=0,o[(a+2)%3]=e[a]>0?1:-1;for(var s=t.next;s!==t;s=s.next)s.s=this.dot_(s.coords,r),s.t=this.dot_(s.coords,o);i&&this.checkOrientation_();for(var l=!0,u=t.next;u!==t;u=u.next)l?(this.bmin[0]=this.bmax[0]=u.s,this.bmin[1]=this.bmax[1]=u.t,l=!1):(u.s<this.bmin[0]&&(this.bmin[0]=u.s),u.s>this.bmax[0]&&(this.bmax[0]=u.s),u.t<this.bmin[1]&&(this.bmin[1]=u.t),u.t>this.bmax[1]&&(this.bmax[1]=u.t))},n.prototype.addWinding_=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},n.prototype.tessellateMonoRegion_=function(t,e){var r,o;if(r=e.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;Se.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;Se.vertLeq(r.Org,r.Dst);r=r.Lnext);o=r.Lprev;for(var i=void 0;r.Lnext!==o;)if(Se.vertLeq(r.Dst,o.Org)){for(;o.Lnext!==r&&(Se.edgeGoesLeft(o.Lnext)||Se.edgeSign(o.Org,o.Dst,o.Lnext.Dst)<=0);)i=t.connect(o.Lnext,o),o=i.Sym;o=o.Lprev}else{for(;o.Lnext!==r&&(Se.edgeGoesRight(r.Lprev)||Se.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)i=t.connect(r,r.Lprev),r=i.Sym;r=r.Lnext}if(o.Lnext===r)throw"Mono region invalid";for(;o.Lnext.Lnext!==r;)i=t.connect(o.Lnext,o),o=i.Sym;return!0},n.prototype.tessellateInterior_=function(t){for(var e,r=t.fHead.next;r!==t.fHead;r=e)if(e=r.next,r.inside&&!this.tessellateMonoRegion_(t,r))return!1;return!0},n.prototype.discardExterior_=function(t){for(var e,r=t.fHead.next;r!==t.fHead;r=e)e=r.next,r.inside||t.zapFace(r)},n.prototype.setWindingNumber_=function(t,e,r){for(var o,i=t.eHead.next;i!==t.eHead;i=o)o=i.next,i.Rface.inside!==i.Lface.inside?i.winding=i.Lface.inside?e:-e:r?t.delete(i):i.winding=0},n.prototype.getNeighbourFace_=function(t){return!t.Rface||!t.Rface.inside?-1:t.Rface.n},n.prototype.outputPolymesh_=function(t,e,r,o){var i,a=0,s=0,l;r>3&&t.mergeConvexFaces(r);for(var u=t.vHead.next;u!==t.vHead;u=u.next)u.n=-1;for(var c=t.fHead.next;c!==t.fHead;c=c.next)if(c.n=-1,!!c.inside){i=c.anEdge,l=0;do{var u=i.Org;u.n===-1&&(u.n=s,s++),l++,i=i.Lnext}while(i!==c.anEdge);if(l>r)throw"Face vertex greater that support polygon";c.n=a,++a}this.elementCount=a,e===_t.CONNECTED_POLYGONS&&(a*=2),this.elements=[],this.elements.length=a*r,this.vertexCount=s,this.vertices=[],this.vertices.length=s*o,this.vertexIndices=[],this.vertexIndices.length=s;for(var u=t.vHead.next;u!==t.vHead;u=u.next)if(u.n!==-1){var d=u.n*o;this.vertices[d+0]=u.coords[0],this.vertices[d+1]=u.coords[1],o>2&&(this.vertices[d+2]=u.coords[2]),this.vertexIndices[u.n]=u.idx}for(var p=0,c=t.fHead.next;c!==t.fHead;c=c.next)if(!!c.inside){i=c.anEdge,l=0;do{var u=i.Org;this.elements[p++]=u.n,l++,i=i.Lnext}while(i!==c.anEdge);for(var f=l;f<r;++f)this.elements[p++]=-1;if(e===_t.CONNECTED_POLYGONS){i=c.anEdge;do this.elements[p++]=this.getNeighbourFace_(i),i=i.Lnext;while(i!==c.anEdge);for(var h=l;h<r;++h)this.elements[p++]=-1}}},n.prototype.outputContours_=function(t,e){var r,o,i=0,a=0;this.vertexCount=0,this.elementCount=0;for(var s=t.fHead.next;s!==t.fHead;s=s.next)if(!!s.inside){o=r=s.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==o);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*e,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,u=0,c=0;i=0;for(var s=t.fHead.next;s!==t.fHead;s=s.next)if(!!s.inside){a=0,o=r=s.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],e>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[u++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,a++,r=r.Lnext;while(r!==o);this.elements[c++]=i,this.elements[c++]=a,i+=a}},n.prototype.addContour=function(t,e){this.mesh===null&&(this.mesh=new hx),t<2&&(t=2),t>3&&(t=3);for(var r=null,o=0;o<e.length;o+=t)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=e[o+0],r.Org.coords[1]=e[o+1],t>2?r.Org.coords[2]=e[o+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},n.prototype.tesselate=function(t,e,r,o,i,a){if(t===void 0&&(t=Ye.ODD),e===void 0&&(e=_t.POLYGONS),a===void 0&&(a=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,i&&(this.normal[0]=i[0],this.normal[1]=i[1],this.normal[2]=i[2]),this.windingRule=t,o<2&&(o=2),o>3&&(o=3),!this.mesh)return!1;this.projectPolygon_(),NT.computeInterior(this,a);var s=this.mesh;return e===_t.BOUNDARY_CONTOURS?this.setWindingNumber_(s,1,!0):this.tessellateInterior_(s),a&&s.check(),e===_t.BOUNDARY_CONTOURS?this.outputContours_(s,o):this.outputPolymesh_(s,e,r,o),!0},n}();function go(n){var t=n.windingRule,e=t===void 0?Ye.ODD:t,r=n.elementType,o=r===void 0?_t.POLYGONS:r,i=n.polySize,a=i===void 0?3:i,s=n.vertexSize,l=s===void 0?2:s,u=n.normal,c=u===void 0?[0,0,1]:u,d=n.contours,p=d===void 0?[]:d,f=n.strict,h=f===void 0?!0:f,m=n.debug,y=m===void 0?!1:m;if(!p&&h)throw new Error("Contours can't be empty");if(!!p){var g=new DT;n.edgeCreateCallback&&(g.edgeCreateCallback=n.edgeCreateCallback),n.vertexIdCallback&&(g.vertexIdCallback=n.vertexIdCallback);for(var b=0;b<p.length;b++)g.addContour(l||2,p[b]);return g.tesselate(e,o,a,l,c,h),{vertices:g.vertices,vertexIndices:g.vertexIndices,vertexCount:g.vertexCount,elements:g.elements,elementCount:g.elementCount,mesh:y?g.mesh:void 0}}}var L4=Ye.ODD,R4=Ye.NONZERO,V4=Ye.POSITIVE,z4=Ye.NEGATIVE,G4=Ye.ABS_GEQ_TWO,F4=_t.POLYGONS,k4=_t.CONNECTED_POLYGONS,j4=_t.BOUNDARY_CONTOURS;var xo=require("three");var Uu=class{constructor(t=256,e=!1){this.capacity=t,this.size=0,this.debug=e,this.debug&&console.log(`allocating with cap ${t}`);let r=t*Uu.eSize;this.buffer=new ArrayBuffer(r);let o=Float32Array.BYTES_PER_ELEMENT,i=0;this.positions=new Float32Array(this.buffer,i*o,3*t),i+=3*t,this.normals=new Float32Array(this.buffer,i*o,3*t),i+=3*t,this.uvs=new Float32Array(this.buffer,i*o,2*t)}realloc(t,e=!1){if(t<this.size)throw Error("cannot shrink buffer");if(t<=this.capacity&&!e)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${t}`);let r=t*Uu.eSize,o=new ArrayBuffer(r),i=Float32Array.BYTES_PER_ELEMENT,a=0,s=new Float32Array(o,a*i,3*t);a+=3*t;let l=new Float32Array(o,a*i,3*t);a+=3*t;let u=new Float32Array(o,a*i,2*t);e?(s.set(this.positions.subarray(0,this.size*3)),l.set(this.normals.subarray(0,this.size*3)),u.set(this.uvs.subarray(0,this.size*2))):(s.set(this.positions),l.set(this.normals),u.set(this.uvs)),this.buffer=o,this.positions=s,this.normals=l,this.uvs=u,this.capacity=t}get(t=1){let e=this.size+t;if(e>this.capacity){let o=this.capacity;for(;e>o;)o*=2;this.realloc(o)}let r=this.size;return this.size=e,r}reserve(t){let e=this.size+t;e>this.capacity&&this.realloc(e)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},Bl=Uu;Bl.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var Sx=ar(vx()),Ll={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},Pf={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},Of={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0},_f=(n,t)=>([e,r])=>(r<e&&(r+=t),(n>=e?n:n+t)<=r),Yn=class extends xo.BufferGeometry{constructor(e,r,o=0,i=12,a=3,s=Ye.ODD,l=!1){super();this.forPathBevel=l;this.type="ShapeGeometry";this.vertexCache={};this._shape=e,this._depth=r,this._curveSegments=i,this._bevelSegmentsInput=a;let u=this._shape.extractShapePointsToFlatArray([],i),c=this._shape.shapeHoles.map(T=>{let I=T.extractShapePointsToFlatArray([],i),E=[];for(let B=I.length-1;B>=1;B-=2){let R=I[B-1],F=I[B-0];E.push(R,F)}return E}),d=[],p=[];for(let T=0;T<u.length;T+=2)p.push([u[T],u[T+1]]);d.push(p);for(let T=0;T<c.length;T++){let I=c[T],E=[];for(let B=0;B<I.length;B+=2)E.push([I[B],I[B+1]]);d.push(E)}let f;e.isText?f=new xo.Box2().setFromPoints(e.points.map(I=>I.position)).getSize(new xo.Vector2).length()*.1:d[0].length===0?f=o:f=(0,Sx.default)(d).distance,o<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(o,f,r/2),this._bevelSegments=Math.floor(a));let h;try{h=go({windingRule:s,elementType:_t.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[u]})}catch{h=Ll}let m;try{m=go({windingRule:Ye.ODD,elementType:_t.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...c]})}catch{m=Pf}if(!h)throw new Error("error generating geometry");let y=h.elementCount;if(m){h.elementCount+=m.elementCount;for(let T=0;T<m.elements.length;T++){let I=m.elements[T],E=T%2===0?h.vertexCount:0;h.elements.push(I+E)}for(let T=0;T<m.vertexIndices.length;T++){let I=m.vertexIndices[T],E=h.vertexCount;h.vertexIndices.push(I+E)}for(let T=0;T<m.vertices.length;T++){let I=m.vertices[T];h.vertices.push(I)}}let g=1/0,b=-1/0,w=1/0,A=-1/0;for(let T=0,I=h.vertexCount;T<I;T++){let E=T*2,B=h.vertices[E+0],R=h.vertices[E+1];B<g&&(g=B),B>b&&(b=B),R<w&&(w=R),R>A&&(A=R)}this._minX=g,this._minY=w,this._width=b-g,this._height=A-w,this._buffer=new Bl(this._computeBufferEstimatedSize(h));let S=[],P=[];for(let T=h.elementCount-1;T>=0;T--){let I=T>=y,E=T*2,B=h.elements[E+0],R=h.elements[E+1],F=B+R,V={start:B,count:R,normals:[],continuous:[],concave:[]},q=B,k=F-1,U=B+1,H=this._shape.roundedCurves.length;do{let te=q-B,$=h.vertices[k*2+0],ee=h.vertices[k*2+1],Q=h.vertices[q*2+0],W=h.vertices[q*2+1],ue=h.vertices[U*2+0],le=h.vertices[U*2+1],ne=Q-$,ce=W-ee,ae=Math.sqrt(ne*ne+ce*ce);ne/=ae,ce/=ae;let me=Q-ue,fe=W-le,he=Math.sqrt(me*me+fe*fe);me/=he,fe/=he,V.normals[te*2+0]=-fe,V.normals[te*2+1]=me,V.concave[te]=ne*fe-ce*me>0;let xe=h.vertexIndices[q];if(Array.isArray(xe))V.continuous[te]=!1;else{let[ye,C]=this._shape.getCurveIndexFromVertexId(xe-1,!0);if(C>0&&C<1)V.continuous[te]=!0;else{let ie=C===1?ye+1:ye-1;ie=(ie+H)%H;let Ve=C===1?0:1,He=this._shape.roundedCurves[ye].getTangent(C),ze=this._shape.roundedCurves[ie].getTangent(Ve);V.continuous[te]=He.dot(ze)>.95}}I&&(V.normals[te*2+0]*=-1,V.normals[te*2+1]*=-1),[k,q,U]=[q,U,U+1],U>=F&&(U-=R)}while(U!==B+1);let Y=[];Y.push({bevelI:0,angle:0,size:0,boundary:{vertices:h.vertices.slice(B*2,F*2),vertexCount:R,vertexIndices:new Array(R).fill(!0).map((te,$)=>[$,$]),elements:[0,R],elementCount:1,mesh:null},reverseMap:[],insetPoints:h.vertices.slice(B*2,F*2)});let J=0;for(let te=1;te<=this._bevelSegments;te++){let $=te/this._bevelSegments*Math.PI/2,ee=(1-Math.cos($))*this._bevel,Q=[],W=[],ue=[],le=[],ne=0;for(let ae=0;ae<R;ae++){let me=ae*2,fe=(ae-1+R)%R*2,he=h.vertices[V.start*2+me+0],xe=h.vertices[V.start*2+me+1],ye=-V.normals[fe+0]*ee,C=-V.normals[fe+1]*ee,ie=-V.normals[me+0]*ee,Ve=-V.normals[me+1]*ee;if(V.concave[ae]||!V.concave[ae]&&I){let He=Math.atan2(C,ye),ze=Math.atan2(Ve,ie);ze>He&&(ze-=Math.PI*2);let Oe=ze-He;if(V.continuous[ae]||I){let jt=He+Oe/2,Ee=Math.cos(jt)*ee,zt=Math.sin(jt)*ee;Q[2*ne+0]=he+Ee*(I?-1:1),Q[2*ne+1]=xe+zt*(I?-1:1),le[ne]=ae,ne++}else{let jt=Math.max(1,Math.floor(i/4*Math.abs(Oe)/Math.PI));for(let Ee=0;Ee<=jt;Ee++){let zt=He+Oe*(Ee/jt),Ut=Math.cos(zt)*ee,hi=Math.sin(zt)*ee;Q[2*ne+0]=he+Ut,Q[2*ne+1]=xe+hi,le[ne]=ae,ne++}}}else Q[2*ne+0]=he+ye,Q[2*ne+1]=xe+C,le[ne]=ae,W[ae]=ne,ne++,Q[2*ne+0]=he,Q[2*ne+1]=xe,le[ne]=ae,ne++,Q[2*ne+0]=he+ie,Q[2*ne+1]=xe+Ve,le[ne]=ae,ue[ae]=ne,ne++}let ce=go({windingRule:Ye.POSITIVE,elementType:_t.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[Q],edgeCreateCallback:ae=>{let fe=ae.Org.idx,he=le[fe],xe=le[(fe+1)%le.length];ae.idx=[he,xe],ae.Sym.idx=[xe,he]},vertexIdCallback:ae=>{let me=ae.Lprev.idx;return[me?me[1]:0,ae.idx?ae.idx[0]:0]}});if(!ce)throw console.log("Error"),new Error(`error generating bevel geometry for ${te}'th loop`);if(!ce.vertexCount){let ae=(te-1)/this._bevelSegments*Math.PI/2;J=(1-Math.sin(ae))*this._bevel;break}for(let ae=0;ae<ce.vertexIndices.length;ae++){let[me,fe]=ce.vertexIndices[ae];if(me===fe)continue;let he=fe;fe<me&&(he+=R);for(let xe=me;xe<he;xe++){let ye=xe%R,C=(xe+1)%R;if(!V.continuous[ye]||!V.continuous[C]){ce.vertexIndices[ae]=[me,ye],ce.vertexIndices.splice(ae+1,0,[C,fe]),ce.vertices.splice((ae+1)*2,0,ce.vertices[ae*2],ce.vertices[ae*2+1]);break}}}Y.push({bevelI:te,angle:$,size:ee,boundary:ce,reverseMap:le,insetPoints:Q})}let Z=(te,$,ee)=>{let Q=0,W=te.boundary.vertexIndices.length;for(;Q<W&&ee(te.boundary.vertexIndices[$]);)$=($+1)%W,Q++;return Q},X=S.length;for(let te=1;te<Y.length;te++){let $=Y[te-1],ee=Y[te],Q=$.boundary.vertexIndices.length,W=ee.boundary.vertexIndices.length;if(!Q||!W)break;let ue=V.concave.length,le=0,ne=_f(le,R);for(;!$.boundary.vertexIndices.filter(ne).length||!ee.boundary.vertexIndices.filter(ne).length;)le++,ne=_f(le,R);let ce=$.boundary.vertexIndices.findIndex(ne),ae=ee.boundary.vertexIndices.findIndex(ne);do ce=(ce+1)%Q;while(ne($.boundary.vertexIndices[ce]));do ae=(ae+1)%W;while(ne(ee.boundary.vertexIndices[ae]));le=(le+1)%R;let me=le,fe=0,he=this._buildBevelVert(V,$,(ce-1+Q)%Q,void 0,fe),xe=this._buildBevelVert(V,ee,(ae-1+W)%W,void 0,fe),ye=he,C=xe,ie,Ve,He=!1;do{fe=(le||ue)/ue,ne=_f(le,R);let ze=Z($,ce,ne),Oe=Z(ee,ae,ne),jt=He;if(He=!1,ze&&!Oe){for(let Ee=0;Ee<ze;Ee++)ie=this._buildBevelVert(V,$,(ce+Ee)%Q,Ee/(ze-1),fe),S.push(ye.topN,ie.topP,C.topN),l===!1&&S.push(ie.bottomP,ye.bottomN,C.bottomN),ye=ie;He=!0}else if(!ze&&Oe)for(let Ee=0;Ee<Oe;Ee++)Ve=this._buildBevelVert(V,ee,(ae+Ee)%W,Ee/(Oe-1),fe),S.push(C.topN,ye.topP,Ve.topP),l===!1&&S.push(ye.bottomP,C.bottomN,Ve.bottomP),C=Ve;else if(ze&&Oe)if(ie=this._buildBevelVert(V,$,ce,0,fe),Ve=this._buildBevelVert(V,ee,ae,0,fe),jt?(S.push(ye.topN,Ve.topP,C.topN),S.push(ye.topN,ie.topP,Ve.topP),l===!1&&(S.push(Ve.bottomP,ye.bottomN,C.bottomN),S.push(Ve.bottomP,ie.bottomP,ye.bottomN))):(S.push(C.topN,ye.topN,ie.topP),S.push(C.topN,ie.topP,Ve.topP),l===!1&&(S.push(ie.bottomP,ye.bottomN,C.bottomN),S.push(ie.bottomP,C.bottomN,Ve.bottomP))),ye=ie,C=Ve,ze===Oe)for(let Ee=1;Ee<ze;Ee++)ie=this._buildBevelVert(V,$,(ce+Ee)%Q,Ee/(ze-1),fe),Ve=this._buildBevelVert(V,ee,(ae+Ee)%W,Ee/(Oe-1),fe),S.push(ye.topN,ie.topP,C.topN),S.push(C.topN,ie.topP,Ve.topP),l===!1&&(S.push(ie.bottomP,ye.bottomN,C.bottomN),S.push(ie.bottomP,C.bottomN,Ve.bottomP)),ye=ie,C=Ve;else if(ze>Oe){let Ee=ze/Oe,zt=0;for(let Ut=1;Ut<ze;Ut++)ie=this._buildBevelVert(V,$,(ce+Ut)%Q,Ut/(ze-1),fe),S.push(ye.topN,ie.topP,C.topN),l===!1&&S.push(ie.bottomP,ye.bottomN,C.bottomN),ye=ie,Ut>(zt+1)*Ee&&(zt++,Ve=this._buildBevelVert(V,ee,(ae+zt)%W,zt/(Oe-1),fe),S.push(C.topN,ie.topP,Ve.topP),l===!1&&S.push(ie.bottomP,C.bottomN,Ve.bottomP),C=Ve)}else{let Ee=Oe/ze,zt=0;for(let Ut=1;Ut<Oe;Ut++)Ve=this._buildBevelVert(V,ee,(ae+Ut)%W,Ut/(Oe-1),fe),S.push(C.topN,ie.topP,Ve.topP),l===!1&&S.push(ie.bottomP,C.bottomN,Ve.bottomP),C=Ve,Ut>(zt+1)*Ee&&(zt++,ie=this._buildBevelVert(V,$,(ce+zt)%Q,zt/(ze-1),fe),S.push(ye.topN,ie.topP,C.topN),l===!1&&S.push(ie.bottomP,ye.bottomN,C.bottomN),ye=ie)}ce=(ce+ze)%Q,ae=(ae+Oe)%W,le=(le+1)%ue}while(le!==me)}if(l===!1&&this._depth>this._bevel*2&&this._buildWall(Y,V,S),I){let te=[];for(let $=S.length-1;$>=X+2;$-=3){let ee=S[$-2],Q=S[$-1],W=S[$-0];te.push(W,Q,ee)}S.splice(X,S.length-X,...te)}if(I){let te=[];for(let $=Y[Y.length-1].boundary.vertices.length-1;$>=1;$-=2){let ee=Y[Y.length-1].boundary.vertices[$-1],Q=Y[Y.length-1].boundary.vertices[$-0];te.push(ee,Q)}P.push(te)}if(!I){let te=Y[Y.length-1],$;try{$=go({windingRule:Y.length>1?Ye.POSITIVE:Ye.ODD,elementType:_t.POLYGONS,vertexSize:2,strict:!0,contours:[te.insetPoints,...P]})}catch{$=Of}if(!$)throw new Error("Error generating geometry for surface");c.length===0&&this._bevel<f&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let ee=0;ee<$.elementCount*3;ee+=3){let Q=this._buildSurfaceVert($,$.elements[ee+0],J),W=this._buildSurfaceVert($,$.elements[ee+1],J),ue=this._buildSurfaceVert($,$.elements[ee+2],J);S.push(Q.top,W.top,ue.top),l===!1&&S.push(ue.bottom,W.bottom,Q.bottom)}}this.vertexCache={}}this._buffer.shrink();let O=new xo.BufferAttribute(Uint32Array.from(S),1),x=new xo.BufferAttribute(this._buffer.positions,3),D=new xo.BufferAttribute(this._buffer.normals,3),N=new xo.BufferAttribute(this._buffer.uvs,2);x.needsUpdate=!0,D.needsUpdate=!0,N.needsUpdate=!0,O.needsUpdate=!0,this.setAttribute("position",x),this.setAttribute("normal",D),this.setAttribute("uv",N),this.setIndex(O)}_computeBufferEstimatedSize(e){return e.vertexCount*2*(2+this._bevelSegments)}_buildWall(e,r,o){let i=e[0];for(let a=0,s=i.boundary.vertexCount;a<s;a++){let l=this._buildBevelVert(r,i,a),u=this._buildBevelVert(r,i,(a+1)%s);o.push(u.topP,l.topN,l.bottomN),o.push(u.topP,l.bottomN,u.bottomP)}}_buildSurfaceVert(e,r,o){let i=r.toString();if(i in this.vertexCache)return this.vertexCache[i];let a=e.vertices[r*2+0],s=e.vertices[r*2+1],l=(a-this._minX)/this._width,u=(s-this._minY)/this._height;this.forPathBevel&&(u=1);let c=this._buffer.get(this.forPathBevel?1:2),d=c*3,p=c*2,f={top:c+0,bottom:c+1};return this._buffer.positions[d+0]=a,this._buffer.positions[d+1]=s,this._buffer.positions[d+2]=this.forPathBevel?this._bevel:this._depth-o,this._buffer.normals[d+0]=0,this._buffer.normals[d+1]=0,this._buffer.normals[d+2]=1,this._buffer.uvs[p+0]=l,this._buffer.uvs[p+1]=u,this.forPathBevel===!1&&(this._buffer.positions[d+3]=a,this._buffer.positions[d+4]=s,this._buffer.positions[d+5]=o,this._buffer.normals[d+3]=0,this._buffer.normals[d+4]=0,this._buffer.normals[d+5]=-1,this._buffer.uvs[p+2]=l,this._buffer.uvs[p+3]=u),this.vertexCache[i]=f,f}_buildBevelVert(e,r,o,i=1,a){let s=`${r.bevelI}:${o}`;if(s in this.vertexCache&&a!==0&&a!==1&&(!a||a===this.vertexCache[s].pathBevelUCoord))return this.vertexCache[s];let[l,u]=r.boundary.vertexIndices[o],c,d,p,f;l!==u?(d=l,c=u,f=!1,p=e.continuous[d]&&e.continuous[c]):(c=l,d=(c-1+e.count)%e.count,f=e.concave[c]&&r.bevelI>0,p=e.continuous[c]||f);let h=Math.cos(r.angle),m=Math.sin(r.angle),y=o*2,g=c*2,b=d*2,w=r.boundary.vertices[y+0],A=r.boundary.vertices[y+1],S=(1-m)*this._bevel,P=(w-this._minX)/this._width,O=(A-this._minY)/this._height;this.forPathBevel&&(a!==void 0&&(P=a),O=1);let x=e.normals[g+0],D=e.normals[g+1],N=e.normals[b+0],T=e.normals[b+1];if(f){let F=N-x,V=T-D;x=x+F*(1-i),D=D+V*(1-i);let q=Math.sqrt(x*x+D*D);x/=q,D/=q}let I=this.forPathBevel?this._buffer.get(p?1:2):this._buffer.get(p?2:4),E=I*3,B=I*2,R={i:o,fi:c,topP:I+0,topN:I+0,bottomP:I+1,bottomN:I+1,pathBevelUCoord:a};return this._buffer.positions[E+0]=w,this._buffer.positions[E+1]=A,this._buffer.positions[E+2]=(this.forPathBevel?this._bevel:this._depth)-S,this._buffer.normals[E+0]=x*h,this._buffer.normals[E+1]=D*h,this._buffer.normals[E+2]=m,this._buffer.uvs[B+0]=P,this._buffer.uvs[B+1]=O,this.forPathBevel===!1&&(this._buffer.positions[E+3]=w,this._buffer.positions[E+4]=A,this._buffer.positions[E+5]=S,this._buffer.normals[E+3]=x*h,this._buffer.normals[E+4]=D*h,this._buffer.normals[E+5]=-m,this._buffer.uvs[B+2]=O,this._buffer.uvs[B+3]=P),p||(this.forPathBevel?(I+=1,E+=3,B+=2):(I+=2,E+=6,B+=4),R.topP=I+0,R.bottomP=I+1,this._buffer.positions[E+0]=w,this._buffer.positions[E+1]=A,this._buffer.positions[E+2]=(this.forPathBevel?this._bevel:this._depth)-S,this._buffer.normals[E+0]=N*h,this._buffer.normals[E+1]=T*h,this._buffer.normals[E+2]=m,this._buffer.uvs[B+0]=P,this._buffer.uvs[B+1]=O,this.forPathBevel===!1&&(this._buffer.positions[E+3]=w,this._buffer.positions[E+4]=A,this._buffer.positions[E+5]=S,this._buffer.normals[E+3]=N*h,this._buffer.normals[E+4]=T*h,this._buffer.normals[E+5]=-m,this._buffer.uvs[B+2]=O,this._buffer.uvs[B+3]=P)),this.vertexCache[s]=R,R}clone(){let e=new Yn(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=on(this.userData),e}};var Ja=class extends Ii.BufferGeometry{constructor(e,r=12,o={}){super();this.type="ShapeGeometry";this.windingRule=Ye.ODD;this.elementType=_t.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=e,this._curveSegments=r,this._triangulationOptions=Object.assign({windingRule:Ye.ODD,elementType:_t.POLYGONS,polySize:3,vertexSize:2,strict:!0},o);let i=this._shape.extractShapePointsToFlatArray([],this._curveSegments),a=this._shape.shapeHoles.map(h=>h.extractShapePointsToFlatArray([],this._curveSegments)),s,l=!0,u=!0,c,d;for(let h=0,m=i.length/2;h<m;h++){let y=h*2,g=i[y+0],b=i[y+1];if(c!==void 0&&g!==c&&(l=!1),d!==void 0&&b!==d&&(u=!1),c=g,d=b,!l&&!u)break}if(!l&&!u)try{s=go({contours:[i,...a],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{s=Ll}let p=s?.vertexCount??1,f=s?.elementCount??1;if(this._positionAttribute=new Ii.BufferAttribute(new Float32Array(p*3),3),this._normalAttribute=new Ii.BufferAttribute(new Float32Array(p*3),3),this._uvAttribute=new Ii.BufferAttribute(new Float32Array(p*2),2),this._indexAttribute=new Ii.BufferAttribute(new Uint32Array(f*3),1),s){let h=1/0,m=-1/0,y=1/0,g=-1/0;for(let A=0,S=p;A<S;A++){let P=A*2,O=s.vertices[P+0],x=s.vertices[P+1];O<h&&(h=O),O>m&&(m=O),x<y&&(y=x),x>g&&(g=x)}let b=m-h,w=g-y;for(let A=0,S=p;A<S;A++){let P=A*2,O=s.vertices[P+0],x=s.vertices[P+1],D=(O-h)/b,N=(x-y)/w;this._positionAttribute.setXYZ(A,O,x,0),this._normalAttribute.setXYZ(A,0,0,1),this._uvAttribute.setXY(A,D,N)}for(let A=0,S=f;A<S;A++){let P=A*3,O=s.elements[P+0],x=s.elements[P+1],D=s.elements[P+2];this._indexAttribute.setX(P+0,O),this._indexAttribute.setX(P+1,x),this._indexAttribute.setX(P+2,D)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,(s?.elementCount??1)*3)}clone(){let e=new Ja(this._shape,this._curveSegments);return e.userData=on(this.userData),e}};var es=class extends Yn{constructor(e,r,o=0,i=12,a=3,s=Ye.ODD){super(e,r,o,i,a,s);this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return e.vertexCount*2*(2+this._bevelSegments)}_buildWall(e,r,o){let i=e[0];for(let a=0,s=i.boundary.vertexCount;a<s;a++){let l=this._buildBevelVert(r,i,a),u=this._buildBevelVert(r,i,(a+1)%s);o.push(u.topP,l.topN,l.bottomN),o.push(u.topP,l.bottomN,u.bottomP)}}clone(){let e=new es(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=on(this.userData),e}};var Mr=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Ye.ODD},n.parameters),r=Math.abs(e.width),o=Math.abs(e.height??e.width),i=Math.abs(e.depth??0),a=n.shape??t?.shape,s=a?.roundness??e.roundness;a!==void 0&&(a instanceof Qe?(a.width!==r||a.height!==o)&&a.applySize(r,o):a=new Qe(r,o).fromJSON(a),n.parameters?.roundness!==void 0&&n.parameters?.roundness>0&&a.update());let l=a??new Qe(r,o);return{parameters:Object.assign(e,{width:r,height:o,depth:i,roundness:s}),shape:l}}static build(n){let{depth:t,extrudeBevelSize:e,extrudeBevelSegments:r,subdivisions:o,roundness:i,windingRule:a}=n.parameters;n.shape.roundness=i;let s;return t<=0?s=new Ja(n.shape,o,{windingRule:a}):s=new es(n.shape,t,e,o,r,a),Object.assign(s,{userData:{...n,type:"VectorGeometry"}})}};var bo=require("three"),Ax=Math.PI*2,rs=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},n.parameters);return e.angle=bo.MathUtils.clamp(e.angle,0,360),{shape:n.shape&&n.shape instanceof Qe?n.shape:new Qe,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(n){let{width:t,height:e,spikes:r,angle:o,innerRadius:i,depth:a,extrudeBevelSize:s,extrudeBevelSegments:l}=n.parameters,u=n.shape,c=t*.5,d=e*.5,p=VT(u,c,d,o*Math.PI/180,r,i);u.isClosed=!0,u.update();let f;return o===0?(f=new bo.BufferGeometry,f.setAttribute("position",new bo.Float32BufferAttribute([],3))):f=Mr.create({shape:u,parameters:{subdivisions:p,depth:a,extrudeBevelSize:s,extrudeBevelSegments:l}}),Object.assign(f,{userData:{...n,type:"EllipseGeometry"}})}};function VT(n,t,e,r,o,i){if(r>=Ax)return o>30||o%4===0?(GT(n,t,e,i),Math.round(o/4)):wx(n,r,o,t,e,i);r=Math.max(r,.001);let a={x:0,y:e},s=r+Math.PI*.5,l={x:Math.cos(s)*t,y:Math.sin(s)*e},u=fx({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:t,ry:e,largeArcFlag:r>Math.PI,sweepFlag:!0});return o>30||o%u.length===0?zT(n,a.x,a.y,u,o,t,e,i):wx(n,r,o,t,e,i)}function zT(n,t,e,r,o,i,a,s){let l=Math.round(o/r.length);n.addPoint(ts(t,e));for(let u=0,c=r.length;u<c;u++){let d=r[u],p=n.points[u],f=ts(d.x,d.y);p.controls[1].position.set(d.x1,d.y1),f.controls[0].position.set(d.x2,d.y2),n.addPoint(f)}return s>0?_x(n,i,a,s):n.addPoint(ts(0,0)),l}function wx(n,t,e,r,o,i){let a=-t/e;for(let s=0;s<=e;s++){let l=a*s,u=Math.sin(l)*r,c=Math.cos(l)*o;n.addPoint(ts(u,c))}return t<Ax?i>0?_x(n,r,o,i):n.addPoint(ts(0,0)):(n.removePoint(n.points[n.points.length-1]),i>0&&Px(n,r,o,i)),1}function GT(n,t,e,r=0,o=0,i=0){let a=.5522847498,s=t*a,l=e*a;n.addPoint(qu(o-t,i,o-t,i-l,o-t,i+l)),n.addPoint(qu(o,i+e,o-s,i+e,o+s,i+e)),n.addPoint(qu(o+t,i,o+t,i+l,o+t,i-l)),n.addPoint(qu(o,i-e,o+s,i-e,o-s,i-e)),r>0&&Px(n,t,e,r)}function ts(n,t){return new yo(bo.MathUtils.generateUUID(),new bo.Vector2(n,t))}function qu(n,t,e,r,o,i){let a=ts(n,t);return a.controls[0].position.set(e,r),a.controls[1].position.set(o,i),a}function _x(n,t,e,r){Ox(n,t,e,r).forEach(i=>n.addPoint(i))}function Px(n,t,e,r){let o=Ox(n,t,e,r),i=new Qe;o.forEach(a=>i.addPoint(a)),i.isClosed=!0,n.shapeHoles.push(i)}function Ox(n,t,e,r){let o=r*t/100,i=o*(Math.abs(e)/Math.abs(t)),a=new bo.Vector2(o/t,i/e),s=n.points.map(l=>{let u=l.clone();return u.uuid=bo.MathUtils.generateUUID(),u}).reverse();return s.forEach(l=>{l.position.multiply(a);let u=l.controls[0].position.clone().multiply(a),c=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(c),l.controls[1].position.copy(u)}),s}var vo=require("three"),Cx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},n.parameters),r=Math.abs(e.width),o=Math.abs(e.height??r),i=Math.abs(e.depth??r),a=Math.abs(Math.min(r,i))/2;return{parameters:Object.assign(e,{width:r,height:o,depth:i,radius:a,segments:Math.round(e.segments),pathSegments:Math.round(e.pathSegments),cornerSegments:Math.round(e.cornerSegments)})}}static build(n){let{width:t,height:e,depth:r,radius:o,revolutions:i,segments:a,pathRadius:s,pathType:l,pathSegments:u,cornerRadius:c,cornerSegments:d}=n.parameters,p=new Rl(!1,t,e,r,o,i,a,s,l,u,c,d);return Object.assign(p,{userData:{...n,type:"HelixGeometry"}})}},Cf=new vo.Uint32BufferAttribute([0,0,0],1),Rl=class extends vo.BufferGeometry{constructor(t=!0,e=1,r=1,o=1,i=1,a=1,s=1,l=1,u=1,c=1,d=1,p=1){if(super(),a===0)return;let f=t&&a===1;f&&(p=0),d>100&&(d=100),d===0&&(p=0);let h=()=>new vo.Vector3,m=new vo.Vector3,y=h(),g=h(),b=h(),w,A,S,P,O,x,D,N,T=h(),I=h(),E=h(),B=h(),R=h(),F=h(),V=h(),q=h(),k=r-2*l+.001,U=k/a,H=Math.ceil(s*a),Y=H+1,J=k/H,Z=-k/2,X=c+1,te=2*Math.PI/c,$=Math.PI/2/p,ee=.01,Q=Math.min((1-d/100)*l,l-ee),W=l-Q,ue=0,le=2,ne=p*le+le,ce=X*ne/le,ae=ce+X*Y,me=Math.max(0,X*(Y+ne)),[fe,he,xe]=[3,3,2].map(vt=>Array(me*vt).fill(0)),ye=[],C=i-l;function ie(vt,at){let co=Math.PI/2;x=at*J,N=2*Math.PI*(x%U)/U+co,x+=Z,D=Math.sin(N)*C,O=Math.cos(N)*C,t?vt.set(O,D,x):vt.set(O,x,D)}ie(m,-1e-10),ie(y,0),T.copy(m),ie(m,1);let Ve=m.distanceTo(y),He=f?0:W+Q,ze=Ve*H+2*He,Oe=Q,jt=ze-He;for(let vt=0;vt<=H;vt++){ie(g,vt),q.subVectors(g,T).normalize(),T.copy(g),F.copy(g).setComponent(+t+1,0).normalize(),V.crossVectors(q,F).normalize();let at=vt===0,co=vt===H,op=at?3*Math.PI/2:$,np=at?Oe:jt,bc=at?X:ae,mi=at?0:me-X,Tt=q.clone().multiplyScalar(at?-W:W).add(g),ip=q.clone().multiplyScalar(at?-1:1).normalize();for(let $r=0;$r<X;$r++){let ll=$r*te;if(I.addVectors(m.copy(F).multiplyScalar(l*Math.cos(ll)),y.copy(V).multiplyScalar(l*Math.sin(ll))),E.copy(I).normalize(),at||co){f||(ue=mi+$r,[0,1,2].forEach(fr=>{fe[ue*3+fr]=Tt.getComponent(fr),he[ue*3+fr]=ip.getComponent(fr)}),xe[ue*2]=+co,xe[ue*2+1]=$r/c),y.copy(E).multiplyScalar(Q),b.addVectors(g,y);for(let fr=0;fr<p;fr++){let yi=fr*$+op;B.addVectors(m.copy(q).multiplyScalar(W*Math.sin(yi)),y.copy(E).multiplyScalar(W*Math.cos(yi))),R.copy(B).normalize(),y.addVectors(b,B),B.normalize(),ue=bc+fr*X+$r,[0,1,2].forEach(Qi=>{fe[ue*3+Qi]=y.getComponent(Qi),he[ue*3+Qi]=R.getComponent(Qi)});let vc=+at+Math.sin(yi);xe[ue*2]=(np+W*vc)/ze,xe[ue*2+1]=$r/c}}y.addVectors(g,I),ue=ce+vt*X+$r,[0,1,2].forEach(fr=>{fe[ue*3+fr]=y.getComponent(fr),he[ue*3+fr]=E.getComponent(fr)}),xe[ue*2]=(He+vt*Ve)/ze,xe[ue*2+1]=$r/c}}let Ee=Y+2*p+le,zt=1,[Ut,hi]=[+f,Ee-1];for(let vt=Ut;vt<=hi-1;vt++){let at=f&&vt===hi-1;for(let co=0;co<X-1;co++)w=vt*X+co,A=w+1,S=(at?co:w)+X,P=(at?co+1:A)+X,vt===0?ye.push(A,P,S):vt===Ee-2?ye.push(w,A,S):ye.push(w,A,S,A,P,S)}this.setIndex(ye),this.setAttribute("position",new vo.Float32BufferAttribute(fe,3)),this.setAttribute("normal",new vo.Float32BufferAttribute(he,3)),this.setAttribute("uv",new vo.Float32BufferAttribute(xe,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t=this.userData.parameters,e=Math.ceil(t.tubularSegments),r=t.radialSegments+1,o=Array.from(this.getIndex().array),i,a,s,l,u=6*(e-1)*t.radialSegments,c=e,d=c===e;for(let p=0;p<t.radialSegments;p++)i=c*r+p,a=i+1,s=(d?p:i)+r,l=(d?p+1:a)+r,o[u++]=i,o[u++]=a,o[u++]=s,o[u++]=a,o[u++]=l,o[u++]=s;return o.length=u,Cf.array=o,Cf.count=o.length,Cf}};var Tx=require("three");var Mx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(n){let{width:t,height:e,depth:r,detail:o,corner:i,cornerSides:a}=n.parameters,s=o===0&&i!==0?new Vl(t*.5,i,a):new Tx.IcosahedronGeometry(t*.5,o);return s.scale(1,e/t,r/t),Object.assign(s,{userData:{...n,type:"IcosahedronGeometry"}})}},Vl=class extends qn{constructor(t=1,e=.2,r=4){let o=(1+Math.sqrt(5))/2,i=[-1,o,0,1,o,0,-1,-o,0,1,-o,0,0,-1,o,0,1,o,0,-1,-o,0,1,-o,o,0,-1,o,0,1,-o,0,-1,-o,0,1],a=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],s="IcosahedronGeometry";super(i,a,s,t,e,r),this.type=s}static fromJSON(t){return new Vl(t.radius,t.corner,t.cornerSides)}};var Wu=require("three"),Ix=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){(n.parameters?.points??[]).forEach(r=>{Array.isArray(r)&&(r.x=r[0],r.y=r[1])});let e=Object.assign({},t?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(n){let{points:t,segments:e,verticalSegments:r}=n.parameters,o=new Wu.Shape;o.moveTo(t[0].x,t[0].y),o.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let i=new Wu.LatheGeometry(o.extractPoints(r).shape,e);return i.rotateZ(Math.PI),Object.assign(i,{userData:{...n,type:"LatheGeometry"}})}};var Fo=require("three");var hn=require("three");var pe=require("three"),Go=new pe.Matrix4,Tf=new pe.Object3D,$u=new pe.Vector3,Xn=class extends pe.EventDispatcher{constructor(){super(),this.uuid=pe.MathUtils.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(t){let e=new pe.Matrix3().getNormalMatrix(t);for(let r=0,o=this.vertices.length;r<o;r++)this.vertices[r].applyMatrix4(t);for(let r=0,o=this.faces.length;r<o;r++){let i=this.faces[r];i.normal.applyMatrix3(e).normalize();for(let a=0,s=i.vertexNormals.length;a<s;a++)i.vertexNormals[a].applyMatrix3(e).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(t){return Go.makeRotationX(t),this.applyMatrix4(Go),this}rotateY(t){return Go.makeRotationY(t),this.applyMatrix4(Go),this}rotateZ(t){return Go.makeRotationZ(t),this.applyMatrix4(Go),this}translate(t,e,r){return Go.makeTranslation(t,e,r),this.applyMatrix4(Go),this}scale(t,e,r){return Go.makeScale(t,e,r),this.applyMatrix4(Go),this}lookAt(t){return Tf.lookAt(t),Tf.updateMatrix(),this.applyMatrix4(Tf.matrix),this}fromBufferGeometry(t){let e=this,r=t.index!==null?t.index:void 0,o=t.attributes;if(o.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let i=o.position,a=o.normal,s=o.color,l=o.uv,u=o.uv2;u!==void 0&&(this.faceVertexUvs[1]=[]);for(let p=0;p<i.count;p++)e.vertices.push(new pe.Vector3().fromBufferAttribute(i,p)),s!==void 0&&e.colors.push(new pe.Color().fromBufferAttribute(s,p));function c(p,f,h,m){let y=s===void 0?[]:[e.colors[p].clone(),e.colors[f].clone(),e.colors[h].clone()],g=a===void 0?[]:[new pe.Vector3().fromBufferAttribute(a,p),new pe.Vector3().fromBufferAttribute(a,f),new pe.Vector3().fromBufferAttribute(a,h)],b=new os(p,f,h,g,y,m);e.faces.push(b),l!==void 0&&e.faceVertexUvs[0].push([new pe.Vector2().fromBufferAttribute(l,p),new pe.Vector2().fromBufferAttribute(l,f),new pe.Vector2().fromBufferAttribute(l,h)]),u!==void 0&&e.faceVertexUvs[1].push([new pe.Vector2().fromBufferAttribute(u,p),new pe.Vector2().fromBufferAttribute(u,f),new pe.Vector2().fromBufferAttribute(u,h)])}let d=t.groups;if(d.length>0)for(let p=0;p<d.length;p++){let f=d[p],h=f.start,m=f.count;for(let y=h,g=h+m;y<g;y+=3)r!==void 0?c(r.getX(y),r.getX(y+1),r.getX(y+2),f.materialIndex):c(y,y+1,y+2,f.materialIndex)}else if(r!==void 0)for(let p=0;p<r.count;p+=3)c(r.getX(p),r.getX(p+1),r.getX(p+2));else for(let p=0;p<i.count;p+=3)c(p,p+1,p+2);return this.computeFaceNormals(),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter($u).negate(),this.translate($u.x,$u.y,$u.z),this}normalize(){this.computeBoundingSphere();let t=this.boundingSphere.center,e=this.boundingSphere.radius,r=e===0?1:1/e,o=new pe.Matrix4;return o.set(r,0,0,-r*t.x,0,r,0,-r*t.y,0,0,r,-r*t.z,0,0,0,1),this.applyMatrix4(o),this}computeFaceNormals(){let t=new pe.Vector3,e=new pe.Vector3;for(let r=0,o=this.faces.length;r<o;r++){let i=this.faces[r],a=this.vertices[i.a],s=this.vertices[i.b],l=this.vertices[i.c];t.subVectors(l,s),e.subVectors(a,s),t.cross(e),t.normalize(),i.normal.copy(t)}}computeVertexNormals(t=!0){let e=new Array(this.vertices.length);for(let r=0,o=this.vertices.length;r<o;r++)e[r]=new pe.Vector3;if(t){let r=new pe.Vector3,o=new pe.Vector3;for(let i=0,a=this.faces.length;i<a;i++){let s=this.faces[i],l=this.vertices[s.a],u=this.vertices[s.b],c=this.vertices[s.c];r.subVectors(c,u),o.subVectors(l,u),r.cross(o),e[s.a].add(r),e[s.b].add(r),e[s.c].add(r)}}else{this.computeFaceNormals();for(let r=0,o=this.faces.length;r<o;r++){let i=this.faces[r];e[i.a].add(i.normal),e[i.b].add(i.normal),e[i.c].add(i.normal)}}for(let r=0,o=this.vertices.length;r<o;r++)e[r].normalize();for(let r=0,o=this.faces.length;r<o;r++){let i=this.faces[r],a=i.vertexNormals;a.length===3?(a[0].copy(e[i.a]),a[1].copy(e[i.b]),a[2].copy(e[i.c])):(a[0]=e[i.a].clone(),a[1]=e[i.b].clone(),a[2]=e[i.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let t=0,e=this.faces.length;t<e;t++){let r=this.faces[t],o=r.vertexNormals;o.length===3?(o[0].copy(r.normal),o[1].copy(r.normal),o[2].copy(r.normal)):(o[0]=r.normal.clone(),o[1]=r.normal.clone(),o[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let e=0,r=this.faces.length;e<r;e++){let o=this.faces[e];o.__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]);for(let i=0,a=o.vertexNormals.length;i<a;i++)o.__originalVertexNormals[i]?o.__originalVertexNormals[i].copy(o.vertexNormals[i]):o.__originalVertexNormals[i]=o.vertexNormals[i].clone()}let t=new Xn;t.faces=this.faces;for(let e=0,r=this.morphTargets.length;e<r;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];let i=this.morphNormals[e].faceNormals,a=this.morphNormals[e].vertexNormals;for(let s=0,l=this.faces.length;s<l;s++){let u=new pe.Vector3,c={a:new pe.Vector3,b:new pe.Vector3,c:new pe.Vector3};i.push(u),a.push(c)}}let o=this.morphNormals[e];t.vertices=this.morphTargets[e].vertices,t.computeFaceNormals(),t.computeVertexNormals();for(let i=0,a=this.faces.length;i<a;i++){let s=this.faces[i],l=o.faceNormals[i],u=o.vertexNormals[i];l.copy(s.normal),u.a.copy(s.vertexNormals[0]),u.b.copy(s.vertexNormals[1]),u.c.copy(s.vertexNormals[2])}}for(let e=0,r=this.faces.length;e<r;e++){let o=this.faces[e];o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pe.Box3),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new pe.Sphere),this.boundingSphere.setFromPoints(this.vertices)}merge(t,e,r=0){if(!(t&&t.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);return}let o,i=this.vertices.length,a=this.vertices,s=t.vertices,l=this.faces,u=t.faces,c=this.colors,d=t.colors;e!==void 0&&(o=new pe.Matrix3().getNormalMatrix(e));for(let p=0,f=s.length;p<f;p++){let m=s[p].clone();e!==void 0&&m.applyMatrix4(e),a.push(m)}for(let p=0,f=d.length;p<f;p++)c.push(d[p].clone());for(let p=0,f=u.length;p<f;p++){let h=u[p],m,y,g=h.vertexNormals,b=h.vertexColors,w=new os(h.a+i,h.b+i,h.c+i);w.normal.copy(h.normal),o!==void 0&&w.normal.applyMatrix3(o).normalize();for(let A=0,S=g.length;A<S;A++)m=g[A].clone(),o!==void 0&&m.applyMatrix3(o).normalize(),w.vertexNormals.push(m);w.color.copy(h.color);for(let A=0,S=b.length;A<S;A++)y=b[A],w.vertexColors.push(y.clone());w.materialIndex=h.materialIndex+r,l.push(w)}for(let p=0,f=t.faceVertexUvs.length;p<f;p++){let h=t.faceVertexUvs[p];this.faceVertexUvs[p]===void 0&&(this.faceVertexUvs[p]=[]);for(let m=0,y=h.length;m<y;m++){let g=h[m],b=[];for(let w=0,A=g.length;w<A;w++)b.push(g[w].clone());this.faceVertexUvs[p].push(b)}}}mergeMesh(t){if(!(t&&t.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t);return}t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)}mergeVertices(t=4){let e={},r=[],o=[],i=Math.pow(10,t);for(let l=0,u=this.vertices.length;l<u;l++){let c=this.vertices[l],d=Math.round(c.x*i)+"_"+Math.round(c.y*i)+"_"+Math.round(c.z*i);e[d]===void 0?(e[d]=l,r.push(this.vertices[l]),o[l]=r.length-1):o[l]=o[e[d]]}let a=[];for(let l=0,u=this.faces.length;l<u;l++){let c=this.faces[l];c.a=o[c.a],c.b=o[c.b],c.c=o[c.c];let d=[c.a,c.b,c.c];for(let p=0;p<3;p++)if(d[p]===d[(p+1)%3]){a.push(l);break}}for(let l=a.length-1;l>=0;l--){let u=a[l];this.faces.splice(u,1);for(let c=0,d=this.faceVertexUvs.length;c<d;c++)this.faceVertexUvs[c].splice(u,1)}let s=this.vertices.length-r.length;return this.vertices=r,s}setFromPoints(t){this.vertices=[];for(let e=0,r=t.length;e<r;e++){let o=t[e];this.vertices.push(new pe.Vector3(o.x,o.y,o.z||0))}return this}sortFacesByMaterialIndex(){let t=this.faces,e=t.length;for(let l=0;l<e;l++)t[l]._id=l;function r(l,u){return l.materialIndex-u.materialIndex}t.sort(r);let o=this.faceVertexUvs[0],i=this.faceVertexUvs[1],a,s;o&&o.length===e&&(a=[]),i&&i.length===e&&(s=[]);for(let l=0;l<e;l++){let u=t[l]._id;a&&a.push(o[u]),s&&s.push(i[u])}a&&(this.faceVertexUvs[0]=a),s&&(this.faceVertexUvs[1]=s)}toJSON(){let t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.parameters!==void 0){let h=this.parameters;for(let m in h)h[m]!==void 0&&(t[m]=h[m]);return t}let e=[];for(let h=0;h<this.vertices.length;h++){let m=this.vertices[h];e.push(m.x,m.y,m.z)}let r=[],o=[],i={},a=[],s={},l=[],u={};for(let h=0;h<this.faces.length;h++){let m=this.faces[h],y=!0,g=!1,b=this.faceVertexUvs[0][h]!==void 0,w=m.normal.length()>0,A=m.vertexNormals.length>0,S=m.color.r!==1||m.color.g!==1||m.color.b!==1,P=m.vertexColors.length>0,O=0;if(O=c(O,0,0),O=c(O,1,y),O=c(O,2,g),O=c(O,3,b),O=c(O,4,w),O=c(O,5,A),O=c(O,6,S),O=c(O,7,P),r.push(O),r.push(m.a,m.b,m.c),r.push(m.materialIndex),b){let x=this.faceVertexUvs[0][h];r.push(f(x[0]),f(x[1]),f(x[2]))}if(w&&r.push(d(m.normal)),A){let x=m.vertexNormals;r.push(d(x[0]),d(x[1]),d(x[2]))}if(S&&r.push(p(m.color)),P){let x=m.vertexColors;r.push(p(x[0]),p(x[1]),p(x[2]))}}function c(h,m,y){return y?h|1<<m:h&~(1<<m)}function d(h){let m=h.x.toString()+h.y.toString()+h.z.toString();return i[m]!==void 0||(i[m]=o.length/3,o.push(h.x,h.y,h.z)),i[m]}function p(h){let m=h.r.toString()+h.g.toString()+h.b.toString();return s[m]!==void 0||(s[m]=a.length,a.push(h.getHex())),s[m]}function f(h){let m=h.x.toString()+h.y.toString();return u[m]!==void 0||(u[m]=l.length/2,l.push(h.x,h.y)),u[m]}return t.data={},t.data.vertices=e,t.data.normals=o,a.length>0&&(t.data.colors=a),l.length>0&&(t.data.uvs=[l]),t.data.faces=r,t}clone(){return new Xn().copy(this)}copy(t){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;let e=t.vertices;for(let p=0,f=e.length;p<f;p++)this.vertices.push(e[p].clone());let r=t.colors;for(let p=0,f=r.length;p<f;p++)this.colors.push(r[p].clone());let o=t.faces;for(let p=0,f=o.length;p<f;p++)this.faces.push(o[p].clone());for(let p=0,f=t.faceVertexUvs.length;p<f;p++){let h=t.faceVertexUvs[p];this.faceVertexUvs[p]===void 0&&(this.faceVertexUvs[p]=[]);for(let m=0,y=h.length;m<y;m++){let g=h[m],b=[];for(let w=0,A=g.length;w<A;w++){let S=g[w];b.push(S.clone())}this.faceVertexUvs[p].push(b)}}let i=t.morphTargets;for(let p=0,f=i.length;p<f;p++){let h={};if(h.name=i[p].name,i[p].vertices!==void 0){h.vertices=[];for(let m=0,y=i[p].vertices.length;m<y;m++)h.vertices.push(i[p].vertices[m].clone())}if(i[p].normals!==void 0){h.normals=[];for(let m=0,y=i[p].normals.length;m<y;m++)h.normals.push(i[p].normals[m].clone())}this.morphTargets.push(h)}let a=t.morphNormals;for(let p=0,f=a.length;p<f;p++){let h={};if(a[p].vertexNormals!==void 0){h.vertexNormals=[];for(let m=0,y=a[p].vertexNormals.length;m<y;m++){let g=a[p].vertexNormals[m],b={};b.a=g.a.clone(),b.b=g.b.clone(),b.c=g.c.clone(),h.vertexNormals.push(b)}}if(a[p].faceNormals!==void 0){h.faceNormals=[];for(let m=0,y=a[p].faceNormals.length;m<y;m++)h.faceNormals.push(a[p].faceNormals[m].clone())}this.morphNormals.push(h)}let s=t.skinWeights;for(let p=0,f=s.length;p<f;p++)this.skinWeights.push(s[p].clone());let l=t.skinIndices;for(let p=0,f=l.length;p<f;p++)this.skinIndices.push(l[p].clone());let u=t.lineDistances;for(let p=0,f=u.length;p<f;p++)this.lineDistances.push(u[p]);let c=t.boundingBox;c!==null&&(this.boundingBox=c.clone());let d=t.boundingSphere;return d!==null&&(this.boundingSphere=d.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}toBufferGeometry(){let t=new Mf().fromGeometry(this),e=new pe.BufferGeometry,r=new Float32Array(t.vertices.length*3);if(e.setAttribute("position",Yu.call(new pe.BufferAttribute(r,3),t.vertices)),t.normals.length>0){let o=new Float32Array(t.normals.length*3);e.setAttribute("normal",Yu.call(new pe.BufferAttribute(o,3),t.normals))}if(t.colors.length>0){let o=new Float32Array(t.colors.length*3);e.setAttribute("color",Nx.call(new pe.BufferAttribute(o,3),t.colors))}if(t.uvs.length>0){let o=new Float32Array(t.uvs.length*2);e.setAttribute("uv",Dx.call(new pe.BufferAttribute(o,2),t.uvs))}if(t.uvs2.length>0){let o=new Float32Array(t.uvs2.length*2);e.setAttribute("uv2",Dx.call(new pe.BufferAttribute(o,2),t.uvs2))}e.groups=t.groups;for(let o in t.morphTargets){let i=[],a=t.morphTargets[o];for(let s=0,l=a.length;s<l;s++){let u=a[s],c=new pe.Float32BufferAttribute(u.data.length*3,3);c.name=u.name,i.push(Yu.call(c,u.data))}e.morphAttributes[o]=i}if(t.skinIndices.length>0){let o=new pe.Float32BufferAttribute(t.skinIndices.length*4,4);e.setAttribute("skinIndex",Ex.call(o,t.skinIndices))}if(t.skinWeights.length>0){let o=new pe.Float32BufferAttribute(t.skinWeights.length*4,4);e.setAttribute("skinWeight",Ex.call(o,t.skinWeights))}return t.boundingSphere!==null&&(e.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(e.boundingBox=t.boundingBox.clone()),e}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(t){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(t){let e=new pe.BufferGeometry,r=t.geometry;if(t.isPoints||t.isLine){let o=new pe.Float32BufferAttribute(r.vertices.length*3,3),i=new pe.Float32BufferAttribute(r.colors.length*3,3);if(e.setAttribute("position",Yu.call(o,r.vertices)),e.setAttribute("color",Nx.call(i,r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let a=new pe.Float32BufferAttribute(r.lineDistances.length,1);e.setAttribute("lineDistance",FT.call(a,r.lineDistances))}r.boundingSphere!==null&&(e.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(e.boundingBox=r.boundingBox.clone())}else t.isMesh&&(e=r.toBufferGeometry());return e}};Xn.prototype.isGeometry=!0;var Mf=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(t){let e=[],r,o,i,a=t.faces;for(o=0;o<a.length;o++){let s=a[o];s.materialIndex!==i&&(i=s.materialIndex,r!==void 0&&(r.count=o*3-r.start,e.push(r)),r={start:o*3,materialIndex:i})}r!==void 0&&(r.count=o*3-r.start,e.push(r)),this.groups=e}fromGeometry(t){let e=t.faces,r=t.vertices,o=t.faceVertexUvs,i=o[0]&&o[0].length>0,a=o[1]&&o[1].length>0,s=t.morphTargets,l=s.length,u;if(l>0){u=[];for(let g=0;g<l;g++)u[g]={name:s[g].name,data:[]};this.morphTargets.position=u}let c=t.morphNormals,d=c.length,p;if(d>0){p=[];for(let g=0;g<d;g++)p[g]={name:c[g].name,data:[]};this.morphTargets.normal=p}let f=t.skinIndices,h=t.skinWeights,m=f.length===r.length,y=h.length===r.length;r.length>0&&e.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;g<e.length;g++){let b=e[g];this.vertices.push(r[b.a],r[b.b],r[b.c]);let w=b.vertexNormals;if(w.length===3)this.normals.push(w[0],w[1],w[2]);else{let S=b.normal;this.normals.push(S,S,S)}let A=b.vertexColors;if(A.length===3)this.colors.push(A[0],A[1],A[2]);else{let S=b.color;this.colors.push(S,S,S)}if(i===!0){let S=o[0][g];S!==void 0?this.uvs.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",g),this.uvs.push(new pe.Vector2,new pe.Vector2,new pe.Vector2))}if(a===!0){let S=o[1][g];S!==void 0?this.uvs2.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",g),this.uvs2.push(new pe.Vector2,new pe.Vector2,new pe.Vector2))}for(let S=0;S<l;S++){let P=s[S].vertices;u[S].data.push(P[b.a],P[b.b],P[b.c])}for(let S=0;S<d;S++){let P=c[S].vertexNormals[g];p[S].data.push(P.a,P.b,P.c)}m&&this.skinIndices.push(f[b.a],f[b.b],f[b.c]),y&&this.skinWeights.push(h[b.a],h[b.b],h[b.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),this}},os=class{constructor(t,e,r,o,i,a=0){this.a=t,this.b=e,this.c=r,this.normal=o&&o.isVector3?o:new pe.Vector3,this.vertexNormals=Array.isArray(o)?o:[],this.color=i&&i.isColor?i:new pe.Color,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=a}clone(){return new this.constructor().copy(this)}copy(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(let e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(let e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}};function FT(n){return this.array.set(n),this}function Nx(n){let t=this.array,e=0;for(let r=0,o=n.length;r<o;r++){let i=n[r];i===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new pe.Color),t[e++]=i.r,t[e++]=i.g,t[e++]=i.b}return this}function Dx(n){let t=this.array,e=0;for(let r=0,o=n.length;r<o;r++){let i=n[r];i===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new pe.Vector2),t[e++]=i.x,t[e++]=i.y}return this}function Yu(n){let t=this.array,e=0;for(let r=0,o=n.length;r<o;r++){let i=n[r];i===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new pe.Vector3),t[e++]=i.x,t[e++]=i.y,t[e++]=i.z}return this}function Ex(n){let t=this.array,e=0;for(let r=0,o=n.length;r<o;r++){let i=n[r];i===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new pe.Vector4),t[e++]=i.x,t[e++]=i.y,t[e++]=i.z,t[e++]=i.w}return this}var kT=["a","b","c"];function jT(n,t){switch(t){case"c":return n.c;case"b":return n.b;case"a":default:return n.a}}function If(n,t,e){let r=Math.min(n,t),o=Math.max(n,t),i=r+"_"+o;return e.get(i)}function Nf(n,t,e,r,o,i){let a=Math.min(n,t),s=Math.max(n,t),l=a+"_"+s,u;if(r.has(l))u=r.get(l);else{let c=e[a],d=e[s];u={a:c,b:d,newEdge:null,faces:[]},r.set(l,u)}u.faces.push(o),i[n].edges.push(u),i[t].edges.push(u)}function UT(n,t,e,r){let o,i,a;for(o=0,i=n.length;o<i;o++)e[o]={edges:[]};for(o=0,i=t.length;o<i;o++)a=t[o],Nf(a.a,a.b,n,r,a,e),Nf(a.b,a.c,n,r,a,e),Nf(a.c,a.a,n,r,a,e)}function Xu(n,t,e,r,o){n.push(new os(t,e,r,void 0,void 0,o))}function ns(n,t){return Math.abs(t-n)/2+Math.min(n,t)}function Qu(n,t,e,r){n.push([t.clone(),e.clone(),r.clone()])}var Ku=class{constructor(t=1){this.subdivisions=t}modify(t){t instanceof hn.BufferGeometry?t=new Xn().fromBufferGeometry(t):t=t.clone(),t.mergeVertices();let e=this.subdivisions;for(;e-- >0;)this._smooth(t);return t.computeFaceNormals(),t.computeVertexNormals(),t}_smooth(t){let e=new hn.Vector3,r,o,i,a,s,l=t.vertices,u=t.faces,c=t.faceVertexUvs[0],d=c!==void 0&&c.length>0,p=[],f=new Map;UT(l,u,p,f);let h=[],m,y,g,b,w,A,S;for(let ee of Array.from(f.keys())){for(y=f.get(ee),g=new hn.Vector3,w=3/8,A=1/8,S=y.faces.length,S!=2&&(w=.5,A=0,S!=1),g.addVectors(y.a,y.b).multiplyScalar(w),e.set(0,0,0),a=0;a<S;a++){for(b=y.faces[a],s=0;s<3&&(m=l[jT(b,kT[s])],!(m!==y.a&&m!==y.b));s++);m&&e.add(m)}e.multiplyScalar(A),g.add(e),y.newEdge=h.length,h.push(g)}let P,O,x,D,N,T,I,E=[];for(o=0,i=l.length;o<i;o++){for(T=l[o],N=p[o].edges,r=N.length,r==3?P=3/16:r>3&&(P=3/(8*r)),O=1-r*Number(P),x=P,r<=2&&(r==2?(O=3/4,x=1/8):r==1||r==0),I=T.clone().multiplyScalar(O),e.set(0,0,0),a=0;a<r;a++)D=N[a],m=D.a!==T?D.a:D.b,e.add(m);e.multiplyScalar(Number(x)),I.add(e),E.push(I)}let B=E.concat(h),R=E.length,F,V,q,k=[],U=[],H,Y,J,Z,X=new hn.Vector2,te=new hn.Vector2,$=new hn.Vector2;for(o=0,i=u.length;o<i;o++)b=u[o],F=Number(If(b.a,b.b,f).newEdge)+R,V=Number(If(b.b,b.c,f).newEdge)+R,q=Number(If(b.c,b.a,f).newEdge)+R,Xu(k,F,V,q,b.materialIndex),Xu(k,b.a,F,q,b.materialIndex),Xu(k,b.b,V,F,b.materialIndex),Xu(k,b.c,q,V,b.materialIndex),d&&(H=c[o],Y=H[0],J=H[1],Z=H[2],X.set(ns(Y.x,J.x),ns(Y.y,J.y)),te.set(ns(J.x,Z.x),ns(J.y,Z.y)),$.set(ns(Y.x,Z.x),ns(Y.y,Z.y)),Qu(U,X,te,$),Qu(U,Y,X,$),Qu(U,J,te,X),Qu(U,Z,$,te));t.vertices=B,t.faces=k,d&&(t.faceVertexUvs[0]=U)}};var Wt=new Fo.Vector3,Bx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=n.geometry??t?.geometry??new Fo.BufferGeometry().copy(new Fo.BoxGeometry(100,100,100)),r;t===void 0?(e.computeBoundingBox(),e.boundingBox.getSize(Wt),r={width:Wt.x,height:Wt.y,depth:Wt.z,subdivisions:0}):r=t.parameters;let o={...r,...n.parameters};return{parameters:{width:Math.abs(o.width),height:Math.abs(o.height),depth:Math.abs(o.depth),subdivisions:Math.abs(o.subdivisions)},geometry:e}}static build(n){let{width:t,height:e,depth:r,subdivisions:o}=n.parameters,i=n.geometry??new Fo.BufferGeometry().copy(new Fo.BoxGeometry(100,100,100)),a=i.userData.parameters;a===void 0?(i.computeBoundingBox(),i.boundingBox.getSize(Wt)):Wt.set(a.width,a.height,a.depth),(t!==Wt.x||e!==Wt.y||r!==Wt.z)&&i.scale(Wt.x===0?1:t/Wt.x,Wt.y===0?1:e/Wt.y,Wt.z===0?1:r/Wt.z);let s=i.originalGeometry;try{o>0?(s===void 0||a?.subdivisions!==o)&&(s===void 0&&(s=i),i=new Ku(o).modify(s).toBufferGeometry()):(s!==void 0&&(i=s),s=void 0,i.getAttribute("normal")===void 0&&i.computeVertexNormals())}catch{s!==void 0&&(i=s),s=void 0,i.getAttribute("normal")===void 0&&i.computeVertexNormals()}return s!==void 0&&Object.assign(i,{originalGeometry:s}),delete n.geometry,Object.assign(i,{userData:{...n,type:"NonParametricGeometry"}})}static loadFromUrl(n,t,e){new Fo.BufferGeometryLoader(e).load(n,o=>{let i=this.normalizeInputs({geometry:o});o.boundingBox.getSize(Wt);let a=100/Wt.x;Object.assign(i.parameters,{width:100,height:Wt.y*a,depth:Wt.z*a}),t(this.build(i))})}};var Zu=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},n.parameters);return{shape:n.shape&&n.shape instanceof Qe?n.shape:new Qe,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(n){let{width:t,height:e,spikes:r,cornerRadius:o,depth:i,extrudeBevelSize:a,extrudeBevelSegments:s}=n.parameters,l=n.shape,u=t*.5,c=e*.5,d=0,p=0,f=2*Math.PI/r;for(let m=0;m<r;m++){let y=f*m,g=d+Math.sin(y)*u,b=p+Math.cos(y)*c;l.addPoint(l.createPoint(g,b))}l.isClosed=!0;for(let m=0,y=l.points.length;m<y;m++)l.points[m].roundness=o;l.roundness=o,l.update();let h=Mr.create({shape:l,parameters:{roundness:o,depth:i,extrudeBevelSize:a,extrudeBevelSegments:s}});return Object.assign(h,{userData:{...n,type:"PolygonGeometry"}})}};var We=require("three"),Lx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(n){let{width:t,height:e,depth:r,radialSegments:o,heightSegments:i,openEnded:a,cornerRadius:s,cornerSegments:l}=n.parameters,u=new Ef(t*.5,e,o,i,a,s,l);return u.scale(1,1,r/t),Object.assign(u,{userData:{...n,type:"PyramidGeometry"}})}};function zl(n,t,e){e.x=n.x*t.x,e.y=n.y,e.z=n.x*t.y}function Df(n,t,e,r,o,i){let a=t.clone().sub(n),s=e.clone().sub(n),l=a.angleTo(s);if(a.normalize(),s.normalize(),r===o){let u=a.add(s).normalize();i.copy(n).addScaledVector(u,r/Math.sin(l/2))}else{let u=a.angleTo(s);i.copy(n),i.addScaledVector(a,o/Math.sin(u)),i.addScaledVector(s,r/Math.sin(u))}}function HT(n,t,e){let r=n.clone().sub(t),o=e.clone().sub(t);return r.projectOnVector(o),r.add(t)}var Ef=class extends We.BufferGeometry{constructor(t=.5,e=1,r=4,o=1,i=!1,a=0,s=4){super(),r=Math.floor(Math.max(3,r)),o=Math.floor(o),s=Math.floor(s);let l=[],u=[],c=[],d=[],p=0,f=e/2,h=Math.PI/r,m=t*Math.cos(Math.PI/r),y=2*Math.PI/r,g=(r-2)*Math.PI/r,b=Math.PI-g,w=new We.Vector3(0,-f,0),A=new We.Vector3(0,f,0),S=new We.Vector2(t,-f),P=new We.Vector2(m,-f),O=new We.Vector2(0,A.y).sub(P),x=new We.Vector2(0,A.y).sub(S),D=new We.Vector2(O.y,-O.x).normalize(),N=new We.Vector2(x.y,-x.x).normalize(),I=t*Math.cos(Math.PI/r)*Math.tan((Math.PI-O.angle())/2)-1e-8;a=Math.min(a,I);let E;{let U=new We.Vector3(D.x,D.y,0),H=new We.Vector3(Math.cos(y)*U.x,U.y,Math.sin(y)*U.x);E=U.angleTo(H)}let B=a/Math.tan((Math.PI-O.angle())/2),R=a/Math.tan((Math.PI-E)/2),F=new We.Vector3;if(!i){u.push(w.x,w.y,w.z),c.push(0,-1,0),d.push(0,0);let U=p++,H=[],Y=S.clone(),J=B/Math.cos(Math.PI/r);Y.x-=J;for(let Z=0;Z<r;Z++){let X=Z/r*Math.PI*2+h,te=new We.Vector2(Math.sin(X),Math.cos(X));zl(Y,te,F),u.push(F.x,F.y,F.z),c.push(0,-1,0),d.push(0,0),H.push(p++)}for(let Z=0;Z<H.length;Z++)l.push(H[Z],U,H[(Z+1)%H.length])}let V=[];{let U=new We.Vector3,H=new We.Vector3,Y=new We.Vector3,J=new We.Vector3,Z=new We.Vector3,X=new We.Vector3;for(let te=0;te<r;te++){let $=te/r*Math.PI*2+h,ee=(te+.5)/r*Math.PI*2+h,Q=(te+1)/r*Math.PI*2+h,W=new We.Vector2(Math.sin($),Math.cos($)),ue=new We.Vector2(Math.sin(ee),Math.cos(ee)),le=new We.Vector2(Math.sin(Q),Math.cos(Q));zl(S,W,H),zl(S,le,Y),zl(D,ue,U),Df(A,H,Y,R,R,J),u.push(J.x,J.y,J.z),Df(H,A,Y,R,B,Z),u.push(Z.x,Z.y,Z.z),Df(Y,H,A,B,R,X),u.push(X.x,X.y,X.z),c.push(U.x,U.y,U.z),c.push(U.x,U.y,U.z),c.push(U.x,U.y,U.z),d.push(0,0),d.push(0,0),d.push(0,0);let ne=p++,ce=p++,ae=p++;if(l.push(ne,ce,ae),a>0){{let he=H.clone().add(Y).multiplyScalar(.5),xe=A.clone().sub(he).normalize(),C=w.clone().sub(he).normalize().add(xe).normalize().multiplyScalar(-1),ie=X.clone().sub(Z);q(he,ie,C,O.angle())}let me,fe;{let he=new We.Vector3;zl(N,le,he);let xe=X.clone().add(J).multiplyScalar(.5);xe=HT(xe,Y,A);let ye=X.clone().sub(J);[me,fe]=q(xe,ye,he,E,J.y)}{let he=me,xe=he.clone().setY(0).normalize(),ye=new We.Vector3(0,-1,0),C=xe.clone().cross(ye);k(he,xe,ye,C)}V.concat(fe);{let he=O.angle(),xe=Math.PI-he,ye=A.clone();ye.y-=a/Math.sin(he-Math.PI/2);let C=new We.Vector3,ie=[];for(let He=0;He<s;He++){let ze=[],Oe=Math.PI/2-xe*He/s,jt=Math.cos(Oe),Ee=Math.sin(Oe),zt=ee;for(let Ut=0;Ut<=He;Ut++){let hi=Math.cos(zt),vt=Math.sin(zt);U.x=jt*vt,U.y=Ee,U.z=jt*hi,C.copy(ye).addScaledVector(U,a),u.push(C.x,C.y,C.z),c.push(U.x,U.y,U.z),d.push(0,0),ze.push(p++),zt+=Math.PI*2/He/r}ie.push(ze)}fe.reverse(),ie.push(fe);let Ve=ie.length-1;for(let He=0;He<Ve;He++){let ze=ie[He],Oe=ie[He+1],jt=ze.length-1;l.push(Oe[1],ze[0],Oe[0]);for(let Ee=1;Ee<=jt;Ee++)l.push(ze[Ee],ze[Ee-1],Oe[Ee]),l.push(Oe[Ee+1],ze[Ee],Oe[Ee])}}}}}this.setIndex(l),this.setAttribute("position",new We.Float32BufferAttribute(u,3)),this.setAttribute("normal",new We.Float32BufferAttribute(c,3)),this.setAttribute("uv",new We.Float32BufferAttribute(d,2));function q(U,H,Y,J,Z){let X=-J/2,te=(Math.PI-J)/2,$=H.clone().normalize().cross(Y);U.addScaledVector(Y,-a/Math.sin(te));let ee=new We.Vector3,Q=new We.Vector3,W=1,ue=p,le=[];for(let ne=0;ne<=s;ne++){let ce=X+ne/s*J;Q.set(0,0,0),Q.addScaledVector($,Math.sin(ce)),Q.addScaledVector(Y,Math.cos(ce));for(let ae=0;ae<=W;ae++){let me=ae/W-.5;if(ee.copy(U),ee.addScaledVector(H,me),ee.addScaledVector(Q,a),Z!=null){let fe=Math.max(0,ee.y-Z);ee.addScaledVector(H,-fe/H.y)}u.push(ee.x,ee.y,ee.z),c.push(Q.x,Q.y,Q.z),d.push(0,0),ae===0&&le.push(p),p++}}for(let ne=0;ne<s;ne++)for(let ce=0;ce<W;ce++){let ae=ue+ce+(W+1)*ne,me=ae+(W+1),fe=me+1,he=ae+1;l.push(ae,me,he),l.push(me,fe,he)}return[U.clone().addScaledVector(H,.5),le]}function k(U,H,Y,J){let Z=Math.PI/2,X=x.angle()-Z,te=[],$=new We.Vector3,ee=new We.Vector3;for(let W=0;W<=s;W++){let ue=[],le=W/s;for(let ne=0;ne<=W;ne++){let ae=((W?ne/W:0)-.5)*b,me=Math.cos(ae),fe=Math.sin(ae),he=Math.atan(Math.tan(X)*me),xe=(Z+he)*le,ye=Math.cos(xe),C=Math.sin(xe);$.set(0,0,0),$.addScaledVector(H,C*me),$.addScaledVector(Y,ye),$.addScaledVector(J,C*fe),ee.copy(U).addScaledVector($,a),u.push(ee.x,ee.y,ee.z),c.push($.x,$.y,$.z),d.push(0,0),ue.push(p++)}te.push(ue)}let Q=te.length-1;for(let W=0;W<Q;W++){let ue=te[W],le=te[W+1],ne=ue.length-1;l.push(ue[0],le[1],le[0]);for(let ce=1;ce<=ne;ce++)l.push(ue[ce-1],ue[ce],le[ce]),l.push(ue[ce],le[ce+1],le[ce])}}}};var is=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},n.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},n.ui);return{shape:n.shape&&n.shape instanceof Qe?n.shape:new Qe,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)}),ui:r}}static build(n){let t=n.shape,{width:e,height:r,cornerRadius:o,cornerType:i,depth:a,extrudeBevelSize:s,extrudeBevelSegments:l}=n.parameters,u={x:e*.5,y:r*.5},c={x:-u.x,y:-u.y},d={x:u.x,y:u.y};function p(A,S,P){return S>e&&P>r?Math.min(A*e/S,A*r/P):S>e?A*e/S:P>r?A*r/P:A}let f=[];f[0]=o[0]===0?0:p(o[0],o[0]+o[3],o[0]+o[1]),f[1]=o[1]===0?0:p(o[1],o[1]+o[2],o[1]+o[0]),f[2]=o[2]===0?0:p(o[2],o[2]+o[1],o[2]+o[3]),f[3]=o[3]===0?0:p(o[3],o[3]+o[0],o[3]+o[2]);let h=c.x,m=d.x,y=d.y,g=c.y;t.addPoint(t.createPoint(h,y)),t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(m,g)),t.addPoint(t.createPoint(h,g)),t.isClosed=!0;let b=!0;for(let A=0,S=t.points.length;A<S;A++)t.points[A].roundness=f[A],A>0&&f[A]!==f[A-1]&&(b=!1);b&&(t.roundness=f[0]),t.useCubicForRoundedCorners=i!==1,t.update();let w=Mr.create({shape:t,parameters:{depth:a,extrudeBevelSize:s,extrudeBevelSegments:l}});return Object.assign(w,{userData:{...n,type:"RectangleGeometry"}})}};var mn=require("three"),Rx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},n.parameters);return e.thetaLength=mn.MathUtils.clamp(e.thetaLength,0,180),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(n){let{width:t=100,height:e=t,depth:r=t,widthSegments:o=64,heightSegments:i=64,phiStart:a,phiLength:s,thetaStart:l,thetaLength:u}=n.parameters,c;return u===0?(c=new mn.BufferGeometry,c.setAttribute("position",new mn.Float32BufferAttribute([],3))):c=new mn.SphereGeometry(.5*t,o,i,a,s,l,u*mn.MathUtils.DEG2RAD),c.scale(1,e/t,r/t),Object.assign(c,{userData:{...n,type:"SphereGeometry"}})}};var Vx=require("three"),zx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:0})}}static build(n){let{width:t=100,height:e=t,widthSegments:r=8,heightSegments:o=8}=n.parameters,i=new Vx.PlaneGeometry(t,e,r,o);return i.scale(1,1,1),Object.assign(i,{userData:{...n,type:"PlaneGeometry"}})}};var Qn=require("three"),Gx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(n){let{width:t,height:e,depth:r,angle:o,cornerRadius:i,cornerSegments:a}=n.parameters,s=new Bf(t,e,r,o,i,a);return Object.assign(s,{userData:{...n,type:"BackdropGeometry"}})}},Bf=class extends Qn.BufferGeometry{constructor(t=1,e=1,r=1,o=90,i=10,a=24){super(),this.type="BackdropGeometry";let s=[],l=[],u=[],c=.001;i==0&&(a=1),a=Math.max(1,Math.floor(a)),i=Math.min(i,100),o=Math.min(180-c,o),o*=Math.PI/180;let d=[],p=Math.PI/2,f=(ee=0,Q=0,W=0)=>new Qn.Vector3(ee,Q,W),h=f(),m=f(),[y,g,b]=[e/2,t/2,r/2],w=-g,A=+g,[S,P,O]=[f(w,-y,+b),f(w,-y,-b),f(w,+y,-b)],x=(ee,Q=!1)=>Math.sin(ee-Math.PI/(1+ +Q)),D=(ee,Q=!1)=>Math.cos(ee-Math.PI/(1+ +Q));O.y=Math.sin(o)*e-y;let N=Math.cos(o)*e-b,T=S.z-c;o<=p?(O.z=Math.min(N,T),O.z==T&&(O.y-=(N-T)/Math.tan(p-o))):P.z=Math.min(P.z-N-b,S.z-c),h.subVectors(S,P),m.subVectors(O,P);let I=Math.min(h.length(),m.length())*i/100,E=I*Math.tan(o/2),B=I/Math.cos(o/2),R=h.clone().normalize().add(m.normalize()).setLength(B).add(P);h.set(0,x(o,!0),D(o,!0)),d.push([O,h.clone()]);let F=(Math.PI-o)/a;for(let ee=0;ee<=a;ee++){let Q=p+o+ee*F;h.set(0,Math.sin(Q)*E,Math.cos(Q)*E),h.add(R),m.set(0,x(Q),D(Q)),d.push([h.clone(),m.clone()])}d.push([S,f(0,1,0)]);let V=Math.sin(F/2)*E*2,q=d.length-1,k=d[0][0].distanceTo(d[1][0]),U=d[q-1][0].distanceTo(d[q][0]),H=k+V*a+U;d[0].push(1);for(let ee=0;ee<=a;ee++)d[ee+1].push(1-(k+ee*V)/H);d[q].push(0);let[Y,J,Z]=d[0],X,te,$;for(let ee=1;ee<d.length;ee++)[X,te,$]=d[ee],s.push(w,Y.y,Y.z,w,X.y,X.z,A,Y.y,Y.z,A,Y.y,Y.z,w,X.y,X.z,A,X.y,X.z),l.push(0,J.y,J.z,0,te.y,te.z,0,J.y,J.z,0,J.y,J.z,0,te.y,te.z,0,te.y,te.z),u.push(0,Z,0,$,1,Z,1,Z,0,$,1,$),[Y,J,Z]=[X,te,$];this.setAttribute("position",new Qn.Float32BufferAttribute(s,3)),this.setAttribute("normal",new Qn.Float32BufferAttribute(l,3)),this.setAttribute("uv",new Qn.Float32BufferAttribute(u,2))}};var Ju=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},n.parameters);return{shape:n.shape&&n.shape instanceof Qe?n.shape:new Qe,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(n){let{width:t,height:e,innerRadiusPercent:r,spikes:o,cornerRadius:i,angle:a,depth:s,extrudeBevelSize:l,extrudeBevelSegments:u}=n.parameters,c=n.shape,d=t*.5,p=e*.5,f=0,h=0,m=a*Math.PI/360/o,y=Math.PI/2*3*-1,g=d*r/100,b=p*r/100;if(o===3&&r===50){m=2*Math.PI/o;for(let A=0;A<o;A++){let S=m*A,P=f+Math.sin(S)*d,O=h+Math.cos(S)*p;c.addPoint(c.createPoint(P,O))}}else for(let A=0;A<o;A++){let S=f+Math.cos(y)*d,P=h+Math.sin(y)*p;c.addPoint(c.createPoint(S,P)),y+=m,S=f+Math.cos(y)*g,P=h+Math.sin(y)*b,A<=o,c.addPoint(c.createPoint(S,P)),y+=m}c.isClosed=!0;for(let A=0,S=c.points.length;A<S;A++)c.points[A].roundness=i;c.roundness=i,c.update();let w=Mr.create({shape:c,parameters:{roundness:i,depth:s,extrudeBevelSize:l,extrudeBevelSegments:u}});return Object.assign(w,{userData:{...n,type:"StarGeometry"}})}};var Fx=require("three"),kx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,depth:0},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(n){let{width:t,height:e}=n.parameters,r=new Fx.PlaneGeometry(t,e);return Object.assign(r,{userData:{...n,type:"TextFrameGeometry"}})}};var as=require("three");var jx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},n.parameters),r=Math.abs(e.width),o=Math.abs(e.height??e.width),i=Math.round(Math.abs(e.depth??e.width*.25));return{parameters:Object.assign(e,{width:r,height:o,depth:i})}}static build(n){let{width:t,height:e,depth:r,radialSegments:o,tubularSegments:i,arc:a,cornerRadius:s,cornerSegments:l}=n.parameters,u=qT(t,e,r,t*.5,a,i,0,0,o,s,l);return u.scale(1,e/t,1),Object.assign(u,{userData:{...n,type:"TorusGeometry"}})}};function qT(n,t,e,r,o,i,a,s,l,u,c){[t,e]=[e,t],a=t/2;let d=as.MathUtils.clamp(o/360,0,1);if(d===0){let p=new as.BufferGeometry;return p.setAttribute("position",new as.Float32BufferAttribute([],3)),p}return d===1&&(u=0),new Rl(!0,n,t,e,r,d,i,a,s,l,u,c)}var Ux=require("three"),Hx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},n.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width),tube:e.tube??e.width*.125})}}static build(n){let{width:t,tube:e,tubularSegments:r,radialSegments:o,p:i,q:a}=n.parameters,s=t*.5;s!==e&&(s-=e);let l=new Ux.TorusKnotGeometry(s,e,r,o,i,a);return Object.assign(l,{userData:{...n,type:"TorusKnotGeometry"}})}};var qx=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},n.parameters);return{shape:n.shape&&n.shape instanceof Qe?n.shape:new Qe,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width*(e.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(e.depth??0)})}}static build(n){let{width:t=100,height:e,cornerRadius:r,depth:o,extrudeBevelSize:i,extrudeBevelSegments:a,isRect:s}=n.parameters,l=n.shape,u=t*.5,c=e*.5;s?(l.addPoint(l.createPoint(-u,c)),l.addPoint(l.createPoint(u,-c)),l.addPoint(l.createPoint(-u,-c))):(l.addPoint(l.createPoint(0,c)),l.addPoint(l.createPoint(u,-c)),l.addPoint(l.createPoint(-u,-c))),l.isClosed=!0;for(let p=0,f=l.points.length;p<f;p++)l.points[p].roundness=r;l.roundness=r,l.update();let d=Mr.create({shape:l,parameters:{roundness:r,depth:o,extrudeBevelSize:i,extrudeBevelSegments:a}});return Object.assign(d,{userData:{...n,type:"TriangleGeometry"}})}};var Me=require("three");function Wx(n,t){let e=2*Math.PI;return(n%e+e)%e===(t%e+e)%e}var WT=new Me.Matrix4,$T=new Me.Matrix4;function YT(n,t,e){let r=[new Me.Vector3,new Me.Vector3,new Me.Vector3],o=[new Me.Vector3,new Me.Vector3,new Me.Vector3];return n.extractBasis(r[0],r[1],r[2]),t.extractBasis(o[0],o[1],o[2]),r.forEach((i,a)=>{let s=o[a],l=Me.MathUtils.lerp(i.length(),s.length(),e);i.lerp(s,e).setLength(l)}),new Me.Matrix4().makeBasis(r[0],r[1],r[2])}var $x=class{static create(n){return this.build(this.normalizeInputs(n))}static normalizeInputs(n,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},n.parameters),r=Math.abs(e.width),o=Math.abs(e.height??e.width),i=Math.abs(e.depth??0),a=t?.shapeData??rs.create({parameters:kp}).userData.shape;return{path:n.path??Ba.defaultData(),parameters:Object.assign(e,{width:r,height:o,depth:i,extrusion:{...vu,...e.extrusion}}),shapeData:a}}static build(n){if(n.path.points.length>=2){let e=new Lf(n);return Object.assign(e,{userData:{...n,type:"PathGeometry"}})}else return Object.assign(new Me.BufferGeometry,{userData:{...n,type:"PathGeometry"}})}},Lf=class extends Me.BufferGeometry{constructor(e){super();this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&this.inputs.parameters.extrusion.depth===1}_isOpenEnded(){let e=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&e.depth===1)||!Wx(e.twist,0)||e.startScale!==e.endScale}build(){let e=this._extractPathPoints();if(e.length<2)return;let r=this._computeBasisMatrices(e),{depth:o,offset:i}=this.inputs.parameters.extrusion;o=Math.max(0,Math.min(o,1)),i=Math.max(0,Math.min(i,1));let a=this.inputs.path.isClosed?e.length:e.length-1,s=Math.floor(i*a),l=this.inputs.path.isClosed?Math.ceil((o+i)*a):Math.ceil(Math.min(1,o+i)*a),u=Math.min(Math.max(2,l-s+1),a+2),c=[],d=[];for(let k=0;k<u;k++){let U=this.inputs.path.isClosed?(k+s)%e.length:Math.min(k+s,e.length-1);c.push(e[U].clone()),d.push(r[U].clone())}let p=(k,U,H)=>{c[k]=c[k].clone().lerp(c[U],H),d[k]=YT(d[k],d[U],H)},f=0,h=i*a%1;(!this.inputs.path.isClosed||o<=1)&&(h||i===0)&&(f=h,p(0,1,f));let m=0,y=(i+o)*a%1;if((this.inputs.path.isClosed&&o<=1||!this.inputs.path.isClosed&&i+o<1)&&y&&(m=y,p(c.length-1,c.length-2,1-m)),o===0){let k=c.length-1;c[k].copy(c[0]),d[k].copy(d[0])}this._applyPathModifiers(d,f,m);let{bevel:g,bevelSides:b}=this.inputs.parameters.extrusion,w=g>0?this.inputs.parameters.extrusion.capType:"flat",A=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(A=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:S,infos:P,vertices:O}=this._computeShapePoints(A),x=0,D;w==="round"&&(D=new Yn(this.inputs.shapeData,2*g,g,A,b,void 0,!0),x=D.getAttribute("position").count);let N=0,T=0;P.sort((k,U)=>k.start-U.start),P.forEach(k=>{k.verticesStart=N,k.verticesCount=k.continuous.reduce((U,H,Y)=>U+(Y===0||!H?2:1),0),T+=k.verticesCount,N=T});let I=T*u,E,B=0;if(this._isOpenEnded()&&w==="flat"){try{E=go({windingRule:Ye.ODD,elementType:_t.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:S})}catch{E=Of}B=E.vertexCount}let R=I+2*B+x*2,F=I+2*B,V={positions:new Float32Array(R*3),normals:new Float32Array(R*3),uvs:new Float32Array(R*2)},q=[];if(P.forEach(k=>{this._extrudeRegion(k,O,d,c,V,q,this._isGeometryClosed()&&!this._isOpenEnded())}),E&&(this._closeEnd(E,I,q,V,d[0],c[0],!1),this._closeEnd(E,I+B,q,V,d[d.length-1],c[c.length-1],!0)),D){V.positions.set(D.getAttribute("position").array,F*3),V.normals.set(D.getAttribute("normal").array,F*3),V.uvs.set(D.getAttribute("uv").array,F*2);let k=q.length;q.push(...D.getIndex().array.map(Y=>Y+F)),F+=x,V.positions.set(D.getAttribute("position").array,F*3),V.normals.set(D.getAttribute("normal").array,F*3),V.uvs.set(D.getAttribute("uv").array,F*2);let U=q.length;q.push(...D.getIndex().array.map(Y=>Y+F)),this.setAttribute("position",new Me.BufferAttribute(V.positions,3)),this.setAttribute("normal",new Me.BufferAttribute(V.normals,3)),this.setAttribute("uv",new Me.BufferAttribute(V.uvs,2)),this.setIndex(q);let H=WT;H.copy(d[d.length-1]).setPosition(c[c.length-1]),this.applyMatrix4OnRange(H,F,R),H.copy(d[0]).setPosition(c[0]).multiply($T.makeScale(1,1,-1)),this.applyMatrix4OnRange(H,F-x,F),this.reverseIndicesOnRange(k,U)}else this.setAttribute("position",new Me.BufferAttribute(V.positions,3)),this.setAttribute("normal",new Me.BufferAttribute(V.normals,3)),this.setAttribute("uv",new Me.BufferAttribute(V.uvs,2)),this.setIndex(q)}_extractPathPoints(){let r=Fu(this.inputs.path).getPoints(this.inputs.path.subdivisions);if(r.length<2)return[];let o=[r[0]];return r.forEach(a=>{o[o.length-1].distanceToSquared(a)>.001&&o.push(a)}),this.inputs.path.isClosed&&o[o.length-1].distanceTo(o[0])<.001&&o.pop(),o}_computeBasisMatrices(e){let r=[],o=e.length,i=this.inputs.path.isClosed,a=new Me.Vector3,s=new Me.Vector3,l=new Me.Vector3,u=new Me.Vector3,c=new Me.Vector3(0,1,0);for(let y=0;y<o;y++){let g=e[y],b;y===0?b=i?e[e.length-2]:g.clone().multiplyScalar(2).sub(e[1]):b=e[y-1];let w;y===o-1?w=i?e[1]:g.clone().multiplyScalar(2).sub(e[y-1]):w=e[y+1];let A=g.clone().sub(b).normalize(),S=w.clone().sub(g).normalize(),P=A.clone().add(S).normalize();l.copy(P),y===0&&(P.equals(c)||P.clone().negate().equals(c))&&c.set(0,0,1);let O=c.clone().cross(P).normalize(),x=P.clone().cross(O).normalize();c.copy(x),u.copy(O),y===0&&(a.copy(x),s.copy(P));let D=new Me.Matrix4().makeBasis(O,x,P);r.push(D)}let d=i?s:l,p=i?a:new Me.Vector3(0,1,0),f=d.clone().cross(u).normalize(),h=Math.acos(p.dot(f));if(isNaN(h))return r;let m=p.clone().cross(f);d.dot(m)>0&&(h*=-1);for(let y=1;y<r.length;y++){let g=new Me.Matrix4().makeRotationZ(h*y/r.length);r[y].multiply(g)}return r}_applyPathModifiers(e,r,o){let i=e.length,{angle:a,twist:s,startScale:l,endScale:u}=this.inputs.parameters.extrusion,c=new Me.Matrix4,d=new Me.Matrix4;return e.forEach((p,f)=>{let h=f===0?0:f===i-1?1:(f-r)/(i-(o===0?0:1)-(r+(1-o)));c.makeRotationZ(Me.MathUtils.lerp(a,a+s,h)*Me.MathUtils.DEG2RAD);let m=Me.MathUtils.lerp(l,u,h);d.makeScale(m,m,m),p.multiply(c).multiply(d)}),e}_computeShapePoints(e=12,r=Ye.ODD){let o=this.inputs.shapeData,i=o.extractShapePointsToFlatArray([],e),a=o.shapeHoles.map(m=>{let y=m.extractShapePointsToFlatArray([],e),g=[];for(let b=y.length-1;b>=1;b-=2){let w=y[b-1],A=y[b-0];g.push(w,A)}return g}),s;try{s=go({windingRule:r,elementType:_t.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[i]})}catch{s=Ll}let l;try{l=go({windingRule:Ye.ODD,elementType:_t.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]})}catch{l=Pf}if(!s)throw new Error("error generating geometry");let u=s.elementCount;if(l){s.elementCount+=l.elementCount;for(let m=0;m<l.elements.length;m++){let y=l.elements[m],g=m%2===0?s.vertexCount:0;s.elements.push(y+g)}for(let m=0;m<l.vertexIndices.length;m++){let y=l.vertexIndices[m],g=s.vertexCount;s.vertexIndices.push(y+g)}for(let m=0;m<l.vertices.length;m++){let y=l.vertices[m];s.vertices.push(y)}}let c=1/0,d=-1/0,p=1/0,f=-1/0;for(let m=0,y=s.vertexCount;m<y;m++){let g=m*2,b=s.vertices[g+0],w=s.vertices[g+1];b<c&&(c=b),b>d&&(d=b),w<p&&(p=w),w>f&&(f=w)}let h=[];for(let m=s.elementCount-1;m>=0;m--){let y=m>=u,g=m*2,b=s.elements[g+0],w=s.elements[g+1],A=b+w,S={start:b,count:w,normals:[],isHole:y,continuous:[],verticesStart:0,verticesCount:0};h.push(S);let P=b,O=A-1,x=b+1,D=o.roundedCurves.length;do{let N=P-b,T=s.vertices[O*2+0],I=s.vertices[O*2+1],E=s.vertices[P*2+0],B=s.vertices[P*2+1],R=s.vertices[x*2+0],F=s.vertices[x*2+1],V=E-T,q=B-I,k=Math.sqrt(V*V+q*q);V/=k,q/=k;let U=E-R,H=B-F,Y=Math.sqrt(U*U+H*H);U/=Y,H/=Y,S.normals[N*2+0]=-H,S.normals[N*2+1]=U;let J=s.vertexIndices[P];if(Array.isArray(J))S.continuous[N]=!1;else{let[Z,X]=o.getCurveIndexFromVertexId(J-1,!0);if(X>0&&X<1)S.continuous[N]=!0;else{let te=X===1?Z+1:Z-1;te=(te+D)%D;let $=X===1?0:1,ee=o.roundedCurves[Z].getTangent(X),Q=o.roundedCurves[te].getTangent($);S.continuous[N]=ee.dot(Q)>.95}}y&&(S.normals[N*2+0]*=-1,S.normals[N*2+1]*=-1),[O,P,x]=[P,x,x+1],x>=A&&(x-=w)}while(x!==b+1)}return{regions:[i,...a],infos:h,vertices:s.vertices}}_insertVertex(e,r,o,i,a){let s=r*2,l=r*3;e.positions[l+0]=o.x,e.positions[l+1]=o.y,e.positions[l+2]=o.z,e.normals[l+0]=i.x,e.normals[l+1]=i.y,e.normals[l+2]=i.z,e.uvs[s+0]=a.x,e.uvs[s+1]=a.y}_extrudeRegion(e,r,o,i,a,s,l){let u=new Me.Vector3,c=new Me.Vector3,d=new Me.Vector3,p=new Me.Vector3,f=new Me.Vector2;o.forEach((m,y)=>{let g=i[y],b=e.verticesStart*o.length+e.verticesCount*y;for(let w=0;w<e.count;w++){let A=(e.start+w)*2;if(u.set(r[A+0],r[A+1],0),d.copy(u).applyMatrix4(m).add(g),e.continuous[w])p.set(e.normals[w*2+0],e.normals[w*2+1],0);else{let S=w===0?(e.start+e.count-1)*2:A-2;c.set(r[S+0],r[S+1],0),p.copy(u).sub(c),p.set(-p.y,p.x,0),e.isHole||p.negate()}if(p.applyMatrix4(m).normalize(),f.set(w===0?1:w/e.count,y/(o.length-1)),this._insertVertex(a,b,d,p,f),b++,!e.continuous[w]||w===0){if(w===0)p.set(e.normals[w*2+0],e.normals[w*2+1],0),f.set(0,y/(o.length-1));else{let S=w===e.count-1?e.start*2:A+2;c.set(r[S+0],r[S+1],0),p.copy(c).sub(u),p.set(-p.y,p.x,0),e.isHole||p.negate()}p.applyMatrix4(m).normalize(),this._insertVertex(a,b,d,p,f),b++}}});let h=o.length-1;for(let m=0;m<h;m++){let y=e.verticesStart*o.length+e.verticesCount*m,g=e.verticesStart*o.length+e.verticesCount*(m+1),b=0;for(let w=0;w<e.count;w++){(!e.continuous[w]||w===0)&&b++;let A=w===e.count-1?0:b+1,S=y+b,P=y+A,O=g+A,x=g+b;e.isHole?s.push(S,O,P,S,x,O):s.push(S,P,O,S,O,x),b++}}}_closeEnd(e,r,o,i,a,s,l){let u=e.vertexCount,c=new Me.Vector3(0,0,l?-1:1).applyMatrix4(a),d=new Me.Vector3,p=new Me.Vector2;for(let h=0;h<u;h++){let m=2*h;d.set(e.vertices[m+0],e.vertices[m+1],0).applyMatrix4(a).add(s),this._insertVertex(i,r+h,d,c,p)}let f=e.elements;for(let h=0;h<e.elementCount;h++){let m=3*h,y=f[m+0]+r,g=f[m+(l?1:2)]+r,b=f[m+(l?2:1)]+r;o.push(y,g,b)}}applyMatrix4OnRange(e,r,o){let i=e.elements,a=new Me.Matrix3().getNormalMatrix(e).elements,s,l,u,c,d=this.attributes.position,p=this.attributes.normal;if(!d||!p)return;let f=d.array,h=p.array,m=d.itemSize;for(let y=r*m,g=o*m;y<g;y+=m){if(y===r)debugger;s=f[y+0],l=f[y+1],u=f[y+2],c=1/(i[3]*s+i[7]*l+i[11]*u+i[15]),f[y+0]=(i[0]*s+i[4]*l+i[8]*u+i[12])*c,f[y+1]=(i[1]*s+i[5]*l+i[9]*u+i[13])*c,f[y+2]=(i[2]*s+i[6]*l+i[10]*u+i[14])*c,s=h[y+0],l=h[y+1],u=h[y+2],h[y+0]=a[0]*s+a[3]*l+a[6]*u,h[y+1]=a[1]*s+a[4]*l+a[7]*u,h[y+2]=a[2]*s+a[5]*l+a[8]*u}d.needsUpdate=!0,p.needsUpdate=!0}reverseIndicesOnRange(e,r){let o=this.index;if(o){for(let i=e;i<r;i+=3){let a=o.getX(i),s=o.getX(i+1),l=o.getX(i+2);o.setXYZ(i,l,s,a)}o.needsUpdate=!0}}};var Ni=require("three"),Yx=require("three/examples/jsm/utils/BufferGeometryUtils.js");function Xx(){let n=new Ni.BufferGeometry;return n.setAttribute("position",new Ni.BufferAttribute(new Float32Array([]),3)),n.setIndex(new Ni.BufferAttribute(new Uint16Array([]),1)),n}var QT=Xx().attributes,KT=12,ZT=1,ss=class extends Ni.BufferGeometry{constructor(e,r){super();this.charWidths=[];this.charCoords=[];this.wrappedText=[];this.isLowResolution=!1;this.vectorShapes=[];Object.assign(this.attributes,QT),this.userData={parameters:e,type:"TextGeometry"};let o=r.getFont(e.font);o?.isLoaded?(this.font=o,this.update(e)):this.updateFont(e.font,r).then(()=>{this.update(e),r?.requestRender()})}async updateFont(e,r){let o=r.getFont(e);o&&(this.font=o,await o.loadingPromise)}update(e){let r=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!r?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:o,height:i,depth:a,extrudeBevelSize:s,extrudeBevelSegments:l,text:u,textTransform:c}=e,d=Mu.getDisplayedValue(u),p=c===2?d.toUpperCase():c===3?d.toLowerCase():d,f=JT(e,r,p),{shapes:h,charWidths:m,charCoords:y}=r.generateShapes(f,e),g=(typeof o=="number"?o:1)*.5,b=(typeof i=="number"?i:1)*.5,w=h.map(P=>new Qe().fromShape(P,!0));this.vectorShapes=w;let A=w.map(P=>Mr.create({shape:P,parameters:{depth:a,extrudeBevelSegments:l,extrudeBevelSize:s,windingRule:a<=0?Ye.NONZERO:Ye.ODD,subdivisions:this.isLowResolution&&a>0?ZT:KT}})),S=A.length?(0,Yx.mergeBufferGeometries)(A):Xx();S.translate(-g,b,0),this.dispose(),this.wrappedText=f,this.charCoords=y,this.charWidths=m,this.deleteAttribute("extrudeNormal"),Object.entries(S.attributes).forEach(([P,O])=>{this.setAttribute(P,O)}),this.setIndex(S.index),this.computeBoundingSphere()}clone(){let e=br(new Ni.BufferGeometry,ss.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([r,o])=>{this.setAttribute(r,o)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:e})}get text(){return this.userData.parameters.text??""}};function JT(n,t,e){let r=[""],o="";for(let i of e)o+=i,i===" "||i===`
|
|
17
17
|
`?(r[r.length-1]+=o,o="",i===`
|
|
18
|
-
`&&r.push("")):t.getTextWidth(r[r.length-1]+o,n)>n.width&&(r[r.length-1].length&&r.push(""),t.getTextWidth(r[r.length-1]+o,n)>n.width&&(o.length===1?(r[r.length-1]+=o,o=""):(r[r.length-1]+=o.slice(0,-1),o=o[o.length-1],r.push(""))));return r[r.length-1]+=o,r}var lt=require("three");var Kx,td=new Promise(n=>{Kx=n}),Qx=!1;var ed;function Zx(){if(Qx)return;if(ed)return ed;async function n(){let e=!1?".":"https://unpkg.com/@splinetool/modelling-wasm@1.0.60/build",o=import("./process.js"),[i,a]=await Promise.all([o,fetch(`${e}/process.wasm`).then(u=>u.arrayBuffer())]),s=i.default,l=await s({wasmBinary:a});Kx(l),Qx=!0}return ed=n(),ed}var Jx=require("three");var eM=["font"];function gn(n,t,e,r){let o,i,a;n.type==="PathGeometry"?(i=JSON.parse(JSON.stringify(n)),a=[[],["extrusion"]]):(i={...n},a=[[]]);for(let u of a){let c=i;for(let d of u)c=c[d];for(o in c){let d=c[o];zp(d)&&!eM.includes(o)&&(c[o]=t.getVariable(d,[r.uuid,"geometry",...u,o]),zp(c[o])&&(c[o]=1))}}let s={parameters:i,type:i.type};if(i.type==="PathGeometry")s.path=i.path;else if(i.type==="VectorGeometry"){let u=Qe.createFromState(i.shape,i.width,i.height);s.shape=u}else if(i.type==="NonParametricGeometry")i.data.groups&&i.data.groups?.forEach(u=>u.materialIndex=Math.max(u.materialIndex??0,0)),s.geometry=new Jx.BufferGeometryLoader().parse(i);else if(i.type==="SubdivGeometry"){let u=new Vt(i,e);return u.data=n,u}else{if(i.type==="TextGeometry")return new ss(i,t);if(i.type==="UIGeometry")return is.create({parameters:{width:i.width,height:i.height,cornerRadius:i.cornerRadius,cornerType:i.cornerType}})}let l;try{l=Rf(s)}catch(u){console.error(u)}if(!l){let u=Qe.createFromState(Ea.defaultData(),100,100);s.shape=u,l=Rf(s)}return l}var eb=require("three"),tM=new eb.Matrix4;function Gl(n,t,e,r){let o=n.position.array,i=n.normal.array,a=tM.makeScale(t,e,r).invert().elements,s,l,u;for(var c=0,d=o.length;c<d;c+=3)o[c]*=t,o[c+1]*=e,o[c+2]*=r,s=i[c],l=i[c+1],u=i[c+2],i[c]=a[0]*s+a[4]*l+a[8]*u,i[c+1]=a[1]*s+a[5]*l+a[9]*u,i[c+2]=a[2]*s+a[6]*l+a[10]*u;n.position.needsUpdate=!0,n.normal.needsUpdate=!0}var rd=new lt.Box3,ls=new lt.Vector3,Ae;td.then(n=>{Ae=n});var tb=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),rb=new Uint32Array([0,1,2,3]),ob=new Uint8Array([4]),Vt=class extends lt.BufferGeometry{constructor(e,r){super();this.data=e;this.flatShading=r;this.subdivPointer=0;this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,r){this.freeSubdivPointer();let o=this.data.scaleBaked,i=Rn.div(r,o);this.subdividedGeometry&&Gl(this.subdividedGeometry.attributes,...i),this.originalGeometry&&Gl(this.originalGeometry.attributes,...i),this.data=e;let a=this.userData.parameters;this.userData.parameters={width:a.width*i[0],height:a.height*i[1],depth:a.depth*i[2]},this.originalGeometry.boundingSphere.center.multiply(ls.fromArray(i));let s=ls.set(a.width,a.height,a.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}rebuild(){let e,r,o;try{({originalGeometry:e,subdividedGeometry:r,subdivPointer:o}=Vt.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new lt.BoxGeometry(100,100,100),o=0}this.subdivPointer=o,this.originalGeometry=e,this.subdividedGeometry=r??void 0;let i=this.subdividedGeometry??this.originalGeometry;Object.assign(this,i),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Vt.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new lt.Sphere,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let r=e.attributes.position,o=e.boundingSphere.center;rd.setFromBufferAttribute(r),rd.getCenter(o),e.boundingSphere.radius=o.distanceTo(rd.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),rd.getSize(ls);let i={width:ls.x,height:ls.y,depth:ls.z};return this.userData.parameters=i,i}static build(e,r,o,i){let a,s,l,u=e?.phongAngle??35;o===!1&&(u=-1),r&&(Ae.free_bvh(r),Ae.free_subdivision_surface(r));try{a=Vt.allocate(e,i)}catch(c){console.error(c,e),a=Vt.allocate({positionWASM:tb,indexWASM:rb,verticesPerFaceWASM:ob},i)}if(Ae.set_destination_refinement_level(a,0),s=Vt.buildLevel(a,!0,u),e.subdivisions>0)try{Ae.set_destination_refinement_level(a,e.subdivisions),l=Vt.buildLevel(a,!1,u)}catch{try{Ae.set_destination_refinement_level(a,e.subdivisions-1),l=Vt.buildLevel(a,!1,u)}catch{l=null}}else l=null;return{subdivPointer:a,originalGeometry:s,subdividedGeometry:l}}static primitiveToQuads(e,r,o){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let i=e.shape!==void 0||e.path!==void 0?r.geometry:gn(e,o,!1),a;e.type==="TorusGeometry"&&e.arc===Math.PI*2?a=i.getClosedTorusIndicesForBooleanOrSubdiv():a=i.getIndex();let s,l,u,c;({positions:s,triIndices:c}=Ff(i.getAttribute("position"),a));let d;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let p=e.radialSegments*e.heightSegments*3*2,f=p+e.radialSegments*3;d=[p,f]}return{indices:l,verticesPerFace:u}=kf(s,c,i,d),{positions:s,indices:l,verticesPerFace:u}}static allocate(e,r){let o,i,a,s=[],l=[];e.positionWASM&&e.positionWASM.length>0?(o=e.positionWASM,i=e.indexWASM,a=e.verticesPerFaceWASM):(o=tb,i=rb,a=ob);let u=o.length,c=i.length,d=a.length,p=o.length+s.length+l.length,f=i.length+a.length,h=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,m=p*Float32Array.BYTES_PER_ELEMENT,y=f*Uint32Array.BYTES_PER_ELEMENT,g=Ae._malloc(h),b=new Float32Array(Ae.HEAPF32.buffer,g,p),w=new Uint32Array(Ae.HEAPU32.buffer,g+m,f);b.set(o,0),b.set(s,o.length),b.set(l,o.length+s.length),w.set(i,0),w.set(a,i.length);let A;e?.scaleBaked?.some(P=>P!==1)&&(A=new lt.Matrix4().makeScale(...e.scaleBaked)),r&&(A?A.premultiply(r):A=r);let S=A?Ae.alloc_subdivision_surface2(g,u,g+m,c,g+m+i.length*Uint32Array.BYTES_PER_ELEMENT,d,A.elements):Ae.alloc_subdivision_surface(g,u,g+m,c,g+m+i.length*Uint32Array.BYTES_PER_ELEMENT,d);return Ae._free(g),S}static buildLevel(e,r,o,i,a){let s=a?Ae.get_mesh_data2(e,r?Ae.Level.CONTROL:Ae.Level.REFINED,o,a.elements):Ae.get_mesh_data(e,r?Ae.Level.CONTROL:Ae.Level.REFINED,o),l=8,u=Ae.HEAPU32.subarray(s>>2,(s>>2)+l),c=u.subarray(4,4+4),d=0,p=Ae.HEAPU32[u[d]>>2],f=Ae.HEAPF32.subarray(p>>2,(p>>2)+c[d]);d++;let h=Ae.HEAPU32[u[d]>>2],m=Ae.HEAPF32.subarray(h>>2,(h>>2)+c[d]);d++;let y=Ae.HEAPU32[u[d]>>2],g=Ae.HEAPU32.subarray(y>>2,(y>>2)+c[d]);d++;let b=Ae.HEAPU32[u[d]>>2],w=Ae.HEAPU32.subarray(b>>2,(b>>2)+c[d]);if(d++,i===void 0){let A=new lt.BufferGeometry;if(A.setIndex(new lt.Uint32BufferAttribute(w,1)),A.setAttribute("position",new lt.Float32BufferAttribute(f,3)),A.setAttribute("normal",new lt.Float32BufferAttribute(m,3)),r){A.setAttribute("faceMap",new lt.Uint32BufferAttribute(g,1));let S=new Float32Array(m.length/3*4).fill(0);A.setAttribute("color",new lt.BufferAttribute(S,4))}return Ae.free_mesh_data(s),A.userData.type="SubdivGeometry",A}i.getAttribute("position").copyArray(f),i.getAttribute("normal").copyArray(m),i.attributes.position.needsUpdate=!0,i.attributes.normal.needsUpdate=!0,Ae.free_mesh_data(s)}static freeSubdivPointer(e){Ae.free_bvh(e),Ae.free_subdivision_surface(e)}static buildControlCageWireframe(e,r,o){let i=Ae.get_wireframe_data_for_base_level(e),a=4,s=Ae.HEAPU32.subarray(i>>2,(i>>2)+a),l=s.subarray(2,2+2),u=0,c=Ae.HEAPU32[s[u]>>2],d=Ae.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let p=Ae.HEAPU32[s[u]>>2],f=Ae.HEAPU32.subarray(p>>2,(p>>2)+l[u]);if(r===void 0){let h=new lt.BufferGeometry;h.setAttribute("position",new lt.Float32BufferAttribute(d,3));let m=new Float32Array(d.length);for(let y=0,g=d.length;y<g;)m[y++]=o.r,m[y++]=o.g,m[y++]=o.b;return h.setAttribute("color",new lt.BufferAttribute(m,3)),h.setIndex(new lt.Uint32BufferAttribute(f,1)),Ae.free_wireframe_data_for_base_level(i),h}r.getAttribute("position").copyArray(d),r.attributes.position.needsUpdate=!0,Ae.free_wireframe_data_for_base_level(i)}static updateCollabMesh(e,r,o){let i=r===0;i||Ae.set_destination_refinement_level(e,r);let a=o?Ae.get_topological_data2(e,i?Ae.Level.CONTROL:Ae.Level.REFINED,o.elements):Ae.get_topological_data(e,i?Ae.Level.CONTROL:Ae.Level.REFINED),s=6,l=Ae.HEAPU32.subarray(a>>2,(a>>2)+s),u=l.subarray(3,3+3),c=0,d=Ae.HEAPU32[l[c]>>2],p=new Float32Array(Ae.HEAPF32.subarray(d>>2,(d>>2)+u[c]));c++;let f=Ae.HEAPU32[l[c]>>2],h=new Uint32Array(Ae.HEAPU32.subarray(f>>2,(f>>2)+u[c]));c++;let m=Ae.HEAPU32[l[c]>>2],y=new Uint8Array(Ae.HEAPU32.subarray(m>>2,(m>>2)+u[c]));return Ae.free_topological_data(a),{positions:p,indices:h,verticesPerFace:y}}};var nb=["getX","getY","getZ"];function Ff(n,t){let e={},r=t?t.count:n.count,o=0,i=[],a=[],s=1e4;for(let u=0;u<r;u++){let c=t?t.getX(u):u,d="";for(let p=0;p<3;p++)d+=`${~~(n[nb[p]](c)*s)},`;if(d in e)i.push(e[d]);else{for(let p=0;p<3;p++)a.push(n[nb[p]](c));e[d]=o,i.push(o),o++}}let l=[];for(let u=0;u<i.length;u+=3)i[u]===i[u+1]||i[u]===i[u+2]||i[u+1]===i[u+2]||l.push(i[u],i[u+1],i[u+2]);return{positions:a,triIndices:l}}var od=new lt.Vector3,Vf=new lt.Vector3,zf=new lt.Vector3,Gf=new lt.Vector3;function kf(n,t,e,r){let o=[],i=[];if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let l=e.userData.shape.extractShapePointsToFlatArray([]),u=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&u<=24&&u%4===0&&e.userData.parameters.angle>=360){let p=l.length/2/u;l=l.filter((f,h)=>Math.floor(h/2)%p===0)}let c=0;for(let p=0;p<l.length;p+=2)c+=(l[p]-l[(p===0?l.length:p)-2])*(l[p+1]+l[(p===0?l.length:p)-1]);n.length=0;let d=0;if(c<0)for(let p=0;p<l.length;p+=2)n.push(l[p],l[p+1],0),o.push(d++);else for(let p=l.length-2;p>=0;p-=2)n.push(l[p],l[p+1],0),o.push(d++);return i.push(d),{indices:o,verticesPerFace:i}}let a=new Float32Array([e.userData.parameters.depth])[0],s=0;for(;s<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let l=0;if((n[t[s]*3+2]===a||n[t[s]*3+2]===0)&&l++,(n[t[s+1]*3+2]===a||n[t[s+1]*3+2]===0)&&l++,(n[t[s+2]*3+2]===a||n[t[s+2]*3+2]===0)&&l++,l===3)break}if(t[s+1]===t[s+3]&&t[s+2]===t[s+5]||t[s+0]===t[s+3]&&t[s+2]===t[s+4]){od.set(n[t[s]*3],n[t[s]*3+1],n[t[s]*3+2]),Vf.set(n[t[s+1]*3],n[t[s+1]*3+1],n[t[s+1]*3+2]),zf.set(n[t[s+4]*3],n[t[s+4]*3+1],n[t[s+4]*3+2]),Gf.set(n[t[s+5]*3],n[t[s+5]*3+1],n[t[s+5]*3+2]),Vf.sub(od).normalize(),zf.sub(od).normalize(),Gf.sub(od).normalize();let l=Vf.cross(zf).dot(Gf);Math.abs(l)>.005||r&&r.some((u,c)=>c%2===1?!1:s>=r[c]&&s<r[c+1])?(o.push(t[s],t[s+1],t[s+2]),i.push(3),s+=3):(o.push(t[s],t[s+1],t[s+4],t[s+5]),i.push(4),s+=6)}else o.push(t[s],t[s+1],t[s+2]),i.push(3),s+=3}if(e.useNgonForTopBottomFaceDuringBake){let l=[],u=[],c=0;for(let d=0,p=0;d<n.length;d+=3,p++)n[d+2]===0&&(l.push(p),c++),n[d+2]===a&&u.push(p);if(e.userData.parameters.extrudeBevelSize===0){let d=u[0];u[0]=u[1],u[1]=d}l.reverse(),o.push(...l,...u),i.push(c,c)}return{indices:o,verticesPerFace:i}}var Zr={};em(Zr,{calcBoolean:()=>iM,calcBooleanTopological:()=>nM,freeMeshSet:()=>cM,getMeshSet:()=>aM,hasOpenEdges:()=>sM,transformMeshSet:()=>lM});var rM,ib=new Promise(n=>{rM=n});var Fl=require("three");var Re,cs;ib.then(n=>Re=n);function oM(n,t,e){let r,o;n.userData.parameters.type==="TorusGeometry"&&n.userData.parameters.arc===Math.PI*2?o=n.getClosedTorusIndicesForBooleanOrSubdiv():o=n.getIndex();let{positions:i,triIndices:a}=Ff(n.getAttribute("position"),o),s;if(t&&e){let{indices:l,verticesPerFace:u}=kf(i,a,n);s=u.length,r=[];for(let c=0,d=0;c<s;c++){r.push(u[c]);for(let p=0;p<u[c];p++)r.push(l[d++])}}else{let l=a.length;r=Array(l+l/3),s=0;for(let u=0,c=0;c<r.length;)r[c++]=3,s++,r[c++]=a[u++],r[c++]=a[u++],r[c++]=a[u++]}return{positions:i,faceIndices:r,nFaces:s}}function ab(n){let t=n.length,e=t*Uint32Array.BYTES_PER_ELEMENT,r=t*Float32Array.BYTES_PER_ELEMENT,o=Number.isInteger(n[0])?e:r,i=Re._malloc(o);return(Number.isInteger(n[0])?new Uint32Array(Re.HEAPU32.buffer,i,t):new Float32Array(Re.HEAPF32.buffer,i,t)).set(n,0),i}function sb(n){switch(n){case 0:return Re.OP.UNION;case 1:return Re.OP.INTERSECTION;case 2:return Re.OP.A_MINUS_B;case 3:return Re.OP.B_MINUS_A;case 4:return Re.OP.SYMMETRIC_DIFFERENCE;case 5:return Re.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function nM(n,t){cs===void 0&&(cs=Re.init_csg());let e=ab(n),r=Re.csg_calc_topological(cs,e,n.length,sb(t));Re._free(e);let o=6,i=Re.HEAPU32.subarray(r>>2,(r>>2)+o),a=i.subarray(3,3+3),s=0,l=Re.HEAPU32[i[s]>>2],u=new Float32Array(Re.HEAPF32.subarray(l>>2,(l>>2)+a[s]));s++;let c=Re.HEAPU32[i[s]>>2],d=new Uint32Array(Re.HEAPU32.subarray(c>>2,(c>>2)+a[s]));s++;let p=Re.HEAPU32[i[s]>>2],f=new Uint8Array(Re.HEAPU32.subarray(p>>2,(p>>2)+a[s]));return Re.free_mesh_data(r),{positions:u,indices:d,verticesPerFace:f}}function iM(n,t,e,r){cs===void 0&&(cs=Re.init_csg());let o=ab(n),i=Re.csg_calc(cs,o,n.length,r,sb(t));Re._free(o);let a=5,s=Re.HEAPU32.subarray(i>>2,(i>>2)+a),l=s.subarray(2,2+3),u=0,c=Re.HEAPU32[s[u]>>2],d=Re.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let p=Re.HEAPU32[s[u]>>2],f=Re.HEAPF32.subarray(p>>2,(p>>2)+l[u]);u++;let h=l[u];e.setAttribute("position",new Fl.Float32BufferAttribute(d,3)),e.setAttribute("normal",new Fl.Float32BufferAttribute(f,3));let m=Re.HEAPF32.subarray((i>>2)+5,(i>>2)+5+6);return e.boundingSphere===null&&(e.boundingSphere=new Fl.Sphere),e.boundingSphere.center.set(m[0],m[1],m[2]),e.boundingSphere.radius=(m[3]**2+m[4]**2+m[5]**2)**.5,e.userData.parameters={width:m[3]*2,height:m[4]*2,depth:m[5]*2},Re.free_mesh_data(i),h}function aM(n,t,e){if(Re===void 0)return-1;let r,o,i;if(t&&n.userData.positions!==void 0){let g=n.userData;i=g.verticesPerFace.length,r=g.positions,o=Array(g.verticesPerFace.reduce((b,w)=>b+w,0)+i);for(let b=0,w=0,A=0;b<g.verticesPerFace.length;b++){o[A++]=g.verticesPerFace[b];for(let S=0;S<g.verticesPerFace[b];S++)o[A++]=g.indices[w++]}}else({positions:r,faceIndices:o,nFaces:i}=oM(n,t,e));let a=r.length,s=o.length,l=r.length,u=o.length,c=l*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,d=l*Float32Array.BYTES_PER_ELEMENT,p=u*Uint32Array.BYTES_PER_ELEMENT,f=Re._malloc(c),h=new Float32Array(Re.HEAPF32.buffer,f,l),m=new Uint32Array(Re.HEAPU32.buffer,f+d,u);h.set(r,0),m.set(o,0);let y=Re.get_csg_mesh(f,a,f+d,s,i);return Re._free(f),y}function sM(n){return Re.has_open_edges(n)}function lM(n,t){Re.transform_csg_mesh(n,t.elements)}function cM(n){Re.free_csg_mesh(n)}var uM={ConeGeometry:X0,CubeGeometry:Q0,CylinderGeometry:Y0,DodecahedronGeometry:Z0,EllipseGeometry:rs,HelixGeometry:Cx,IcosahedronGeometry:Mx,LatheGeometry:Ix,NonParametricGeometry:Bx,PolygonGeometry:Zu,PyramidGeometry:Lx,RectangleGeometry:is,SphereGeometry:Rx,PlaneGeometry:zx,BackdropGeometry:Gx,StarGeometry:Ju,TextFrameGeometry:kx,TorusGeometry:jx,TorusKnotGeometry:Hx,TriangleGeometry:qx,PathGeometry:$x,VectorGeometry:Mr},Rf=n=>uM[n.type].create(n);function us(n){return n!==null&&"booleanOp"in n}var ds=class extends Ya(nd.Mesh){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new nd.Matrix4}updateVisible(e){super.updateVisible(e),this.visible=!us(this.parent)&&this.visible,us(this.parent)&&this.parent.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Zr.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),us(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof ds&&(e.freeBooleanPointer(),us(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,r){let o=super.updateTransformState(e,r);return o&&us(this.parent)&&this.invalidateDownstreamBooleanData(!0),o}onVariableUpdate(e=!1){super.onVariableUpdate(e),us(this.parent)&&this.invalidateDownstreamBooleanData(!0)}};var id=new ps.Box3;function kl(n,t=0,e=n.count,r,o){let i=1/0,a=1/0,s=1/0,l=-1/0,u=-1/0,c=-1/0;for(let d=t;d<e;d++){let p=n.getX(d),f=n.getY(d),h=n.getZ(d);p<i&&(i=p),f<a&&(a=f),h<s&&(s=h),p>l&&(l=p),f>u&&(u=f),h>c&&(c=h)}id.min.set(i,a,s),id.max.set(l,u,c),id.getCenter(r),id.getSize(o).multiplyScalar(.5)}var dM=new ps.BufferGeometry,pM=new ps.MeshBasicMaterial,$t=class extends ds{constructor(t,e){super(dM,pM),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}updateEntityBoxSize(t,e){let r=this.geometry.getAttribute("position");r!==void 0?kl(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,t,e):super.updateEntityBoxSize(t,e)}};var vn=require("three");var qr=require("three");var Nb=require("three");var wo=require("three");var jl=class{constructor(t){t=t??{},this.name=t.name,this.type=t.type,this.node=t.node,this.size=t.size,this.needsUpdate=t.needsUpdate}get value(){return this.node.value}set value(t){this.node.value=t}};var lb=require("three"),rr=class{constructor(t){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=lb.MathUtils.generateUUID(),this.type=t,this.name=""}analyze(t,e){e=e??{},t.analyzing=!0,this.build(t.addFlow(e.slot,e.cache,e.context),"v4"),t.clearVertexNodeCode(),t.clearFragmentNodeCode(),t.removeFlow(),t.analyzing=!1}analyzeAndFlow(t,e,r){return r=r??{},this.analyze(t,r),this.flow(t,e,r)}flow(t,e,r){r=r??{},t.addFlow(r.slot,r.cache,r.context);let o={result:this.build(t,e),code:t.clearNodeCode(),extra:t.context.extra};return t.removeFlow(),o}build(t,e,r){e=e??this.getType(t,e);let o=t.getNodeData(r??this);return t.analyzing&&this.appendDepsNode(t,o,e),t.nodes.indexOf(this)===-1&&t.nodes.push(this),this.updateFrame!==void 0&&t.updaters.indexOf(this)===-1&&t.updaters.push(this),this.generate(t,e,r)}updateFrame(t){}generateReadonly(t,e,r,o,i,a){return""}generate(t,e,r,o,i){return""}parse(t,e,r,o){}appendDepsNode(t,e,r){e.deps=(e.deps||0)+1;let o=t.getTypeLength(r);(o>(e.outputMax||0)||this.getType(t,r))&&(e.outputMax=o,e.output=r)}setName(t){this.name=t}getName(){return this.name}getType(t,e){return e==="sampler2D"||e==="samplerCube"?e:this.type}getHash(){let t="{",e,r;for(e in this)r=this[e],r instanceof rr&&(t+='"'+e+'":'+r.getHash()+",");if(this.hashProperties)for(let o=0;o<this.hashProperties.length;o++)e=this.hashProperties[o],r=this[e],t+='"'+e+'":"'+String(r)+'",';return t+='"id":"'+this.uuid+'"}',t}};var jf=class{constructor(){this.nodes={};this.keywords={}}add(t){this.nodes[t.name]=t}addKeyword(t,e,r){r=r!==void 0?r:!0,this.keywords[t]={callback:e,cache:r}}remove(t){delete this.nodes[t.name]}removeKeyword(t){delete this.keywords[t]}get(t){return this.nodes[t]}getKeyword(t,e){return this.keywords[t].callback(e)}getKeywordData(t){return this.keywords[t]}contains(t){return this.nodes[t]!==void 0}containsKeyword(t){return this.keywords[t]!==void 0}},Yt=new jf;var Uf=require("three");var cb=require("three"),ge=class extends rr{constructor(e,r){super(e);this.scope="";r=r??{},this.shared=r.shared!==void 0?r.shared:!0,this.unique=r.unique!==void 0?r.unique:!1}build(e,r,o,i){if(r=r??this.getType(e),this.getShared(e,r)){let a=this.getUnique(e,r);a&&this.uuid===void 0&&(this.uuid=cb.MathUtils.generateUUID()),o=e.getUUID(o??this.getUUID(),!a);let s=e.getNodeData(o),l=s.output||this.getType(e);if(e.analyzing)return(s.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,s,r),this.generate(e,r,o)):super.build(e,r,o);if(a)return s.name=s.name||super.build(e,r,o),s.name;if(!this.getLabel()&&(!this.getShared(e,l)||e.context.ignoreCache||s.deps===1))return super.build(e,r,o);o=this.getUUID(!1);let u=this.getTemp(e,o);if(u)return e.format(u,l,r);{u=super.generate(e,r,o,s.output,i);let c=this.generate(e,l,o);return e.addNodeCode(u+" = "+c+";"),e.format(u,l,r)}}return super.build(e,r,o)}getShared(e,r){return r!=="sampler2D"&&r!=="samplerCube"&&this.shared}getUnique(e,r){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let r=this.uuid;return typeof this.scope=="string"&&(r=this.scope+"-"+r),r}getTemp(e,r){r=r||this.uuid;let o=e.getVars()[r];return o?o.name:void 0}generate(e,r,o,i,a){return this.getShared(e,r)||console.error("TempNode is not shared"),o=o??this.uuid,e.getTempVar(o,i??this.getType(e),a,this.getLabel()).name}};var ot=class extends ge{constructor(e,r){r=r??{},r.shared=r.shared!==void 0?r.shared:!1;super(e,r);this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}generate(e,r,o,i,a,s){o=e.getUUID(o??this.getUUID()),i=i??this.getType(e);let l=e.getNodeData(o);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,r,o,i,a,s):e.isShader("vertex")?(l.vertex||(l.vertex=e.createVertexUniform(i,this,a,s,this.getLabel())),e.format(l.vertex.name,i,r)):(l.fragment||(l.fragment=e.createFragmentUniform(i,this,a,s,this.getLabel())),e.format(l.fragment.name,i,r))}};var Pt=class extends ot{constructor(e=0,r){super("v2");this.nodeType="Vector2";this.value=e instanceof Uf.Vector2?e:new Uf.Vector2(e,r)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,r,o,i,a,s){return e.format("vec2("+this.value.x+", "+this.value.y+")",i,r)}};var Hf=require("three");var cr=class extends ot{constructor(e=0,r,o){super("v3");this.nodeType="Vector3";this.value=e instanceof Hf.Vector3?e:new Hf.Vector3(e,r,o)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,r,o,i,a,s){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",i,r)}};var ub=require("three"),Xt=class extends ub.Color{constructor(e,r,o,i){super(e,r,o);this.isColorA=!0;this.a=i}setRGBA(e,r,o,i){super.setRGB(e,r,o),this.a=i}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,r="srgb"){let o;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(o=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let i,a=o[1],s=o[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=a==="rgba"?parseFloat(i[4]):1,super.setStyle(e,r);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=a==="hsla"?parseFloat(i[4]):1,super.setStyle(e,r);break}}return super.setStyle(e,r)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}};var Ir=class extends ot{constructor(e){super("v4");this.nodeType="Vector4";this.value=e instanceof Xt?e:new Xt(e.r,e.g,e.b,e.a)}generateReadonly(e,r,o,i,a,s){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",i,r)}};var fM=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,db=/[a-z_0-9]+/gi,re=class extends ge{constructor(e,r,o,i,a){super(a);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=a===void 0,this.isInterface=!1,this.parse(e,r,o,i)}getShared(e,r){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===e)return this.inputs[r]}}getIncludeByName(e){if(this.includes){let r=this.includes.length;for(;r--;)if(this.includes[r].name===e)return this.includes[r]}}generate(e,r,o,i,a){let s,l=0,u=this.src;if(this.includes)for(let d=0;d<this.includes.length;d++)e.include(this.includes[d],this);for(let d in this.extensions)e.extensions[d]=!0;let c=[];for(;s=db.exec(this.src);)c.push(s);for(let d=0;d<c.length;d++){let p=c[d],f=p[0],h=this.isMethod?!this.getInputByName(f):!0,m=f;if(this.keywords[f]||this.useKeywords&&h&&Yt.containsKeyword(f)){let y=this.keywords[f];if(!y){let g=Yt.getKeywordData(f);g.cache&&(y=e.keywords[f]),y=y||Yt.getKeyword(f,e),g.cache&&(e.keywords[f]=y)}m=y.build(e)}f!==m&&u[p.index+l-1]!=="."&&(u=u.substring(0,p.index+l)+m+u.substring(p.index+f.length+l),l+=m.length-f.length),this.getIncludeByName(m)===void 0&&Yt.contains(m)&&e.include(Yt.get(m))}return r==="source"?u:this.isMethod?(this.isInterface||e.include(this,void 0,u),this.name):e.format("( "+u+" )",this.getType(e),r)}parse(e,r,o,i){if(this.src=e||"",this.includes=r??[],this.extensions=o??{},this.keywords=i??{},this.isMethod){let a=fM.exec(this.src);if(this.inputs=[],a&&a.length==4){this.type=a[1],this.name=a[2];let s=a[3].match(db);if(s){let l=0;for(;l<s.length;){let u=s[l++],c;u==="in"||u==="out"||u==="inout"?c=s[l++]:(c=u,u="");let d=s[l++];this.inputs.push({name:d,type:c,qualifier:u})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}};var hM=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,qf=class extends ge{constructor(e="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||qf.PI,void 0,void 0,void 0,r)}getType(e){return e.getTypeByFormat(this.type)}parse(e,r,o,i,a){this.src=e||"";let s,l,u="",c=hM.exec(e);this.useDefine=a??this.src.charAt(0)==="#",c&&c.length>1?(l=c[1],s=c[2],u=c[3]):(s=this.src,l="f"),this.name=s,this.type=l,this.value=u}build(e,r){if(r==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),r)}generate(e,r,o,i,a){return e.format(this.name,this.getType(e),r)}},Xe=qf;Xe.PI="PI",Xe.PI2="PI2",Xe.RECIPROCAL_PI="RECIPROCAL_PI",Xe.RECIPROCAL_PI2="RECIPROCAL_PI2",Xe.LOG2="LOG2",Xe.EPSILON="EPSILON";var mM=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
18
|
+
`&&r.push("")):t.getTextWidth(r[r.length-1]+o,n)>n.width&&(r[r.length-1].length&&r.push(""),t.getTextWidth(r[r.length-1]+o,n)>n.width&&(o.length===1?(r[r.length-1]+=o,o=""):(r[r.length-1]+=o.slice(0,-1),o=o[o.length-1],r.push(""))));return r[r.length-1]+=o,r}var lt=require("three");var Kx,td=new Promise(n=>{Kx=n}),Qx=!1;var ed;function Zx(){if(Qx)return;if(ed)return ed;async function n(){let e=!1?".":"https://unpkg.com/@splinetool/modelling-wasm@1.0.62/build",o=import("./process.js"),[i,a]=await Promise.all([o,fetch(`${e}/process.wasm`).then(u=>u.arrayBuffer())]),s=i.default,l=await s({wasmBinary:a});Kx(l),Qx=!0}return ed=n(),ed}var Jx=require("three");var eM=["font"];function gn(n,t,e,r){let o,i,a;n.type==="PathGeometry"?(i=JSON.parse(JSON.stringify(n)),a=[[],["extrusion"]]):(i={...n},a=[[]]);for(let u of a){let c=i;for(let d of u)c=c[d];for(o in c){let d=c[o];zp(d)&&!eM.includes(o)&&(c[o]=t.getVariable(d,[r.uuid,"geometry",...u,o]),zp(c[o])&&(c[o]=1))}}let s={parameters:i,type:i.type};if(i.type==="PathGeometry")s.path=i.path;else if(i.type==="VectorGeometry"){let u=Qe.createFromState(i.shape,i.width,i.height);s.shape=u}else if(i.type==="NonParametricGeometry")i.data.groups&&i.data.groups?.forEach(u=>u.materialIndex=Math.max(u.materialIndex??0,0)),s.geometry=new Jx.BufferGeometryLoader().parse(i);else if(i.type==="SubdivGeometry"){let u=new Vt(i,e);return u.data=n,u}else{if(i.type==="TextGeometry")return new ss(i,t);if(i.type==="UIGeometry")return is.create({parameters:{width:i.width,height:i.height,cornerRadius:i.cornerRadius,cornerType:i.cornerType}})}let l;try{l=Rf(s)}catch(u){console.error(u)}if(!l){let u=Qe.createFromState(Ea.defaultData(),100,100);s.shape=u,l=Rf(s)}return l}var eb=require("three"),tM=new eb.Matrix4;function Gl(n,t,e,r){let o=n.position.array,i=n.normal.array,a=tM.makeScale(t,e,r).invert().elements,s,l,u;for(var c=0,d=o.length;c<d;c+=3)o[c]*=t,o[c+1]*=e,o[c+2]*=r,s=i[c],l=i[c+1],u=i[c+2],i[c]=a[0]*s+a[4]*l+a[8]*u,i[c+1]=a[1]*s+a[5]*l+a[9]*u,i[c+2]=a[2]*s+a[6]*l+a[10]*u;n.position.needsUpdate=!0,n.normal.needsUpdate=!0}var rd=new lt.Box3,ls=new lt.Vector3,Ae;td.then(n=>{Ae=n});var tb=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),rb=new Uint32Array([0,1,2,3]),ob=new Uint8Array([4]),Vt=class extends lt.BufferGeometry{constructor(e,r){super();this.data=e;this.flatShading=r;this.subdivPointer=0;this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,r){this.freeSubdivPointer();let o=this.data.scaleBaked,i=Rn.div(r,o);this.subdividedGeometry&&Gl(this.subdividedGeometry.attributes,...i),this.originalGeometry&&Gl(this.originalGeometry.attributes,...i),this.data=e;let a=this.userData.parameters;this.userData.parameters={width:a.width*i[0],height:a.height*i[1],depth:a.depth*i[2]},this.originalGeometry.boundingSphere.center.multiply(ls.fromArray(i));let s=ls.set(a.width,a.height,a.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}rebuild(){let e,r,o;try{({originalGeometry:e,subdividedGeometry:r,subdivPointer:o}=Vt.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new lt.BoxGeometry(100,100,100),o=0}this.subdivPointer=o,this.originalGeometry=e,this.subdividedGeometry=r??void 0;let i=this.subdividedGeometry??this.originalGeometry;Object.assign(this,i),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Vt.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new lt.Sphere,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let r=e.attributes.position,o=e.boundingSphere.center;rd.setFromBufferAttribute(r),rd.getCenter(o),e.boundingSphere.radius=o.distanceTo(rd.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),rd.getSize(ls);let i={width:ls.x,height:ls.y,depth:ls.z};return this.userData.parameters=i,i}static build(e,r,o,i){let a,s,l,u=e?.phongAngle??35;o===!1&&(u=-1),r&&(Ae.free_bvh(r),Ae.free_subdivision_surface(r));try{a=Vt.allocate(e,i)}catch(c){console.error(c,e),a=Vt.allocate({positionWASM:tb,indexWASM:rb,verticesPerFaceWASM:ob},i)}if(Ae.set_destination_refinement_level(a,0),s=Vt.buildLevel(a,!0,u),e.subdivisions>0)try{Ae.set_destination_refinement_level(a,e.subdivisions),l=Vt.buildLevel(a,!1,u)}catch{try{Ae.set_destination_refinement_level(a,e.subdivisions-1),l=Vt.buildLevel(a,!1,u)}catch{l=null}}else l=null;return{subdivPointer:a,originalGeometry:s,subdividedGeometry:l}}static primitiveToQuads(e,r,o){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let i=e.shape!==void 0||e.path!==void 0?r.geometry:gn(e,o,!1),a;e.type==="TorusGeometry"&&e.arc===Math.PI*2?a=i.getClosedTorusIndicesForBooleanOrSubdiv():a=i.getIndex();let s,l,u,c;({positions:s,triIndices:c}=Ff(i.getAttribute("position"),a));let d;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let p=e.radialSegments*e.heightSegments*3*2,f=p+e.radialSegments*3;d=[p,f]}return{indices:l,verticesPerFace:u}=kf(s,c,i,d),{positions:s,indices:l,verticesPerFace:u}}static allocate(e,r){let o,i,a,s=[],l=[];e.positionWASM&&e.positionWASM.length>0?(o=e.positionWASM,i=e.indexWASM,a=e.verticesPerFaceWASM):(o=tb,i=rb,a=ob);let u=o.length,c=i.length,d=a.length,p=o.length+s.length+l.length,f=i.length+a.length,h=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,m=p*Float32Array.BYTES_PER_ELEMENT,y=f*Uint32Array.BYTES_PER_ELEMENT,g=Ae._malloc(h),b=new Float32Array(Ae.HEAPF32.buffer,g,p),w=new Uint32Array(Ae.HEAPU32.buffer,g+m,f);b.set(o,0),b.set(s,o.length),b.set(l,o.length+s.length),w.set(i,0),w.set(a,i.length);let A;e?.scaleBaked?.some(P=>P!==1)&&(A=new lt.Matrix4().makeScale(...e.scaleBaked)),r&&(A?A.premultiply(r):A=r);let S=A?Ae.alloc_subdivision_surface2(g,u,g+m,c,g+m+i.length*Uint32Array.BYTES_PER_ELEMENT,d,A.elements):Ae.alloc_subdivision_surface(g,u,g+m,c,g+m+i.length*Uint32Array.BYTES_PER_ELEMENT,d);return Ae._free(g),S}static buildLevel(e,r,o,i,a){let s=a?Ae.get_mesh_data2(e,r?Ae.Level.CONTROL:Ae.Level.REFINED,o,a.elements):Ae.get_mesh_data(e,r?Ae.Level.CONTROL:Ae.Level.REFINED,o),l=8,u=Ae.HEAPU32.subarray(s>>2,(s>>2)+l),c=u.subarray(4,4+4),d=0,p=Ae.HEAPU32[u[d]>>2],f=Ae.HEAPF32.subarray(p>>2,(p>>2)+c[d]);d++;let h=Ae.HEAPU32[u[d]>>2],m=Ae.HEAPF32.subarray(h>>2,(h>>2)+c[d]);d++;let y=Ae.HEAPU32[u[d]>>2],g=Ae.HEAPU32.subarray(y>>2,(y>>2)+c[d]);d++;let b=Ae.HEAPU32[u[d]>>2],w=Ae.HEAPU32.subarray(b>>2,(b>>2)+c[d]);if(d++,i===void 0){let A=new lt.BufferGeometry;if(A.setIndex(new lt.Uint32BufferAttribute(w,1)),A.setAttribute("position",new lt.Float32BufferAttribute(f,3)),A.setAttribute("normal",new lt.Float32BufferAttribute(m,3)),r){A.setAttribute("faceMap",new lt.Uint32BufferAttribute(g,1));let S=new Float32Array(m.length/3*4).fill(0);A.setAttribute("color",new lt.BufferAttribute(S,4))}return Ae.free_mesh_data(s),A.userData.type="SubdivGeometry",A}i.getAttribute("position").copyArray(f),i.getAttribute("normal").copyArray(m),i.attributes.position.needsUpdate=!0,i.attributes.normal.needsUpdate=!0,Ae.free_mesh_data(s)}static freeSubdivPointer(e){Ae.free_bvh(e),Ae.free_subdivision_surface(e)}static buildControlCageWireframe(e,r,o){let i=Ae.get_wireframe_data_for_base_level(e),a=4,s=Ae.HEAPU32.subarray(i>>2,(i>>2)+a),l=s.subarray(2,2+2),u=0,c=Ae.HEAPU32[s[u]>>2],d=Ae.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let p=Ae.HEAPU32[s[u]>>2],f=Ae.HEAPU32.subarray(p>>2,(p>>2)+l[u]);if(r===void 0){let h=new lt.BufferGeometry;h.setAttribute("position",new lt.Float32BufferAttribute(d,3));let m=new Float32Array(d.length);for(let y=0,g=d.length;y<g;)m[y++]=o.r,m[y++]=o.g,m[y++]=o.b;return h.setAttribute("color",new lt.BufferAttribute(m,3)),h.setIndex(new lt.Uint32BufferAttribute(f,1)),Ae.free_wireframe_data_for_base_level(i),h}r.getAttribute("position").copyArray(d),r.attributes.position.needsUpdate=!0,Ae.free_wireframe_data_for_base_level(i)}static updateCollabMesh(e,r,o){let i=r===0;i||Ae.set_destination_refinement_level(e,r);let a=o?Ae.get_topological_data2(e,i?Ae.Level.CONTROL:Ae.Level.REFINED,o.elements):Ae.get_topological_data(e,i?Ae.Level.CONTROL:Ae.Level.REFINED),s=6,l=Ae.HEAPU32.subarray(a>>2,(a>>2)+s),u=l.subarray(3,3+3),c=0,d=Ae.HEAPU32[l[c]>>2],p=new Float32Array(Ae.HEAPF32.subarray(d>>2,(d>>2)+u[c]));c++;let f=Ae.HEAPU32[l[c]>>2],h=new Uint32Array(Ae.HEAPU32.subarray(f>>2,(f>>2)+u[c]));c++;let m=Ae.HEAPU32[l[c]>>2],y=new Uint8Array(Ae.HEAPU32.subarray(m>>2,(m>>2)+u[c]));return Ae.free_topological_data(a),{positions:p,indices:h,verticesPerFace:y}}};var nb=["getX","getY","getZ"];function Ff(n,t){let e={},r=t?t.count:n.count,o=0,i=[],a=[],s=1e4;for(let u=0;u<r;u++){let c=t?t.getX(u):u,d="";for(let p=0;p<3;p++)d+=`${~~(n[nb[p]](c)*s)},`;if(d in e)i.push(e[d]);else{for(let p=0;p<3;p++)a.push(n[nb[p]](c));e[d]=o,i.push(o),o++}}let l=[];for(let u=0;u<i.length;u+=3)i[u]===i[u+1]||i[u]===i[u+2]||i[u+1]===i[u+2]||l.push(i[u],i[u+1],i[u+2]);return{positions:a,triIndices:l}}var od=new lt.Vector3,Vf=new lt.Vector3,zf=new lt.Vector3,Gf=new lt.Vector3;function kf(n,t,e,r){let o=[],i=[];if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let l=e.userData.shape.extractShapePointsToFlatArray([]),u=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&u<=24&&u%4===0&&e.userData.parameters.angle>=360){let p=l.length/2/u;l=l.filter((f,h)=>Math.floor(h/2)%p===0)}let c=0;for(let p=0;p<l.length;p+=2)c+=(l[p]-l[(p===0?l.length:p)-2])*(l[p+1]+l[(p===0?l.length:p)-1]);n.length=0;let d=0;if(c<0)for(let p=0;p<l.length;p+=2)n.push(l[p],l[p+1],0),o.push(d++);else for(let p=l.length-2;p>=0;p-=2)n.push(l[p],l[p+1],0),o.push(d++);return i.push(d),{indices:o,verticesPerFace:i}}let a=new Float32Array([e.userData.parameters.depth])[0],s=0;for(;s<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let l=0;if((n[t[s]*3+2]===a||n[t[s]*3+2]===0)&&l++,(n[t[s+1]*3+2]===a||n[t[s+1]*3+2]===0)&&l++,(n[t[s+2]*3+2]===a||n[t[s+2]*3+2]===0)&&l++,l===3)break}if(t[s+1]===t[s+3]&&t[s+2]===t[s+5]||t[s+0]===t[s+3]&&t[s+2]===t[s+4]){od.set(n[t[s]*3],n[t[s]*3+1],n[t[s]*3+2]),Vf.set(n[t[s+1]*3],n[t[s+1]*3+1],n[t[s+1]*3+2]),zf.set(n[t[s+4]*3],n[t[s+4]*3+1],n[t[s+4]*3+2]),Gf.set(n[t[s+5]*3],n[t[s+5]*3+1],n[t[s+5]*3+2]),Vf.sub(od).normalize(),zf.sub(od).normalize(),Gf.sub(od).normalize();let l=Vf.cross(zf).dot(Gf);Math.abs(l)>.005||r&&r.some((u,c)=>c%2===1?!1:s>=r[c]&&s<r[c+1])?(o.push(t[s],t[s+1],t[s+2]),i.push(3),s+=3):(o.push(t[s],t[s+1],t[s+4],t[s+5]),i.push(4),s+=6)}else o.push(t[s],t[s+1],t[s+2]),i.push(3),s+=3}if(e.useNgonForTopBottomFaceDuringBake){let l=[],u=[],c=0;for(let d=0,p=0;d<n.length;d+=3,p++)n[d+2]===0&&(l.push(p),c++),n[d+2]===a&&u.push(p);if(e.userData.parameters.extrudeBevelSize===0){let d=u[0];u[0]=u[1],u[1]=d}l.reverse(),o.push(...l,...u),i.push(c,c)}return{indices:o,verticesPerFace:i}}var Zr={};em(Zr,{calcBoolean:()=>iM,calcBooleanTopological:()=>nM,freeMeshSet:()=>cM,getMeshSet:()=>aM,hasOpenEdges:()=>sM,transformMeshSet:()=>lM});var rM,ib=new Promise(n=>{rM=n});var Fl=require("three");var Re,cs;ib.then(n=>Re=n);function oM(n,t,e){let r,o;n.userData.parameters.type==="TorusGeometry"&&n.userData.parameters.arc===Math.PI*2?o=n.getClosedTorusIndicesForBooleanOrSubdiv():o=n.getIndex();let{positions:i,triIndices:a}=Ff(n.getAttribute("position"),o),s;if(t&&e){let{indices:l,verticesPerFace:u}=kf(i,a,n);s=u.length,r=[];for(let c=0,d=0;c<s;c++){r.push(u[c]);for(let p=0;p<u[c];p++)r.push(l[d++])}}else{let l=a.length;r=Array(l+l/3),s=0;for(let u=0,c=0;c<r.length;)r[c++]=3,s++,r[c++]=a[u++],r[c++]=a[u++],r[c++]=a[u++]}return{positions:i,faceIndices:r,nFaces:s}}function ab(n){let t=n.length,e=t*Uint32Array.BYTES_PER_ELEMENT,r=t*Float32Array.BYTES_PER_ELEMENT,o=Number.isInteger(n[0])?e:r,i=Re._malloc(o);return(Number.isInteger(n[0])?new Uint32Array(Re.HEAPU32.buffer,i,t):new Float32Array(Re.HEAPF32.buffer,i,t)).set(n,0),i}function sb(n){switch(n){case 0:return Re.OP.UNION;case 1:return Re.OP.INTERSECTION;case 2:return Re.OP.A_MINUS_B;case 3:return Re.OP.B_MINUS_A;case 4:return Re.OP.SYMMETRIC_DIFFERENCE;case 5:return Re.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function nM(n,t){cs===void 0&&(cs=Re.init_csg());let e=ab(n),r=Re.csg_calc_topological(cs,e,n.length,sb(t));Re._free(e);let o=6,i=Re.HEAPU32.subarray(r>>2,(r>>2)+o),a=i.subarray(3,3+3),s=0,l=Re.HEAPU32[i[s]>>2],u=new Float32Array(Re.HEAPF32.subarray(l>>2,(l>>2)+a[s]));s++;let c=Re.HEAPU32[i[s]>>2],d=new Uint32Array(Re.HEAPU32.subarray(c>>2,(c>>2)+a[s]));s++;let p=Re.HEAPU32[i[s]>>2],f=new Uint8Array(Re.HEAPU32.subarray(p>>2,(p>>2)+a[s]));return Re.free_mesh_data(r),{positions:u,indices:d,verticesPerFace:f}}function iM(n,t,e,r){cs===void 0&&(cs=Re.init_csg());let o=ab(n),i=Re.csg_calc(cs,o,n.length,r,sb(t));Re._free(o);let a=5,s=Re.HEAPU32.subarray(i>>2,(i>>2)+a),l=s.subarray(2,2+3),u=0,c=Re.HEAPU32[s[u]>>2],d=Re.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let p=Re.HEAPU32[s[u]>>2],f=Re.HEAPF32.subarray(p>>2,(p>>2)+l[u]);u++;let h=l[u];e.setAttribute("position",new Fl.Float32BufferAttribute(d,3)),e.setAttribute("normal",new Fl.Float32BufferAttribute(f,3));let m=Re.HEAPF32.subarray((i>>2)+5,(i>>2)+5+6);return e.boundingSphere===null&&(e.boundingSphere=new Fl.Sphere),e.boundingSphere.center.set(m[0],m[1],m[2]),e.boundingSphere.radius=(m[3]**2+m[4]**2+m[5]**2)**.5,e.userData.parameters={width:m[3]*2,height:m[4]*2,depth:m[5]*2},Re.free_mesh_data(i),h}function aM(n,t,e){if(Re===void 0)return-1;let r,o,i;if(t&&n.userData.positions!==void 0){let g=n.userData;i=g.verticesPerFace.length,r=g.positions,o=Array(g.verticesPerFace.reduce((b,w)=>b+w,0)+i);for(let b=0,w=0,A=0;b<g.verticesPerFace.length;b++){o[A++]=g.verticesPerFace[b];for(let S=0;S<g.verticesPerFace[b];S++)o[A++]=g.indices[w++]}}else({positions:r,faceIndices:o,nFaces:i}=oM(n,t,e));let a=r.length,s=o.length,l=r.length,u=o.length,c=l*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,d=l*Float32Array.BYTES_PER_ELEMENT,p=u*Uint32Array.BYTES_PER_ELEMENT,f=Re._malloc(c),h=new Float32Array(Re.HEAPF32.buffer,f,l),m=new Uint32Array(Re.HEAPU32.buffer,f+d,u);h.set(r,0),m.set(o,0);let y=Re.get_csg_mesh(f,a,f+d,s,i);return Re._free(f),y}function sM(n){return Re.has_open_edges(n)}function lM(n,t){Re.transform_csg_mesh(n,t.elements)}function cM(n){Re.free_csg_mesh(n)}var uM={ConeGeometry:X0,CubeGeometry:Q0,CylinderGeometry:Y0,DodecahedronGeometry:Z0,EllipseGeometry:rs,HelixGeometry:Cx,IcosahedronGeometry:Mx,LatheGeometry:Ix,NonParametricGeometry:Bx,PolygonGeometry:Zu,PyramidGeometry:Lx,RectangleGeometry:is,SphereGeometry:Rx,PlaneGeometry:zx,BackdropGeometry:Gx,StarGeometry:Ju,TextFrameGeometry:kx,TorusGeometry:jx,TorusKnotGeometry:Hx,TriangleGeometry:qx,PathGeometry:$x,VectorGeometry:Mr},Rf=n=>uM[n.type].create(n);function us(n){return n!==null&&"booleanOp"in n}var ds=class extends Ya(nd.Mesh){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new nd.Matrix4}updateVisible(e){super.updateVisible(e),this.visible=!us(this.parent)&&this.visible,us(this.parent)&&this.parent.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Zr.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),us(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof ds&&(e.freeBooleanPointer(),us(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,r){let o=super.updateTransformState(e,r);return o&&us(this.parent)&&this.invalidateDownstreamBooleanData(!0),o}onVariableUpdate(e=!1){super.onVariableUpdate(e),us(this.parent)&&this.invalidateDownstreamBooleanData(!0)}};var id=new ps.Box3;function kl(n,t=0,e=n.count,r,o){let i=1/0,a=1/0,s=1/0,l=-1/0,u=-1/0,c=-1/0;for(let d=t;d<e;d++){let p=n.getX(d),f=n.getY(d),h=n.getZ(d);p<i&&(i=p),f<a&&(a=f),h<s&&(s=h),p>l&&(l=p),f>u&&(u=f),h>c&&(c=h)}id.min.set(i,a,s),id.max.set(l,u,c),id.getCenter(r),id.getSize(o).multiplyScalar(.5)}var dM=new ps.BufferGeometry,pM=new ps.MeshBasicMaterial,$t=class extends ds{constructor(t,e){super(dM,pM),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}updateEntityBoxSize(t,e){let r=this.geometry.getAttribute("position");r!==void 0?kl(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,t,e):super.updateEntityBoxSize(t,e)}};var vn=require("three");var qr=require("three");var Nb=require("three");var wo=require("three");var jl=class{constructor(t){t=t??{},this.name=t.name,this.type=t.type,this.node=t.node,this.size=t.size,this.needsUpdate=t.needsUpdate}get value(){return this.node.value}set value(t){this.node.value=t}};var lb=require("three"),rr=class{constructor(t){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=lb.MathUtils.generateUUID(),this.type=t,this.name=""}analyze(t,e){e=e??{},t.analyzing=!0,this.build(t.addFlow(e.slot,e.cache,e.context),"v4"),t.clearVertexNodeCode(),t.clearFragmentNodeCode(),t.removeFlow(),t.analyzing=!1}analyzeAndFlow(t,e,r){return r=r??{},this.analyze(t,r),this.flow(t,e,r)}flow(t,e,r){r=r??{},t.addFlow(r.slot,r.cache,r.context);let o={result:this.build(t,e),code:t.clearNodeCode(),extra:t.context.extra};return t.removeFlow(),o}build(t,e,r){e=e??this.getType(t,e);let o=t.getNodeData(r??this);return t.analyzing&&this.appendDepsNode(t,o,e),t.nodes.indexOf(this)===-1&&t.nodes.push(this),this.updateFrame!==void 0&&t.updaters.indexOf(this)===-1&&t.updaters.push(this),this.generate(t,e,r)}updateFrame(t){}generateReadonly(t,e,r,o,i,a){return""}generate(t,e,r,o,i){return""}parse(t,e,r,o){}appendDepsNode(t,e,r){e.deps=(e.deps||0)+1;let o=t.getTypeLength(r);(o>(e.outputMax||0)||this.getType(t,r))&&(e.outputMax=o,e.output=r)}setName(t){this.name=t}getName(){return this.name}getType(t,e){return e==="sampler2D"||e==="samplerCube"?e:this.type}getHash(){let t="{",e,r;for(e in this)r=this[e],r instanceof rr&&(t+='"'+e+'":'+r.getHash()+",");if(this.hashProperties)for(let o=0;o<this.hashProperties.length;o++)e=this.hashProperties[o],r=this[e],t+='"'+e+'":"'+String(r)+'",';return t+='"id":"'+this.uuid+'"}',t}};var jf=class{constructor(){this.nodes={};this.keywords={}}add(t){this.nodes[t.name]=t}addKeyword(t,e,r){r=r!==void 0?r:!0,this.keywords[t]={callback:e,cache:r}}remove(t){delete this.nodes[t.name]}removeKeyword(t){delete this.keywords[t]}get(t){return this.nodes[t]}getKeyword(t,e){return this.keywords[t].callback(e)}getKeywordData(t){return this.keywords[t]}contains(t){return this.nodes[t]!==void 0}containsKeyword(t){return this.keywords[t]!==void 0}},Yt=new jf;var Uf=require("three");var cb=require("three"),ge=class extends rr{constructor(e,r){super(e);this.scope="";r=r??{},this.shared=r.shared!==void 0?r.shared:!0,this.unique=r.unique!==void 0?r.unique:!1}build(e,r,o,i){if(r=r??this.getType(e),this.getShared(e,r)){let a=this.getUnique(e,r);a&&this.uuid===void 0&&(this.uuid=cb.MathUtils.generateUUID()),o=e.getUUID(o??this.getUUID(),!a);let s=e.getNodeData(o),l=s.output||this.getType(e);if(e.analyzing)return(s.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,s,r),this.generate(e,r,o)):super.build(e,r,o);if(a)return s.name=s.name||super.build(e,r,o),s.name;if(!this.getLabel()&&(!this.getShared(e,l)||e.context.ignoreCache||s.deps===1))return super.build(e,r,o);o=this.getUUID(!1);let u=this.getTemp(e,o);if(u)return e.format(u,l,r);{u=super.generate(e,r,o,s.output,i);let c=this.generate(e,l,o);return e.addNodeCode(u+" = "+c+";"),e.format(u,l,r)}}return super.build(e,r,o)}getShared(e,r){return r!=="sampler2D"&&r!=="samplerCube"&&this.shared}getUnique(e,r){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let r=this.uuid;return typeof this.scope=="string"&&(r=this.scope+"-"+r),r}getTemp(e,r){r=r||this.uuid;let o=e.getVars()[r];return o?o.name:void 0}generate(e,r,o,i,a){return this.getShared(e,r)||console.error("TempNode is not shared"),o=o??this.uuid,e.getTempVar(o,i??this.getType(e),a,this.getLabel()).name}};var ot=class extends ge{constructor(e,r){r=r??{},r.shared=r.shared!==void 0?r.shared:!1;super(e,r);this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}generate(e,r,o,i,a,s){o=e.getUUID(o??this.getUUID()),i=i??this.getType(e);let l=e.getNodeData(o);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,r,o,i,a,s):e.isShader("vertex")?(l.vertex||(l.vertex=e.createVertexUniform(i,this,a,s,this.getLabel())),e.format(l.vertex.name,i,r)):(l.fragment||(l.fragment=e.createFragmentUniform(i,this,a,s,this.getLabel())),e.format(l.fragment.name,i,r))}};var Pt=class extends ot{constructor(e=0,r){super("v2");this.nodeType="Vector2";this.value=e instanceof Uf.Vector2?e:new Uf.Vector2(e,r)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,r,o,i,a,s){return e.format("vec2("+this.value.x+", "+this.value.y+")",i,r)}};var Hf=require("three");var cr=class extends ot{constructor(e=0,r,o){super("v3");this.nodeType="Vector3";this.value=e instanceof Hf.Vector3?e:new Hf.Vector3(e,r,o)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,r,o,i,a,s){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",i,r)}};var ub=require("three"),Xt=class extends ub.Color{constructor(e,r,o,i){super(e,r,o);this.isColorA=!0;this.a=i}setRGBA(e,r,o,i){super.setRGB(e,r,o),this.a=i}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,r="srgb"){let o;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(o=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let i,a=o[1],s=o[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=a==="rgba"?parseFloat(i[4]):1,super.setStyle(e,r);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=a==="hsla"?parseFloat(i[4]):1,super.setStyle(e,r);break}}return super.setStyle(e,r)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}};var Ir=class extends ot{constructor(e){super("v4");this.nodeType="Vector4";this.value=e instanceof Xt?e:new Xt(e.r,e.g,e.b,e.a)}generateReadonly(e,r,o,i,a,s){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",i,r)}};var fM=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,db=/[a-z_0-9]+/gi,re=class extends ge{constructor(e,r,o,i,a){super(a);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=a===void 0,this.isInterface=!1,this.parse(e,r,o,i)}getShared(e,r){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===e)return this.inputs[r]}}getIncludeByName(e){if(this.includes){let r=this.includes.length;for(;r--;)if(this.includes[r].name===e)return this.includes[r]}}generate(e,r,o,i,a){let s,l=0,u=this.src;if(this.includes)for(let d=0;d<this.includes.length;d++)e.include(this.includes[d],this);for(let d in this.extensions)e.extensions[d]=!0;let c=[];for(;s=db.exec(this.src);)c.push(s);for(let d=0;d<c.length;d++){let p=c[d],f=p[0],h=this.isMethod?!this.getInputByName(f):!0,m=f;if(this.keywords[f]||this.useKeywords&&h&&Yt.containsKeyword(f)){let y=this.keywords[f];if(!y){let g=Yt.getKeywordData(f);g.cache&&(y=e.keywords[f]),y=y||Yt.getKeyword(f,e),g.cache&&(e.keywords[f]=y)}m=y.build(e)}f!==m&&u[p.index+l-1]!=="."&&(u=u.substring(0,p.index+l)+m+u.substring(p.index+f.length+l),l+=m.length-f.length),this.getIncludeByName(m)===void 0&&Yt.contains(m)&&e.include(Yt.get(m))}return r==="source"?u:this.isMethod?(this.isInterface||e.include(this,void 0,u),this.name):e.format("( "+u+" )",this.getType(e),r)}parse(e,r,o,i){if(this.src=e||"",this.includes=r??[],this.extensions=o??{},this.keywords=i??{},this.isMethod){let a=fM.exec(this.src);if(this.inputs=[],a&&a.length==4){this.type=a[1],this.name=a[2];let s=a[3].match(db);if(s){let l=0;for(;l<s.length;){let u=s[l++],c;u==="in"||u==="out"||u==="inout"?c=s[l++]:(c=u,u="");let d=s[l++];this.inputs.push({name:d,type:c,qualifier:u})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}};var hM=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,qf=class extends ge{constructor(e="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||qf.PI,void 0,void 0,void 0,r)}getType(e){return e.getTypeByFormat(this.type)}parse(e,r,o,i,a){this.src=e||"";let s,l,u="",c=hM.exec(e);this.useDefine=a??this.src.charAt(0)==="#",c&&c.length>1?(l=c[1],s=c[2],u=c[3]):(s=this.src,l="f"),this.name=s,this.type=l,this.value=u}build(e,r){if(r==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),r)}generate(e,r,o,i,a){return e.format(this.name,this.getType(e),r)}},Xe=qf;Xe.PI="PI",Xe.PI2="PI2",Xe.RECIPROCAL_PI="RECIPROCAL_PI",Xe.RECIPROCAL_PI2="RECIPROCAL_PI2",Xe.LOG2="LOG2",Xe.EPSILON="EPSILON";var mM=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
19
19
|
)*?)}`,"gim"),yM=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),fs=class extends ge{constructor(e=""){super();this.inputs=[];this.src="";this.nodeType="Struct";this.parse(e)}getType(e){return e.getTypeByFormat(this.name)}getInputByName(e){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===e)return this.inputs[r]}generate(e,r,o,i,a){return r==="source"?this.src+";":e.format("( "+this.src+" )",this.getType(e),r)}parse(e=""){this.src=e,this.inputs=[];let r=mM.exec(e);if(r){let o=r[2],i;for(;i=yM.exec(o);)this.inputs.push({type:i[1],name:i[2]});this.name=r[1]}else this.name="";this.type=this.name}};var hs=class extends ge{constructor(e){super("v2",{shared:!1});this.nodeType="UV";this.index=e??0}generate(e,r){e.requires.uv[this.index]=!0;let o=this.index>0?this.index+1:"",i=e.isShader("vertex")?"uv"+o:"vUv"+o;return e.format(i,this.getType(e),r)}};Yt.addKeyword("uv",function(){return new hs});Yt.addKeyword("uv2",function(){return new hs(1)});var ad=require("three");var Di=class extends ge{constructor(e,r){super("v4");this.nodeType="ColorSpace";this.input=e,this.method=r??Di.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case ad.LinearEncoding:return["Linear"];case ad.sRGBEncoding:return["sRGB"];default:return[]}}generate(e,r){let o=this.input.build(e,"v4"),i=this.getType(e),a=Di.Nodes[this.method],s=e.include(a);if(s===Di.LINEAR_TO_LINEAR)return e.format(o,i,r);if(a.inputs?.length===2){let l=this.factor.build(e,"f");return e.format(s+"( "+o+", "+l+" )",i,r)}else return e.format(s+"( "+o+" )",i,r)}fromEncoding(e){let r=Di.getEncodingComponents(e);this.method="LinearTo"+r[0],this.factor=r[1]}fromDecoding(e){let r=Di.getEncodingComponents(e);this.method=r[0]+"ToLinear",this.factor=r[1]}},Sr=Di;Sr.Nodes={LinearToLinear:new re(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(`
|
|
20
20
|
`)),sRGBToLinear:new re(["vec4 sRGBToLinear( in vec4 value ) {"," return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join(`
|
|
21
21
|
`)),LinearTosRGB:new re(["vec4 LinearTosRGB( in vec4 value ) {"," return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );","}"].join(`
|
|
@@ -1834,7 +1834,7 @@ float sobelSample(sampler2D t, sampler2D d, vec2 uv, vec2 resolution, float outl
|
|
|
1834
1834
|
vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
|
|
1835
1835
|
displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
|
|
1836
1836
|
return displaced_position;
|
|
1837
|
-
}`,[e,r])}}();var De={normalRenderTarget:new wr,normalRenderTargetDepth:new wr,transmissionRenderTarget:new wr,aspectRatio:new Pt,transmissionSize:new Pt(2048,2048),transmissionRenderTargetDepth:new wr,aoRenderTarget:new wr,aoEnabled:new Et,pixelRatioNode:new se(1),resolution:new Pt,penumbraSize:new Ao(5,.5),frameIndex:new Ge(0),transmissionLod:new Ge(2)};for(let n of Object.values(De))n.isRenderGlobal=!0;var Cb={skiaWasmUrl:"https://unpkg.com/@splinetool/ui-wasm@1.0.
|
|
1837
|
+
}`,[e,r])}}();var De={normalRenderTarget:new wr,normalRenderTargetDepth:new wr,transmissionRenderTarget:new wr,aspectRatio:new Pt,transmissionSize:new Pt(2048,2048),transmissionRenderTargetDepth:new wr,aoRenderTarget:new wr,aoEnabled:new Et,pixelRatioNode:new se(1),resolution:new Pt,penumbraSize:new Ao(5,.5),frameIndex:new Ge(0),transmissionLod:new Ge(2)};for(let n of Object.values(De))n.isRenderGlobal=!0;var Cb={skiaWasmUrl:"https://unpkg.com/@splinetool/ui-wasm@1.0.62/build/ui.wasm"};var xn=class extends rr{constructor(){super("basic");this.nodeType="Basic";this.color=new et(Rt),this.shadingAlpha=new se(1),this.shadingBlend=new Ge(0),this.previousModelViewMatrix=new ur,this.previouseProjectionMatrix=new ur}get category(){return"phong"}generate(e){let r;if(e.isShader("vertex")){let o=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:De.frameIndex}),e.mergeUniform({resolution:De.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(dd.UniformsUtils.merge([dd.UniformsLib.fog])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>"].join(`
|
|
1838
1838
|
`));let i=["#include <beginnormal_vertex>",`
|
|
1839
1839
|
#if !defined( USE_LAYER_DISPLACE )
|
|
1840
1840
|
#include <defaultnormal_vertex>
|
|
@@ -3662,4 +3662,4 @@ end_header
|
|
|
3662
3662
|
A = exp(A) * vColor.a;
|
|
3663
3663
|
gl_FragColor = vec4(color.rgb, A);
|
|
3664
3664
|
gVelocity = vec4(0.0); // so it is ignored by TAA
|
|
3665
|
-
}`,i={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new Pe.Vector2},viewport:{type:"v2",value:new Pe.Vector2},basisViewport:{type:"v2",value:new Pe.Vector2},debugColor:{type:"v3",value:new Pe.Color},covariancesTextureSize:{type:"v2",value:new Pe.Vector2(1024,1024)},centersColorsTextureSize:{type:"v2",value:new Pe.Vector2(1024,1024)},orthoZoom:{type:"f",value:-1}};return new Pe.ShaderMaterial({uniforms:i,vertexShader:r,fragmentShader:o,transparent:!0,alphaTest:1,blending:Pe.NormalBlending,depthTest:!0,depthWrite:!1,side:Pe.DoubleSide})}static buildGeomtery(e){let r=new Pe.BufferGeometry;r.setIndex([0,1,2,0,2,3]);let o=new Float32Array(4*3),i=new Pe.BufferAttribute(o,3);r.setAttribute("position",i),i.setXYZ(0,-1,-1,0),i.setXYZ(1,-1,1,0),i.setXYZ(2,1,1,0),i.setXYZ(3,1,-1,0),i.needsUpdate=!0;let a=new Pe.InstancedBufferGeometry().copy(r),s=new Uint32Array(e),l=new Pe.InstancedBufferAttribute(s,1,!1);return l.setUsage(Pe.DynamicDrawUsage),a.setAttribute("splatIndex",l),a.instanceCount=e,a}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(i=>i.buildPreComputedBuffers()),this.covariances=new Float32Array(this.splatCount*6),this.colors=new Uint8Array(this.splatCount*4),this.centers=new Float32Array(this.splatCount*3);let e=0,r=0,o=0;for(let i of this.splatBuffers){let a=i.nsplats;this.colors.subarray(e,e+a*4).set(i.colorsA),e+=a*4,this.centers.subarray(r,r+a*3).set(i.decoded.xyz.denormDequant().data),r+=a*3,this.covariances.subarray(o,o+a*6).set(new Float32Array(i.precomputedCovarianceBufferData)),o+=a*6}}allocateAndStoreLocalSplatDataInTextures(){let o=this.splatCount,i=new Pe.Vector2(4096,1024);for(;i.x*i.y*2<o*6;)i.y*=2;let a=new Pe.Vector2(4096,1024);for(;a.x*a.y*4<o*4;)a.y*=2;let s,l;if(this.halfPrecisionCovariancesOnGPU){l=new Uint16Array(i.x*i.y*2);for(let h=0;h<this.covariances.length;h++)l[h]=Pe.DataUtils.toHalfFloat(this.covariances[h]);s=new Pe.DataTexture(l,i.x,i.y,Pe.RGFormat,Pe.HalfFloatType)}else l=new Float32Array(i.x*i.y*2),l.set(this.covariances),s=new Pe.DataTexture(l,i.x,i.y,Pe.RGFormat,Pe.FloatType);s.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=s,this.material.uniforms.covariancesTextureSize.value.copy(i);let u=new Uint32Array(a.x*a.y*4);for(let h=0;h<o;h++){let m=h*4,y=h*3,g=h*4;u[g]=r1(this.colors[m],this.colors[m+1],this.colors[m+2],this.colors[m+3]),u[g+1]=Zd(this.centers[y]),u[g+2]=Zd(this.centers[y+1]),u[g+3]=Zd(this.centers[y+2])}let c=new Pe.DataTexture(u,a.x,a.y,Pe.RGBAIntegerFormat,Pe.UnsignedIntType);c.internalFormat="RGBA32UI",c.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=c,this.material.uniforms.centersColorsTextureSize.value.copy(a);let d=256*4,p=new Float32Array(256*16);for(let h=0;h<this.meshMatrixWorlds.length;h++)p.set(this.meshMatrixWorlds[h].elements,h*16);let f=new Pe.DataTexture(p,d,1,Pe.RGBAFormat,Pe.FloatType);f.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=f,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:l,texture:s,size:i},centerColors:{data:u,texture:c,size:a},meshMatrixWorlds:{data:p,texture:f}}}updateIndexes(e){let r=this.geometry;r.attributes.splatIndex.set(e),r.attributes.splatIndex.needsUpdate=!0,r.instanceCount=e.length}updateUniforms(e,r,o,i){this.splatCount>0&&(Jd.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(Jd),this.material.uniforms.basisViewport.value.set(2/Jd.x,2/Jd.y),this.material.uniforms.focal.value.set(r,o),this.material.uniforms.orthoZoom.value=i,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose())}};var gc=class{constructor(t={}){Zt(this,"updateSplatMeshUniforms",function(){let t=new zr.Vector2;return function(){if(this.splatMesh===null)return;this.splatMesh.getSplatCount()>0&&(this.renderer.getSize(t),this.cameraFocalLengthX=this.camera.projectionMatrix.elements[0]*this.devicePixelRatio*t.x*.45,this.cameraFocalLengthY=this.camera.projectionMatrix.elements[5]*this.devicePixelRatio*t.y*.45,this.splatMesh.updateUniforms(t,this.cameraFocalLengthX,this.cameraFocalLengthY,this.camera.isPerspectiveCamera?-1:this.camera.zoom*this.devicePixelRatio))}}());Zt(this,"updateView",function(){let t=new zr.Matrix4,e=[],r=new zr.Vector3(0,0,-1),o=new zr.Vector3(0,0,-1),i=new zr.Vector3,a=new zr.Vector3;return function(s=!1){let l=this.updateMatrixWorldsInWorkerIfNeeded(),u=this.cropsChanged();if(!s){o.set(0,0,-1).applyQuaternion(this.camera.quaternion);let d=!1,p=!1;if(o.dot(r)<=.95&&(d=!0),a.copy(this.camera.position).sub(i).length()>=1&&(p=!0),!d&&!p&&!l&&!u)return}i.copy(this.camera.position),r.copy(o),t.copy(this.camera.matrixWorld).invert(),t.premultiply(this.camera.perspCamera.projectionMatrix),e[0]=this.camera.position.x,e[1]=this.camera.position.y,e[2]=this.camera.position.z;let c={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...l?{newMatrixWorlds:this.meshMatrixWorlds}:{},...u?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=c:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(c))}}());this.scene=t.scene,this.currentPage=null,this.renderer=t.renderer,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.splatRenderingInitialized=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null}get camera(){return this.scene.activeCamera}reloadSplats(){this.splatRenderingInitialized=!1;let t=this.loadSplat();this.renderer.pipeline.opaquePass.splatViewer=t?this:null}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=new zr.Vector3().fromArray(t.position)),t.orientation&&(t.orientation=new zr.Quaternion().fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseEntity(a=>{if(a.data.type==="Splat"){let s=a.visible;a.traverseAncestors(l=>{s&&(s=l.visible)}),s&&e.push(a)}}),this.splatMesh&&this.splatMesh.dispose(),e.length===0)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(a=>a.matrixWorld),this.meshMatrixWorldsOld=e.map(a=>a.matrixWorld.clone()),this.cropsArray=e.map(a=>a.data.crops.map(s=>s.data));let r=e.map(a=>new di(new Uint8Array(a.data.buffer).buffer)),o=0,i=[0];for(let a of r)o+=a.getSplatCount(),i.push(o);return this.setupSplatMesh(r,o,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,i,this.meshMatrixWorlds),this.setupSortWorker(o),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,e*16);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,this.meshMatrixWorlds.every((e,r)=>e.equals(this.meshMatrixWorldsOld[r]))?!1:(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(e=>e.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,r)=>{e.data.crops.forEach((o,i)=>{this.cropsArray[r][i]===void 0?(t=!0,this.cropsArray[r][i]=o.data):Object.entries(o.data).forEach(([a,s])=>{Array.isArray(s)&&s.some((l,u)=>l!==this.cropsArray[r][i][a][u])?(t=!0,this.cropsArray[r][i][a]=s):s!==this.cropsArray[r][i]?.[a]&&(t=!0,this.cropsArray[r][i][a]=s)})}),e.data.crops.length!==this.cropsArray[r]?.length&&(this.cropsArray[r].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,r=new zr.Vector3,o=new zr.Quaternion,i=!1,a=1,s,l){this.splatMesh=pi.buildMesh(t,e,i,a,s,l),this.splatMesh.position.copy(r),this.splatMesh.quaternion.copy(o),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=10,this.updateSplatMeshUniforms(),this.splatRenderCount=e}setupSortWorker(t){this.sortWorker=t1(t),this.sortWorker.onmessage=e=>{e.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(e.data.indexesBuffer)),this.lastSortTime=e.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):e.data.sortCanceled?this.sortRunning=!1:e.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):e.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.updateView(!0,!0),this.splatRenderingInitialized=!0)}}update(){this.splatRenderingInitialized!==!1&&(this.updateSplatMeshUniforms(),this.updateView())}getSplatMesh(){return this.splatMesh}};var t3=new lo.MeshBasicMaterial;t3.wireframe=!0;var o1=new lo.Vector3,ep=class extends lo.Scene{constructor(e,r){super();this.data=e;this.sharedAssets=r;this.enableHelpers=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this.needsNormalDirty=!0;this._needsTransmission=!1;this._needsNormal=!1;this.geometryCacheChanged=!1;this.splatViewer=null;this.entityByUuid={};this.entityIdentityToEntity={};this.toExpandCloner=new Set;this.toUpdateCloner=new Set;this.pendingCommands=[];this.pathConstraints=new Xd;this.invisibleObjects=new ni("jflkdsafjasdifjaslk",{...Ou.defaultData,visible:!1,name:"buildin invisible"});this.needsRecomputeInstances=!1;this.init(e,r),this.matrixAutoUpdate=!1,this.errorPage=new io("fdasfa",{...an.defaultData,name:""},{shared:r,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=_S(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=AS(this),this.needsNormalDirty=!1),this._needsNormal}registerInstanceAndSetUuid(e){let r=e.identity.join("-"),o=this.entityIdentityToEntity[r];o&&(e.uuid=o.uuid),this.entityIdentityToEntity[r]=e,this.entityByUuid[e.uuid]=e}markPenumbraSizeDirty(){for(let e of this.children)e instanceof io&&(e.penumbraSizeArrayCache=null)}findInstance(e){return this.entityIdentityToEntity[e.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(e){let r=this.find(e);if(r===void 0)return;let o=[],i=r;for(;i!==this;){let a=i;i=i.parent;let s=i.children.indexOf(a);o.splice(0,0,s)}return{entity:r,sortKey:o}}getAllSorted(e){let r=[];for(let o of e){let i=this.getWithSortKey(o.id);i!==void 0&&r.push(i)}return r.sort((o,i)=>Oc(o.sortKey,i.sortKey)),r.map(o=>o.entity)}nonExistOrDescendantOf(e,r){let o=this.find(e);if(o===void 0)return!0;for(;o;){if(o.uuid===r)return!0;o=o.parent}return!1}find(e){if(this.activePage&&this.activePage.personalCamera.parent){if(e==="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera")return this.activePage.personalCamera;if(e===zn)return this.activePage.personalCamera}if(e===""||e===void 0)return;let r=this.entityByUuid[e];return r===void 0?this.getObjectByProperty("uuid",e):r}find2D(e){for(let r of this.children)if(r instanceof io&&r.uiScene){let o=r.uiScene.find(e);if(o)return o}}findScene2DfromObject2D(e){for(let r of this.children)if(r instanceof io&&r.uiScene&&r.uiScene.find(e))return r.uiScene}find2DInUIObjects(e){let r;return this.traverseEntity(o=>{r===void 0&&o instanceof qi&&(r=o.uiCanvas.find(e))}),r}traverse2D(e){for(let r of this.children)r instanceof io&&r.uiScene&&r.uiScene.traverse(e)}debugEnsureEntity(e){let r=this.find(e);if(r){if(Array.isArray(r.identity)&&this.findInstance(r.identity)===void 0){console.error("not found instance");debugger}}else{console.error("not found");debugger}}addPendingExpandCloner(e){this.toExpandCloner.add(e)}addPendingUpdateCloner(e){this.toUpdateCloner.add(e)}markToExpandCloner(e){this.toExpandCloner.add(e),e.traverseEntityAncestors(r=>{this.toExpandCloner.add(r)})}doPendingExpandCloner(){this.toExpandCloner.forEach(e=>{e.expandCloner(this)}),this.toExpandCloner.clear()}doPendingUpdateCloner(){this.toUpdateCloner.forEach(e=>{e.cloner?.update()}),this.toUpdateCloner.clear()}doPendingUpdates(){this.doPendingExpandCloner(),this.doPendingUpdateCloner(),this.applyPendingCommands()}addPendingCommand(e){this.pendingCommands.push(e)}applyPendingCommands(){this.pendingCommands.forEach(e=>e()),this.pendingCommands.length=0}updateByLibOp(e,r){e.path.length===1&&e.path[0]==="components"&&e.type===1&&this.createChildrenObjects([{...e.data.asset,id:e.id}],this.invisibleObjects,r)}updateTreeByOp(e,r){if(e.path.length===0&&e.type===7){let o=e.parent===null?this:this.find(e.parent);if(o===void 0)throw new Error("unexpected");let i=this.createObject(e.id,e.data,e.children,o,e.localIndex,r);i.updateVisible(this),i.resetBBoxNeedsUpdate(),oi(i)&&lc(i.parent)&&(i.invalidateUpstreamBooleanData(),i.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(o),this.markNeedsRecomputeInstancesForChildren(i),this.markToExpandCloner(i),this.markPenumbraSizeDirty(),i.updatePathSnapping()}else if(e.path.length===0&&e.type===8){let o=this.find(e.id);if(o===void 0)throw new Error("unexpected");this.markToExpandCloner(o),o.resetBBoxNeedsUpdate(),this.unregisterObject(o);let i=o.parent;this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(o),this.markPenumbraSizeDirty(),o.parent.remove(o),lc(o.parent)&&(o.parent.invalidateUpstreamBooleanData(),o.parent.invalidateDownstreamBooleanData().recomputeBoolean()),oi(o)&&(o.freeBooleanPointer(),i instanceof Br&&i.invalidateDownstreamBooleanData().recomputeBoolean()),o instanceof tl&&o.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(o),this.pathConstraints.removeDependencies(o.uuid),o.updatePathSnapping()}else if(e.path.length===0&&e.type===9){let o=this.find(e.id);if(o===void 0)throw new Error("unexpected");this.markNeedsRecomputeInstancesForChildren(o);let i=o.parent;this.markNeedsRecomputeInstancesForAncessors(i),o.cloner?.resetOnMove(),this.markToExpandCloner(o);let a=e.parent===null?this:this.find(e.parent);if(a===void 0)throw new Error("unexpected");a.add(o),this.markNeedsRecomputeInstancesForAncessors(a),this.markToExpandCloner(o),o.invalidateClonerTransform(o),o.updateVisible(this),o.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let s=e.localIndex;a.children.splice(s,0,a.children.pop()),oi(o)&&(o.invalidateUpstreamBooleanData(),lc(o.parent)?o.parent.invalidateDownstreamBooleanData().recomputeBoolean():i instanceof Br&&i.invalidateDownstreamBooleanData().recomputeBoolean()),o.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let r of this.children)r instanceof io&&(r.visible=r.uuid===e,r.visible&&(this.activePage=r,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(e,r,o,i){if(r.type===0){if(("overrides"in r.props||"component"in r.props)&&this.markNeedsRecomputeInstances(),"visible"in r.props&&this.markPenumbraSizeDirty(),r.path.includes("overrides")&&"states"in r.props){let{rest:s}=r.props;r={...r,props:s},this.markNeedsRecomputeInstances()}r.path[0]==="pathSnapping"&&r.props.pathId!==void 0&&this.pathConstraints.setConstraint(e,r.props.pathId)}let a=this.find(e);if(a)try{vS(a,r,o,{scene:this,shared:i}),a instanceof Ot&&a.updateGeometryGroupsIfNeeded()}catch(s){console.error(s)}}updateEntity2DByOp(e,r,o,i,a,s=[]){e.updateEntityByOp(r,o,i,a),this.traverseEntity(l=>{(l instanceof qi||l instanceof io)&&(s.includes(l.frameId??"")||l.frameId===r)&&l.updateEntity2DByOp(r,o,i,a)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(e){this.activePage.switchActiveCamera(e)}isInvisibleObjects(e){return e===this.invisibleObjects||e.hasAnccestor(this.invisibleObjects)}init(e,r){let o=Object.entries(r.data.lib.components).map((i,a)=>({data:i[1].asset.data,children:i[1].asset.children,id:i[0],fi:a}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:r}),this.add(this.invisibleObjects),this.createChildrenObjects(o,this.invisibleObjects,r),this.createChildrenObjects(e.objects,this,r),this.updatePage(e.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(r,!0),this.traverseEntity(i=>{i instanceof wn&&i.updateUp()}),this.doPendingExpandCloner(),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity(r=>{(r.data.type==="Component"||r.data.type==="Instance")&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(e){ke.is(e)&&(e.data.type==="Component"&&this.markNeedsRecomputeInstances(),e.traverseAncestors(r=>{ke.is(r)&&r.data.type==="Component"&&this.markNeedsRecomputeInstances()}))}relativeizeInner(e,r,o,i,a,s,l){if(e){let u=i.find(e);u&&u!==i&&a.forInstancesRec(c=>{c.data=Dn(c.data,d=>{let p=d.events.data(l.id),f=c.goUp(s);if(f){let h=[...Pc(f.identity),e].join("-"),m=this.entityIdentityToEntity[h];if(m){let y=m.uuid,g=St.zoom(p,r);g[o]=y}else{if(!1)debugger;console.warn("cannot find instance")}}}).data})}}rewriteActions(e,r,o,i,a,s){e.forEach(l=>{l.data.type==="Transition"?this.relativeizeInner(l.data.object,[...r,l.id],"object",o,i,a,s):l.data.type==="Animation"&&this.relativeizeInner(l.data.object,[...r,l.id],"object",o,i,a,s)})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(e=>{if(e instanceof Pn&&typeof e.identity=="string"&&e.data.type==="Component")return e.traverseEntity((r,o)=>{r.data.events.forEach(i=>{if(i.data.type==="GameControl"){let a=!1;if(r.forInstancesRec(s=>{s.data=Dn(s.data,l=>{s.isInstanceRoot||(l.events.delete(i.id),a=!0)}).data}),a===!1)for(let s of Iu.list)this.rewriteActions(i.data.gameActions[s],["gameActions",s],e,r,o,i)}else i.data.type==="Conditional"?(i.data.condition.type==="Distance"?(this.relativeizeInner(i.data.condition.fromObject,["condition"],"fromObject",e,r,o,i),this.relativeizeInner(i.data.condition.toObject,["condition"],"toObject",e,r,o,i)):i.data.condition.type==="State"?this.relativeizeInner(i.data.condition.object,["condition"],"object",e,r,o,i):i.data.condition.type==="Comparison"&&(i.data.condition.lOperand.type==="Property"&&this.relativeizeInner(i.data.condition.lOperand.value[0],["condition","lOperand","value"],0,e,r,o,i),i.data.condition.rOperand.type==="Property"&&this.relativeizeInner(i.data.condition.rOperand.value[0],["condition","rOperand","value"],0,e,r,o,i)),this.rewriteActions(i.data.inActions,["inActions"],e,r,o,i),this.rewriteActions(i.data.outActions,["outActions"],e,r,o,i)):"actions"in i.data&&this.rewriteActions(i.data.actions,["actions"],e,r,o,i)})}),!0})}expandInstances(e,r,o){let i=new Set;this.traverseEntity(a=>{if(a instanceof Pn&&a.isInstanceRoot)return a.expandInstanceChildren({scene:this,shared:e,pendingDeletes:i}),r||a.resetBBoxNeedsUpdate(),o&&a.traverseEntity(s=>{o.addClip(s)}),!0});for(let a of i)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),Ud(a)}recomputeInstances(e,r){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(o=>{o instanceof Pn&&o.isInstanceRoot&&(o.component=void 0)}),this.expandInstances(e,!1,r))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(e){e.traverseEntity(r=>{let o=typeof r.identity=="string"?r.identity:r.identity.join("-");this.entityIdentityToEntity[o]===r&&(delete this.entityByUuid[r.uuid],delete this.entityIdentityToEntity[o]),r.dispose()})}clearScene(){for(let e of this.children)ke.is(e)&&e.disposeRecursively();this.children.length=0}resetAfterClear(e,r){this.init(e,r)}raycast(e){return this.raycast1(e,!1)}raycast1(e,r){let o=[],i=a=>{for(let s of a.children){let l=s.cloner;if(ke.is(s)&&!s.raycastLock&&(s.visible||l?.object.data.visible))if(r===!0&&s.isInstanceRoot){let u=[];if(e.intersectObject(s,!0,u),u.length){let c=u[0];c.object=s,c.point.applyMatrix4(c.object.matrixWorld);let d=s.matrixWorld.clone().invert();c.point.applyMatrix4(d),o.push(c)}}else(oi(s)||cc(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,o),yc(s,e,o)),i(s)}};return i(this.activePage),o}raycastWithClones(e){let r=[],o=i=>{for(let a of i.children){let s=a.cloner;ke.is(a)&&(a.visible||s?.object.data.visible)&&((oi(a)||cc(a)&&this.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,r),yc(a,e,r,!0)),o(a))}};return o(this),r}forEachEntity(e){for(let r of this.children)ke.is(r)&&e(r)}traverseConcreteEntity(e){for(let r of this.children)ke.is(r)&&r.isConcreteEntity&&r.traverseEntity(e)}traverseEntity(e){for(let r of this.children)ke.is(r)&&r.traverseEntity(e)}updateFont(e,r){this.traverseEntity(o=>{if(o instanceof Ot&&o.data.type==="Mesh"&&o.data.geometry.type==="TextGeometry"&&o.data.geometry.font===e){let i=o.geometry,a=o.data.geometry;i.updateFont(e,r).then(()=>{i.update(a);let s=o.invalidateDownstreamBooleanData();lc(s)&&s.recomputeBoolean()})}})}traverseObject(e){for(let r of this.children)Ha.is(r)&&r.traverseObject(e)}traverseVisibleEntity(e){for(let r of this.children)ke.is(r)&&r.visible&&r.traverseVisibleEntity(e)}dispose(){this.clearScene()}createChildrenObjects(e,r,o){let i=0;for(let a of e)this.createObject(a.id,a.data,a.children,r,i,o),i+=1}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let r of e.children)this.unregisterObject(r)}createObject(e,r,o,i,a,s){let l={scene:this,shared:s},u=Yd(e,r,l);return u&&(this.entityByUuid[e]=u,i.add(u),i.children.splice(a,0,i.children.pop()),o.length>0&&(u.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(o,u,s)),u.updateState(r,l),u instanceof Ot&&u.updateGeometryGroupsIfNeeded(),u.updateVisible(this),u.cloner&&this.toExpandCloner.add(u),r.pathSnapping?.pathId&&this.pathConstraints.setConstraint(e,r.pathSnapping.pathId)),r.type==="Empty"&&r.animations&&u.traverseEntity(c=>{let d=c.dataPatched;if(c instanceof Ot&&d.bones&&d.boneInverses){let p=d.bones.map(m=>this.find(m)),f=d.boneInverses.map(m=>new lo.Matrix4().fromArray(m)),h=new lo.Skeleton(p,f);c.bind(h,c.bindMatrix)}else c.matrixAutoUpdate=!0}),u}getCenter(e){let r=[];for(let i=0,a=e.length;i<a;++i){let{id:s,recursive:l}=e[i],u=this.find(s),c=l?u.recursiveBBox:u.singleBBox;r.push(...c.vertices)}let o=new lo.Box3;return o.setFromPoints(r),o.getCenter(o1),o1}copyMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e);o?r.copy(o.matrixWorld):r.identity()}copyParentMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e)?.parent;o?r.copy(o.matrixWorld):r.identity()}traverseMaterial(e){this.traverseEntity(r=>{if(r instanceof $t)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)r.material[o]instanceof Dr&&e(r.material[o]);else r.material instanceof Dr&&e(r.material)})}updateViewPlaneSize(e,r,o=!1){this.traverseConcreteEntity(i=>{i instanceof wn&&i.setViewplaneSize(e,r,o)})}initializeSplatViewer(e){this.splatViewer=new gc({scene:this,renderer:e}),this.reloadSplats()}reloadSplats(){this.splatViewer?.reloadSplats()}};var n1=require("three/examples/jsm/loaders/DRACOLoader.js");var fi;function r3(){return fi||(fi=new n1.DRACOLoader,fi.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),fi.decoderPending}async function o3(n){if(fi){let t={attributeIDs:fi.defaultAttributeIDs,attributeTypes:fi.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await fi.decodeGeometry(new Int8Array(n).buffer,t)}catch(r){console.error(r)}if(e)return{index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([r,o])=>({name:r,itemSize:o.itemSize,array:o.array}))}}return null}async function i1(n,t){let[e,r]=Pp(fu.deserialize(new Uint8Array(n)));Du(e);let o=[];e.scene.objects.traverse((i,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&a.geometry.data.draco!==void 0&&o.push(a)}),o.length&&await r3();for(let i of o){let a=await o3(At(i.geometry.data.draco));if(a){a.index&&(i.geometry.data.index={array:a.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let s={};a.attributes.forEach(({name:l,array:u,itemSize:c})=>{s[l]={array:u,itemSize:c,type:"Float32Array",normalized:!1}}),i.geometry.data.attributes=s,i.geometry.data.draco=void 0}}return t&&t(e),r.result().data}var n3=require("three"),i3=require("three/examples/jsm/utils/BufferGeometryUtils.js");function a1(n){let t;if(!!n.index)for(let e=0;e<n.index.array.length;e+=3)t=n.index.array[e],n.index.array[e]=n.index.array[e+2],n.index.array[e+2]=t}var xc=require("three");function s1(n){let t=new Set;return n.traverse(e=>{if(e instanceof Er)if(Mt(e.material))e.material.forEach(r=>{let o=r;t.has(o)||t.add(o)});else{let r=e.material;t.has(r)||t.add(r)}}),t.forEach(e=>{if(e instanceof Array)return;let r=e.onBeforeCompile.bind(e);if(a3(e)){Object.assign(e,{isMeshStandardMaterial:!0,isMeshPhysicalMaterial:!0,transmission:1,attenuationColor:new xc.Color,specularColor:new xc.Color});let o=0;e.onBeforeCompile=(i,a)=>{r&&r(i,a),i.uniforms=Object.assign({},xc.ShaderLib.physical.uniforms,i.uniforms),e.getLayersOfType("transmission").forEach(s=>{if(i.uniforms.transmissionSamplerMap.value){let l=s.color;l&&(l.transmissionSamplerMap.value=i.uniforms.transmissionSamplerMap.value,l.transmissionSamplerSize.value=i.uniforms.transmissionSamplerSize.value,l.aspectRatio.value=Ob(window.innerWidth,window.innerHeight),e.defines.IS_THREEJS_EXPORT=!0)}else o++,o<2&&(e.needsUpdate=!0)})}}else s3(e)||(e.onBeforeCompile=(o,i)=>{r&&r(o,i),e.transparent=!1})}),n}function a3(n){return n.getLayersOfType("transmission").length>0}function s3(n){let t=0;for(let e of n.layers){if(e.data.type!=="displace"&&e.data.isMask)return!0;if(e.type!=="light"&&e.type!=="fresnel"){let o=e.uniforms["f"+e.id+"_alpha"];o&&(t+=(1-t)*o.value)}}return t<1}function l1(n){return n.traverse(t=>{if(t.type==="Camera"){let e=t;e.type=e.cameraType}}),n}function c1(n){let t=[],e=(r,o=0)=>{let i=o>0?r+o:r;return t.includes(i)?e(r,o+1):i};return n.traverse(r=>{if(t.includes(r.name)){let o=r.name,i=e(r.name);if(r.name=i,r.isMesh){let a=r;a.material instanceof Array?a.material.forEach(s=>{s.name=s.name.replace(o,i)}):a.material.isAsset||(a.material.name=a.material.name.replace(o,i))}}t.push(r.name)}),n}var u1=require("three/examples/jsm/utils/BufferGeometryUtils.js");function d1(n){let t=[];return n.traverse(e=>{e instanceof Us&&t.push(e)}),t.forEach(e=>{let r=e.object,a=[...e.children.map(s=>{s.updateMatrix();let l;if(s.geometry!==void 0)try{l=s.geometry.clone().applyMatrix4(s.matrix)}catch(u){console.error(u)}return l!==void 0&&s.matrix.determinant()<0&&a1(l),l}).filter(s=>s!==void 0)];if(!e.parameters.hideBase&&r instanceof $t&&a.unshift(r.geometry),a.length){let s=(0,u1.mergeBufferGeometries)(a);r instanceof $t&&(r.geometry=s)}e.removeFromParent(),r.setFromClonerState(null,{scene:n,shared:Fb})}),n}function p1(n){return n.traverse(t=>{t.matrixAutoUpdate=!0}),n}function f1(n){Object.values(n.shared.materials).forEach(t=>{qh(t)}),n.scene.objects.traverse((t,e)=>{"material"in e?qh(e.material):"materials"in e&&e.materials.forEach(r=>{qh(r)})})}function qh(n){if(typeof n=="string")return;let t=[];n.layers.forEach((e,r)=>{e.type==="outline"&&t.push(r)}),t.reverse().forEach(e=>{n.layers.delete(e)}),t.length&&console.warn("The Spline Loader currently does not support the outline layer.")}var x1=ar(m1(),1);function y1(n){return n.traverseMaterial(t=>{t.needsJitter=!1}),n}var g1="The SplineLoader only accepts .splinecode files that are generated from Spline export panel.",tp=class extends rp.Loader{load(t,e,r,o=console.error){let i=new rp.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),t.endsWith(".spline")?console.warn(g1+" The .spline files are only meant to be used by the Editor."):t.endsWith(".splinecode")||console.warn(g1),i.load(t,async a=>{try{if(typeof a=="string")throw new Error("The .spline file is not binary!");let s=await this.parse(a);e(s)}catch(s){o(s)}},r,o)}async parse(t){let e=await i1(t,f1);e.version&&(0,x1.default)(e.version,"1.0.60")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/loader to the latest version."),await Promise.allSettled([qb(e)&&Zx(),rv(e)&&zb(),Lv(e)&&Dv()].filter(Boolean));let r=new Fi(e.shared);Object.values(r.getMaterials()).forEach(a=>Object.assign(a,{isAsset:!0}));let o=new ep(e.scene,r),i=o.activeCamera;return i&&Object.assign(i,{makeDefault:!0}),o=d1(o),o=s1(o),o=l1(o),o=c1(o),o=p1(o),o=y1(o),o}};
|
|
3665
|
+
}`,i={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new Pe.Vector2},viewport:{type:"v2",value:new Pe.Vector2},basisViewport:{type:"v2",value:new Pe.Vector2},debugColor:{type:"v3",value:new Pe.Color},covariancesTextureSize:{type:"v2",value:new Pe.Vector2(1024,1024)},centersColorsTextureSize:{type:"v2",value:new Pe.Vector2(1024,1024)},orthoZoom:{type:"f",value:-1}};return new Pe.ShaderMaterial({uniforms:i,vertexShader:r,fragmentShader:o,transparent:!0,alphaTest:1,blending:Pe.NormalBlending,depthTest:!0,depthWrite:!1,side:Pe.DoubleSide})}static buildGeomtery(e){let r=new Pe.BufferGeometry;r.setIndex([0,1,2,0,2,3]);let o=new Float32Array(4*3),i=new Pe.BufferAttribute(o,3);r.setAttribute("position",i),i.setXYZ(0,-1,-1,0),i.setXYZ(1,-1,1,0),i.setXYZ(2,1,1,0),i.setXYZ(3,1,-1,0),i.needsUpdate=!0;let a=new Pe.InstancedBufferGeometry().copy(r),s=new Uint32Array(e),l=new Pe.InstancedBufferAttribute(s,1,!1);return l.setUsage(Pe.DynamicDrawUsage),a.setAttribute("splatIndex",l),a.instanceCount=e,a}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(i=>i.buildPreComputedBuffers()),this.covariances=new Float32Array(this.splatCount*6),this.colors=new Uint8Array(this.splatCount*4),this.centers=new Float32Array(this.splatCount*3);let e=0,r=0,o=0;for(let i of this.splatBuffers){let a=i.nsplats;this.colors.subarray(e,e+a*4).set(i.colorsA),e+=a*4,this.centers.subarray(r,r+a*3).set(i.decoded.xyz.denormDequant().data),r+=a*3,this.covariances.subarray(o,o+a*6).set(new Float32Array(i.precomputedCovarianceBufferData)),o+=a*6}}allocateAndStoreLocalSplatDataInTextures(){let o=this.splatCount,i=new Pe.Vector2(4096,1024);for(;i.x*i.y*2<o*6;)i.y*=2;let a=new Pe.Vector2(4096,1024);for(;a.x*a.y*4<o*4;)a.y*=2;let s,l;if(this.halfPrecisionCovariancesOnGPU){l=new Uint16Array(i.x*i.y*2);for(let h=0;h<this.covariances.length;h++)l[h]=Pe.DataUtils.toHalfFloat(this.covariances[h]);s=new Pe.DataTexture(l,i.x,i.y,Pe.RGFormat,Pe.HalfFloatType)}else l=new Float32Array(i.x*i.y*2),l.set(this.covariances),s=new Pe.DataTexture(l,i.x,i.y,Pe.RGFormat,Pe.FloatType);s.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=s,this.material.uniforms.covariancesTextureSize.value.copy(i);let u=new Uint32Array(a.x*a.y*4);for(let h=0;h<o;h++){let m=h*4,y=h*3,g=h*4;u[g]=r1(this.colors[m],this.colors[m+1],this.colors[m+2],this.colors[m+3]),u[g+1]=Zd(this.centers[y]),u[g+2]=Zd(this.centers[y+1]),u[g+3]=Zd(this.centers[y+2])}let c=new Pe.DataTexture(u,a.x,a.y,Pe.RGBAIntegerFormat,Pe.UnsignedIntType);c.internalFormat="RGBA32UI",c.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=c,this.material.uniforms.centersColorsTextureSize.value.copy(a);let d=256*4,p=new Float32Array(256*16);for(let h=0;h<this.meshMatrixWorlds.length;h++)p.set(this.meshMatrixWorlds[h].elements,h*16);let f=new Pe.DataTexture(p,d,1,Pe.RGBAFormat,Pe.FloatType);f.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=f,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:l,texture:s,size:i},centerColors:{data:u,texture:c,size:a},meshMatrixWorlds:{data:p,texture:f}}}updateIndexes(e){let r=this.geometry;r.attributes.splatIndex.set(e),r.attributes.splatIndex.needsUpdate=!0,r.instanceCount=e.length}updateUniforms(e,r,o,i){this.splatCount>0&&(Jd.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(Jd),this.material.uniforms.basisViewport.value.set(2/Jd.x,2/Jd.y),this.material.uniforms.focal.value.set(r,o),this.material.uniforms.orthoZoom.value=i,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose())}};var gc=class{constructor(t={}){Zt(this,"updateSplatMeshUniforms",function(){let t=new zr.Vector2;return function(){if(this.splatMesh===null)return;this.splatMesh.getSplatCount()>0&&(this.renderer.getSize(t),this.cameraFocalLengthX=this.camera.projectionMatrix.elements[0]*this.devicePixelRatio*t.x*.45,this.cameraFocalLengthY=this.camera.projectionMatrix.elements[5]*this.devicePixelRatio*t.y*.45,this.splatMesh.updateUniforms(t,this.cameraFocalLengthX,this.cameraFocalLengthY,this.camera.isPerspectiveCamera?-1:this.camera.zoom*this.devicePixelRatio))}}());Zt(this,"updateView",function(){let t=new zr.Matrix4,e=[],r=new zr.Vector3(0,0,-1),o=new zr.Vector3(0,0,-1),i=new zr.Vector3,a=new zr.Vector3;return function(s=!1){let l=this.updateMatrixWorldsInWorkerIfNeeded(),u=this.cropsChanged();if(!s){o.set(0,0,-1).applyQuaternion(this.camera.quaternion);let d=!1,p=!1;if(o.dot(r)<=.95&&(d=!0),a.copy(this.camera.position).sub(i).length()>=1&&(p=!0),!d&&!p&&!l&&!u)return}i.copy(this.camera.position),r.copy(o),t.copy(this.camera.matrixWorld).invert(),t.premultiply(this.camera.perspCamera.projectionMatrix),e[0]=this.camera.position.x,e[1]=this.camera.position.y,e[2]=this.camera.position.z;let c={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...l?{newMatrixWorlds:this.meshMatrixWorlds}:{},...u?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=c:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(c))}}());this.scene=t.scene,this.currentPage=null,this.renderer=t.renderer,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.splatRenderingInitialized=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null}get camera(){return this.scene.activeCamera}reloadSplats(){this.splatRenderingInitialized=!1;let t=this.loadSplat();this.renderer.pipeline.opaquePass.splatViewer=t?this:null}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=new zr.Vector3().fromArray(t.position)),t.orientation&&(t.orientation=new zr.Quaternion().fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseEntity(a=>{if(a.data.type==="Splat"){let s=a.visible;a.traverseAncestors(l=>{s&&(s=l.visible)}),s&&e.push(a)}}),this.splatMesh&&this.splatMesh.dispose(),e.length===0)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(a=>a.matrixWorld),this.meshMatrixWorldsOld=e.map(a=>a.matrixWorld.clone()),this.cropsArray=e.map(a=>a.data.crops.map(s=>s.data));let r=e.map(a=>new di(new Uint8Array(a.data.buffer).buffer)),o=0,i=[0];for(let a of r)o+=a.getSplatCount(),i.push(o);return this.setupSplatMesh(r,o,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,i,this.meshMatrixWorlds),this.setupSortWorker(o),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,e*16);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,this.meshMatrixWorlds.every((e,r)=>e.equals(this.meshMatrixWorldsOld[r]))?!1:(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(e=>e.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,r)=>{e.data.crops.forEach((o,i)=>{this.cropsArray[r][i]===void 0?(t=!0,this.cropsArray[r][i]=o.data):Object.entries(o.data).forEach(([a,s])=>{Array.isArray(s)&&s.some((l,u)=>l!==this.cropsArray[r][i][a][u])?(t=!0,this.cropsArray[r][i][a]=s):s!==this.cropsArray[r][i]?.[a]&&(t=!0,this.cropsArray[r][i][a]=s)})}),e.data.crops.length!==this.cropsArray[r]?.length&&(this.cropsArray[r].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,r=new zr.Vector3,o=new zr.Quaternion,i=!1,a=1,s,l){this.splatMesh=pi.buildMesh(t,e,i,a,s,l),this.splatMesh.position.copy(r),this.splatMesh.quaternion.copy(o),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=10,this.updateSplatMeshUniforms(),this.splatRenderCount=e}setupSortWorker(t){this.sortWorker=t1(t),this.sortWorker.onmessage=e=>{e.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(e.data.indexesBuffer)),this.lastSortTime=e.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):e.data.sortCanceled?this.sortRunning=!1:e.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):e.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.updateView(!0,!0),this.splatRenderingInitialized=!0)}}update(){this.splatRenderingInitialized!==!1&&(this.updateSplatMeshUniforms(),this.updateView())}getSplatMesh(){return this.splatMesh}};var t3=new lo.MeshBasicMaterial;t3.wireframe=!0;var o1=new lo.Vector3,ep=class extends lo.Scene{constructor(e,r){super();this.data=e;this.sharedAssets=r;this.enableHelpers=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this.needsNormalDirty=!0;this._needsTransmission=!1;this._needsNormal=!1;this.geometryCacheChanged=!1;this.splatViewer=null;this.entityByUuid={};this.entityIdentityToEntity={};this.toExpandCloner=new Set;this.toUpdateCloner=new Set;this.pendingCommands=[];this.pathConstraints=new Xd;this.invisibleObjects=new ni("jflkdsafjasdifjaslk",{...Ou.defaultData,visible:!1,name:"buildin invisible"});this.needsRecomputeInstances=!1;this.init(e,r),this.matrixAutoUpdate=!1,this.errorPage=new io("fdasfa",{...an.defaultData,name:""},{shared:r,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=_S(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=AS(this),this.needsNormalDirty=!1),this._needsNormal}registerInstanceAndSetUuid(e){let r=e.identity.join("-"),o=this.entityIdentityToEntity[r];o&&(e.uuid=o.uuid),this.entityIdentityToEntity[r]=e,this.entityByUuid[e.uuid]=e}markPenumbraSizeDirty(){for(let e of this.children)e instanceof io&&(e.penumbraSizeArrayCache=null)}findInstance(e){return this.entityIdentityToEntity[e.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(e){let r=this.find(e);if(r===void 0)return;let o=[],i=r;for(;i!==this;){let a=i;i=i.parent;let s=i.children.indexOf(a);o.splice(0,0,s)}return{entity:r,sortKey:o}}getAllSorted(e){let r=[];for(let o of e){let i=this.getWithSortKey(o.id);i!==void 0&&r.push(i)}return r.sort((o,i)=>Oc(o.sortKey,i.sortKey)),r.map(o=>o.entity)}nonExistOrDescendantOf(e,r){let o=this.find(e);if(o===void 0)return!0;for(;o;){if(o.uuid===r)return!0;o=o.parent}return!1}find(e){if(this.activePage&&this.activePage.personalCamera.parent){if(e==="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera")return this.activePage.personalCamera;if(e===zn)return this.activePage.personalCamera}if(e===""||e===void 0)return;let r=this.entityByUuid[e];return r===void 0?this.getObjectByProperty("uuid",e):r}find2D(e){for(let r of this.children)if(r instanceof io&&r.uiScene){let o=r.uiScene.find(e);if(o)return o}}findScene2DfromObject2D(e){for(let r of this.children)if(r instanceof io&&r.uiScene&&r.uiScene.find(e))return r.uiScene}find2DInUIObjects(e){let r;return this.traverseEntity(o=>{r===void 0&&o instanceof qi&&(r=o.uiCanvas.find(e))}),r}traverse2D(e){for(let r of this.children)r instanceof io&&r.uiScene&&r.uiScene.traverse(e)}debugEnsureEntity(e){let r=this.find(e);if(r){if(Array.isArray(r.identity)&&this.findInstance(r.identity)===void 0){console.error("not found instance");debugger}}else{console.error("not found");debugger}}addPendingExpandCloner(e){this.toExpandCloner.add(e)}addPendingUpdateCloner(e){this.toUpdateCloner.add(e)}markToExpandCloner(e){this.toExpandCloner.add(e),e.traverseEntityAncestors(r=>{this.toExpandCloner.add(r)})}doPendingExpandCloner(){this.toExpandCloner.forEach(e=>{e.expandCloner(this)}),this.toExpandCloner.clear()}doPendingUpdateCloner(){this.toUpdateCloner.forEach(e=>{e.cloner?.update()}),this.toUpdateCloner.clear()}doPendingUpdates(){this.doPendingExpandCloner(),this.doPendingUpdateCloner(),this.applyPendingCommands()}addPendingCommand(e){this.pendingCommands.push(e)}applyPendingCommands(){this.pendingCommands.forEach(e=>e()),this.pendingCommands.length=0}updateByLibOp(e,r){e.path.length===1&&e.path[0]==="components"&&e.type===1&&this.createChildrenObjects([{...e.data.asset,id:e.id}],this.invisibleObjects,r)}updateTreeByOp(e,r){if(e.path.length===0&&e.type===7){let o=e.parent===null?this:this.find(e.parent);if(o===void 0)throw new Error("unexpected");let i=this.createObject(e.id,e.data,e.children,o,e.localIndex,r);i.updateVisible(this),i.resetBBoxNeedsUpdate(),oi(i)&&lc(i.parent)&&(i.invalidateUpstreamBooleanData(),i.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(o),this.markNeedsRecomputeInstancesForChildren(i),this.markToExpandCloner(i),this.markPenumbraSizeDirty(),i.updatePathSnapping()}else if(e.path.length===0&&e.type===8){let o=this.find(e.id);if(o===void 0)throw new Error("unexpected");this.markToExpandCloner(o),o.resetBBoxNeedsUpdate(),this.unregisterObject(o);let i=o.parent;this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(o),this.markPenumbraSizeDirty(),o.parent.remove(o),lc(o.parent)&&(o.parent.invalidateUpstreamBooleanData(),o.parent.invalidateDownstreamBooleanData().recomputeBoolean()),oi(o)&&(o.freeBooleanPointer(),i instanceof Br&&i.invalidateDownstreamBooleanData().recomputeBoolean()),o instanceof tl&&o.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(o),this.pathConstraints.removeDependencies(o.uuid),o.updatePathSnapping()}else if(e.path.length===0&&e.type===9){let o=this.find(e.id);if(o===void 0)throw new Error("unexpected");this.markNeedsRecomputeInstancesForChildren(o);let i=o.parent;this.markNeedsRecomputeInstancesForAncessors(i),o.cloner?.resetOnMove(),this.markToExpandCloner(o);let a=e.parent===null?this:this.find(e.parent);if(a===void 0)throw new Error("unexpected");a.add(o),this.markNeedsRecomputeInstancesForAncessors(a),this.markToExpandCloner(o),o.invalidateClonerTransform(o),o.updateVisible(this),o.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let s=e.localIndex;a.children.splice(s,0,a.children.pop()),oi(o)&&(o.invalidateUpstreamBooleanData(),lc(o.parent)?o.parent.invalidateDownstreamBooleanData().recomputeBoolean():i instanceof Br&&i.invalidateDownstreamBooleanData().recomputeBoolean()),o.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let r of this.children)r instanceof io&&(r.visible=r.uuid===e,r.visible&&(this.activePage=r,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(e,r,o,i){if(r.type===0){if(("overrides"in r.props||"component"in r.props)&&this.markNeedsRecomputeInstances(),"visible"in r.props&&this.markPenumbraSizeDirty(),r.path.includes("overrides")&&"states"in r.props){let{rest:s}=r.props;r={...r,props:s},this.markNeedsRecomputeInstances()}r.path[0]==="pathSnapping"&&r.props.pathId!==void 0&&this.pathConstraints.setConstraint(e,r.props.pathId)}let a=this.find(e);if(a)try{vS(a,r,o,{scene:this,shared:i}),a instanceof Ot&&a.updateGeometryGroupsIfNeeded()}catch(s){console.error(s)}}updateEntity2DByOp(e,r,o,i,a,s=[]){e.updateEntityByOp(r,o,i,a),this.traverseEntity(l=>{(l instanceof qi||l instanceof io)&&(s.includes(l.frameId??"")||l.frameId===r)&&l.updateEntity2DByOp(r,o,i,a)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(e){this.activePage.switchActiveCamera(e)}isInvisibleObjects(e){return e===this.invisibleObjects||e.hasAnccestor(this.invisibleObjects)}init(e,r){let o=Object.entries(r.data.lib.components).map((i,a)=>({data:i[1].asset.data,children:i[1].asset.children,id:i[0],fi:a}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:r}),this.add(this.invisibleObjects),this.createChildrenObjects(o,this.invisibleObjects,r),this.createChildrenObjects(e.objects,this,r),this.updatePage(e.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(r,!0),this.traverseEntity(i=>{i instanceof wn&&i.updateUp()}),this.doPendingExpandCloner(),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity(r=>{(r.data.type==="Component"||r.data.type==="Instance")&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(e){ke.is(e)&&(e.data.type==="Component"&&this.markNeedsRecomputeInstances(),e.traverseAncestors(r=>{ke.is(r)&&r.data.type==="Component"&&this.markNeedsRecomputeInstances()}))}relativeizeInner(e,r,o,i,a,s,l){if(e){let u=i.find(e);u&&u!==i&&a.forInstancesRec(c=>{c.data=Dn(c.data,d=>{let p=d.events.data(l.id),f=c.goUp(s);if(f){let h=[...Pc(f.identity),e].join("-"),m=this.entityIdentityToEntity[h];if(m){let y=m.uuid,g=St.zoom(p,r);g[o]=y}else{if(!1)debugger;console.warn("cannot find instance")}}}).data})}}rewriteActions(e,r,o,i,a,s){e.forEach(l=>{l.data.type==="Transition"?this.relativeizeInner(l.data.object,[...r,l.id],"object",o,i,a,s):l.data.type==="Animation"&&this.relativeizeInner(l.data.object,[...r,l.id],"object",o,i,a,s)})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(e=>{if(e instanceof Pn&&typeof e.identity=="string"&&e.data.type==="Component")return e.traverseEntity((r,o)=>{r.data.events.forEach(i=>{if(i.data.type==="GameControl"){let a=!1;if(r.forInstancesRec(s=>{s.data=Dn(s.data,l=>{s.isInstanceRoot||(l.events.delete(i.id),a=!0)}).data}),a===!1)for(let s of Iu.list)this.rewriteActions(i.data.gameActions[s],["gameActions",s],e,r,o,i)}else i.data.type==="Conditional"?(i.data.condition.type==="Distance"?(this.relativeizeInner(i.data.condition.fromObject,["condition"],"fromObject",e,r,o,i),this.relativeizeInner(i.data.condition.toObject,["condition"],"toObject",e,r,o,i)):i.data.condition.type==="State"?this.relativeizeInner(i.data.condition.object,["condition"],"object",e,r,o,i):i.data.condition.type==="Comparison"&&(i.data.condition.lOperand.type==="Property"&&this.relativeizeInner(i.data.condition.lOperand.value[0],["condition","lOperand","value"],0,e,r,o,i),i.data.condition.rOperand.type==="Property"&&this.relativeizeInner(i.data.condition.rOperand.value[0],["condition","rOperand","value"],0,e,r,o,i)),this.rewriteActions(i.data.inActions,["inActions"],e,r,o,i),this.rewriteActions(i.data.outActions,["outActions"],e,r,o,i)):"actions"in i.data&&this.rewriteActions(i.data.actions,["actions"],e,r,o,i)})}),!0})}expandInstances(e,r,o){let i=new Set;this.traverseEntity(a=>{if(a instanceof Pn&&a.isInstanceRoot)return a.expandInstanceChildren({scene:this,shared:e,pendingDeletes:i}),r||a.resetBBoxNeedsUpdate(),o&&a.traverseEntity(s=>{o.addClip(s)}),!0});for(let a of i)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),Ud(a)}recomputeInstances(e,r){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(o=>{o instanceof Pn&&o.isInstanceRoot&&(o.component=void 0)}),this.expandInstances(e,!1,r))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(e){e.traverseEntity(r=>{let o=typeof r.identity=="string"?r.identity:r.identity.join("-");this.entityIdentityToEntity[o]===r&&(delete this.entityByUuid[r.uuid],delete this.entityIdentityToEntity[o]),r.dispose()})}clearScene(){for(let e of this.children)ke.is(e)&&e.disposeRecursively();this.children.length=0}resetAfterClear(e,r){this.init(e,r)}raycast(e){return this.raycast1(e,!1)}raycast1(e,r){let o=[],i=a=>{for(let s of a.children){let l=s.cloner;if(ke.is(s)&&!s.raycastLock&&(s.visible||l?.object.data.visible))if(r===!0&&s.isInstanceRoot){let u=[];if(e.intersectObject(s,!0,u),u.length){let c=u[0];c.object=s,c.point.applyMatrix4(c.object.matrixWorld);let d=s.matrixWorld.clone().invert();c.point.applyMatrix4(d),o.push(c)}}else(oi(s)||cc(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,o),yc(s,e,o)),i(s)}};return i(this.activePage),o}raycastWithClones(e){let r=[],o=i=>{for(let a of i.children){let s=a.cloner;ke.is(a)&&(a.visible||s?.object.data.visible)&&((oi(a)||cc(a)&&this.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,r),yc(a,e,r,!0)),o(a))}};return o(this),r}forEachEntity(e){for(let r of this.children)ke.is(r)&&e(r)}traverseConcreteEntity(e){for(let r of this.children)ke.is(r)&&r.isConcreteEntity&&r.traverseEntity(e)}traverseEntity(e){for(let r of this.children)ke.is(r)&&r.traverseEntity(e)}updateFont(e,r){this.traverseEntity(o=>{if(o instanceof Ot&&o.data.type==="Mesh"&&o.data.geometry.type==="TextGeometry"&&o.data.geometry.font===e){let i=o.geometry,a=o.data.geometry;i.updateFont(e,r).then(()=>{i.update(a);let s=o.invalidateDownstreamBooleanData();lc(s)&&s.recomputeBoolean()})}})}traverseObject(e){for(let r of this.children)Ha.is(r)&&r.traverseObject(e)}traverseVisibleEntity(e){for(let r of this.children)ke.is(r)&&r.visible&&r.traverseVisibleEntity(e)}dispose(){this.clearScene()}createChildrenObjects(e,r,o){let i=0;for(let a of e)this.createObject(a.id,a.data,a.children,r,i,o),i+=1}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let r of e.children)this.unregisterObject(r)}createObject(e,r,o,i,a,s){let l={scene:this,shared:s},u=Yd(e,r,l);return u&&(this.entityByUuid[e]=u,i.add(u),i.children.splice(a,0,i.children.pop()),o.length>0&&(u.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(o,u,s)),u.updateState(r,l),u instanceof Ot&&u.updateGeometryGroupsIfNeeded(),u.updateVisible(this),u.cloner&&this.toExpandCloner.add(u),r.pathSnapping?.pathId&&this.pathConstraints.setConstraint(e,r.pathSnapping.pathId)),r.type==="Empty"&&r.animations&&u.traverseEntity(c=>{let d=c.dataPatched;if(c instanceof Ot&&d.bones&&d.boneInverses){let p=d.bones.map(m=>this.find(m)),f=d.boneInverses.map(m=>new lo.Matrix4().fromArray(m)),h=new lo.Skeleton(p,f);c.bind(h,c.bindMatrix)}else c.matrixAutoUpdate=!0}),u}getCenter(e){let r=[];for(let i=0,a=e.length;i<a;++i){let{id:s,recursive:l}=e[i],u=this.find(s),c=l?u.recursiveBBox:u.singleBBox;r.push(...c.vertices)}let o=new lo.Box3;return o.setFromPoints(r),o.getCenter(o1),o1}copyMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e);o?r.copy(o.matrixWorld):r.identity()}copyParentMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e)?.parent;o?r.copy(o.matrixWorld):r.identity()}traverseMaterial(e){this.traverseEntity(r=>{if(r instanceof $t)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)r.material[o]instanceof Dr&&e(r.material[o]);else r.material instanceof Dr&&e(r.material)})}updateViewPlaneSize(e,r,o=!1){this.traverseConcreteEntity(i=>{i instanceof wn&&i.setViewplaneSize(e,r,o)})}initializeSplatViewer(e){this.splatViewer=new gc({scene:this,renderer:e}),this.reloadSplats()}reloadSplats(){this.splatViewer?.reloadSplats()}};var n1=require("three/examples/jsm/loaders/DRACOLoader.js");var fi;function r3(){return fi||(fi=new n1.DRACOLoader,fi.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),fi.decoderPending}async function o3(n){if(fi){let t={attributeIDs:fi.defaultAttributeIDs,attributeTypes:fi.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await fi.decodeGeometry(new Int8Array(n).buffer,t)}catch(r){console.error(r)}if(e)return{index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([r,o])=>({name:r,itemSize:o.itemSize,array:o.array}))}}return null}async function i1(n,t){let[e,r]=Pp(fu.deserialize(new Uint8Array(n)));Du(e);let o=[];e.scene.objects.traverse((i,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&a.geometry.data.draco!==void 0&&o.push(a)}),o.length&&await r3();for(let i of o){let a=await o3(At(i.geometry.data.draco));if(a){a.index&&(i.geometry.data.index={array:a.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let s={};a.attributes.forEach(({name:l,array:u,itemSize:c})=>{s[l]={array:u,itemSize:c,type:"Float32Array",normalized:!1}}),i.geometry.data.attributes=s,i.geometry.data.draco=void 0}}return t&&t(e),r.result().data}var n3=require("three"),i3=require("three/examples/jsm/utils/BufferGeometryUtils.js");function a1(n){let t;if(!!n.index)for(let e=0;e<n.index.array.length;e+=3)t=n.index.array[e],n.index.array[e]=n.index.array[e+2],n.index.array[e+2]=t}var xc=require("three");function s1(n){let t=new Set;return n.traverse(e=>{if(e instanceof Er)if(Mt(e.material))e.material.forEach(r=>{let o=r;t.has(o)||t.add(o)});else{let r=e.material;t.has(r)||t.add(r)}}),t.forEach(e=>{if(e instanceof Array)return;let r=e.onBeforeCompile.bind(e);if(a3(e)){Object.assign(e,{isMeshStandardMaterial:!0,isMeshPhysicalMaterial:!0,transmission:1,attenuationColor:new xc.Color,specularColor:new xc.Color});let o=0;e.onBeforeCompile=(i,a)=>{r&&r(i,a),i.uniforms=Object.assign({},xc.ShaderLib.physical.uniforms,i.uniforms),e.getLayersOfType("transmission").forEach(s=>{if(i.uniforms.transmissionSamplerMap.value){let l=s.color;l&&(l.transmissionSamplerMap.value=i.uniforms.transmissionSamplerMap.value,l.transmissionSamplerSize.value=i.uniforms.transmissionSamplerSize.value,l.aspectRatio.value=Ob(window.innerWidth,window.innerHeight),e.defines.IS_THREEJS_EXPORT=!0)}else o++,o<2&&(e.needsUpdate=!0)})}}else s3(e)||(e.onBeforeCompile=(o,i)=>{r&&r(o,i),e.transparent=!1})}),n}function a3(n){return n.getLayersOfType("transmission").length>0}function s3(n){let t=0;for(let e of n.layers){if(e.data.type!=="displace"&&e.data.isMask)return!0;if(e.type!=="light"&&e.type!=="fresnel"){let o=e.uniforms["f"+e.id+"_alpha"];o&&(t+=(1-t)*o.value)}}return t<1}function l1(n){return n.traverse(t=>{if(t.type==="Camera"){let e=t;e.type=e.cameraType}}),n}function c1(n){let t=[],e=(r,o=0)=>{let i=o>0?r+o:r;return t.includes(i)?e(r,o+1):i};return n.traverse(r=>{if(t.includes(r.name)){let o=r.name,i=e(r.name);if(r.name=i,r.isMesh){let a=r;a.material instanceof Array?a.material.forEach(s=>{s.name=s.name.replace(o,i)}):a.material.isAsset||(a.material.name=a.material.name.replace(o,i))}}t.push(r.name)}),n}var u1=require("three/examples/jsm/utils/BufferGeometryUtils.js");function d1(n){let t=[];return n.traverse(e=>{e instanceof Us&&t.push(e)}),t.forEach(e=>{let r=e.object,a=[...e.children.map(s=>{s.updateMatrix();let l;if(s.geometry!==void 0)try{l=s.geometry.clone().applyMatrix4(s.matrix)}catch(u){console.error(u)}return l!==void 0&&s.matrix.determinant()<0&&a1(l),l}).filter(s=>s!==void 0)];if(!e.parameters.hideBase&&r instanceof $t&&a.unshift(r.geometry),a.length){let s=(0,u1.mergeBufferGeometries)(a);r instanceof $t&&(r.geometry=s)}e.removeFromParent(),r.setFromClonerState(null,{scene:n,shared:Fb})}),n}function p1(n){return n.traverse(t=>{t.matrixAutoUpdate=!0}),n}function f1(n){Object.values(n.shared.materials).forEach(t=>{qh(t)}),n.scene.objects.traverse((t,e)=>{"material"in e?qh(e.material):"materials"in e&&e.materials.forEach(r=>{qh(r)})})}function qh(n){if(typeof n=="string")return;let t=[];n.layers.forEach((e,r)=>{e.type==="outline"&&t.push(r)}),t.reverse().forEach(e=>{n.layers.delete(e)}),t.length&&console.warn("The Spline Loader currently does not support the outline layer.")}var x1=ar(m1(),1);function y1(n){return n.traverseMaterial(t=>{t.needsJitter=!1}),n}var g1="The SplineLoader only accepts .splinecode files that are generated from Spline export panel.",tp=class extends rp.Loader{load(t,e,r,o=console.error){let i=new rp.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),t.endsWith(".spline")?console.warn(g1+" The .spline files are only meant to be used by the Editor."):t.endsWith(".splinecode")||console.warn(g1),i.load(t,async a=>{try{if(typeof a=="string")throw new Error("The .spline file is not binary!");let s=await this.parse(a);e(s)}catch(s){o(s)}},r,o)}async parse(t){let e=await i1(t,f1);e.version&&(0,x1.default)(e.version,"1.0.62")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/loader to the latest version."),await Promise.allSettled([qb(e)&&Zx(),rv(e)&&zb(),Lv(e)&&Dv()].filter(Boolean));let r=new Fi(e.shared);Object.values(r.getMaterials()).forEach(a=>Object.assign(a,{isAsset:!0}));let o=new ep(e.scene,r),i=o.activeCamera;return i&&Object.assign(i,{makeDefault:!0}),o=d1(o),o=s1(o),o=l1(o),o=c1(o),o=p1(o),o=y1(o),o}};
|