@splinetool/loader 2.0.122 → 2.0.124

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.
@@ -1,4 +1,4 @@
1
- "use strict";var n_=Object.create;var dp=Object.defineProperty;var i_=Object.getOwnPropertyDescriptor;var o_=Object.getOwnPropertyNames;var a_=Object.getPrototypeOf,s_=Object.prototype.hasOwnProperty;var l_=(i,t,e)=>t in i?dp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var xe=(i,t)=>()=>(i&&(t=i(i=0)),t);var Hf=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),DC=(i,t)=>{for(var e in t)dp(i,e,{get:t[e],enumerable:!0})},RC=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of o_(t))!s_.call(i,n)&&n!==e&&dp(i,n,{get:()=>t[n],enumerable:!(r=i_(t,n))||r.enumerable});return i};var Ec=(i,t,e)=>(e=i!=null?n_(a_(i)):{},RC(t||!i||!i.__esModule?dp(e,"default",{value:i,enumerable:!0}):e,i)),c_=i=>RC(dp({},"__esModule",{value:!0}),i);var bn=(i,t,e)=>(l_(i,typeof t!="symbol"?t+"":t,e),e);var BC=xe(()=>{"use strict"});function Wf(i){return Array.isArray(i)?i:[i]}function ll(i,t){let e=0;for(;e<i.length&&e<t.length;){if(i[e]<t[e])return-1;if(i[e]>t[e])return 1;e+=1}return e!==t.length?-1:e!==i.length?1:0}var NC=xe(()=>{"use strict"});function Mr(i,t){return Object.setPrototypeOf(i,t),i}function qf(i){let t={...i};return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}function No(i,t,e){if(i===void 0?t===void 0?(i=0,t=10):i=t-10:t===void 0&&(t=i+10),i>t){let o=i;i=t,t=o}let r=[],n=1/(e+1);for(let o=0;o<e;o++){let a=i+(t-i)*(o+.75+Math.random()*.5)*n;r.push(a)}return r}function Qn(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function LC(){return typeof process<"u"}var _C=xe(()=>{"use strict"});function up(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let t=Object.getOwnPropertyNames(i);for(let e of t){let r=i[e];r&&typeof r=="object"&&up(r)}return Object.freeze(i)}function Xf(i){for(let t of Object.keys(i))i[t]===void 0&&delete i[t];return i}var kC=xe(()=>{"use strict"});var gr=xe(()=>{BC();NC();_C();kC()});var Yf,cl,pp,Kf=xe(()=>{"use strict";Yf=class{},cl=class extends Yf{constructor(e){super();this.id=e}},pp=class extends Yf{constructor(e){super();this.data=e}}});var FC=xe(()=>{"use strict"});var ve,hp=xe(()=>{"use strict";ve=class{modifyById(t,e){let r=this;if(r[t]===void 0)throw new Error("not expected");{let o={...r,[t]:e};return Object.setPrototypeOf(o,ve.prototype),o}}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],n;r===void 0?n={type:2,id:t.id}:n={type:1,id:t.id,data:r};let{id:o,data:a}=t,s={...e,[o]:a};return Object.setPrototypeOf(s,ve.prototype),{data:s,actual:t,reverse:n}}else if(t.type===2){let{id:r}=t,n=e[r];if(n===void 0)return null;{let o={...e};return Object.setPrototypeOf(o,ve.prototype),delete o[r],{data:o,actual:t,reverse:{type:1,id:r,data:n}}}}return null}}});var Tc,Qf=xe(()=>{"use strict";Tc=class extends Error{}});function VC(i,t){for(let e of i)t(e.id,e.data)!==!0&&VC(e.children,t)}function GC(i,t){if(t(i.id,i.data)!==!0)for(let e of i.children)GC(e,t)}var Rt,ds=xe(()=>{"use strict";gr();Qf();gr();Rt=class extends Array{constructor(...e){super(...e);bn(this,"partialObjectCaches");bn(this,"objCaches");bn(this,"parentCaches");Object.setPrototypeOf(this,Rt.prototype)}deepFreeze(){let e=0;for(;e<this.length;)up(this[e]),e++}fillCaches0(e,r){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,r);for(let n of e.children)this.fillCaches0(n,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 n=this.parent(e);if(n===r)return!0;e=n}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 n=this.parent(e);if(n===r)return!0;e=n}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let r=this.get(e);r!==void 0&&this.partialObjectCaches.set(e,r)}get(e){if(this.partialObjectCaches!==void 0){let r=this.partialObjectCaches.get(e);if(r!==void 0)return r}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 n=this.get(e);n&&GC(n,r)}}traverse(e){VC(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 o=this.parent(e),a=this.childrenArray(o),s=a.findIndex(u=>u.id===e);if(s<0)throw new Error("not expected");let l=a[s];a=[...a],a[s]={...l,data:r};let c=new Map;return c.set(e,a[s]),this.modifyArrayBy(o,a,c)}}modifyArrayBy(e,r,n=void 0){let o=e,a=r;for(;o!==null;){let l=a,c=o;if(o=this.parent(o),o===void 0)throw new Error;a=this.childrenArray(o);let d=a.findIndex(u=>u.id===c);if(d<0)throw new Error;a=[...a],a[d]={...a[d],children:l},n&&n.set(c,a[d])}Object.setPrototypeOf(a,Rt.prototype);let s=a;if(n&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[l,c]of n)s.objCaches.set(l,c);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}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 n of r)if(this.checkDuplicatedIdRec(n))return!0;return!1}addOp(e){let{parent:r,fi:n,id:o,data:a,children:s}=e;if(r!==null&&this.get(r)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=r,c=this.childrenArray(l),d={fi:n,id:o,data:a,children:s};return c=[...c,d],c.sort((p,h)=>p.fi-h.fi),e.localIndex=c.indexOf(d),{data:this.modifyArrayBy(l,c),actual:e,reverse:{type:8,id:o}}}}deleteOp(e){let{id:r}=e;if(this.get(r)===null)return null;{let n=this.parent(r);if(n===void 0)return null;let o=this.childrenArray(n),a=o.findIndex(c=>c.id===r);e.localIndex=a,o=[...o];let s=o.splice(a,1)[0];return{data:this.modifyArrayBy(n,o),actual:e,reverse:{type:7,...s,parent:n}}}}moveOp(e){let{parent:r,fi:n,id:o}=e;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:o});if(r!==null){let h=r;for(;h!==null;){if(h===void 0)throw new Error;if(h===o)throw new Tc("cyclic tree");h=this.parent(h)}}let a=this.parent(o);if(a===void 0)return null;let s=a,l=this.childrenArray(a),c=l.findIndex(h=>h.id===o);l=[...l];let d=l.splice(c,1)[0],u=this.modifyArrayBy(a,l);a=r,l=u.childrenArray(a);let p=d.fi;return d={...d,fi:n},l=[...l,d],l.sort((h,f)=>h.fi-f.fi),e.localIndex=l.indexOf(d),u=u.modifyArrayBy(a,l),{data:u,actual:e,reverse:{type:9,parent:s,fi:p,id:o}}}previous(e,r){if(r===null){let o=this.childrenArray(e);return o.length===0?null:o[o.length-1].id}let n=null;for(let o of this.childrenArray(e)){if(o.id===r)return n;n=o.id}return null}traverseSortNext(e){let r=this.parent(e);if(r!==void 0){let n=this.childrenArray(r),o=n.findIndex(a=>a.id===e)+1;if(o<n.length)return n[o].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 n=this.childrenArray(r),o=n.findIndex(a=>a.id===e)-1;return o>=0?this.traverseSortPrevious(n[o].id):r}}getAllSorted(e){let r=[];for(let n of e){let o=this.getWithSortKey(n.id);o!==void 0&&r.push({...n,...o})}r.sort((n,o)=>ll(n.sortKey,o.sortKey));for(let n of r)delete n.sortKey;return r}getAllIdSorted(e){let r=[];for(let n of e){let o=this.getWithSortKey(n);o!==void 0&&r.push(o)}r.sort((n,o)=>ll(n.sortKey,o.sortKey));for(let n of r)delete n.sortKey;return r.map(n=>n.id)}getWithSortKey(e){let r=e,n=[],o=this.get(r),a=o;if(o!==void 0){for(;r;)n.splice(0,0,o.fi),r=this.parent(r),r!==null&&(o=this.get(r));return{...a,sortKey:n}}}insertBeforeHelper(e,r,n){return this.insertAfterHelper(e,this.previous(e,r),n)}insertAfterHelper(e,r,n){let o=this.childrenArray(e);if(r===null){if(o.length===0)return No(0,n,n);{let a=o[0].fi;return No(a-n,a,n)}}else{let a=this.get(r);if(a===void 0||this.parent(r)!==e)throw new Error("illegal args");let s=o.find(l=>l.fi>a.fi);if(s===void 0){let l=o[o.length-1].fi;return No(l,l+n,n)}else return No(a.fi,s.fi,n)}}}});var kx,us,Zf=xe(()=>{"use strict";gr();kx=null;(r=>{function i(n){kx=n}r.setPreservePrototype=i;function t(n,o){return Object.getPrototypeOf(n)===kx&&Object.setPrototypeOf(o,kx),o}r.tryPreservePrototype=t;function e(n,o){if(o.type!==0)return null;if(Array.isArray(n)||Qn(n)){let a=o.props,s={},l=Qn(n)?n.slice():[...n],c=!1;if(a)for(let d of Object.keys(a)){let u=parseInt(d);if(isNaN(u))throw new Error("wrong index");s[d]=l[u],l[u]=a[d],c=!0}return c?{data:l,actual:o,reverse:{type:0,props:s}}:null}else{let a=o.props,s={},l={...n},c=!1;if(a)for(let d of Object.keys(a)){s[d]=l[d];let u=a[d];u===void 0?delete l[d]:l[d]=u,c=!0}return c?{data:r.tryPreservePrototype(n,l),actual:o,reverse:{type:0,props:s}}:null}}r.runOp=e})(us||(us={}))});var oe,ps=xe(()=>{"use strict";gr();gr();oe=class extends Array{constructor(...e){super(...e);bn(this,"objCaches");Object.setPrototypeOf(this,oe.prototype)}deepFreeze(){let e=0;for(;e<this.length;)up(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 o=this,a=o.findIndex(c=>c.id===e);if(a<0)throw new Error("not expected");let s=o[a];return o=[...o],o[a]={...s,data:r},this.modifyArrayBy(o)}}modifyArrayBy(e){Object.setPrototypeOf(e,oe.prototype);let r=e;return LC()||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:n,data:o}=e,a=this,s={fi:r,id:n,data:o};return a=[...a,s],a.sort((c,d)=>c.fi-d.fi),e.localIndex=a.indexOf(s),{data:this.modifyArrayBy(a),actual:e,reverse:{type:5,id:n}}}deleteOp(e){let{id:r}=e,n=this,o=n.findIndex(l=>l.id===r);if(o===-1)return null;e.localIndex=o,n=[...n];let a=n.splice(o,1)[0];return{data:this.modifyArrayBy(n),actual:e,reverse:{type:4,...a}}}moveOp(e){let{fi:r,id:n}=e,o=this;o=[...o];let a=o.findIndex(d=>d.id===n);if(a===-1)return null;let s=o[a].fi,l={...o[a],fi:r};return o[a]=l,o.sort((d,u)=>d.fi-u.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(o),actual:e,reverse:{type:6,fi:s,id:n}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let n of this){if(n.id===e)return r;r=n.id}return null}insertBeforeHelper(e,r){return this.insertAfterHelper(this.previous(e),r)}insertAfterHelper(e,r){let n=this;if(e===null){if(n.length===0)return No(0,r,r);{let o=n[0].fi;return No(o-r,o,r)}}else{let o=this.get(e);if(o===void 0)throw new Error("illegal args");let a=n.find(s=>s.fi>o.fi);if(a===void 0){let s=n[n.length-1].fi;return No(s,s+r,r)}else return No(o.fi,a.fi,r)}}}});function UC(i,t){let e={cur:[],result:[],len:0};return i=fp(i,t,e)??i,[i,e.result]}function Jf(i,t){return i===null?null:(i.cur[i.len]=t,i.len+=1,i)}function $f(i){i&&(i.len-=1)}function d_(i){if(i===null)return null;i.result.push(i.cur.slice(0,i.len))}function zC(i,t,e){let r=!1,n=i.map(o=>{let a=o.id,s=t[a];if(s!==void 0&&typeof s=="string"&&(r=!0,a=s,e!==null))throw new Error("not supported");let l=fp(o.data,t,Jf(e,a));$f(e),r=r||l!==void 0,l===void 0&&(l=o.data);let c=zC(o.children,t,e);return c!==void 0?r=!0:c=o.children,{...o,id:a,data:l,children:c}});if(r)return n}function u_(i,t,e){let r=!1,n=i.map(o=>{let a=o.id,s=t[a];if(s!==void 0&&typeof s=="string"&&(r=!0,a=s,e!==null))throw new Error("not supported");let l=fp(o.data,t,Jf(e,a));return $f(e),r=r||l!==void 0,l===void 0&&(l=o.data),{...o,id:a,data:l}});if(r)return Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}function fp(i,t,e){if(i instanceof Rt){let r=zC(i,t,e);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}else{if(i instanceof oe)return u_(i,t,e);if(Array.isArray(i)){let r=!1,n=i.map((o,a)=>{let s=fp(o,t,Jf(e,a));return $f(e),r=r||s!==void 0,s===void 0&&(s=o),s});return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else if(i&&typeof i=="object"&&!Qn(i)){let r={},n=!1;for(let[o,a]of Object.entries(i))if(o!=="name"&&o!=="variableId"){let s=t[o];if(typeof s=="string"){if(e!==null)throw new Error("not supported");n=!0,o=s}let l=fp(a,t,Jf(e,o));$f(e),n=n||l!==void 0,l===void 0&&(l=a),r[o]=l}else r[o]=a;return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else if(typeof i=="string"){let r=t[i];return r!==void 0&&d_(e),r}else return}}var Fx=xe(()=>{"use strict";ds();ps();gr()});function Pc(i){return i&&typeof i=="object"&&i instanceof vt}function Vx(i,t){if(t===void 0)return;let e=!1,r=i.map(n=>{let o=n.id,a=mp(n.data,t[o]);if(e=e||a!==void 0,a===void 0&&(a=n.data),n.children){let s=Vx(n.children,t);return s!==void 0?e=!0:s=n.children,{...n,id:o,data:a,children:s}}else return{...n,id:o,data:a}});if(e)return r}function p_(i,t){if(t===void 0)return;let e=!1,r=i.map(n=>{let o=n.id,a=mp(n.data,t[o]);return e=e||a!==void 0,a===void 0&&(a=n.data),{...n,id:o,data:a}});if(e)return Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}function mp(i,t){if(!Pc(t))return t;if(i instanceof Rt){let e=Vx(i,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e}else{if(i instanceof oe)return p_(i,t);if(Array.isArray(i)){let e=!1,r=i.map((n,o)=>{let a=mp(n,t[o]);return e=e||a!==void 0,a===void 0&&(a=n),a});return e?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else{if(i instanceof vt)return Gx(i,t);if(i&&typeof i=="object"){let e={},r=!1;for(let[n,o]of Object.entries(i)){let a=mp(o,t[n]);r=r||a!==void 0,a===void 0&&(a=o),e[n]=a}return r?(Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e):void 0}}}}function Gx(i,t){if(i===void 0)return t;if(t===void 0)return i;if(!Pc(t))return t;if(!Pc(i))return Lo.apply(i,t);let e=new Set;for(let n of Object.keys(i))e.add(n);for(let n of Object.keys(t))e.add(n);let r=new vt;for(let n of e){let o=Gx(i===void 0?void 0:i[n],t===void 0?void 0:t[n]);r[n]=o}return r}var vt,Lo,yp=xe(()=>{"use strict";ds();ps();gp();gr();vt=class{unusedFunOverridesTable(t){}runOp(t){let e=[],r=this,n=0,o={};for(;n<t.path.length;){if(e.push(r),r=r===void 0?void 0:r[t.path[n]],r!==void 0&&!Pc(r))return null;n+=1}r=r?qf(r):new vt;for(let[l,c]of Object.entries(t.props)){let d=r[l];o[l]=d,c===void 0?delete r[l]:r[l]=c}for(;n>0;){if(Object.keys(r).length===0){let l=e[n-1];l&&(r=qf(l),delete r[t.path[n-1]])}else{let l=e[n-1];if(l){let c=qf(l);c[t.path[n-1]]=r,r=c}else{let c=new vt;c[t.path[n-1]]=r,r=c}}n-=1}let a=Object.setPrototypeOf(r,vt.prototype),s={...t,props:o};return{data:a,actual:t,reverse:s}}};(r=>{function i(n,o){return mp(n,o)??n}r.apply=i;function t(n,o){return Gx(n,o)}r.merge=t;function e(n,o){let a=0,s=o.path,l=n;for(;a<s.length&&l!==void 0;){if(l=jt.zoomOnce(l,s[a]),l===void 0)return o;if(!Pc(l))return;a+=1}if(l===void 0)return o;if(!!Pc(l))if(o.type===0){let c={...o.props};for(let d of Object.keys(l))delete c[d];return{...o,props:c}}else if(o.type===1||o.type===4||o.type===7){let c=Vx([o],l);return c?c[0]:o}else return o}r.filterOp=e})(Lo||(Lo={}))});var Mc,or,Ux,jC=xe(()=>{"use strict";gr();gp();hp();ds();Qf();Zf();ps();Fx();yp();(t=>{function i(e,r){let n=jt.zoom(r,e.path);if(typeof n=="object"){let o={};for(let a of Object.keys(e.props))o[a]=n[a];return{...e,props:o}}else return{...e,props:{}}}t.replaceProps=i})(Mc||(Mc={}));(s=>{function i(l,c){return{...l,path:l.path.slice(c)}}s.drop=i;function t(l,c){return e(l,c)?.data??l}s.applySimple=t;function e(l,c){let d=c.path,u=[];for(;;){let p;if(l instanceof vt&&c.type===0&&(p=l.runOp({...c,path:d.slice(u.length)}),p===null&&(p=void 0)),p===void 0&&u.length===d.length&&(l instanceof Rt||l instanceof oe||l instanceof ve?p=l.runOp(c):p=us.runOp(l,c)),p!==void 0)if(p!==null){let m=p.data;for(let y=u.length-1;y>=0;y--){let g=d[y],v=u[y];if(v instanceof Rt){if(typeof g=="number")throw new Error("illegal arg");m=v.modifyById(g,m)}else if(v instanceof oe){if(typeof g=="number")throw new Error("illegal arg");m=v.modifyById(g,m)}else if(v instanceof ve){if(typeof g=="number")throw new Error("illegal arg");m=v.modifyById(g,m)}else if(v instanceof vt){let b={...v,[g]:m};m=Object.setPrototypeOf(b,vt.prototype)}else if(typeof v=="object")if(Array.isArray(v)||Qn(v)){if(typeof g=="string"&&(g=parseInt(g),isNaN(g)))throw new Error("Invalid path");let b=m;m=Qn(v)?v.slice():[...v],m[g]=b}else m=us.tryPreservePrototype(v,{...v,[g]:m});else return null}return{data:m,actual:{...p.actual,path:d},reverse:{...p.reverse,path:d}}}else return null;let h=d[u.length],f;if(l instanceof Rt){if(typeof h=="number")throw new Error("");f=l.get(h)?.data}else if(l instanceof oe){if(typeof h=="number")throw new Error("");f=l.get(h)?.data}else l!==null&&(f=l[h]);if(f!==void 0)u.push(l),l=f;else return null}}s.apply=e;function r(l,c){for(let d=0;d<l.length&&d<c.length;d++)if(l[d]!==c[d])return!0;return!1}s.pathDisjoint=r;function n(l,c){if(l.length!==c.length)return!1;for(let d=0;d<l.length;d++)if(l[d]!==c[d])return!1;return!0}s.pathEq=n;function o(l,c){return r(l.path,c.path)}s.commutative=o;function a(l,c){return l.type===0&&c.type===0&&n(l.path,c.path)?Object.keys(l.props).every(d=>c.props[d]!==void 0):!1}s.subsumed=a})(or||(or={}));(l=>{function i(){return[]}l.empty=i;function t(c,d){let u=[];for(let p of c){let[h,...f]=p.path;h===d&&u.push({...p,path:f})}return u}l.removePrefix=t;function e(c,d){return c.map(u=>({...u,path:[d,...u.path]}))}l.addPrefix=e;function r(c,d){return[...c,...d]}l.concat=r;function n(c,d){return[...c.filter(p=>!d.some(h=>or.subsumed(p,h))),...d]}l.compress=n;function o(c,d){return c.every(u=>d.every(p=>or.commutative(u,p)))}l.commutative=o;function a(c,d){for(let u of d){let p=s(c,u);p!==null&&(c=p.data)}return c}l.applyAll=a;function s(c,d){let u=c,p=[],h=[];for(let f of d)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let m,y;if(f.type===3?(m=jt.zoom(u,[...f.path,f.id]),y=or.apply(u,{...f,type:2})):(m=jt.zoom(u,[...f.path,f.id,"value"]),y=or.apply(u,f)),y!==null){u=y.data;let[g,v]=UC(u,{[f.id]:m});u=g;for(let b=0;b<v.length;b++){let S=v[b],x=S.pop(),A,w;if(typeof x=="number"){let C=[x];for(let M=b+1;M<v.length;M++){let D=v[M],I=D[D.length-1];if(typeof I=="number"&&jt.equal(S,D.slice(0,D.length-1)))C.push(I),v.splice(M,1);else break}let T=jt.zoom(u,S);w=T.map((M,D)=>C.includes(D)?f.id:M),A=T,x=S.pop()}else{if(A=m,x==="alphaOverride"||x==="alpha"){A=m/100;let C=jt.zoom(u,S);C[x]=A}w=f.id}p.push({type:0,path:S,props:{[x]:A}}),h.push({type:0,path:S,props:{[x]:w}})}h.push(y.reverse),p.push(y.actual)}}else{let m=or.apply(u,f);m!==null&&(p.push(m.actual),u=m.data,h.push(m.reverse))}}catch(m){if(m instanceof Tc)return null;throw m}return{data:u,actual:p,reverse:h.reverse()}}l.apply=s})(Ux||(Ux={}))});function HC(i,t){return i instanceof vt?Object.setPrototypeOf(t,vt.prototype):us.tryPreservePrototype(i,t)}function zx(i,t,e){if(i.length>0){let r=i[i.length-1];if(r.type===0&&t.type===0&&jt.equal(r.path,e)){Object.assign(r.props,t.props);return}}i.push({...t,path:e})}function rm(i,t,e){return e instanceof Rt?new ul(i,t,e):e instanceof oe?new pl(i,t,e):e instanceof ve?new Proxy(new Hx(i,t,e),m_):e!==null&&typeof e=="object"?Qn(e)?e:new Proxy(new jx(i,t,e),f_):e}function qx(i){let t=new em(i);return[rm(t,"",i),t]}function Oc(i,t){let[e,r]=qx(i);return t(e),r.result()}function ar(i){return i instanceof ul||i instanceof pl?i._current:i!==null&&typeof i=="object"?i[Wx]:i}function hl(i){if(i instanceof ul)return i._current;if(i instanceof pl)return i._current;if(i!==null&&typeof i=="object"){let t=i[Wx];return t!==void 0?t:i}else return i}var Wx,h_,tm,dl,jx,Hx,WC,f_,m_,ul,pl,em,Xx=xe(()=>{"use strict";hp();ds();Zf();ps();gr();gp();yp();Wx=Symbol(),h_=Symbol(),tm=Symbol(),dl=class{reportOp(t,e,r=[]){let n=this;if(e===null)return;n._current=e.data;let o=r;for(;!(n instanceof em);){let a=n._path,s=n._current;if(a!==""&&o.splice(0,0,a),n=n._parent,n===null)return;n.update(a,s)}n.push(o,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let r=e[tm];r&&r(),delete this._children[t]}}}};jx=class extends dl{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=HC(this._current,{...this._current,[t]:e})}runOp(t){let e=us.runOp(this._current,t);e!==null&&(e.data=HC(this._current,e.data)),this.reportOp(t,e,t.path)}},Hx=class extends dl{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,ve.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},WC={get(i,t){if(t===tm)return()=>{i._parent=null};if(t===Wx)return i._current;if(t===h_)return i;let{_current:e,_children:r}=i;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[t];if(n!==void 0)return n;let o=e[t],a=rm(i,t,o);return a!==o?(r===void 0&&(r={},i._children=r),r[t]=a,a):o},has(i,t){return t in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,t){let e=i._current,r=Reflect.getOwnPropertyDescriptor(e,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:e[t]}}},f_={...WC,set(i,t,e){let r={type:0,props:{[t]:ar(e)??e}};return i.deleteChildren(t),i.runOp(r),!0},deleteProperty(i,t){let e={type:0,props:{[t]:void 0}};return i.deleteChildren(t),i.runOp(e),!0}},m_={...WC,set(i,t,e){return e===void 0?this.deleteProperty(i,t):(i.deleteChildren(t),i.runOp({type:1,id:t,data:e})),!0},deleteProperty(i,t){return i.runOp({type:2,id:t}),!0}},ul=class extends dl{constructor(t,e,r){super(),this._children={},this._parent=t,this._path=e,this._current=r,this[tm]=()=>{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)}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,n=r===void 0?void 0:r[t];if(n!==void 0)return n;let o=e.get(t)?.data,a=rm(this,t,o);return a!==o?(r===void 0&&(r={},this._children=r),r[t]=a,a):o}add(t,e,r,n,o){this.runOp({type:7,parent:t,fi:e,id:r,data:n,children:o})}move(t,e,r){this.runOp({type:9,parent:t,fi:e,id:r})}insertAfter(t,e,r){let n=this._current.insertAfterHelper(t,e,r.length);for(let o=0;o<r.length;o++){let a=r[o];this.add(t,n[o],a.id,a.data,a.children)}}insertBefore(t,e,r){let n=this._current.insertBeforeHelper(t,e,r.length);for(let o=0;o<r.length;o++){let a=r[o];this.add(t,n[o],a.id,a.data,a.children)}}moveAfter(t,e,r){let n=this._current.insertAfterHelper(t,e,r.length);for(let o=0;o<r.length;o++){let a=r[o];this.move(t,n[o],a)}}moveBefore(t,e,r){let n=this._current.insertBeforeHelper(t,e,r.length);for(let o=0;o<r.length;o++){let a=r[o];this.move(t,n[o],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)}},pl=class extends dl{constructor(t,e,r){super(),this._children={},this._parent=t,this._path=e,this._current=r,this[tm]=()=>{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 n=this._current[r].id,o=this._current[r].fi;t(this.data(this._current[r].id),n,o,r)}}find(t){let e=this.length;for(let r=0;r<e;r++){let n=this._current[r].id;if(t(this.data(n),n))return this.get(n)}}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)}}at(t){let{id:e,fi:r}=this._current.at(t);return{id:e,fi:r,data:this.data(e)}}data(t){let{_current:e,_children:r}=this,n=r===void 0?void 0:r[t];if(n!==void 0)return n;let o=e.get(t)?.data,a=rm(this,t,o);return a!==o?(r===void 0&&(r={},this._children=r),r[t]=a,a):o}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 n=0;n<e.length;n++){let o=e[n];this.add(r[n],o.id,o.data)}}insertBefore(t,e){let r=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let o=e[n];this.add(r[n],o.id,o.data)}}moveAfter(t,e){let r=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let o=e[n];this.move(r[n],o)}}moveBefore(t,e){let r=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let o=e[n];this.move(r[n],o)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};em=class extends dl{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,n){zx(this.ts,e,t),zx(this.actual,r,t),zx(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}});var jt,gp=xe(()=>{"use strict";Kf();Xx();ps();ds();gr();(o=>{function i(a,s){if(s.length===a.length){let l=0;for(;l<a.length;){if(a[l]!==s[l])return!1;l+=1}}else return!1;return!0}o.equal=i;function t(a,s,l){let c=r(l,a);if(c!==void 0&&typeof c=="object"&&c!==null){let d={...s};return Object.keys(c).forEach(u=>{delete d[u]}),d}else return s}o.removeOverridden=t;function e(a,s){if((a instanceof Rt||a instanceof ul)&&typeof s=="string")return a.data(s);if((a instanceof oe||a instanceof pl)&&typeof s=="string")return a.data(s);if(typeof s=="number"&&Array.isArray(a))return a[s];if(typeof s=="string"&&typeof a=="object"&&a!==null)return a[s]}o.zoomOnce=e;function r(a,s,l=0){for(;l<s.length&&a!==void 0;)a=e(a,s[l]),l+=1;return a}o.zoom=r;function n(a,s){let l=[];function c(d,u){if(d instanceof cl&&d.id===s.id)l.push(u);else if(d instanceof oe)for(let p=0;p<d.length;p++)c(d[p].data,[...u,d[p].id]);else if(d instanceof Rt)d.traverse((p,h)=>{c(h,[...u,p])});else if(Array.isArray(d)){if(typeof d[0]=="number")return;for(let p=0;p<d.length;p++)c(d[p],[...u,p])}else{if(Qn(d))return;if(typeof d=="object"&&d!==null)for(let p in d)c(d[p],[...u,p])}}return c(a,[]),l}o.findPathes=n})(jt||(jt={}))});var qC=xe(()=>{"use strict"});function XC(i,t){let e=[];if(t.length===i.length){let r=0;for(;r<i.length;){if(t[r]==="*")e.push(i[r]);else if(i[r]!==t[r])return null;r+=1}}else return null;return e}function Ye(i,t){let e=[];if(t.length<=i.length){let r=0;for(;r<t.length;){if(t[r]==="*")e.push(i[r]);else if(i[r]!==t[r])return null;r+=1}}else return null;return e}var YC=xe(()=>{"use strict"});function nm(i){try{if(!Ht.trusted&&!fs){let e=ct.sharedLength||0;e<ct.length&&(ct.length=e)}let t;if(Ht.randomAccessStructure&&fe[z]<64&&fe[z]>=32&&ZC?(t=ZC(fe,z,Pi,Ht),fe=null,!(i&&i.lazy)&&t&&(t=t.toJSON()),z=Pi):t=Or(),en&&(z=en.postBundlePosition,en=null),fs&&(ct.restoreStructures=null),z==Pi)ct&&ct.restoreStructures&&eE(),ct=null,fe=null,Aa&&(Aa=null);else{if(z>Pi)throw new Error("Unexpected end of MessagePack data");if(!fs){let e;try{e=JSON.stringify(t,(r,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(r){e="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+e)}}return t}catch(t){throw ct&&ct.restoreStructures&&eE(),im(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||z>Pi)&&(t.incomplete=!0),t}}function eE(){for(let i in ct.restoreStructures)ct[i]=ct.restoreStructures[i];ct.restoreStructures=null}function Or(){let i=fe[z++];if(i<160)if(i<128){if(i<64)return i;{let t=ct[i&63]||Ht.getStructures&&cE()[i&63];return t?(t.read||(t.read=e0(t,i&63)),t.read()):i}}else if(i<144)if(i-=128,Ht.mapsAsObjects){let t={};for(let e=0;e<i;e++){let r=uE();r==="__proto__"&&(r="__proto_"),t[r]=Or()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(Or(),Or());return t}else{i-=144;let t=new Array(i);for(let e=0;e<i;e++)t[e]=Or();return Ht.freezeData?Object.freeze(t):t}else if(i<192){let t=i-160;if(_o>=z)return hs.slice(z-Ti,(z+=t)-Ti);if(_o==0&&Pi<140){let e=t<16?t0(t):dE(t);if(e!=null)return e}return Jx(t)}else{let t;switch(i){case 192:return null;case 193:return en?(t=Or(),t>0?en[1].slice(en.position1,en.position1+=t):en[0].slice(en.position0,en.position0-=t)):$x;case 194:return!1;case 195:return!0;case 196:if(t=fe[z++],t===void 0)throw new Error("Unexpected end of buffer");return Yx(t);case 197:return t=st.getUint16(z),z+=2,Yx(t);case 198:return t=st.getUint32(z),z+=4,Yx(t);case 199:return fl(fe[z++]);case 200:return t=st.getUint16(z),z+=2,fl(t);case 201:return t=st.getUint32(z),z+=4,fl(t);case 202:if(t=st.getFloat32(z),Ht.useFloat32>2){let e=am[(fe[z]&127)<<1|fe[z+1]>>7];return z+=4,(e*t+(t>0?.5:-.5)>>0)/e}return z+=4,t;case 203:return t=st.getFloat64(z),z+=8,t;case 204:return fe[z++];case 205:return t=st.getUint16(z),z+=2,t;case 206:return t=st.getUint32(z),z+=4,t;case 207:return Ht.int64AsType==="number"?(t=st.getUint32(z)*4294967296,t+=st.getUint32(z+4)):Ht.int64AsType==="string"?t=st.getBigUint64(z).toString():Ht.int64AsType==="auto"?(t=st.getBigUint64(z),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=st.getBigUint64(z),z+=8,t;case 208:return st.getInt8(z++);case 209:return t=st.getInt16(z),z+=2,t;case 210:return t=st.getInt32(z),z+=4,t;case 211:return Ht.int64AsType==="number"?(t=st.getInt32(z)*4294967296,t+=st.getUint32(z+4)):Ht.int64AsType==="string"?t=st.getBigInt64(z).toString():Ht.int64AsType==="auto"?(t=st.getBigInt64(z),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=st.getBigInt64(z),z+=8,t;case 212:if(t=fe[z++],t==114)return aE(fe[z++]&63);{let e=xn[t];if(e)return e.read?(z++,e.read(Or())):e.noBuffer?(z++,e()):e(fe.subarray(z,++z));throw new Error("Unknown extension "+t)}case 213:return t=fe[z],t==114?(z++,aE(fe[z++]&63,fe[z++])):fl(2);case 214:return fl(4);case 215:return fl(8);case 216:return fl(16);case 217:return t=fe[z++],_o>=z?hs.slice(z-Ti,(z+=t)-Ti):g_(t);case 218:return t=st.getUint16(z),z+=2,_o>=z?hs.slice(z-Ti,(z+=t)-Ti):v_(t);case 219:return t=st.getUint32(z),z+=4,_o>=z?hs.slice(z-Ti,(z+=t)-Ti):b_(t);case 220:return t=st.getUint16(z),z+=2,rE(t);case 221:return t=st.getUint32(z),z+=4,rE(t);case 222:return t=st.getUint16(z),z+=2,nE(t);case 223:return t=st.getUint32(z),z+=4,nE(t);default:if(i>=224)return i-256;if(i===void 0){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+i)}}}function e0(i,t){function e(){if(e.count++>QC){let n;try{n=i.read=new Function("r","return function(){return "+(Ht.freezeData?"Object.freeze":"")+"({"+i.map(o=>o==="__proto__"?"__proto_:r()":y_.test(o)?o+":r()":"["+JSON.stringify(o)+"]:r()").join(",")+"})}")(Or)}catch{return QC=1/0,e()}return i.read0=n,i.highByte===0&&(i.read=tE(t,i.read)),n()}let r={};for(let n=0,o=i.length;n<o;n++){let a=i[n];a==="__proto__"&&(a="__proto_"),r[a]=Or()}return Ht.freezeData?Object.freeze(r):r}return e.count=0,i.read0=e,i.highByte===0?tE(t,e):e}function cE(){let i=hE(()=>(fe=null,Ht.getStructures()));return ct=Ht._mergeStructures(i,ct)}function bp(i){let t;if(i<16&&(t=t0(i)))return t;if(i>64&&Kx)return Kx.decode(fe.subarray(z,z+=i));let e=z+i,r=[];for(t="";z<e;){let n=fe[z++];if((n&128)===0)r.push(n);else if((n&224)===192){let o=fe[z++]&63,a=(n&31)<<6|o;a<128?r.push(65533):r.push(a)}else if((n&240)===224){let o=fe[z++]&63,a=fe[z++]&63,s=(n&31)<<12|o<<6|a;s<2048||s>=55296&&s<=57343?r.push(65533):r.push(s)}else if((n&248)===240){let o=fe[z++]&63,a=fe[z++]&63,s=fe[z++]&63,l=(n&7)<<18|o<<12|a<<6|s;l<65536||l>1114111?r.push(65533):(l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l))}else r.push(65533);r.length>=4096&&(t+=$r.apply(String,r),r.length=0)}return r.length>0&&(t+=$r.apply(String,r)),t}function rE(i){let t=new Array(i);for(let e=0;e<i;e++)t[e]=Or();return Ht.freezeData?Object.freeze(t):t}function nE(i){if(Ht.mapsAsObjects){let t={};for(let e=0;e<i;e++){let r=uE();r==="__proto__"&&(r="__proto_"),t[r]=Or()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(Or(),Or());return t}}function dE(i){let t=z,e=new Array(i);for(let r=0;r<i;r++){let n=fe[z++];if((n&128)>0){z=t;return}e[r]=n}return $r.apply(String,e)}function t0(i){if(i<4)if(i<2){if(i===0)return"";{let t=fe[z++];if((t&128)>1){z-=1;return}return $r(t)}}else{let t=fe[z++],e=fe[z++];if((t&128)>0||(e&128)>0){z-=2;return}if(i<3)return $r(t,e);let r=fe[z++];if((r&128)>0){z-=3;return}return $r(t,e,r)}else{let t=fe[z++],e=fe[z++],r=fe[z++],n=fe[z++];if((t&128)>0||(e&128)>0||(r&128)>0||(n&128)>0){z-=4;return}if(i<6){if(i===4)return $r(t,e,r,n);{let o=fe[z++];if((o&128)>0){z-=5;return}return $r(t,e,r,n,o)}}else if(i<8){let o=fe[z++],a=fe[z++];if((o&128)>0||(a&128)>0){z-=6;return}if(i<7)return $r(t,e,r,n,o,a);let s=fe[z++];if((s&128)>0){z-=7;return}return $r(t,e,r,n,o,a,s)}else{let o=fe[z++],a=fe[z++],s=fe[z++],l=fe[z++];if((o&128)>0||(a&128)>0||(s&128)>0||(l&128)>0){z-=8;return}if(i<10){if(i===8)return $r(t,e,r,n,o,a,s,l);{let c=fe[z++];if((c&128)>0){z-=9;return}return $r(t,e,r,n,o,a,s,l,c)}}else if(i<12){let c=fe[z++],d=fe[z++];if((c&128)>0||(d&128)>0){z-=10;return}if(i<11)return $r(t,e,r,n,o,a,s,l,c,d);let u=fe[z++];if((u&128)>0){z-=11;return}return $r(t,e,r,n,o,a,s,l,c,d,u)}else{let c=fe[z++],d=fe[z++],u=fe[z++],p=fe[z++];if((c&128)>0||(d&128)>0||(u&128)>0||(p&128)>0){z-=12;return}if(i<14){if(i===12)return $r(t,e,r,n,o,a,s,l,c,d,u,p);{let h=fe[z++];if((h&128)>0){z-=13;return}return $r(t,e,r,n,o,a,s,l,c,d,u,p,h)}}else{let h=fe[z++],f=fe[z++];if((h&128)>0||(f&128)>0){z-=14;return}if(i<15)return $r(t,e,r,n,o,a,s,l,c,d,u,p,h,f);let m=fe[z++];if((m&128)>0){z-=15;return}return $r(t,e,r,n,o,a,s,l,c,d,u,p,h,f,m)}}}}}function iE(){let i=fe[z++],t;if(i<192)t=i-160;else switch(i){case 217:t=fe[z++];break;case 218:t=st.getUint16(z),z+=2;break;case 219:t=st.getUint32(z),z+=4;break;default:throw new Error("Expected string")}return bp(t)}function Yx(i){return Ht.copyBuffers?Uint8Array.prototype.slice.call(fe,z,z+=i):fe.subarray(z,z+=i)}function fl(i){let t=fe[z++];if(xn[t]){let e;return xn[t](fe.subarray(z,e=z+=i),r=>{z=r;try{return Or()}finally{z=e}})}else throw new Error("Unknown extension type "+t)}function uE(){let i=fe[z++];if(i>=160&&i<192){if(i=i-160,_o>=z)return hs.slice(z-Ti,(z+=i)-Ti);if(!(_o==0&&Pi<180))return Jx(i)}else return z--,pE(Or());let t=(i<<5^(i>1?st.getUint16(z):i>0?fe[z]:0))&4095,e=oE[t],r=z,n=z+i-3,o,a=0;if(e&&e.bytes==i){for(;r<n;){if(o=st.getUint32(r),o!=e[a++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(o=fe[r++],o!=e[a++]){r=1879048192;break}if(r===n)return z=r,e.string;n-=3,r=z}for(e=[],oE[t]=e,e.bytes=i;r<n;)o=st.getUint32(r),e.push(o),r+=4;for(n+=3;r<n;)o=fe[r++],e.push(o);let s=i<16?t0(i):dE(i);return s!=null?e.string=s:e.string=Jx(i)}function pE(i){if(typeof i=="string")return i;if(typeof i=="number"||typeof i=="boolean"||typeof i=="bigint")return i.toString();if(i==null)return i+"";if(Ht.allowArraysInMapKeys&&Array.isArray(i)&&i.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return i.flat().toString();throw new Error(`Invalid property type for record: ${typeof i}`)}function hE(i){$C&&$C();let t=Pi,e=z,r=Zx,n=Ti,o=_o,a=hs,s=Qx,l=Aa,c=en,d=new Uint8Array(fe.slice(0,Pi)),u=ct,p=ct.slice(0,ct.length),h=Ht,f=fs,m=i();return Pi=t,z=e,Zx=r,Ti=n,_o=o,hs=a,Qx=s,Aa=l,en=c,fe=d,fs=f,ct=u,ct.splice(0,ct.length,...p),Ht=h,st=new DataView(fe.buffer,fe.byteOffset,fe.byteLength),m}function im(){fe=null,Aa=null,ct=null}function om(i){i.unpack?xn[i.type]=i.unpack:xn[i.type]=i}var Kx,fe,Pi,z,lE,Qx,Zx,Ht,ct,hs,Ti,_o,en,Aa,xn,st,KC,vp,$x,fs,QC,ZC,JC,$C,Mi,y_,tE,Jx,g_,v_,b_,$r,oE,aE,sE,r0,x_,S_,am,sm,A_,w_,C_,lm,E_,XW,ml=xe(()=>{try{Kx=new TextDecoder}catch{}z=0,lE=[],Qx=lE,Zx=0,Ht={},Ti=0,_o=0,xn=[],KC={useRecords:!1,mapsAsObjects:!0},vp=class{},$x=new vp;$x.name="MessagePack 0xC1";fs=!1,QC=2,Mi=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(fe)return hE(()=>(im(),this?this.unpack(t,e):Mi.prototype.unpack.call(KC,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(Pi=e.end||t.length,z=e.start||0):(z=0,Pi=e>-1?e:t.length),Zx=0,_o=0,hs=null,Qx=lE,en=null,fe=t;try{st=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(r){throw fe=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 Mi){if(Ht=this,this.structures)return ct=this.structures,nm(e);(!ct||ct.length>0)&&(ct=[])}else Ht=KC,(!ct||ct.length>0)&&(ct=[]);return nm(e)}unpackMultiple(t,e){let r,n=0;try{fs=!0;let o=t.length,a=this?this.unpack(t,o):sm.unpack(t,o);if(e){if(e(a,n,z)===!1)return;for(;z<o;)if(n=z,e(nm(),n,z)===!1)return}else{for(r=[a];z<o;)n=z,r.push(nm());return r}}catch(o){throw o.lastPosition=n,o.values=r,o}finally{fs=!1,im()}}_mergeStructures(t,e){JC&&(t=JC.call(this,t)),t=t||[],Object.isFrozen(t)&&(t=t.map(r=>r.slice(0)));for(let r=0,n=t.length;r<n;r++){let o=t[r];o&&(o.isShared=!0,r>=32&&(o.highByte=r-32>>5))}t.sharedLength=t.length;for(let r in e||[])if(r>=0){let n=t[r],o=e[r];o&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[r]=n),t[r]=o)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};y_=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;tE=(i,t)=>function(){let e=fe[z++];if(e===0)return t();let r=i<32?-(i+(e<<5)):i+(e<<5),n=ct[r]||cE()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=e0(n,i)),n.read()};Jx=bp,g_=bp,v_=bp,b_=bp;$r=String.fromCharCode;oE=new Array(4096);aE=(i,t)=>{let e=Or().map(pE),r=i;t!==void 0&&(i=i<32?-((t<<5)+i):(t<<5)+i,e.highByte=t);let n=ct[i];return n&&(n.isShared||fs)&&((ct.restoreStructures||(ct.restoreStructures=[]))[i]=n),ct[i]=e,e.read=e0(e,r),(e.read0||e.read)()};xn[0]=()=>{};xn[0].noBuffer=!0;xn[66]=i=>{let t=i.byteLength%8||8,e=BigInt(i[0]&128?i[0]-256:i[0]);for(let r=1;r<t;r++)e<<=BigInt(8),e+=BigInt(i[r]);if(i.byteLength!==t){let r=new DataView(i.buffer,i.byteOffset,i.byteLength),n=(o,a)=>{let s=a-o;if(s<=40){let u=r.getBigUint64(o);for(let p=o+8;p<a;p+=8)u<<=BigInt(64),u|=r.getBigUint64(p);return u}let l=o+(s>>4<<3),c=n(o,l),d=n(l,a);return c<<BigInt((a-l)*8)|d};e=e<<BigInt((r.byteLength-t)*8)|n(t,r.byteLength)}return e};sE={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};xn[101]=()=>{let i=Or();if(!sE[i[0]]){let t=Error(i[1],{cause:i[2]});return t.name=i[0],t}return sE[i[0]](i[1],{cause:i[2]})};xn[105]=i=>{if(Ht.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=st.getUint32(z-4);Aa||(Aa=new Map);let e=fe[z],r;e>=144&&e<160||e==220||e==221?r=[]:e>=128&&e<144||e==222||e==223?r=new Map:(e>=199&&e<=201||e>=212&&e<=216)&&fe[z+1]===115?r=new Set:r={};let n={target:r};Aa.set(t,n);let o=Or();if(n.used)Object.assign(r,o);else return n.target=o;if(r instanceof Map)for(let[a,s]of o.entries())r.set(a,s);if(r instanceof Set)for(let a of Array.from(o))r.add(a);return r};xn[112]=i=>{if(Ht.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=st.getUint32(z-4),e=Aa.get(t);return e.used=!0,e.target};xn[115]=()=>new Set(Or());r0=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array"),x_=typeof globalThis=="object"?globalThis:window;xn[116]=i=>{let t=i[0],e=Uint8Array.prototype.slice.call(i,1).buffer,r=r0[t];if(!r){if(t===16)return e;if(t===17)return new DataView(e);throw new Error("Could not find typed array for code "+t)}return new x_[r](e)};xn[120]=()=>{let i=Or();return new RegExp(i[0],i[1])};S_=[];xn[98]=i=>{let t=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],e=z;return z+=t-i.length,en=S_,en=[iE(),iE()],en.position0=0,en.position1=0,en.postBundlePosition=z,z=e,Or()};xn[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");am=new Array(147);for(let i=0;i<256;i++)am[i]=+("1e"+Math.floor(45.15-i*.30103));sm=new Mi({useRecords:!1}),A_=sm.unpack,w_=sm.unpackMultiple,C_=sm.unpack,lm={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},E_=new Float32Array(1),XW=new Uint8Array(E_.buffer,0,4)});function n0(i,t,e,r){let n=i.byteLength;if(n+1<256){var{target:o,position:a}=e(4+n);o[a++]=199,o[a++]=n+1}else if(n+1<65536){var{target:o,position:a}=e(5+n);o[a++]=200,o[a++]=n+1>>8,o[a++]=n+1&255}else{var{target:o,position:a,targetView:s}=e(7+n);o[a++]=201,s.setUint32(a,n+1),a+=4}o[a++]=116,o[a++]=t,i.buffer||(i=new Uint8Array(i)),o.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),a)}function i0(i,t){let e=i.byteLength;var r,n;if(e<256){var{target:r,position:n}=t(e+2);r[n++]=196,r[n++]=e}else if(e<65536){var{target:r,position:n}=t(e+3);r[n++]=197,r[n++]=e>>8,r[n++]=e&255}else{var{target:r,position:n,targetView:o}=t(e+5);r[n++]=198,o.setUint32(n,e),n+=4}r.set(i,n)}function mE(i,t,e,r){let n=i.length;switch(n){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:n<256?(t[e++]=199,t[e++]=n):n<65536?(t[e++]=200,t[e++]=n>>8,t[e++]=n&255):(t[e++]=201,t[e++]=n>>24,t[e++]=n>>16&255,t[e++]=n>>8&255,t[e++]=n&255)}return t[e++]=r,t.set(i,e),e+=n,e}function O_(i,t){let e,r=t.length*6,n=i.length-r;for(;e=t.pop();){let o=e.offset,a=e.id;i.copyWithin(o+r,o,n),r-=6;let s=o+r;i[s++]=214,i[s++]=105,i[s++]=a>>24,i[s++]=a>>16&255,i[s++]=a>>8&255,i[s++]=a&255,n=o}return i}function yE(i,t,e){if(ur.length>0){Wt.setUint32(ur.position+i,H+e-ur.position-i),ur.stringsPosition=H-i;let r=ur;ur=null,t(r[0]),t(r[1])}}function o0(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");pm.unshift(i.Class),um.unshift(i)}om(i)}function I_(i,t){return i.isCompatible=e=>{let r=!e||(t.lastNamedStructuresLength||0)===e.length;return r||t._mergeStructures(e),r},i}var dm,um,pm,Dc,cm,gE,fE,K,xp,Wt,H,Sn,ur,T_,P_,M_,Ic,yl,vE,D_,R_,B_,N_,L_,__,bE,xE,SE,a0=xe(()=>{ml();ml();ml();try{dm=new TextEncoder}catch{}Dc=typeof Buffer<"u",cm=Dc?function(i){return Buffer.allocUnsafeSlow(i)}:Uint8Array,gE=Dc?Buffer:Uint8Array,fE=Dc?4294967296:2144337920,H=0,ur=null,P_=21760,M_=/[\u0080-\uFFFF]/,Ic=Symbol("record-id"),yl=class extends Mi{constructor(t){super(t),this.offset=0;let e,r,n,o,a,s=gE.prototype.utf8Write?function(E,B){return K.utf8Write(E,B,K.byteLength-B)}:dm&&dm.encodeInto?function(E,B){return dm.encodeInto(E,K.subarray(B)).written}:!1,l=this;t||(t={});let c=t&&t.sequential,d=t.structures||t.saveStructures,u=t.maxSharedStructures;if(u==null&&(u=d?32:0),u>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let p=t.maxOwnStructures;p==null&&(p=d?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let h=u>32||p+u>64,f=u+64,m=u+p+64;if(m>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let y=[],g=0,v=0;this.pack=this.encode=function(E,B){if(K||(K=new cm(8192),Wt=K.dataView||(K.dataView=new DataView(K.buffer,0,8192)),H=0),Sn=K.length-10,Sn-H<2048?(K=new cm(K.length),Wt=K.dataView||(K.dataView=new DataView(K.buffer,0,K.length)),Sn=K.length-10,H=0):H=H+7&2147483640,r=H,B&SE&&(H+=B&255),a=l.structuredClone?new Map:null,l.bundleStrings&&typeof E!="string"?(ur=[],ur.size=1/0):ur=null,o=l.structures,o){o.uninitialized&&(o=l._mergeStructures(l.getStructures()));let k=o.sharedLength||0;if(k>u)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 F=0;F<k;F++){let W=o[F];if(!W)continue;let U,G=o.transitions;for(let q=0,X=W.length;q<X;q++){let Y=W[q];U=G[Y],U||(U=G[Y]=Object.create(null)),G=U}G[Ic]=F+64}this.lastNamedStructuresLength=k}c||(o.nextId=k+64)}n&&(n=!1);let L;try{l.randomAccessStructure&&!l.readOnlyStructures&&E&&typeof E=="object"?E.constructor===Object?_(E):E.constructor!==Map&&!Array.isArray(E)&&!pm.some(F=>E instanceof F)?_(E.toJSON?E.toJSON():E):x(E):x(E);let k=ur;if(ur&&yE(r,x,0),a&&a.idsToInsert){let F=a.idsToInsert.sort((q,X)=>q.offset>X.offset?1:-1),W=F.length,U=-1;for(;k&&W>0;){let q=F[--W].offset+r;q<k.stringsPosition+r&&U===-1&&(U=0),q>k.position+r?U>=0&&(U+=6):(U>=0&&(Wt.setUint32(k.position+r,Wt.getUint32(k.position+r)+U),U=-1),k=k.previous,W++)}U>=0&&k&&Wt.setUint32(k.position+r,Wt.getUint32(k.position+r)+U),H+=F.length*6,H>Sn&&M(H),l.offset=H;let G=O_(K.subarray(r,H),F);return a=null,G}return l.offset=H,B&bE?(K.start=r,K.end=H,K):K.subarray(r,H)}catch(k){throw L=k,k}finally{if(o&&(b(),n&&l.saveStructures)){let k=o.sharedLength||0,F=K.subarray(r,H),W=I_(o,l);if(!L)return l.saveStructures(W,W.isCompatible)===!1?(o.uninitialized=!0,l.pack(E,B)):(l.lastNamedStructuresLength=k,K.length>1073741824&&(K=null),F)}K.length>1073741824&&(K=null),B&xE&&(H=r)}};let b=()=>{v<10&&v++;let E=o.sharedLength||0;if(o.length>E&&!c&&(o.length=E),g>1e4)o.transitions=null,v=0,g=0,y.length>0&&(y=[]);else if(y.length>0&&!c){for(let B=0,L=y.length;B<L;B++)y[B][Ic]=0;y=[]}},S=E=>{var B=E.length;B<16?K[H++]=144|B:B<65536?(K[H++]=220,K[H++]=B>>8,K[H++]=B&255):(K[H++]=221,Wt.setUint32(H,B),H+=4);for(let L=0;L<B;L++)x(E[L])},x=E=>{H>Sn&&(K=M(H));var B=typeof E,L;if(B==="string"){let k=E.length;if(ur&&k>=4&&k<4096){if((ur.size+=k)>P_){let G,q=(ur[0]?ur[0].length*3+ur[1].length:0)+10;H+q>Sn&&(K=M(H+q));let X;ur.position?(X=ur,K[H]=200,H+=3,K[H++]=98,G=H-r,H+=4,yE(r,x,0),Wt.setUint16(G+r-3,H-r-G)):(K[H++]=214,K[H++]=98,G=H-r,H+=4),ur=["",""],ur.previous=X,ur.size=0,ur.position=G}let U=M_.test(E);ur[U?0:1]+=E,K[H++]=193,x(U?-k:k);return}let F;k<32?F=1:k<256?F=2:k<65536?F=3:F=5;let W=k*3;if(H+W>Sn&&(K=M(H+W)),k<64||!s){let U,G,q,X=H+F;for(U=0;U<k;U++)G=E.charCodeAt(U),G<128?K[X++]=G:G<2048?(K[X++]=G>>6|192,K[X++]=G&63|128):(G&64512)===55296&&((q=E.charCodeAt(U+1))&64512)===56320?(G=65536+((G&1023)<<10)+(q&1023),U++,K[X++]=G>>18|240,K[X++]=G>>12&63|128,K[X++]=G>>6&63|128,K[X++]=G&63|128):(K[X++]=G>>12|224,K[X++]=G>>6&63|128,K[X++]=G&63|128);L=X-H-F}else L=s(E,H+F);L<32?K[H++]=160|L:L<256?(F<2&&K.copyWithin(H+2,H+1,H+1+L),K[H++]=217,K[H++]=L):L<65536?(F<3&&K.copyWithin(H+3,H+2,H+2+L),K[H++]=218,K[H++]=L>>8,K[H++]=L&255):(F<5&&K.copyWithin(H+5,H+3,H+3+L),K[H++]=219,Wt.setUint32(H,L),H+=4),H+=L}else if(B==="number")if(E>>>0===E)E<32||E<128&&this.useRecords===!1||E<64&&!this.randomAccessStructure?K[H++]=E:E<256?(K[H++]=204,K[H++]=E):E<65536?(K[H++]=205,K[H++]=E>>8,K[H++]=E&255):(K[H++]=206,Wt.setUint32(H,E),H+=4);else if(E>>0===E)E>=-32?K[H++]=256+E:E>=-128?(K[H++]=208,K[H++]=E+256):E>=-32768?(K[H++]=209,Wt.setInt16(H,E),H+=2):(K[H++]=210,Wt.setInt32(H,E),H+=4);else{let k;if((k=this.useFloat32)>0&&E<4294967296&&E>=-2147483648){K[H++]=202,Wt.setFloat32(H,E);let F;if(k<4||(F=E*am[(K[H]&127)<<1|K[H+1]>>7])>>0===F){H+=4;return}else H--}K[H++]=203,Wt.setFloat64(H,E),H+=8}else if(B==="object"||B==="function")if(!E)K[H++]=192;else{if(a){let F=a.get(E);if(F){if(!F.id){let W=a.idsToInsert||(a.idsToInsert=[]);F.id=W.push(F)}K[H++]=214,K[H++]=112,Wt.setUint32(H,F.id),H+=4;return}else a.set(E,{offset:H-r})}let k=E.constructor;if(k===Object)T(E);else if(k===Array)S(E);else if(k===Map)if(this.mapAsEmptyObject)K[H++]=128;else{L=E.size,L<16?K[H++]=128|L:L<65536?(K[H++]=222,K[H++]=L>>8,K[H++]=L&255):(K[H++]=223,Wt.setUint32(H,L),H+=4);for(let[F,W]of E)x(F),x(W)}else{for(let F=0,W=um.length;F<W;F++){let U=pm[F];if(E instanceof U){let G=um[F];if(G.write){G.type&&(K[H++]=212,K[H++]=G.type,K[H++]=0);let te=G.write.call(this,E);te===E?Array.isArray(E)?S(E):T(E):x(te);return}let q=K,X=Wt,Y=H;K=null;let Q;try{Q=G.pack.call(this,E,te=>(K=q,q=null,H+=te,H>Sn&&M(H),{target:K,targetView:Wt,position:H-te}),x)}finally{q&&(K=q,Wt=X,H=Y,Sn=K.length-10)}Q&&(Q.length+H>Sn&&M(Q.length+H),H=mE(Q,K,H,G.type));return}}if(Array.isArray(E))S(E);else{if(E.toJSON){let F=E.toJSON();if(F!==E)return x(F)}if(B==="function")return x(this.writeFunction&&this.writeFunction(E));T(E)}}}else if(B==="boolean")K[H++]=E?195:194;else if(B==="bigint"){if(E<9223372036854776e3&&E>=-9223372036854776e3)K[H++]=211,Wt.setBigInt64(H,E);else if(E<18446744073709552e3&&E>0)K[H++]=207,Wt.setBigUint64(H,E);else if(this.largeBigIntToFloat)K[H++]=203,Wt.setFloat64(H,Number(E));else{if(this.largeBigIntToString)return x(E.toString());if(this.useBigIntExtension||this.moreTypes){let k=E<0?BigInt(-1):BigInt(0),F;if(E>>BigInt(65536)===k){let W=BigInt(18446744073709552e3)-BigInt(1),U=[];for(;U.push(E&W),E>>BigInt(63)!==k;)E>>=BigInt(64);F=new Uint8Array(new BigUint64Array(U).buffer),F.reverse()}else{let W=E<0,U=(W?~E:E).toString(16);if(U.length%2?U="0"+U:parseInt(U.charAt(0),16)>=8&&(U="00"+U),Dc)F=Buffer.from(U,"hex");else{F=new Uint8Array(U.length/2);for(let G=0;G<F.length;G++)F[G]=parseInt(U.slice(G*2,G*2+2),16)}if(W)for(let G=0;G<F.length;G++)F[G]=~F[G]}F.length+H>Sn&&M(F.length+H),H=mE(F,K,H,66);return}else throw new RangeError(E+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string")}H+=8}else if(B==="undefined")this.encodeUndefinedAsNil?K[H++]=192:(K[H++]=212,K[H++]=0,K[H++]=0);else throw new Error("Unknown type: "+B)},A=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?E=>{let B;if(this.skipValues){B=[];for(let F in E)(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(F))&&!this.skipValues.includes(E[F])&&B.push(F)}else B=Object.keys(E);let L=B.length;L<16?K[H++]=128|L:L<65536?(K[H++]=222,K[H++]=L>>8,K[H++]=L&255):(K[H++]=223,Wt.setUint32(H,L),H+=4);let k;if(this.coercibleKeyAsNumber)for(let F=0;F<L;F++){k=B[F];let W=Number(k);x(isNaN(W)?k:W),x(E[k])}else for(let F=0;F<L;F++)x(k=B[F]),x(E[k])}:E=>{K[H++]=222;let B=H-r;H+=2;let L=0;for(let k in E)(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(k))&&(x(k),x(E[k]),L++);if(L>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');K[B+++r]=L>>8,K[B+r]=L&255},w=this.useRecords===!1?A:t.progressiveRecords&&!h?E=>{let B,L=o.transitions||(o.transitions=Object.create(null)),k=H++-r,F;for(let W in E)if(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(W)){if(B=L[W],B)L=B;else{let U=Object.keys(E),G=L;L=o.transitions;let q=0;for(let X=0,Y=U.length;X<Y;X++){let Q=U[X];B=L[Q],B||(B=L[Q]=Object.create(null),q++),L=B}k+r+1==H?(H--,D(L,U,q)):I(L,U,k,q),F=!0,L=G[W]}x(E[W])}if(!F){let W=L[Ic];W?K[k+r]=W:I(L,Object.keys(E),k,0)}}:E=>{let B,L=o.transitions||(o.transitions=Object.create(null)),k=0;for(let W in E)(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(W))&&(B=L[W],B||(B=L[W]=Object.create(null),k++),L=B);let F=L[Ic];F?F>=96&&h?(K[H++]=((F-=96)&31)+96,K[H++]=F>>5):K[H++]=F:D(L,L.__keys__||Object.keys(E),k);for(let W in E)(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(W))&&x(E[W])},C=typeof this.useRecords=="function"&&this.useRecords,T=C?E=>{C(E)?w(E):A(E)}:w,M=E=>{let B;if(E>16777216){if(E-r>fE)throw new Error("Packed buffer would be larger than maximum buffer size");B=Math.min(fE,Math.round(Math.max((E-r)*(E>67108864?1.25:2),4194304)/4096)*4096)}else B=(Math.max(E-r<<2,K.length-1)>>12)+1<<12;let L=new cm(B);return Wt=L.dataView||(L.dataView=new DataView(L.buffer,0,B)),E=Math.min(E,K.length),K.copy?K.copy(L,0,r,E):L.set(K.slice(r,E)),H-=r,r=0,Sn=L.length-10,K=L},D=(E,B,L)=>{let k=o.nextId;k||(k=64),k<f&&this.shouldShareStructure&&!this.shouldShareStructure(B)?(k=o.nextOwnId,k<m||(k=f),o.nextOwnId=k+1):(k>=m&&(k=f),o.nextId=k+1);let F=B.highByte=k>=96&&h?k-96>>5:-1;E[Ic]=k,E.__keys__=B,o[k-64]=B,k<f?(B.isShared=!0,o.sharedLength=k-63,n=!0,F>=0?(K[H++]=(k&31)+96,K[H++]=F):K[H++]=k):(F>=0?(K[H++]=213,K[H++]=114,K[H++]=(k&31)+96,K[H++]=F):(K[H++]=212,K[H++]=114,K[H++]=k),L&&(g+=v*L),y.length>=p&&(y.shift()[Ic]=0),y.push(E),x(B))},I=(E,B,L,k)=>{let F=K,W=H,U=Sn,G=r;K=xp,H=0,r=0,K||(xp=K=new cm(8192)),Sn=K.length-10,D(E,B,k),xp=K;let q=H;if(K=F,H=W,Sn=U,r=G,q>1){let X=H+q-1;X>Sn&&M(X);let Y=L+r;K.copyWithin(Y+q,Y+1,H),K.set(xp.slice(0,q),Y),H=X}else K[L+r]=xp[0]},_=E=>{let B=T_(E,K,r,H,o,M,(L,k,F)=>{if(F)return n=!0;H=k;let W=K;return x(L),b(),W!==K?{position:H,targetView:Wt,target:K}:H},this);if(B===0)return T(E);H=B}}useBuffer(t){K=t,K.dataView||(K.dataView=new DataView(K.buffer,K.byteOffset,K.byteLength)),Wt=K.dataView,H=0}set position(t){H=t}get position(){return H}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}};pm=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,vp];um=[{pack(i,t,e){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:o,position:a}=t(6);n[a++]=214,n[a++]=255,o.setUint32(a,r)}else if(r>0&&r<4294967296){let{target:n,targetView:o,position:a}=t(10);n[a++]=215,n[a++]=255,o.setUint32(a,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),o.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),e(this.onInvalidDate());let{target:n,targetView:o,position:a}=t(3);n[a++]=212,n[a++]=255,n[a++]=255}else{let{target:n,targetView:o,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,o.setUint32(a,i.getMilliseconds()*1e6),o.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(i,t,e){if(this.setAsEmptyObject)return t(0),e({});let r=Array.from(i),{target:n,position:o}=t(this.moreTypes?3:0);this.moreTypes&&(n[o++]=212,n[o++]=115,n[o++]=0),e(r)}},{pack(i,t,e){let{target:r,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(r[n++]=212,r[n++]=101,r[n++]=0),e([i.name,i.message,i.cause])}},{pack(i,t,e){let{target:r,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(r[n++]=212,r[n++]=120,r[n++]=0),e([i.source,i.flags])}},{pack(i,t){this.moreTypes?n0(i,16,t):i0(Dc?Buffer.from(i):new Uint8Array(i),t)}},{pack(i,t){let e=i.constructor;e!==gE&&this.moreTypes?n0(i,r0.indexOf(e.name),t):i0(i,t)}},{pack(i,t){this.moreTypes?n0(i,17,t):i0(Dc?Buffer.from(i):new Uint8Array(i),t)}},{pack(i,t){let{target:e,position:r}=t(1);e[r]=193}}];vE=new yl({useRecords:!1}),D_=vE.pack,R_=vE.pack,{NEVER:B_,ALWAYS:N_,DECIMAL_ROUND:L_,DECIMAL_FIT:__}=lm,bE=512,xE=1024,SE=2048});var AE=xe(()=>{a0();ml()});var wE=xe(()=>{a0();ml();AE()});var s0,k_,hm,CE=xe(()=>{"use strict";ml();Kf();yp();ps();hp();ds();s0=[{Class:ve.prototype.constructor,type:1,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,ve.prototype),i}},{Class:oe.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,oe.prototype),i}},{Class:Rt.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Rt.prototype),i}},{Class:cl.prototype.constructor,type:4,write(i){return i.id},read(i){return new cl(i)}},{Class:pp.prototype.constructor,type:5,write(i){return i.data},read(i){return new pp(i)}},{Class:vt.prototype.constructor,type:6,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,vt.prototype),i}}];for(let i of s0)om(i);k_=new Mi({structuredClone:!0});(t=>{function i(e){return k_.unpack(e)}t.deserialize=i})(hm||(hm={}))});function V_(i){let t=0;if(i.length===0)return t;for(let e=0;e<i.length;e++){let r=i[e];t=(t<<5)-t+r,t=t&t}return t}function l0(i){if(Qn(i))return i;if(Array.isArray(i))return i.map(l0);if(typeof i=="object"&&i!==null){let t={};for(let e of Object.keys(i).sort())t[e]=l0(i[e]);return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}else return i}var F_,gl,EE=xe(()=>{"use strict";wE();gr();CE();F_=new yl({structuredClone:!0});for(let i of s0)o0(i);(r=>{function i(n){return F_.pack(n)}r.serialize=i;function t(n){return hm.deserialize(n)}r.deserialize=t;function e(n){return V_(i(l0(n))).toString()}r.checksum=e})(gl||(gl={}))});var yt=xe(()=>{gp();FC();Qf();ds();hp();Zf();ps();jC();qC();Xx();YC();Kf();EE();Fx();yp()});function Sp(i){return i==="MouseDown"||i==="MouseUp"||i==="KeyDown"||i==="KeyUp"||i==="Collision"||i==="Trigger"}var fm,TE,d0,Rc,mm,c0,PE,ME,OE,ym,gm,IE,DE,RE,BE,NE,vm,bm,LE,_E,kE,FE,u0=xe(()=>{"use strict";yt();fm=require("three");(e=>{function i(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type}e.toEventUIType=i;function t(r){return r==="Distance"||r==="StateChange"?"Conditional":r}e.fromEventUIType=t})(TE||(TE={}));d0={["LookAt"]:[],["Follow"]:["Create"],["DragDrop"]:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseHover"]:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Scroll"]:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Start"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Conditional"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MousePress"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyPress"]:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["GameControl"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],["Collision"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Trigger"]:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Resize"]:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["VariableChange"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["API"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["WEBHOOK"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["AIAssistantListener"]:["SetVariable"],["AIAssistantTrigger"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(e=>{function i(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"}e.is=i;function t(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new oe}:{type:r,disabled:!1,name:"",key:void 0,actions:new oe}}e.defaultData=t})(Rc||(Rc={}));(e=>{function i(r){return{type:"Property",value:[r??null,"position","x"]}}e.propertyDefaultData=i,e.valueDefaultData={type:"Literal",value:0}})(mm||(mm={}));(r=>{function i(n){return{type:"Comparison",operator:"==",lOperand:mm.propertyDefaultData(n),rOperand:{...mm.valueDefaultData}}}r.comparisonDefaultData=i;function t(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}}r.distanceDefaultData=t;function e(n,o){return{type:"State",object:n??null,state:o??null}}r.stateDefaultData=e})(c0||(c0={}));(t=>{function i(e){return e.find(r=>r==="ifActions"||r==="elseActions")!==void 0}t.isConditionalSubActions=i})(PE||(PE={}));(e=>{function i(r){return r.type==="Conditional"}e.is=i;function t(r){return{type:"Conditional",disabled:!1,name:"",inActions:new oe,outActions:new oe,condition:c0.distanceDefaultData(r)}}e.defaultData=t})(ME||(ME={}));(t=>t.defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new oe,drop:new oe}})(OE||(OE={}));(t=>t.defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new oe})(ym||(ym={}));(t=>t.defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5})(gm||(gm={}));(e=>{function i(r){return r.type==="MouseHover"}e.is=i;function t(){return{type:"MouseHover",disabled:!1,name:"",actions:new oe}}e.defaultData=t})(IE||(IE={}));(e=>{function i(r){return r.type==="Scroll"}e.is=i;function t(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new oe}}e.defaultData=t})(DE||(DE={}));(e=>{function i(r){return r.type==="Start"}e.is=i;function t(){return{type:"Start",disabled:!1,name:"",actions:new oe}}e.defaultData=t})(RE||(RE={}));(e=>{function i(r){return r.type==="Collision"}e.is=i;function t(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new oe}}e.defaultData=t})(BE||(BE={}));(e=>{function i(r){return r.type==="Trigger"}e.is=i;function t(r,n){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new oe,triggerZone:"box",position:n.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}e.defaultData=t})(NE||(NE={}));(a=>{a.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(s){return s.type==="Resize"}a.is=t;function e(s){return typeof s=="string"?s:"custom"}a.sizeToDevice=e;function r(s){return typeof s=="string"?[...a.defaultSizes[s]]:[...s]}a.deviceToSize=r;function n(){let s={size:"mobile",operator:"<",actions:new oe},l={size:"tablet",operator:"<",actions:new oe},c={size:[...a.defaultSizes.custom],operator:"<>",actions:new oe},d=new oe;return d.push({id:fm.MathUtils.generateUUID(),fi:0,data:s},{id:fm.MathUtils.generateUUID(),fi:1,data:l},{id:fm.MathUtils.generateUUID(),fi:2,data:c}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:d}}a.defaultData=n;function o(){return{size:[...a.defaultSizes.custom],operator:"<>",actions:new oe}}a.defaultBreakpointData=o})(vm||(vm={}));(r=>{r.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]};function t(n){return n.type==="VariableChange"}r.is=t;function e(){return{disabled:!1,type:"VariableChange",name:"",actions:new oe,variableId:"",objectId:null,property:"Position X"}}r.defaultData=e})(bm||(bm={}));(e=>{function i(r){return r.type==="API"}e.is=i;function t(){return{disabled:!1,type:"API",name:"",successActions:new oe,errorActions:new oe,userAPIId:""}}e.defaultData=t})(LE||(LE={}));(e=>{function i(r){return r.type==="WEBHOOK"}e.is=i;function t(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new oe,userWebhookId:""}}e.defaultData=t})(_E||(_E={}));(e=>{function i(r){return r.type==="AIAssistantListener"}e.is=i;function t(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new oe,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=t})(kE||(kE={}));(e=>{function i(r){return r.type==="AIAssistantTrigger"}e.is=i;function t(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new oe}}e.defaultData=t})(FE||(FE={}))});function UE(i){let t=typeof i;return i!==null&&(t==="object"||t==="function")}function Ap(i){return typeof i=="string"&&i.length===36?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(i):!1}var ko,ms,zE,Ir,hi,Oi,vl,VE,p0,tn,Jt,Ve,xm,wa,bl,GE,_n=xe(()=>{"use strict";ko="personal camera",ms="a218fcc3-276b-49b9-b485-49037fd14f5f",zE=2500134,Ir=5526619;(h=>{function i(f,m){return f[0]===m[0]&&f[1]===m[1]}h.isEqual=i;function t(f,m,y){return[f[0]+(m[0]-f[0])*y,f[1]+(m[1]-f[1])*y]}h.lerp=t;function e(f,m){return[f[0]+m[0],f[1]+m[1]]}h.add=e;function r(f,m){return[f[0]-m[0],f[1]-m[1]]}h.sub=r;function n(f,m){return[f[0]*m[0],f[1]*m[1]]}h.multiply=n;function o(f,m){return[f[0]/m[0],f[1]/m[1]]}h.divide=o;function a(f,m){return Math.pow(m[0]-f[0],2)+Math.pow(m[1]-f[1],2)}h.distanceSquared=a;function s(f,m){return Math.sqrt(a(f,m))}h.distance=s;function l(f,m){return f[0]*m[0]+f[1]*m[1]}h.dot=l;function c(f,m){return[f[0]*m,f[1]*m]}h.scalarMultiply=c;function d(f,m,y){let g=h.sub(m,f),v=h.sub(y,f),b=h.dot(g,v)/h.dot(g,g),S=h.scalarMultiply(g,b);return h.add(f,S)}h.projectionOnto=d;function u(f,m,y){return s(f,d(f,m,y))}h.projectionOntoDistance=u;function p(f,m){return[(f[0]+m[0])*.5,(f[1]+m[1])*.5]}h.center=p})(hi||(hi={}));(s=>{function i(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]}s.isEqual=i;function t(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}s.add=t;function e(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]}s.sub=e;function r(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]}s.div=r;function n(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]}s.mul=n;function o(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])}s.dist=o;function a(l,c,d){return[l[0]+(c[0]-l[0])*d,l[1]+(c[1]-l[1])*d,l[2]+(c[2]-l[2])*d]}s.lerp=a})(Oi||(Oi={}));(e=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}e.isEqual=i;function t(r,n,o){return[r[0]+(n[0]-r[0])*o,r[1]+(n[1]-r[1])*o,r[2]+(n[2]-r[2])*o,r[3]+(n[3]-r[3])*o]}e.lerp=t})(vl||(vl={}));(a=>{let i=180/Math.PI,t=Math.PI/180;function e(s){return typeof s=="number"?s*i:s}function r(s){return typeof s=="number"?s*t:s}function n(s){return[e(s[0]),e(s[1]),e(s[2])]}a.radToDeg=n;function o(s){return[r(s[0]),r(s[1]),r(s[2])]}a.degToRad=o})(VE||(VE={}));(n=>{n.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(o,a){for(let s=0;s<16;s++)if(o[s]!==a[s])return!1;return!0}n.isEqual=t;function e(o){return o??n.identity}n.simplify=e;function r(o,a){let s=a.slice(0);for(let l=0,c=a.length;l<c;l+=3){let d=o[3]*a[l]+o[7]*a[l+1]+o[11]*a[l+2]+o[15];s[l]=(o[0]*a[l]+o[4]*a[l+1]+o[8]*a[l+2]+o[12])/d,s[l+1]=(o[1]*a[l]+o[5]*a[l+1]+o[9]*a[l+2]+o[13])/d,s[l+2]=(o[2]*a[l]+o[6]*a[l+1]+o[10]*a[l+2]+o[14])/d}return s}n.applyMatrix4=r})(p0||(p0={}));(n=>{n.zero=[0,0,0,0,0,0],n.INDEX_MAP=[4,8,1,9,2,6];function e(o){let a=[...p0.identity];for(let s=0;s<6;s++)a[n.INDEX_MAP[s]]=o[s];return a}n.toMatrix=e;function r(o){return[o[n.INDEX_MAP[0]],o[n.INDEX_MAP[1]],o[n.INDEX_MAP[2]],o[n.INDEX_MAP[3]],o[n.INDEX_MAP[4]],o[n.INDEX_MAP[5]]]}n.fromMatrix=r})(tn||(tn={}));(p=>{function i(h){return typeof h=="object"&&typeof h.r=="number"&&typeof h.g=="number"&&typeof h.b=="number"}p.isRGB=i,p.white={r:1,g:1,b:1},p.red={r:1,g:0,b:0},p.black={r:0,g:0,b:0};function n(h){return{r:Math.round(h.r*255),g:Math.round(h.g*255),b:Math.round(h.b*255),a:1}}p.toRgb255a1=n;function o(h){return{r:h.r,g:h.g,b:h.b}}p.clone=o;function a(h){return h=Math.floor(h),{r:(h>>16&255)/255,g:(h>>8&255)/255,b:(h&255)/255}}p.fromHex=a;function s(h){return Math.round(h.r*255)*65536+Math.round(h.g*255)*256+Math.round(h.b*255)}p.toHex=s;function l(h,f){return h.r===f.r&&h.g===f.g&&h.b===f.b}p.equals=l;function c(h,f){return h.r.toFixed(2)===f.r.toFixed(2)&&h.g.toFixed(2)===f.g.toFixed(2)&&h.b.toFixed(2)===f.b.toFixed(2)}p.equalsFixed=c;function d(h,f,m){return{r:h.r+(f.r-h.r)*m,g:h.g+(f.g-h.g)*m,b:h.b+(f.b-h.b)*m}}p.lerp=d;function u(h){return UE(h)?"r"in h&&"g"in h&&"b"in h&&!("a"in h):!1}p.is=u})(Jt||(Jt={}));(d=>{d.white={...Jt.white,a:1};function t(u){return UE(u)?"r"in u&&"g"in u&&"b"in u&&"a"in u:!1}d.is=t,d.transparent={...Jt.white,a:0};function r(u){return{r:u[0],g:u[1],b:u[2],a:u[3]}}d.from0to1=r;function n(u,p){return{...Jt.fromHex(u),a:p}}d.fromHexAndA=n;function o(u){return{r:Math.round(u.r*255),g:Math.round(u.g*255),b:Math.round(u.b*255),a:u.a}}d.toRgb255a1=o;function a(u,p){return Jt.equals(u,p)&&u.a===p.a}d.equals=a;function s(u,p){return Jt.equalsFixed(u,p)&&u.a.toFixed(2)===p.a.toFixed(2)}d.equalsFixed=s;function l(u,p,h){return{r:u.r+(p.r-u.r)*h,g:u.g+(p.g-u.g)*h,b:u.b+(p.b-u.b)*h,a:u.a+(p.a-u.a)*h}}d.lerp=l;function c({r:u,g:p,b:h,a:f}=d.white){return`rgba(${u*255}, ${p*255}, ${h*255}, ${f})`}d.toStyle=c})(Ve||(Ve={}));(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(xm||(xm={}));(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(wa||(wa={}));(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})(bl||(bl={}));(o=>(o.linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]))(GE||(GE={}))});var jE,HE,WE,qE,XE,YE,KE,h0,QE,ZE,f0,JE,$E,eT,m0,tT,y0,rT,nT,g0,iT,Sm,oT,aT,sT,lT,cT,dT=xe(()=>{"use strict";yt();u0();(t=>t.defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"})(jE||(jE={}));(t=>t.defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"})(HE||(HE={}));(t=>t.defaultData={type:"Link",name:"",url:null,context:"tab"})(WE||(WE={}));(t=>t.defaultData={type:"Destroy",name:"",objects:[],delay:0})(qE||(qE={}));(t=>t.defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"})(XE||(XE={}));(t=>t.defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"})(YE||(YE={}));(t=>t.defaultData={type:"Reset",name:"",delay:0})(KE||(KE={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1})(h0||(h0={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(QE||(QE={}));(o=>(o.defaultData={type:"Audio",name:"",...h0.defaultData},o.hasAudioByActions=a=>a.some(({data:s})=>s.type==="Audio"&&s.interaction==="play"&&s.audio),o.hasAudioByEvents=a=>o.getAudiosByEvents(a).length>0,o.getAudiosByActions=a=>{let s=[];return a.forEach(l=>{let c=l.data;c.type==="Audio"&&c.interaction==="play"&&c.audio&&s.push(l),c.type==="Conditional"&&(s.push(...o.getAudiosByActions(c.ifActions)),s.push(...o.getAudiosByActions(c.elseActions)))}),s},o.getAudiosByEvents=a=>{let s=[];return a.forEach(({data:l})=>{Rc.is(l)||l.type==="Collision"||l.type==="Start"||l.type==="Trigger"||l.type==="VariableChange"||l.type==="WEBHOOK"||l.type==="AIAssistantTrigger"?s.push(...o.getAudiosByActions(l.actions)):l.type==="Conditional"?(s.push(...o.getAudiosByActions(l.inActions)),s.push(...o.getAudiosByActions(l.outActions))):l.type==="GameControl"?Object.values(l.gameActions).forEach(c=>{s.push(...o.getAudiosByActions(c))}):l.type==="DragDrop"?(s.push(...o.getAudiosByActions(l.dragDropActions.drag)),s.push(...o.getAudiosByActions(l.dragDropActions.drop))):l.type==="Resize"?l.breakpoints.forEach(({data:c})=>{s.push(...o.getAudiosByActions(c.actions))}):l.type==="API"&&(s.push(...o.getAudiosByActions(l.successActions)),s.push(...o.getAudiosByActions(l.errorActions)))}),s}))(ZE||(ZE={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1/0})(f0||(f0={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(JE||(JE={}));(o=>(o.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...f0.defaultData},o.hasVideoByActions=a=>a.some(({data:s})=>s.type==="Video"&&s.interaction==="play"&&s.layerId),o.hasVideoByObject=a=>{if(a.events){for(let{data:s}of a.events)if((Rc.is(s)||s.type==="Start")&&o.hasVideoByActions(s.actions))return!0}},o.getVideosByActions=a=>{let s=[];return a.forEach(l=>{let c=l.data;c.type==="Video"&&c.interaction==="play"&&c.layerId&&s.push(l)}),s},o.getVideosByEvents=a=>{let s=[];return a.forEach(({data:l})=>{(Rc.is(l)||l.type==="Start")&&s.push(...o.getVideosByActions(l.actions))}),s}))($E||($E={}));(t=>{function i(e){return{state:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}}t.defaultData=i})(eT||(eT={}));(t=>{function i(){return{tweens:new oe,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}}t.defaultData=i})(m0||(m0={}));(t=>{function i(e){return{type:"Transition",name:"",runMode:"Once",object:e??null,...m0.defaultData()}}t.defaultData=i})(tT||(tT={}));(t=>{function i(e){return{interaction:"play",timeline:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}}t.defaultData=i})(y0||(y0={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(rT||(rT={}));(t=>{function i(e){return{type:"TimelineAnimation",name:"",...y0.defaultData(e)}}t.defaultData=i})(nT||(nT={}));(t=>{function i(e,r,n){return{interaction:"play",object:e,clipId:r,crop:n,crop2:n,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}}t.defaultData=i})(g0||(g0={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(iT||(iT={}));(e=>{function i(r,n,o){return{type:"Animation",name:"",...g0.defaultData(r,n,o)}}e.defaultData=i;function t(r){return r.interaction==="pause"||r.interaction==="stop"}e.isPause=t})(Sm||(Sm={}));(t=>t.defaultData={type:"SetVariable",name:"",variableId:"",expression:[]})(oT||(oT={}));(t=>t.defaultData=()=>({type:"Conditional",name:"",ifActions:new oe,elseActions:new oe,condition:[]}))(aT||(aT={}));(t=>t.defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0})(sT||(sT={}));(t=>t.defaultData={type:"ClearLocalStorage",name:"",target:"all"})(lT||(lT={}));(t=>t.defaultData={name:"",type:"UserAPI"})(cT||(cT={}))});var uT,pT=xe(()=>{"use strict";(e=>(e.emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),r=>r.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6))(uT||(uT={}))});var co,uo,v0=xe(()=>{"use strict";(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(r){return e.all.includes(r)}e.is=t})(co||(co={}));(h=>{h.DefaultUp=[0,1,0],h.DefaultTargetOffset=1e3,h.MinTargetOffset=.001;function r(f){return f===void 0||!Number.isFinite(f)||f<h.MinTargetOffset?h.DefaultTargetOffset:f}h.sanitizeTargetOffset=r,h.DefaultAzimuth=-24,h.DefaultElevation=15;let a=h.DefaultAzimuth*Math.PI/180,s=h.DefaultElevation*Math.PI/180,l=180/Math.PI;h.DefaultPosition=[h.DefaultTargetOffset*Math.sin(a)*Math.cos(s),h.DefaultTargetOffset*Math.sin(s),h.DefaultTargetOffset*Math.cos(a)*Math.cos(s)],h.DefaultRotation=[Math.atan2(-Math.sin(s),Math.cos(a)*Math.cos(s))*l,Math.asin(Math.sin(a)*Math.cos(s))*l,Math.atan2(Math.sin(a)*Math.sin(s),Math.cos(a))*l],h.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:h.DefaultUp,isUpVectorFlipped:!1,targetOffset:h.DefaultTargetOffset};function p(f){return f.type==="PerspectiveCamera"?f.perspective?.zoom??1:f.orthographic?.zoom??1}h.getZoom=p})(uo||(uo={}))});var Fo,Am,b0,wm,Cm,Em,Tm,Pm,x0=xe(()=>{"use strict";(r=>{function i(n,o=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:Math.max(typeof n[0]=="number"?n[0]:1,typeof n[1]=="number"?n[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[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",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof n[0]=="number"?n[0]+n[0]:1)*o,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:n.map(a=>(typeof a=="number"?a:1)*(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"}}}r.defaultData=i;function t(n,o){let a={...n};if(b0.forEach(s=>{Object.assign(a,{[s]:o[s]??n[s]})}),a.radial={...n.radial},o.radial){let s=n.radial,l=o.radial;wm.forEach(c=>{Object.assign(a.radial,{[c]:l[c]??s[c]})})}if(a.linear={...n.linear},o.linear){let s=n.linear,l=o.linear;Cm.forEach(c=>{Object.assign(a.linear,{[c]:l[c]??s[c]})})}if(a.grid={...n.grid},o.grid){let s=n.grid,l=o.grid;Em.forEach(c=>{Object.assign(a.grid,{[c]:l[c]??s[c]})})}if(a.toObject={...n.toObject},o.toObject){let s=n.toObject,l=o.toObject;Tm.forEach(c=>{Object.assign(a.toObject,{[c]:l[c]??s[c]})})}if(a.randomnessObject={...n.randomnessObject},o.randomnessObject){let s=n.randomnessObject,l=o.randomnessObject;Pm.forEach(c=>{Object.assign(a.randomnessObject,{[c]:l[c]??s[c]})})}return a}r.merge=t;function e(n){return!!(n.randomnessObject||n.toObject)}r.isPartial=e})(Fo||(Fo={}));(r=>{r.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(n,o){let a=[];n.count!==void 0&&a.push({type:0,path:o,props:{count:n.count}});for(let s of t){let l=n[s];l&&Object.keys(l).length>0&&a.push({type:0,path:[...o,s],props:l})}return a}r.toOps=e})(Am||(Am={}));b0=["count"],wm=["radius","start","end","position","scale","rotation"],Cm=["position","scale","rotation"],Em=["count","size"],Tm=["count","position","scale","rotation"],Pm=["strength","scale","rotation","position","movement","seed","freqScale"]});var Mm,Om,S0=xe(()=>{"use strict";_n();(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(r){return e.all.includes(r)}e.is=t})(Mm||(Mm={}));(e=>{function i(r){return t(r)}e.defaultData=i;function t(r){if(r==="PointLight")return{type:r,color:Ve.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(r==="SpotLight")return{type:r,color:Ve.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:Ve.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(Om||(Om={}))});var Bc,A0=xe(()=>{"use strict";(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",emitTimeDuration:1,...r.defaultCollisionData}))(Bc||(Bc={}))});var Im,w0=xe(()=>{"use strict";(e=>(e.defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]))(Im||(Im={}))});var ys,Dm=xe(()=>{"use strict";(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]})(ys||(ys={}))});var C0,E0,Rm,hT,T0=xe(()=>{"use strict";(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}e.equals=t})(C0||(C0={}));(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0};function t(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe&&(r.shadowCatcher??!1)===(n.shadowCatcher??!1)}e.equals=t})(E0||(E0={}));(t=>t.defaultData={...E0.defaultData,...C0.defaultData})(Rm||(Rm={}));(t=>{function i(e,r){let n=[];if("material"in e){let o=typeof e.material=="string"?r.materials[e.material]??r.lib.materials[e.material]?.asset:e.material;o&&n.push(o)}else if("materials"in e)for(let o of e.materials){let a=typeof o=="string"?r.materials[o]??r.lib.materials[o]?.asset:o;a&&n.push(a)}return n}t.getMaterialData=i})(hT||(hT={}))});var Nc,P0=xe(()=>{"use strict";(e=>{function i(r){if(typeof r!="object"||r===null||Array.isArray(r)||ArrayBuffer.isView(r)||typeof r[0]!="number")return null;let n=Object.getPrototypeOf(r);if(n!==Object.prototype&&n!==null)return null;let o=Object.keys(r),a=new Uint8Array(o.length),s=r;for(let l=0;l<o.length;l++){let c=s[l];if(o[l]!==String(l)||typeof c!="number"||!Number.isInteger(c)||c<0||c>255)return null;a[l]=c}return a}e.bytesFromFlattened=i,e.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}})(Nc||(Nc={}))});var Lc,M0=xe(()=>{"use strict";(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(Lc||(Lc={}))});function mT(i){return i.type!=="displace"}var O0,fT,wp,I0,Bm,yT,qt,sr,Cp=xe(()=>{"use strict";yt();_n();P0();M0();_n();(t=>{function i(e){return e==="texture"||e==="video"||e==="color"||e==="depth"||e==="normal"||e==="gradient"||e==="noise"||e==="fresnel"||e==="cavity"||e==="dust"||e==="rainbow"||e==="toon"||e==="outline"||e==="particle"||e==="transmission"||e==="reflection"||e==="matcap"||e==="displace"||e==="pattern"||e==="vertexColor"||e==="light"}t.is=i})(O0||(O0={}));(t=>{function i(e){return e==="luminance"||e==="r"||e==="g"||e==="b"||e==="a"}t.is=i})(fT||(fT={}));(t=>{function i(e){return typeof e=="object"&&e!==null&&e.image!=null}t.is=i})(wp||(wp={}));(t=>{function i(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=i})(I0||(I0={}));Bm=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],yT=["wrapping","image","video","name","minFilter","magFilter"];(a=>{function i(s,l){let{texture:c,...d}=l;if(Object.assign(s,d),c){let u=s.texture;u&&Object.assign(u,c)}}a.patch=i;function t(s){return{...a.defaultData("color"),color:s}}a.defaultColorLayer=t;function e(s,l){return s==="light"&&l?n(l):o(s)}a.defaultData=e;function r(s,l){return s!=="light"?e(s):e("light",typeof l=="string"&&I0.is(l)?l:"physical")}a.defaultDataFor=r;function n(s){let l={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(s){case"phong":return{...l,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...l,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...l,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...l,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}function o(s){let l={alpha:1,mode:0,isMask:!1,visible:!0};switch(s){case"texture":return{...l,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,magFilter:1006},crop:!1};case"video":return{...l,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Lc.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:Jt.fromHex(Ir)};case"vertexColor":return{...l,type:"vertexColor"};case"depth":return{...l,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{...l,type:"normal",cnormal:[1,1,1]};case"gradient":return{...l,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{...l,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Jt.fromHex(6710886),a:1},colorB:{...Jt.fromHex(6710886),a:1},colorC:{...Jt.fromHex(16777215),a:1},colorD:{...Jt.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"cavity":return{...l,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...l,type:"fresnel",color:Ve.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Ve.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...l,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...l,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:Ve.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Ve.fromHexAndA(0,1),contourColor:Ve.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{...l,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...l,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...l,type:"reflection",blur:0,thickness:10/1e4,steps:60,stepSize:5/1e3,tracingMode:1,mirror:0};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{...l,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Jt.fromHex(0),a:1},colorB:{...Jt.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}}}})(qt||(qt={}));(m=>{function i(y){let g=[],v=new Map,b=(A,w)=>{let C=hl(A);if(typeof C!="object"||C===null||ArrayBuffer.isView(C))return A;if(v.has(C))return v.get(C)??A;v.set(C,void 0);let T=S(C,w)??A;return v.set(C,T),T},S=(A,w)=>{let C=A;if(!Array.isArray(A)){if(typeof C[0]=="number")return;if(typeof C.name=="string"){let M=Nc.bytesFromFlattened(hl(C.data));if(M!==null)return g.push({path:`${w}/data`,bytes:M.byteLength}),Object.setPrototypeOf({...C,data:M},Object.getPrototypeOf(A))}}let T=null;for(let M of Object.keys(A)){let D=C[M],I=b(D,`${w}/${M}`);I!==D&&(T===null&&(T=Array.isArray(A)?[...A]:{...C},Object.setPrototypeOf(T,Object.getPrototypeOf(A))),T[M]=I)}return T??void 0};return{material:b(y,""),restored:g}}m.restoreImageBytes=i;function t(y){let g=hl(y.layers);if(!Array.isArray(g)||g instanceof oe||!g.every(S=>typeof S=="object"&&S!==null&&typeof S.id=="string"&&typeof S.data=="object"))return{material:y,restored:!1};let v=Object.setPrototypeOf([...g],oe.prototype),b=hl(y);return{material:Object.setPrototypeOf({...b,layers:v},Object.getPrototypeOf(b)),restored:!0}}m.restoreLayersSeq=t;function e(y){return!y.layers.some(v=>v.data.type==="texture"&&v.data.projection!==0||v.data.type==="depth"&&!v.data.isWorldSpace||v.data.type==="noise"||v.data.type==="dust"&&v.data.noiseStrength!==0||v.data.type==="displace")}m.isMergable=e;function r(y){let g="";return y.layers.forEach(v=>{Object.entries(v.data).forEach(([b,S])=>{g+=`${b}${S}`,Array.isArray(S)?S.forEach(x=>g+=`${x}`):typeof S=="object"?Object.values(S).forEach(x=>{typeof x=="number"?g+=`${x.toFixed(4)}`:g+=`${x}`}):g+=`${S}`})}),g}m.getHash=r;function n(){return{layers:new oe}}m.defaultEmptyData=n;function o(y="layer1",g="layer2"){return d("physical",y,g)}m.defaultData=o;function a(y,g){return{...y,name:g}}m.withName=a;function s(y,g){if(typeof y!="string"||!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(y))return y;let{r:v,g:b,b:S}=Jt.fromHex(parseInt(y.slice(1,7),16)),x=y.length===9?parseInt(y.slice(7),16)/255:void 0;if(Array.isArray(g))return g.length>3?[v,b,S,x??g[3]]:[v,b,S];let A=g;return typeof A?.r!="number"?y:typeof A.a=="number"?{r:v,g:b,b:S,a:x??A.a}:{r:v,g:b,b:S}}function l(y){let g=y?.data;return typeof g=="object"&&g!==null}m.isLayerEntry=l;function c(y){if(y.layers===void 0)return{...y,layers:d("phong").layers};let g=Array.from(y.layers);if(g.every(l))return y;let v=new oe;return g.forEach((b,S)=>{if(l(b)){v.push(b);return}let{id:x,fi:A,...w}=b??{};if(typeof w.type!="string"||!O0.is(w.type))return;let C=qt.defaultDataFor(w.type,w.category),T={...C,...w};for(let[M,D]of Object.entries(w)){let I=C[M];T[M]=Array.isArray(D)&&Array.isArray(I)&&Array.isArray(I[0])?D.map(_=>s(_,I[0])):s(D,I)}v.push({id:typeof x=="string"&&x?x:`layer${S+1}`,fi:typeof A=="number"?A:S,data:T})}),{...y,layers:v}}m.withRepairedLayers=c;function d(y,g="layer1",v="layer2",b=Jt.fromHex(16777215)){let S=new oe;return S.push({fi:0,data:qt.defaultData("light",y),id:g}),S.push({fi:1,data:qt.defaultData("color"),id:v}),{layers:S}}m.defaultTwoLayerData=d;function u(y,g,v="layer1",b="layer2"){let S=new oe;return S.push({fi:0,data:qt.defaultData("light",g),id:v}),S.push({fi:1,data:qt.defaultColorLayer(y),id:b}),{layers:S}}m.defaultColorMaterial=u;function p(y){let g=qt.defaultData("texture");y&&Object.assign(g.texture,{image:y});let v=new oe;return v.push({fi:0,data:g,id:"layer1"}),v.push({fi:1,data:{...qt.defaultData("transmission"),alpha:1},id:"layer2"}),v.push({fi:2,data:{...qt.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:v}}m.defaultUIObjectMaterial=p;function h(y,g="physical",v="layer1",b="layer2"){let S=qt.defaultData("texture");Object.assign(S.texture,{image:y});let x=new oe;return x.push({fi:0,data:S,id:v}),x.push({fi:1,data:qt.defaultData("light",g),id:b}),{layers:x}}m.defaultTwoLayerTextureData=h;function f(y,g="physical",v="layer1",b="layer2"){let S=qt.defaultData("video");Object.assign(S.texture,{video:y});let x=new oe;return x.push({fi:0,data:S,id:v}),x.push({fi:1,data:qt.defaultData("light",g),id:b}),{layers:x}}m.defaultTwoLayerVideoTextureData=f})(sr||(sr={}))});var gT=xe(()=>{"use strict"});var gs,D0=xe(()=>{"use strict";yt();(e=>{function i(){return{points:new oe,roundness:0,shapeHoles:[],isClosed:!1}}e.defaultData=i;function t(r,n,o){let a=s=>[s[0]*n,s[1]*o];return{...r,points:new oe(...r.points.map(({id:s,fi:l,data:c})=>({id:s,fi:l,data:{...c,position:a(c.position),controlPrevious:{position:a(c.controlPrevious.position)},controlNext:{position:a(c.controlNext.position)}}}))),shapeHoles:r.shapeHoles.map(s=>t(s,n,o))}}e.scaled=t})(gs||(gs={}))});var _c,Sl,Nm,Lm,Ep,R0=xe(()=>{"use strict";yt();(t=>{function i(){return{points:new oe,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}t.defaultData=i})(_c||(_c={}));Sl={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(t=>{function i(e,r){let n={...e};return Ep.forEach(o=>{Object.assign(n,{[o]:r[o]??e[o]})}),n}t.merge=i})(Nm||(Nm={}));Lm={shape:Sl,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},Ep=["depth","offset","angle","twist","startScale","endScale"]});var Tp,kc,Vo,_m,km=xe(()=>{"use strict";D0();R0();(r=>{function i(n){return n==="PolygonGeometry"||n==="RectangleGeometry"||n==="StarGeometry"||n==="TriangleGeometry"||n==="EllipseGeometry"||n==="UIGeometry"}r.is2DParametricMesh=i;function t(n){return n==="PolygonGeometry"||n==="RectangleGeometry"||n==="StarGeometry"||n==="TriangleGeometry"||n==="EllipseGeometry"||n==="PathGeometry"||n==="VectorGeometry"||n==="ConeGeometry"||n==="CubeGeometry"||n==="CylinderGeometry"||n==="DodecahedronGeometry"||n==="HelixGeometry"||n==="IcosahedronGeometry"||n==="LatheGeometry"||n==="PyramidGeometry"||n==="SphereGeometry"||n==="PlaneGeometry"||n==="BackdropGeometry"||n==="TorusGeometry"||n==="TorusKnotGeometry"||n==="BooleanGeometry"||n==="TextGeometry"||n==="InputGeometry"||n==="DecalGeometry"}r.isParametricMesh=t;function e(n){return n==="PolygonGeometry"||n==="RectangleGeometry"||n==="StarGeometry"||n==="TriangleGeometry"||n==="EllipseGeometry"||n==="PathGeometry"||n==="VectorGeometry"||n==="ConeGeometry"||n==="CubeGeometry"||n==="CylinderGeometry"||n==="DodecahedronGeometry"||n==="HelixGeometry"||n==="IcosahedronGeometry"||n==="LatheGeometry"||n==="PyramidGeometry"||n==="SphereGeometry"||n==="PlaneGeometry"||n==="BackdropGeometry"||n==="TorusGeometry"||n==="TorusKnotGeometry"||n==="TextGeometry"||n==="SubdivGeometry"||n==="NonParametricGeometry"}r.isSwappableGeometry=e})(Tp||(Tp={}));(t=>{function i(e,r){let n={...e};if(Object.assign(n,r),n.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(n.extrusion={...e.extrusion},Object.assign(n.extrusion,Nm.merge(n.extrusion,r.extrusion))),e.type==="VectorGeometry"&&n.type==="VectorGeometry"){let o=(l,c)=>typeof l=="number"&&typeof c=="number"&&c!==0?l/c:1,a=o(n.width,e.width),s=o(n.height,e.height);(a!==1||s!==1)&&(n.shape=gs.scaled(e.shape,a,s))}return n}t.merge=i})(kc||(kc={}));(t=>{function i(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:_c.defaultData(),extrusion:Lm};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:gs.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==="ShapeBlendGeometry")return{type:e,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(e==="DecalGeometry")return{type:e,width:200,height:200,depth:200,offset:1,projection:"all",projectionTargets:[]};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",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="InputGeometry")return{...t.defaultData("TextGeometry"),type:e,editable:!0};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=i})(Vo||(Vo={}));_m=["width","height","depth"]});var Ii,B0=xe(()=>{"use strict";_n();(a=>{a.defaultData={enabled:!1,useBackgroundColor:!1,color:Jt.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0};function t(s){return s.mode??"linear"}a.getMode=t;function e(s){let l=t(s);return l==="height"?1:l==="both"?2:0}a.getModeIndex=e;function r(s){return s.density??a.defaultData.density}a.getDensity=r;function n(s){return s.heightFalloff??a.defaultData.heightFalloff}a.getHeightFalloff=n;function o(s){return s.heightBase??a.defaultData.heightBase}a.getHeightBase=o})(Ii||(Ii={}))});var N0,Go,Fm=xe(()=>{"use strict";(t=>t.defaultData={image:null,rotation:0,blur:32,showBackground:!0})(N0||(N0={}));(t=>t.defaultData={enabled:!1,mode:"hdri",hdri:N0.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2})(Go||(Go={}))});var Vm,L0=xe(()=>{"use strict";(e=>{let i={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...i,blendFunction:16,granularity:15},bloom:{...i,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...i,offset:[2,2]},vignette:{...i,darkness:1,offset:0},hueSaturation:{...i,hue:3,saturation:0},brightnessContrast:{...i,brightness:.25,contrast:0},depthOfField:{...i,focusDistance:100,focalLength:20,bokehScale:5},noise:{...i,blendFunction:16}}})(Vm||(Vm={}))});var Pp,_0,k0,F0,vs,V0,Gm,Um=xe(()=>{"use strict";B0();Fm();L0();_n();(e=>{e.defaultData={type:"normal",softShadowQuality:"low"};function t(r){return r==null?!1:r.type===void 0||r.type==="soft"}e.isSoft=t})(Pp||(Pp={}));(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(_0||(_0={}));(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(k0||(k0={}));(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1};function t(r){return r===void 0||r.pipeline==="classic"&&(r.toneMapping==="none"||r.toneMapping==="aces")&&r.exposure===1}e.isUntouched=t})(F0||(F0={}));(t=>t.defaultData={usePhysics:!1,gravity:-10})(vs||(vs={}));(t=>t.defaultData={playCamera:ko,gameControlObject:null})(V0||(V0={}));(t=>t.defaultData={backgroundColor:Ve.fromHexAndA(zE,1),postprocessing:Vm.defaultData,fog:Ii.defaultData,sky:Go.defaultData,globalPhysics:vs.defaultData,ambient:_0.defaultData,ao:k0.defaultData,shadow:Pp.defaultData,publish:V0.defaultData,grading:F0.defaultData})(Gm||(Gm={}))});var zm,vT=xe(()=>{"use strict";(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(zm||(zm={}))});var bT,Fc,ET,vr,jm,xT,ST,AT,wT,Ca,Al,Hm,Vc,Uo,po,CT,Ea,Mp=xe(()=>{"use strict";yt();v0();S0();A0();w0();Dm();T0();_n();Cp();km();x0();gr();Um();vT();(e=>{function i(r){return r==="Component"||r==="Instance"}e.isComponentRelated=i;function t(r){return r==="Empty"||r==="Instance"}e.isEmptyOrComponent=t})(bT||(bT={}));(n=>{n.identity={...xm.identity,shear:tn.zero};function t(o){return{position:o.position,rotation:o.rotation,scale:o.scale,pivot:o.pivot,pivotRotation:o.pivotRotation,shear:o.shear}}n.fromObject=t;function e(o,a){return{position:a?.position||o.position,rotation:a?.rotation||o.rotation,pivot:a?.pivot||o.pivot,pivotRotation:a?.pivotRotation||o.pivotRotation,scale:a?.scale||o.scale,shear:a?.shear||o.shear}}n.merge=e;function r(o,a){return Xf({position:Oi.isEqual(o.position,a.position)?void 0:a.position,rotation:Oi.isEqual(o.rotation,a.rotation)?void 0:a.rotation,scale:Oi.isEqual(o.scale,a.scale)?null:a.scale,shear:a.shear?.every((s,l)=>s===o.shear?.[l])?void 0:a.shear})}n.diff=r})(Fc||(Fc={}));ET=["slide","offset"];(t=>t.defaultData={states:new oe,events:new oe,visible:!0,raycastLock:!1,physics:ys.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Fc.identity,cloner:null})(vr||(vr={}));(t=>t.defaultData={type:"Empty",...vr.defaultData})(jm||(jm={}));(t=>t.defaultData={type:"ParticleCollider",...zm.defaultData,...vr.defaultData})(xT||(xT={}));(t=>t.defaultData={type:"Component",...vr.defaultData})(ST||(ST={}));(t=>t.defaultData={type:"Particle",...vr.defaultData,...Bc.defaultData})(AT||(AT={}));(t=>t.defaultData={type:"Hair",...vr.defaultData,...Im.defaultData})(wT||(wT={}));(t=>t.defaultData={type:"Mesh",...vr.defaultData,...Rm.defaultData})(Ca||(Ca={}));(t=>t.defaultData={...vr.defaultData,...Fc.identity,position:uo.DefaultPosition,rotation:uo.DefaultRotation,...uo.defaultData})(Al||(Al={}));(e=>{function i(r){return{...vr.defaultData,...Om.defaultData(r)}}e.defaultData=i,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(Hm||(Hm={}));(e=>{function i(r,n,o=0){for(;o<n.length;){let a=r?r[n[o]]:void 0;if(n.length===o+1)return a;if(a)r=a.descendants,o+=1;else return}}e.resolveWithDes=i;function t(r,n,o=0){let a=i(r,n,o);if(a){let s=Object.keys(a);if(s.length===1&&s[0]==="descendants")return}return a}e.resolve=t})(Vc||(Vc={}));(o=>{o.rootOverrideProps=["physics","events"],o.compositeNonOptionalOverrideProps=["geometry"],o.compositeEntireOverrideOverrideProps=["material"];function r(a,s){return{...vr.defaultData,...s,component:a,overrides:new vt,physics:void 0,events:void 0,type:"Instance"}}o.ofComponent=r;function n(a){let s=Fc.fromObject(a.data);return r(a.id,s)}o.fromComponentData=n})(Uo||(Uo={}));(e=>{e.defaultData={type:"Page",...vr.defaultData,physics:{...ys.defaultData,fusedBody:!1},...Gm.defaultData,camera:Al.defaultData,timelines:new ve};function t(r){return r.uiScene!==void 0}e.isUIPage=t})(po||(po={}));(s=>(s.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],shear:tn.zero,name:"Play Camera",visible:!0,raycastLock:!1,physics:ys.defaultData,states:new oe,events:new oe,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...uo.defaultData},s.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","shear"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},s.defaultMeshObject={name:"Rectangle",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("RectangleGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")},s.defaultBooleanObject={name:"Boolean",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("BooleanGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")},s.defaultShapeBlendObject={name:"Shape Blend",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("ShapeBlendGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")},s.defaultTextObject={name:"Text",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("TextGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")},s.defaultInputObject={name:"Input",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("InputGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")}))(CT||(CT={}));(n=>{function i(o,a){let s={name:a};return o.type==="Mesh"?(s.geometry={},"material"in o&&(s.material={layers:new vt}),"materials"in o&&(s.materials=o.materials.map(l=>({layers:new vt})))):co.is(o.type)&&(s.perspective={},s.orthographic={}),s}n.newEmpty=i;function t(o,a){if(a===void 0)return o;let s={...o};return"material"in s&&"material"in a&&a.material&&(s.material=Oc(s.material,l=>{if(typeof l!="string")for(let[c,d]of Object.entries(a.material.layers)){let u=l.layers.data(c);u&&qt.patch(u,d)}}).data),s.materials&&a.materials&&(s.materials=Oc(s.materials,l=>{for(let c=0;c<s.materials.length;c++){let d=a.materials[c];if(typeof d!="string")for(let[u,p]of Object.entries(d.layers)){let h=l[c]?.layers?.data(u);h&&qt.patch(h,p)}}}).data),s}function e(o,a){let s,l=[],c={orthographic:0,perspective:0,geometry:0};function d(u,p){for(let[h,f]of Object.entries(p.layers)){let{texture:m,...y}=f;if(m!==void 0&&Object.keys(m).length>0){let g={path:[...u,"layers",h,"texture"],props:m,type:0};l.push(g)}if(Object.keys(y).length>0){let g={path:[...u,"layers",h],props:y,type:0};l.push(g)}}}for(let[u,p]of Object.entries(a)){let h=p;if(u!=="name")if(u==="cloner")l.push(...Am.toOps(h,["cloner"]));else if(u==="pathSnapping")l.push({path:[u],props:{slide:h.slide,offset:h.offset},type:0});else if(u==="material")d(["material"],h);else if(u==="materials")for(let[f,m]of Object.entries(h))d(["materials",f],m);else if(c[u]===0){if(u==="geometry"&&h.extrusion!==void 0){let f={path:[u,"extrusion"],props:h.extrusion,type:0};l.push(f),h={...h},delete h.extrusion}if(Object.keys(h).length>0){let f={path:[u],props:h,type:0};l.push(f)}}else s===void 0&&(s={path:[],props:{},type:0},l.push(s)),s.props[u]=h}return l}n.toOps=e;function r(o,a){if(a===void 0)return o;let s={...o};if(Object.assign(s,Fc.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})}),co.is(o.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(o.type==="Mesh")"geometry"in a&&Object.assign(s,{geometry:kc.merge(s.geometry,a.geometry)}),(a.material||a.materials)&&(s=t(s,a)),s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Fo.merge(s.cloner,a.cloner)});else if(o.type==="Empty")s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Fo.merge(s.cloner,a.cloner)});else if(Mm.is(o.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=Jt.clone(l.color))}return s}n.patch=r})(Ea||(Ea={}))});var Gc,Wm=xe(()=>{"use strict";(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,rotationSpeed:1,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})(Gc||(Gc={}))});var Ri,Op=xe(()=>{"use strict";Wm();_n();(t=>t.defaultData={orbitControls:Gc.defaultData,playPage:ms,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,r)=>{let n=0,o=0;return r<5?o=-30:r<10&&(o=30),r===0||r===10||r===5?n=30:(r===4||r===11||r===9)&&(n=-30),[120,[n,o],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0})(Ri||(Ri={}))});var G0,U0,Ta,z0=xe(()=>{"use strict";(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(G0||(G0={}));(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(U0||(U0={}));(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...G0.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:U0.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(Ta||(Ta={}))});var Uc,Pa,qm=xe(()=>{"use strict";Mp();yt();Op();_n();gr();z0();(n=>{function i(o){return o.find(a=>a.data.type==="Page"&&a.data.globalPhysics.usePhysics)!==void 0}n.physicsEnabled=i;function t(o,a){let s=o.find(l=>l.data.type==="Page"&&l.data.timelines?.[a]!==void 0);return s&&s.data.timelines?.[a]}n.findTimeline=t;function e(o,a){let s=o.scene.objects.get(a);if(s&&s.data.type==="Component")return s;{let l=o.shared.lib.components[a];if(l)return{...l.asset,id:a}}}n.getComponentData=e;function r(o,a,s){o.scene.objects.traverseFrom(a,(l,c)=>{if(c.type==="Instance"){let d=e(o,c.component)?.data;d&&s(l,c,d.events)}else s(l,c,c.events)})}n.traverseModuleInstances=r})(Uc||(Uc={}));(c=>{c.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",c.defaultLight={fi:-1,data:Hm.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]};function e(d=!0,u=[]){let p=[];d&&p.push({...c.defaultLight}),p.push(...u);let h=new Rt;return h.push({fi:1,id:ms,data:{...po.defaultData,name:"Scene 1"},children:p}),h}c.createDefaultObjectTreeWithPage=e,c.defaultData={objects:e(),publish:Ri.defaultData,styles:Ta.defaultData()},c.emptyDataWithoutPage=function(){return{objects:new Rt,publish:Ri.defaultData,styles:Ta.defaultData()}},c.emptyDataWithPage=function(d=!0){return{objects:e(d),publish:Ri.defaultData,styles:Ta.defaultData()}},c.emptyData=function(){return{objects:new Rt,publish:{...Ri.defaultData},styles:Ta.defaultData()}};function s(d){return{...c.defaultData,objects:Mr(d,Rt.prototype)}}c.withObjs=s;function l(d,u){return s([{id:d,data:u,children:[],fi:0}])}c.withObj=l})(Pa||(Pa={}))});var zc,j0=xe(()=>{"use strict";(t=>t.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})(zc||(zc={}))});var Xm,TT,Dr,H0,PT,MT,ho,kn,Ym=xe(()=>{"use strict";yt();gr();(e=>(e.defaultData=r=>({url:r,name:"New Webhook",parametersSchemas:new oe}),e.defaultParameterValueByType=r=>r==="number"?0:r==="boolean"?!1:""))(Xm||(Xm={}));(t=>t.defaultData=(e,r="GET")=>({url:e,method:r,name:"New API",headers:new oe,queries:new oe,autoStart:!0}))(TT||(TT={}));(o=>{function i(a){return a.textValue!==void 0}o.isTextValue=i;function t(a){return typeof a=="number"}o.isNumber=t;function e(a){return typeof a=="boolean"}o.isBoolean=e;function r(a){return i(a)?"string":e(a)?"boolean":"number"}o.typeOfVariable=r;function n(a){return o.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():o.isBoolean(a)?a?"True":"False":o.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}o.getDisplayedValue=n})(Dr||(Dr={}));(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(H0||(H0={}));(t=>t.all=[...H0.all,"components"])(PT||(PT={}));(t=>{function i(){return{images:new ve,videos:new ve,colors:new ve,audios:new ve,particles:new ve,fonts:new ve,materials:new ve,components:new ve,variables:new ve,userAPIs:new ve,userWebhooks:new ve}}t.defaultData=i})(MT||(MT={}));(t=>{function i(){return{images:new ve,videos:new ve,colors:new ve,audios:new ve,particles:new ve,fonts:new ve,materials:new ve,components:new ve,variables:new ve,userAPIs:new ve,userWebhooks:new ve}}t.defaultData=i})(ho||(ho={}));(o=>{function i(){let a={};return a["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},Mr(a,ve.prototype)}o.defaultColors=i;function t(){return Mr({},ve.prototype)}o.defaultImages=t;function e(){return{catelogs:new ve,materials:new ve,images:new ve,videos:new ve,colors:new ve,audios:new ve,particles:new ve,fonts:new ve,variables:new oe,userAPIs:new ve,userWebhooks:new ve,lib:ho.defaultData()}}o.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)}}o.defaultVariables=r;function n(a,s){if(s.format==="HH:mm:ss"){let l=Math.floor(a/3600),c=Math.floor((a-l*3600)/60),d=Math.round(a-l*3600-c*60);return{textValue:[l,c,d]}}else if(s.format==="mm:ss"){let l=Math.floor(a/60),c=Math.round(a-l*60);return{textValue:[l,c]}}else return s.format==="number"?a=Math.round(a):a=Math.round(a*1e3)/1e3,a}o.getFormattedTimerTime=n})(kn||(kn={}))});var OT=xe(()=>{"use strict"});var bs,W0=xe(()=>{"use strict";yt();qm();j0();Ym();(l=>{l.defaultData={schema:135,scene:Pa.defaultData,frames:new ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",zc.defaultData),shared:{...kn.emptyData(),colors:kn.defaultColors()}},l.createDefaultData=function(){return gl.deserialize(gl.serialize(l.defaultData))},l.emptyDataForImports=function(){let c=Pa.emptyDataWithPage();return{schema:135,scene:c,frames:new ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",zc.defaultData),shared:{...kn.emptyData(),colors:kn.defaultColors(),images:kn.defaultImages()}}},l.emptyData=function(){return{schema:135,scene:Pa.emptyDataWithPage(),frames:new ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",zc.defaultData),shared:kn.emptyData()}},l.clipboard2dData=function(){return{schema:135,scene:Pa.emptyData(),frames:new ve,shared:kn.emptyData()}};function o(c){return{...c,shared:{...c.shared,lib:ho.defaultData()}}}l.withoutLib=o;function a(c,d){return Uc.getComponentData(c,d)}l.getComponentData=a;function s(c){let d=Object.values(c.shared.userAPIs);for(let u of d){let p=u.headers;for(let h of p)if(h.data.key.toLowerCase()==="authorization"&&h.data.value!=="")return!0}return!1}l.hasSensitiveData=s})(bs||(bs={}))});function Bi(i,t=[0,0]){let e=i&&!isNaN(i[0])?i[0]:t[0],r=i&&!isNaN(i[1])?i[1]:t[1];return[e,r]}function Ip(i,t,e){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:r,control2:n}=t??{...bl.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`}case 6:{let{mass:r,stiffness:n,damping:o,velocity:a}=e??{...wa.defaultData},s=new q0(r,n,o,a),l=s.solve(1);return()=>c=>s.solve(c)/l}case 8:return()=>r=>Math.floor(r)}}var IT,DT,fo,jc,q0,Km=xe(()=>{"use strict";yt();_n();(t=>{function i(e,r){return{id:e,name:r,duration:5,objectTimelines:new ve}}t.defaultData=i})(IT||(IT={}));(t=>{function i(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"}t.is=i})(DT||(DT={}));(S=>{function i(x,A){let w=[0,0],C=[1,1];if(x?.cubicControls)w=Bi(x.cubicControls.control1,w);else switch(x?.type){case 2:w=[.42,0];break;case 3:w=[0,0];break;case 4:w=[.42,0];break;case 1:w=[.25,.1];break;case 0:w=[0,0];break;case 7:w=[.25,1];break}if(A?.cubicControls)C=Bi(A.cubicControls.control2,C);else switch(A?.type){case 2:C=[1,1];break;case 3:C=[.58,1];break;case 4:C=[.58,1];break;case 1:C=[.25,1];break;case 0:C=[1,1];break;case 7:C=[.5,1];break}return{control1:w,control2:C}}S.getControlsWithDefault=i,S.BEZIER_PRESETS=[0,1,2,3,4,7];function e(x){if(!S.BEZIER_PRESETS.includes(x))return;let A={type:x};return{control1:i(A).control1,control2:i(void 0,A).control2}}S.presetHandles=e;let r=.001;function n(x,A){return Math.abs(x[0]-A[0])<r&&Math.abs(x[1]-A[1])<r}function o(x){return S.BEZIER_PRESETS.find(A=>{let w=e(A);return w!==void 0&&n(w.control1,x.control1)&&n(w.control2,x.control2)})}S.presetForHandles=o;function a(x){return{id:x,keyframes:new oe}}S.defaultData=a,S.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"];function l(x){let A=S.ROOT_PROPERTY_ORDER.indexOf(x[0]);return A===-1?S.ROOT_PROPERTY_ORDER.length:A}S.rowOrder=l;function c(x){return x.layerId??x.path.join(".")}S.propertyKey=c;function d(x,A){let w=new Map;for(let C of x){let T=C.data;if(A?.(T))continue;let M=c(T),D=w.get(M);D||(D={id:M,path:T.path,keyframes:[],layerId:T.layerId,index:T.index},w.set(M,D)),T.isPlaceholder?D.placeholder=C.id:D.keyframes.push(C)}return[...w.values()].sort((C,T)=>{let M=l(C.path)-l(T.path);return M!==0?M:(C.index??0)-(T.index??0)})}S.groupKeyframes=d;function u(x){let A=x[x.length-1];return jc.includes(A)?A:void 0}S.rowAxis=u;function p(x){return x.layerId?x.layerId:(u(x.path)?x.path.slice(0,-1):x.path).join(".")}S.drawnRowKey=p;function h(x){let A=new Map;for(let w of x){let C=u(w.path),T=C?w.path.slice(0,-1):w.path,M=p(w),D=A.get(M);D||(D={id:M,path:T,layerId:w.layerId,index:w.index,tracks:[]},A.set(M,D)),D.tracks.push({axis:C,property:w})}return[...A.values()]}S.drawnRows=h;function f(x){return[...x].sort((A,w)=>A.data.time-w.data.time)}S.sortedKeyframes=f;function m(x){return["material",x.type==="light"?`${x.category} lighting`:x.type]}S.materialLayerPath=m;function y(x,A){return x.map(({data:w,id:C},T)=>g(A(),m(w),{layerId:C,index:T}))}S.createMaterialGroup=y;function g(x,A,w){return{id:x,data:{id:x,time:w?.time??0,path:A,value:{},layerId:w?.layerId,index:w?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}S.placeholderKeyframe=g;function v(x){return Object.entries(x).reduce((A,[w,C])=>(typeof C!="string"&&A.push({name:C.name}),A),[])}S.createName=v,S.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Ip(3),duration:1e3},opacity:{value:[0,1],easing:Ip(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Ip(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Ip(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:Ip(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(fo||(fo={}));jc=["x","y","z"],q0=class{constructor(t=1,e=100,r=10,n=0){this.mass=t,this.stiffness=e,this.damping=r,this.initialVelocity=n,this.m_w0=Math.sqrt(e/t),this.m_zeta=r/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-n)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-n+this.m_w0)}solve(t){return this.m_zeta<1?t=Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):t=(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0),1-t}getDuration(){let t=.16666666666666666,e=0,r=0;for(;;)if(e+=t,this.solve(e)===1){if(r++,r>=16)break}else r=0;return e*t*1e3}}});var Hc,Wc,Qm=xe(()=>{"use strict";_n();yt();(t=>t.list=["idle","move","jump","run"])(Hc||(Hc={}));(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 oe,move:new oe,jump:new oe,run:new oe},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Ve.fromHexAndA(3728051,1)}}))(Wc||(Wc={}))});function wl(i,...t){let e={};for(let r of t.flat())i!=null&&r in i&&(e[r]=i[r]);return e}function RT(i){i.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,r=t.colorB,n=[[e.r,e.g,e.b,e.a],[r.r,r.g,r.b,r.a]],o=[0,1];for(let s=2;s<10;s++)n.push(n[1]),o.push(1);let a={...wl(ar(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:o,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={...ar(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,e)}})}function jo(i,t){Object.values(i.shared.materials).forEach(e=>t(e))}function Ho(i,t){i.scene.objects.traverse((e,r)=>{"materials"in r?r.materials.forEach((n,o)=>{n===void 0&&(r.materials[o]=sr.defaultTwoLayerData("phong"),n=r.materials[o]),typeof n!="string"&&t(n)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=sr.defaultTwoLayerData("phong")),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=sr.defaultTwoLayerData("phong")),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(n=>{n.material&&typeof n.material!="string"&&Object.getPrototypeOf(n.material)!==vt.prototype&&t(n.material)})})}function G_(i){Object.assign(i.scene.publish,{orbitControls:{...Gc.defaultData,...ar(i.scene.publish.orbitControls)}})}function U_(i){Object.assign(i.scene.publish.settings,{video:{...Ri.defaultData.settings.video,...ar(i.scene.publish.settings.video)}})}function z_(i){function t(e){if(e.layers){for(let r of Object.values(e.layers))if(r){for(let[n,o]of Object.entries(r))if((Bm.includes(n)||typeof o=="boolean")&&delete r[n],n==="texture")for(let[a,s]of Object.entries(o))(yT.includes(a)||typeof s=="boolean")&&delete o[a]}}}i.scene.objects.traverse((e,r)=>{r.states.forEach(n=>{let o=n;o.material?t(o.material):o.materials&&o.materials.forEach(a=>{t(a)})})})}function j_(i){i.scene.publish.withBackground=!0}function H_(i){i.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function W_(i){i.scene.objects.traverse((t,e)=>{let r=e.cloner;r&&(r.radial.scale=r.radial.scale.map(n=>n+1),r.linear.scale=r.linear.scale.map(n=>n+1))})}function q_(i){i.scene.objects.traverse((t,e)=>{let r=e.geometry;r&&(r.type==="DodecahedronGeometry"||r.type==="IcosahedronGeometry")&&(r.detail=Math.round(r.detail))})}function X_(i){i.scene.objects.traverse((t,e)=>{let r=i.scene.objects.unproxy().parent(t);if(r){let n=ar(i.scene.objects.data(r));n&&n.type==="Mesh"&&n.geometry.type==="BooleanGeometry"&&e.type==="Mesh"&&(e.visible=ar(e).booleanExclude!==!0)}})}function Y_(i){i.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 K_(i){function t(r){Object.setPrototypeOf(r,vt.prototype),r.texture&&Object.setPrototypeOf(r.texture,vt.prototype)}function e(r){Object.setPrototypeOf(r,vt.prototype);for(let n in r)t(r[n])}i.scene.objects.traverse((r,n)=>{n.states.forEach(o=>{let a=o;if(a.material){let s=ar(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],c=ar(l).layers;e(c),l.layers=c}})})}function BT(i){i.layers===void 0&&Object.assign(i,sr.defaultTwoLayerData("lambert"))}function Y0(i){!i.layers||i.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 n={...ar(t),colors:e,steps:r};Object.assign(t,n)}})}function Q_(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function NT(i){i.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(r=>{typeof r!="string"&&Y0(r)}):"material"in e&&typeof e.material!="string"&&Y0(e.material)}),Object.values(i.shared.materials).forEach(t=>Y0(t))}function Z_(i){i.scene.environment.ambientLight.softShadows=!1,i.scene.environment.ambientLight.softShadowQuality="low",i.scene.objects.traverse((t,e)=>{(e.type==="DirectionalLight"||e.type==="SpotLight")&&(e.shadowResolution=1024,e.shadowRadius=1,e.depth=1e5)}),i.shared.penumbraSize=new Array(5).fill(.5)}function J_(i){i.shared.audios=Mr({},ve.prototype)}function $_(i){i.shared.videos=Mr({},ve.prototype)}function ek(i){let t=i.shared.materials;Object.entries(t).forEach(([e,r])=>{if(!r.layers){let n={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]:n})}})}function tk(i){Object.entries(ar(i.shared.images)).filter(r=>r[1].asset===!1).map(r=>r[0]).forEach(r=>{delete i.shared.images[r]}),Object.entries(ar(i.shared.audios)).filter(r=>r[1].asset===!1).map(r=>r[0]).forEach(r=>{delete i.shared.audios[r]})}function rk(i){i.scene.publish.settings.web.preload=!1}function LT(i){i.layers&&i.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 _T(i){i.layers&&i.layers.forEach(t=>{mT(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 nk(i){i.shared.fonts=Mr({},ve.prototype)}function ik(i){return i.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 ok(i){let t=[];i.scene.objects.traverse((e,r)=>{let n=r;if(n.type==="TextFrame"){let o=sr.defaultTwoLayerData("phong"),a=typeof n.color=="string"?i.shared.colors[n.color]:n.color;o.layers[1].data.color={r:a.r,g:a.g,b:a.b},o.layers[1].data.alpha=n.alpha;let s=ik(n.font);i.shared.fonts[s]===void 0&&(i.shared.fonts[s]={name:s});let l={name:n.name,...vr.defaultData,...Ca.defaultData,flatShading:!1,wireframe:!1,geometry:{...Vo.defaultData("TextGeometry"),width:n.width,height:n.height,font:s,depth:0,horizontalAlign:n.horizontalAlign,verticalAlign:n.verticalAlign,fontSize:n.fontSize*1.40625,lineHeight:n.lineHeight/1.40625,letterSpacing:n.letterSpacing-1,text:n.text,textTransform:n.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:o,states:ar(n.states),events:ar(n.events),visible:n.visible,raycastLock:n.raycastLock,position:n.position,rotation:n.rotation,scale:n.scale,hiddenMatrix:n.hiddenMatrix},c=ar(i.scene.objects).parent(e);i.scene.objects.insertAfter(c??null,e,[{id:e+"new",data:l,children:[]}]),t.push(e)}}),t.forEach(e=>{i.scene.objects.delete(e)})}function ak(i){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};i.scene.objects.traverse((e,r)=>{r.events.forEach(n=>{if(!!t[Number(n.type)])if(Object.assign(n,{type:t[Number(n.type)]}),n.type==="Audio"&&"audioEvent"in n&&(Object.assign(n,{playAudio:n.audioEvent}),delete n.audioEvent),n.type==="GameControl")Object.assign(n,{gameActions:{idle:new oe,move:new oe,jump:new oe}});else{let o=new oe;Object.assign(n,{actions:o}),(n.type==="MouseDown"||n.type==="MouseUp"||n.type==="KeyDown"||n.type==="KeyUp")&&"url"in n&&o.push({fi:0,id:Dp.MathUtils.generateUUID(),data:{type:"Link",url:n.url,delay:0}}),"targets"in n&&(n.targets.forEach((a,s,l)=>{let c={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},d={easing:a.easing,duration:a.duration};a.easing===6?Object.assign(d,wl(a,"mass","stiffness","damping","velocity")):a.easing===5&&Object.assign(d,{control1:{...a.control1},control2:{...a.control2}});let u={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,...u,...d},h={allowSlerp:!0,type:"Transition",object:a.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new oe({fi:0,id:Dp.MathUtils.generateUUID(),data:c},{fi:1,id:Dp.MathUtils.generateUUID(),data:p})};o.push({fi:l,id:s,data:h})}),delete n.targets)}})})}function sk(i){i.scene.objects.traverse((t,e)=>{function r(n,o){let a=new oe,s=[];if(e.events.forEach((l,c,d)=>{if(l.type==="Audio"&&l.trigger===o){let u;s.push(c),l.interaction==="play"?u={...wl(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")&&(u={...wl(l,"interaction","delay","object","playAudio"),type:"Audio"}),u&&a.push({fi:d,id:c,data:u})}}),s.forEach(l=>e.events.delete(l)),a.length){let l=e.events.find(c=>c.type===n)?.data;l?"actions"in l&&l.actions.insertBefore(null,a):e.events.insertBefore(null,[{id:Dp.MathUtils.generateUUID(),data:{type:n,actions:a}}])}}r("Start","start"),r("MouseDown","mouseDown"),r("MouseUp","mouseUp"),r("KeyDown","keyDown"),r("KeyUp","keyUp")})}function kT(i){let t=i.layers.find(e=>e.type==="light")?.data;if(t?.category==="basic"){let e=qt.defaultData("light","phong"),r=t;Object.assign(r,e),r.visible=!1}}function FT(i){jo(i,kT),Ho(i,kT)}function lk(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function ck(i){i.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 dk(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="NonParametricGeometry"&&!("material"in e)&&!("materials"in e)&&(e.material=sr.defaultTwoLayerData("phong"))})}function uk(i){i.scene.publish.orbitControls.autoZoom===void 0&&(i.scene.publish.orbitControls.autoZoom=!1),i.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 pk(i){i.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 hk(i){i.scene.publish.mouseEventTarget===void 0&&(i.scene.publish.mouseEventTarget="canvas"),i.scene.publish.settings.web.hint===void 0&&(i.scene.publish.settings.web.hint=!1)}function fk(i){let{video:t}=i.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function mk(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.resetYPosition=Math.abs(r.resetYPosition-e.position[1]))})})}function yk(i){let t=i.scene.environment.usePhysics;i.scene.objects.traverse((e,r)=>{t&&r.physics===null?r.collision=!1:r.collision="visibility"})}function gk(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.navmesh=Wc.defaultDataThirdPerson.navmesh)})})}function vk(i){i.scene.styles||(i.scene.styles=Ta.defaultData())}function VT(i){i.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function bk(i){i.scene.environment.ambientLight.occlusion===void 0&&(i.scene.environment.ambientLight.occlusion=!1),i.scene.environment.ambientLight.aoFullRes===void 0&&(i.scene.environment.ambientLight.aoFullRes=!1),i.scene.environment.ambientLight.radius===void 0&&(i.scene.environment.ambientLight.radius=256),i.scene.environment.ambientLight.bias===void 0&&(i.scene.environment.ambientLight.bias=.5),i.scene.environment.ambientLight.aoColor===void 0&&(i.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Ho(i,VT),jo(i,VT)}function xk(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&Object.assign(r.gameActions,{run:new oe})})})}function Sk(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.keyAssignments=[...r.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function GT(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function UT(i,t){if(t<1&&(Ho(i,RT),jo(i,RT),i.schema=1),t<2&&(G_(i),i.schema=2),t<3&&(z_(i),i.schema=3),t<4&&(j_(i),i.schema=4),t<5&&(H_(i),i.schema=5),t<6&&(W_(i),i.schema=6),t<7&&(q_(i),i.schema=7),t<8&&(i.schema=8),t<9&&(NT(i),i.schema=9),t<10&&(Q_(i),i.schema=10),t<11&&(Z_(i),i.schema=11),t<12&&(NT(i),i.schema=12),t<13&&(J_(i),i.schema=13),t<14&&(ek(i),i.schema=14),t<15&&(tk(i),i.schema=15),t<16&&(rk(i),i.schema=16),t<17&&(Ho(i,LT),jo(i,LT),i.schema=17),t<18&&(Ho(i,BT),jo(i,BT),i.schema=18),t<19&&(U_(i),i.schema=19),t<20&&(nk(i),ok(i),i.schema=20),t<21&&(ak(i),sk(i),i.schema=21),t<22&&(FT(i),i.schema=22),t<23&&(lk(i),i.schema=23),t<24&&(ck(i),i.schema=24),(t<25||i.shared.videos===void 0)&&($_(i),t<25&&(i.schema=25)),t<26&&(X_(i),i.schema=26),t<27&&(Y_(i),i.schema=27),t<28&&(FT(i),i.schema=28),t<29&&(K_(i),i.schema=29),t<30&&(dk(i),i.schema=30),t<31&&(uk(i),i.schema=31),t<33&&(pk(i),i.schema=33),t<34&&(hk(i),i.schema=34),t<35&&(fk(i),i.schema=35),t<36&&(mk(i),i.schema=36),t<37&&(yk(i),i.schema=37),t<38&&(Ho(i,_T),jo(i,_T),i.schema=38),t<39&&(gk(i),i.schema=39),t<40&&(vk(i),i.schema=40),t<41&&(bk(i),i.schema=41),t<42&&(xk(i),i.schema=42),t<43&&(Sk(i),i.schema=43),t<99){Ho(i,GT),jo(i,GT),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=ko);let e=ar(i.scene.objects),r=i.scene.objects;i.scene.publish.playPage=ms,r.insertBefore(null,null,[{id:ms,data:{...po.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:wl(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:wl(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...vs.defaultData,...wl(i.scene.environment,"usePhysics","gravity")},camera:ar(i.scene.ownerCamera)??po.defaultData.camera,name:"Scene"},children:[]}]);for(let a of e)a.id!==Pa.TRASH_CAN_ID&&r.move(ms,a.fi,a.id);let n=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((a,s)=>{s.type==="DirectionalLight"?(s.penumbraSize=i.shared.penumbraSize[Math.min(n,2)],n+=1):s.type==="SpotLight"&&(s.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(s.physics===void 0||s.physics===null)&&s.type!=="Instance"&&(s.physics={},Object.assign(s.physics,ys.defaultData)),s.physics!==void 0&&s.physics!==null&&(s.physics.enabled=s.collision??"visibility",delete s.collision)}),i.schema=99}}var Dp,zT=xe(()=>{"use strict";Cp();_n();Wm();Mp();yt();Op();gr();Dp=require("three");km();Qm();z0();qm();Dm();Um()});function jT(i){let t=i.elements;Wo.set(t[0],t[1],t[2]),qo.set(t[4],t[5],t[6]),Ma.set(t[8],t[9],t[10])}function wk(i,t){i.set(1,0,0).cross(t),i.lengthSq()<=Jm&&i.set(0,1,0).cross(t),i.normalize()}function HT(){let i=Math.max(Wo.lengthSq(),qo.lengthSq(),Ma.lengthSq());Wo.lengthSq()>Jm*i?Ni.copy(Wo).normalize():Ni.set(1,0,0),Li.crossVectors(Ma,Ni),Li.lengthSq()<=Jm*i&&(Li.copy(qo).addScaledVector(Ni,-qo.dot(Ni)),Li.lengthSq()<=Jm*i&&wk(Li,Ni)),Li.normalize(),qc.crossVectors(Ni,Li)}function Ck(){let i=Wo.length(),t=qo.length(),e=Ma.length(),r=Math.max(i,t,e);if(r-i>Zm||r-t>Zm||r-e>Zm)return!0;let n=Zm*r*r;return Math.abs(Wo.dot(qo))>n||Math.abs(Wo.dot(Ma))>n||Math.abs(qo.dot(Ma))>n}function $m(i,t,e){return jT(i),HT(),t.makeBasis(Ni,Li,qc),e.set(Ni.dot(Wo),Ni.dot(qo),Ni.dot(Ma),0,Li.dot(Wo),Li.dot(qo),Li.dot(Ma),0,qc.dot(Wo),qc.dot(qo),qc.dot(Ma),0,0,0,0,1),Ck()}function WT(i){return jT(i),HT(),Ak.makeBasis(Ni,Li,qc)}var Oa,Wo,qo,Ma,Ni,Li,qc,Ak,Jm,Zm,ey=xe(()=>{Oa=require("three"),Wo=new Oa.Vector3,qo=new Oa.Vector3,Ma=new Oa.Vector3,Ni=new Oa.Vector3,Li=new Oa.Vector3,qc=new Oa.Vector3,Ak=new Oa.Matrix4,Jm=1e-12,Zm=.01});function Ek(i,t,e){let r=Math.PI*2,n=l=>l-r*Math.round(l/r),o=n(i+Math.PI),a=n(Math.PI-t),s=n(e+Math.PI);return Math.abs(o)+Math.abs(s)<Math.abs(i)+Math.abs(e)-1e-9?[o,a,s]:[i,t,e]}function Xc(i,t){return t===0?0:i/t}function Bp(i){$m(i,XT,qT),Rp.setFromRotationMatrix(XT);let t=Ek(Rp.x,Rp.y,Rp.z),e=qT.elements;return{position:[i.elements[12],i.elements[13],i.elements[14]],rotation:[t[0]*_i.MathUtils.RAD2DEG,t[1]*_i.MathUtils.RAD2DEG,t[2]*_i.MathUtils.RAD2DEG],scale:[e[0],e[5],e[10]],shear:[Xc(e[4],e[5]),Xc(e[8],e[10]),Xc(e[1],e[0]),Xc(e[9],e[10]),Xc(e[2],e[0]),Xc(e[6],e[5])]}}function Ia(i,{translation:t,quaternion:e,scale:r,shearMatrix:n}={}){let o=Bp(i);if(t!==void 0&&t.fromArray(o.position),e!==void 0){let a=o.rotation;e.setFromEuler(Rp.set(a[0]*_i.MathUtils.DEG2RAD,a[1]*_i.MathUtils.DEG2RAD,a[2]*_i.MathUtils.DEG2RAD))}r!==void 0&&r.fromArray(o.scale),n!==void 0&&n.fromArray(tn.toMatrix(o.shear))}var _i,qT,XT,Rp,Np=xe(()=>{_i=require("three");ey();K0();qT=new _i.Matrix4,XT=new _i.Matrix4,Rp=new _i.Euler});function Pk(i,t,e){let r={name:t,duration:e.duration,tracks:[],uuid:i};return e.blendMode!==void 0&&(r.blendMode=e.blendMode),JSON.stringify(r)}function Mk(i,t,e){for(let r=0;r<e.length;r++)if(!Object.is(i[t+r],e[r]))return!1;return!0}function Ok(i,t,e){let r=[],n=0,o=p=>{let h=[n,p.length];return r.push(p),n+=p.length,h},a=new Map,s=p=>{let h=Float32Array.from(p),f=h.length+":"+h[0]+":"+h[h.length-1],m=a.get(f)??[];for(let g of m)if(Mk(g.run,0,h))return g.span;let y=o(h);return m.push({span:y,run:h}),a.set(f,m),y},l=e.tracks.map(p=>{let h=s(p.times),f=!Tk.has(p.type),m={name:p.name,type:p.type,times:h,values:f?o(Float32Array.from(p.values)):[0,0]};return f||(m.list=Array.from(p.values)),p.interpolation!==void 0&&(m.interpolation=p.interpolation),m}),c=new Float32Array(n),d=0;for(let p of r)c.set(p,d),d+=p.length;let u={v:1,duration:e.duration,data:c,tracks:l};return e.blendMode!==void 0&&(u.blendMode=e.blendMode),e.userData!==void 0&&e.userData!=="{}"&&(u.userData=e.userData),[i,t,Pk(i,t,u),u]}function YT(i){if(!Array.isArray(i)||i.length>3)return i;let[t,e,r]=i;if(typeof t!="string"||typeof r!="string")return i;let n;try{n=JSON.parse(r)}catch{return i}return!n||!Array.isArray(n.tracks)||n.tracks.some(o=>!o?.type||!o.times||!o.values)?i:Ok(t,typeof n.name=="string"?n.name:e,n)}var Tk,Q0=xe(()=>{"use strict";Tk=new Set(["bool","string"])});function ty(i,[t,e]){return Math.min(Math.max(i,t),e)}function QT(i,t,e,r,n){i=ty(i,Ik),t=ty(t,Dk),e=ty(e,Rk),r=ty(r,Bk);let o=Math.sqrt(t/i),a=e/(2*Math.sqrt(t*i)),s=a<1?o*Math.sqrt(1-a*a):0,l=1,c=a<1?(a*o+-r)/s:-r+o;return d=>{let u=n!==void 0?n*d:d;return a<1?u=Math.exp(-u*a*o)*(l*Math.cos(s*u)+c*Math.sin(s*u)):u=(l+c*u)*Math.exp(-u*o),d===0||d===1?d:1-u}}function Nk(i,t,e,r){let n=.16666666666666666,o=0,a=0,s=QT(i,t,e,r),l=1e5;for(let c=0;c<l;c++)if(o+=n,s(o)===1){if(a+=1,a>=16)break}else a=0;return Ge(o*n)}function ZT(i,t){return Ge(Ge(1-Ge(3*t))+Ge(3*i))}function JT(i,t){return Ge(Ge(3*t)-Ge(6*i))}function $T(i){return Ge(3*i)}function iy(i,t,e){return Ge(Ge(Ge(Ge(Ge(ZT(t,e)*i)+JT(t,e))*i)+$T(t))*i)}function eP(i,t,e){let r=Ge(Ge(Ge(3*ZT(t,e))*i)*i),n=Ge(Ge(2*JT(t,e))*i);return Ge(Ge(r+n)+$T(t))}function Vk(i,t,e,r,n){let o,a=0,s=0;do a=Ge(t+Ge(Ge(e-t)/2)),o=Ge(iy(a,r,n)-i),o>0?e=a:t=a,s+=1;while(Math.abs(o)>kk&&s<Fk);return a}function Gk(i,t,e,r){for(let n=0;n<Lk;n++){let o=eP(t,e,r);if(o===0)return t;let a=Ge(iy(t,e,r)-i);t=Ge(t-Ge(a/o))}return t}function Yc(i,t,e,r){if(i=Ge(i),t=Ge(t),e=Ge(e),r=Ge(r),i<0||i>1||e<0||e>1||i===t&&e===r)return KT;let n=new Float32Array(ny);for(let a=0;a<ny;a++)n[a]=iy(Ge(a*ry),i,e);let o=a=>{let s=0,l=1,c=ny-1;for(;l!==c&&n[l]<=a;)s=Ge(s+ry),l+=1;l-=1;let d=Ge(Ge(a-n[l])/Ge(n[l+1]-n[l])),u=Ge(s+Ge(d*ry)),p=eP(u,i,e);return p>=_k?Gk(a,u,i,e):p===0?u:Vk(a,s,Ge(s+ry),i,e)};return a=>(a=Ge(a),a===0||a===1?a:iy(o(a),t,r))}function oy(i,t,e){switch(i.easing){case 0:return e;case 1:return Yc(.25,.1,.25,1)(e);case 2:return Yc(.42,0,1,1)(e);case 3:return Yc(0,0,.58,1)(e);case 4:return Yc(.42,0,.58,1)(e);case 7:return Yc(.25,1,.5,1)(e);case 8:return Math.floor(e);case 5:{let{control1:r,control2:n}=i;return!r||!n?e:Yc(r[0],r[1],n[0],n[1])(e)}case 6:{let{mass:r,stiffness:n,damping:o,velocity:a}=i;return r===void 0||n===void 0||o===void 0||a===void 0?e:Ge(QT(r,n,o,a,t)(e))}default:return e}}function Z0(i,t){if(i.easing!==6)return t;let{mass:e,stiffness:r,damping:n,velocity:o}=i;return e===void 0||r===void 0||n===void 0||o===void 0?t:Nk(e,r,n,o)}var Ge,Ik,Dk,Rk,Bk,Lk,_k,kk,Fk,ny,ry,KT,Uk,n7,tP=xe(()=>{Ge=Math.fround,Ik=[.01,100],Dk=[.01,1e4],Rk=[.01,1e3],Bk=[.01,1e3];Lk=4,_k=Ge(.001),kk=Ge(1e-7),Fk=10,ny=11,ry=Ge(1/(ny-1));KT=i=>i;Uk=Ge(1.70158),n7=Ge(Uk+1)});function zk(i,t){let e=i.length,r=0,n=e;for(;r<n;){let o=r+Math.floor(e/2),a=i[o].time;if(a<t)r=o+1;else if(a>t)n=o;else return{found:!0,index:o};e=n-r}return{found:!1,index:r}}function ay(i,t){if(i.length===0)throw new Error("sampleKeyframes requires at least one keyframe");if(t<=i[0].time)return{index0:0,index1:0,t:1};let{found:e,index:r}=zk(i,t);if(e)return{index0:r,index1:r,t:1};if(r>=i.length){let u=i.length-1;return{index0:u,index1:u,t:1}}let n=r-1,o=r,a=i[n].time,s=i[o].time;if(s===a)return{index0:n,index1:o,t:.5};let l=J0(s-a),c={...i[n].ease,control2:i[o].ease.control2},d=oy(c,l,J0(J0(t-a)/l));return{index0:n,index1:o,t:d}}function sy(i){return[...i].sort((t,e)=>t.time-e.time)}var J0,rP=xe(()=>{tP();J0=Math.fround});function jk(i){if(i?.length!==2)return;let t=`${i[0]}.${i[1]}`;return iP.includes(t)?t:void 0}function oP(i){return i.slice(0,i.indexOf("."))}function aP(i){return Cl.indexOf(i.slice(-1))}function Hk(i){return{easing:i?.type,control1:Bi(i?.cubicControls?.control1,[0,0]),control2:Bi(i?.cubicControls?.control2,[1,1]),...i?.springParameters}}function Wk(i){let t=i?.cubicControls;return{...i,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...i?.springParameters?{springParameters:{...i.springParameters}}:{}}}function qk(i,t){let{index0:e,index1:r,t:n}=ay(i.sampled,t),o=i.sampled[e].value,a=i.sampled[r].value;return o+(a-o)*n}function Xk(i){let t=i.elements,e=[0,4,8].map(o=>new Fn.Vector3(t[o],t[o+1],t[o+2])),r=e[0].lengthSq(),n=1e-9*Math.max(1,r);return Math.abs(e[1].lengthSq()-r)<n&&Math.abs(e[2].lengthSq()-r)<n&&Math.abs(e[0].dot(e[1]))<n&&Math.abs(e[0].dot(e[2]))<n&&Math.abs(e[1].dot(e[2]))<n}function nP(i,t,e){let r=oP(i);if(r==="position"){let o=aP(i);return Cl.flatMap((a,s)=>Math.abs(t.elements[s*4+o])>1e-9?[`position.${a}`]:[])}return(e?[r]:["rotation","scale"]).flatMap(o=>Cl.map(a=>`${o}.${a}`))}function Yk(i,t){let[e,r,n]=i,o=[[e,r,n],[e+180,180-r,n+180]],a=[e,r,n],s=1/0;for(let l of o){let c=l.map((u,p)=>u+360*Math.round((t[p]-u)/360)),d=c.reduce((u,p,h)=>u+Math.abs(p-t[h]),0);d<s-1e-9&&(a=c,s=d)}return a}function Kk(i,t,e){if(i==="rotation"){let r=((t-e)%360+540)%360-180;return Math.abs(r)<1e-6}return Math.abs(t-e)<1e-9*Math.max(1,Math.abs(t),Math.abs(e))}function sP(i,t,e,r){let n=new Map;for(let{id:f,data:m}of i.unproxy()){if(m.isPlaceholder)continue;let y=jk(m.path);if(!y){if(Lp.includes(m.path?.[0]))return;continue}if(typeof m.value!="number"||!Number.isFinite(m.value))return;let g=n.get(y)??{keys:[],sampled:[]};g.keys.push({id:f,time:m.time,value:m.value,keyframe:m}),n.set(y,g)}if(n.size===0)return;for(let f of n.values())f.keys.sort((m,y)=>m.time-y.time),f.sampled=sy(f.keys.map(m=>({time:m.time,ease:Hk(m.keyframe.easing),value:m.value})));let o=(f,m)=>{let y=n.get(f);return y?qk(y,m):e[oP(f)][aP(f)]},a=new Fn.Quaternion,s=new Fn.Euler,l=new Fn.Matrix4,c=new Fn.Vector3,d=new Fn.Vector3,u=f=>{let m={};for(let y of Lp)m[y]=Cl.map((g,v)=>o(iP[Lp.indexOf(y)*3+v],f));return m},p=f=>{let m=u(f);return s.set(m.rotation[0]*Fn.MathUtils.DEG2RAD,m.rotation[1]*Fn.MathUtils.DEG2RAD,m.rotation[2]*Fn.MathUtils.DEG2RAD),l.compose(c.fromArray(m.position),a.setFromEuler(s),d.fromArray(m.scale)).premultiply(t),{pose:m,out:Bp(l)}},h=Xk(t);for(let f of Lp){let m=Cl.map(S=>`${f}.${S}`),y=S=>{let x=new Set;for(let A of nP(S,t,h))for(let w of n.get(A)?.keys??[])x.add(w.time);return[...x].sort((A,w)=>A-w)},g=[...new Set(m.flatMap(S=>y(S)))].sort((S,x)=>S-x),v=new Map,b;for(let S of g){let{pose:x,out:A}=p(S),w=[...A[f]];if(f==="rotation"){let C=b?b.out.map((T,M)=>T+x.rotation[M]-b.in[M]):x.rotation;w=Yk(w,C),b={in:x.rotation,out:w}}v.set(S,w)}m.forEach((S,x)=>{let A=n.get(S)?.keys??[],w=y(S),C=new Set(w);if(!(A.length===0&&w.every(T=>Kk(f,v.get(T)[x],r[f][x])))){for(let T of A)C.has(T.time)||i.delete(T.id);for(let T of w){let M=v.get(T)[x],D=A.find(E=>E.time===T);if(D){let E=i.data(D.id);E&&(E.value=M);continue}let I=nP(S,t,h).sort((E,B)=>Number(B===S)-Number(E===S)).map(E=>n.get(E)?.keys.find(B=>B.time===T)).find(E=>E!==void 0),_=Fn.MathUtils.generateUUID();i.insertBefore(null,[{id:_,data:{id:_,time:T,path:[f,Cl[x]],value:M,easing:Wk(I.keyframe.easing),index:fo.rowOrder([f])}}])}}})}}var Fn,Lp,Cl,iP,lP=xe(()=>{"use strict";Fn=require("three");Km();rP();Np();Lp=["position","rotation","scale"],Cl=["x","y","z"],iP=Lp.flatMap(i=>Cl.map(t=>`${i}.${t}`))});var bP={};DC(bP,{updateAllMaterials:()=>$0,updateDocumentSchema:()=>EF,updateLibSchema:()=>CF,updateMaterialSchema:()=>aF,updateObjectStateRec:()=>Xo,updateObjectsSchema:()=>yP,updateTextValues:()=>iF});function cP(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function Qk(i){i.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 hP(i){let t=i.geometry;t!==void 0&&Zk.has(t.type)&&t.extrusionVersion===void 0&&(t.extrusionVersion=1)}function fP(i){if(i.type!=="Empty")return;let t=ar(i.animations);if(!Array.isArray(t))return;let e=t.map(YT);e.some((r,n)=>r!==t[n])&&(i.animations=e)}function Jk(i){Array.isArray(ar(i.events))&&i.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),(t.type==="MouseDown"||t.type==="MouseUp"||t.type==="MousePress")&&(t.mode=t.mode||"Object")})}function eF(i){i.rotation=i.rotation.slice(0,3).map(t=>t*El)}function dP(i,t){let[e,r,n]=i,o=Math.cos(e),a=Math.sin(e),s=Math.cos(r),l=Math.sin(r),c=Math.cos(n),d=Math.sin(n),u=[s*c,o*d+a*c*l,a*d-o*c*l],p=Math.hypot(t[0],t[1],t[2])||1;return Math.abs((u[0]*t[0]+u[1]*t[1]+u[2]*t[2])/p)}function tF(i,t){let e=Array.isArray(t)&&t.length>=3&&t.every(o=>typeof o=="number"&&Number.isFinite(o))?t:[0,1,0],r=dP(i,e),n=dP(i.map(o=>o*$k),e);return Math.abs(r-n)<1e-6?i.some(o=>Math.abs(o)>Math.PI):n<r}function rF(i){let t=i.rotation.slice(0,3);if(tF(t,i.up)){i.rotation=t;return}i.rotation=t.map(e=>e*El)}function mP(i){eF(i),i.type==="Page"&&rF(i.camera),i.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(r=>r*El))});let t=i.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*El),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*El),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=El,t.extrusion.twist*=El),i.type==="Mesh"&&i.geometry.type==="TextGeometry"&&(i.geometry.text={textValue:i.geometry.text}),Array.isArray(ar(i.events))&&i.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 nF(i){i.shared.variables=Mr({},ve.prototype)}function iF(i){i.scene.objects.traverse((t,e)=>{})}function oF(i){let t=ar(i.shared.variables);i.shared.variables=Mr(Object.entries(t??{}).map(([e,r],n)=>({fi:n,id:e,data:r})),oe.prototype)}function aF(i){let t=i.schema??104;t!==135&&(t<130&&(rS(i.asset),i.schema=130),t<135&&(nS(i.asset),i.schema=135))}function Xo(i,t){t(i.data);for(let e of i.children)Xo(e,t)}function yP(i){let t=i.schema??104;t!==135&&(t<105&&(Xo(i.asset,mP),i.schema=105),t<118&&(Xo(i.asset,gP),i.schema=118),t<121&&(Xo(i.asset,tS),i.schema=121),t<130&&(Xo(i.asset,e=>uP(e,rS)),i.schema=130),t<132&&(Xo(i.asset,hP),i.schema=132),t<133&&(Xo(i.asset,e=>vP(e,()=>{})),i.schema=133),t<134&&(Xo(i.asset,fP),i.schema=134),t<135&&(Xo(i.asset,e=>uP(e,nS)),i.schema=135))}function $0(i,t){Ho(i,t),jo(i,t),Object.values(i.shared.lib.materials).forEach(e=>t(e.asset))}function rS(i){i.layers===void 0&&Object.assign(i,sr.defaultTwoLayerData("phong"))}function nS(i){let t=hl(i),e=sr.withRepairedLayers(t);e!==t&&(i.layers=e.layers)}function uP(i,t){"materials"in i?i.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&t(e)}):"material"in i&&i.material!==void 0&&typeof i.material!="string"&&t(i.material)}function sF(i){i.shared.particles=Mr({},ve.prototype),i.shared.lib&&(i.shared.lib.particles=ho.defaultData().particles)}function lF(i){i.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 cF(i){i.scene.objects.traverse((t,e)=>{e.type==="Page"&&(e.postprocessing.depthOfField.focusDistance=100,e.postprocessing.depthOfField.focalLength=20,e.postprocessing.depthOfField.bokehScale=5)})}function dF(i){i.scene.objects.traverse((t,e)=>{Array.isArray(ar(e.events))!==!1&&e.events?.forEach(r=>{let n=r.runMode;r.type==="MouseDown"||r.type==="MouseUp"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="Collision"||r.type==="Trigger"?r.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=n??"Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode=n==="Toggle"?"Toggle":"Normal")}):r.type==="MouseHover"||r.type==="MousePress"||r.type==="KeyPress"?r.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):r.type==="GameControl"?(delete r.actions,Object.keys(r.gameActions).forEach(a=>{r.gameActions[a]?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),s.type==="Animation"&&"runMode"in s&&(s.runMode="Normal")})})):r.type==="DragDrop"?(delete r.actions,r.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),r.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):r.type==="Resize"?(delete r.actions,r.breakpoints?.forEach(o=>{o.actions?.forEach(a=>{(a.type==="Transition"||a.type==="Animation"&&"runMode"in a||a.type==="SwitchCamera")&&(a.runMode="Toggle")})})):r.type==="Start"?r.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):r.type==="VariableChange"||r.type==="Scroll"?r.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):r.type==="Conditional"&&(delete r.actions,r.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}),r.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}function uF(i){i.shared.userAPIs=Mr({},ve.prototype),i.shared.userWebhooks=Mr({},ve.prototype),i.shared.lib&&(i.shared.lib.userAPIs=ho.defaultData().userAPIs,i.shared.lib.userWebhooks=ho.defaultData().userWebhooks)}function pF(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=Ri.defaultData.settings.videoStatic)}function gP(i){i.timelineAnimations=Mr({},ve.prototype)}function hF(i){let t=[];return i?(i.forEach((e,r)=>{let{path:n,keyframes:o}=e.data,a=n[0]==="material"?e.id:void 0;if(!o?.length){t.push(fo.placeholderKeyframe(e.id,n,{layerId:a,index:r}));return}o.forEach(({id:s,data:l})=>{t.push({id:s,data:{...l,path:n,layerId:a,index:r}})})}),t.sort((e,r)=>e.data.time-r.data.time),new oe(...t.map((e,r)=>({...e,fi:r})))):new oe}function fF(i){let t=i.shared,e=t.timelineAnimations;if(!e)return;let r=i.scene.objects,n=r.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,a]of Object.entries(e)){let s=Mr({},ve.prototype),l=0,c=Boolean(a.loop);for(let[h,f]of Object.entries(a.mapping??{})){let y=r.data(h)?.timelineAnimations?.[f];!y||(l=Math.max(l,y.to??0),c=c||Boolean(y.loop),s[h]={id:h,keyframes:hF(y.properties?.unproxy())})}let d=a.page??n,u=d?r.data(d):void 0;if(!u||u.type!=="Page")continue;let p=u.timelines??(u.timelines=Mr({},ve.prototype));p[o]={id:o,name:a.name,duration:l||5,...c?{loop:c}:{},objectTimelines:s}}delete t.timelineAnimations,r.traverse((o,a)=>{delete a.timelineAnimations})}function mF(i){i.scene.objects.traverse((t,e)=>{let r=e.states;if(!r)return;let n=e.timelineAnimations,o=[];r.forEach((a,s)=>{(a.isAnimation||n?.[s])&&o.push(s)}),o.forEach(a=>r.delete(a))})}function gF(i){for(let{id:t,data:e}of[...i.unproxy()]){let r=e.path?.[0];if(!r||!yF.includes(r))continue;let n=eS(e.value);if(!n.length)continue;let o=i.data(t);if(!o)continue;let a=e.value,[s,...l]=n;for(let c of l){let d=An.MathUtils.generateUUID();i.insertBefore(null,[{id:d,data:{...e,id:d,path:[r,c],value:a[c],easing:vF(e.easing)}}])}o.path=[r,s],o.value=a[s]}}function eS(i){return i===null||typeof i!="object"?[]:jc.filter(t=>t in i)}function vF(i){let t=i?.cubicControls;return{...i,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...i?.springParameters?{springParameters:{...i.springParameters}}:{}}}function bF(i,t){return Math.abs(i[0]-t[0])<1e-6&&Math.abs(i[1]-t[1])<1e-6}function xF(i){let t=[];for(let e of fo.groupKeyframes(i)){let r=new Set(e.keyframes.flatMap(o=>eS(o.data.value))),n=r.size?[...r].map(o=>e.keyframes.filter(a=>eS(a.data.value).includes(o))):[e.keyframes];for(let o of n){let a=[...o].sort((s,l)=>s.data.time-l.data.time);for(let s=0;s+1<a.length;s++)t.push({left:a[s],right:a[s+1]})}}return t}function SF(i){let t=xF([...i.unproxy()]),e=new Map,r=new Set;for(let{left:o,right:a}of t){let s=o.data.easing?.type,c=(s===void 0?void 0:fo.presetHandles(s))?.control2??(s===5?Bi(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!c)continue;let d=e.get(a.id);d?bF(d,c)||r.add(a.id):e.set(a.id,c)}let n=new Map;for(let{id:o,data:a}of i.unproxy()){let s=a.easing?.type,l=s===void 0?void 0:fo.presetHandles(s);l&&n.set(o,l.control1)}for(let{left:o,right:a}of t)r.has(a.id)&&n.delete(o.id);for(let[o,a]of n){let s=i.data(o);!s?.easing||(s.easing.cubicControls={control1:a,control2:Bi(s.easing.cubicControls?.control2,[1,1])},s.easing.type=5)}for(let{left:o,right:a}of t){if(!n.has(o.id))continue;let s=i.data(a.id),l=e.get(a.id);!s?.easing||!l||(s.easing.cubicControls={control1:Bi(s.easing.cubicControls?.control1,[0,0]),control2:l})}}function pP(i,t){i.scene.objects.traverse((e,r)=>{let n=r;if(!(n.type!=="Page"||!n.timelines))for(let o of Object.values(n.timelines))for(let a of Object.values(o.objectTimelines??{}))t(a.keyframes)})}function tS(i){i.pivot=[0,0,0],i.pivotRotation=[0,0,0]}function AF(i){return i.every((e,r)=>Math.abs(e-(r%5===0?1:0))<1e-6)}function wF(i){return t=>i.get(t)?.data?.value}function vP(i,t,e=[]){let r=["position","rotation","scale","shear"];function n(p,h,f){return p?.map(m=>typeof m=="string"?t(m)??f:m)??[...h]}function o(p,h){if(!p||AF(p))return;let f=new An.Matrix4().fromArray(p).multiply(new An.Matrix4().compose(new An.Vector3().fromArray(h.position),new An.Quaternion().setFromEuler(new An.Euler(h.rotation[0]*An.MathUtils.DEG2RAD,h.rotation[1]*An.MathUtils.DEG2RAD,h.rotation[2]*An.MathUtils.DEG2RAD)),new An.Vector3().fromArray(h.scale)));return Bp(f)}function a(p,h){return p.length===h.length&&p.every((f,m)=>f===h[m])}i.shear=tn.zero;let s=i,l=s.hiddenMatrix;l!==void 0&&delete s.hiddenMatrix;let c={position:n(s.position,[0,0,0],0),rotation:n(s.rotation,[0,0,0],0),scale:n(s.scale,[1,1,1],1)},d=o(l,c);if(d&&Object.assign(s,d),d){let p=new An.Matrix4().fromArray(l);for(let h of e)sP(h,p,c,d)}let u=d??{...c,shear:[...tn.zero]};s.states?.forEach(p=>{let h=p.hiddenMatrix;if(h!==void 0&&delete p.hiddenMatrix,!(h!==void 0||p.position!=null||p.rotation!=null||p.scale!=null))return;let m={position:n(p.position,c.position,0),rotation:n(p.rotation,c.rotation,0),scale:n(p.scale,c.scale,1)},y=o(h??l,m);if(!d&&!y)return;let g=y??{...m,shear:[...tn.zero]};for(let v of r)(p[v]!=null||!a(g[v],u[v]))&&(p[v]=g[v])})}function CF(i){}function EF(i){let t=i.schema??0;if(t!==135){if(t>135){console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads ${135}). Update @splinetool/runtime to the latest version to load it correctly.`);return}console.warn("updating from ",t,"to ",135),UT(i,t),t<100&&(i.scene.publish.joystickSizeAndXYOffset===void 0&&(i.scene.publish.joystickSizeAndXYOffset=Ri.defaultData.joystickSizeAndXYOffset),i.schema=100),t<101&&(Ho(i,cP),jo(i,cP),i.schema=101),t<102&&(Qk(i),i.schema=102),t<104&&(i.shared.catelogs=new ve,i.shared.lib=ho.defaultData(),i.schema=104),t<105&&(nF(i),i.scene.objects.traverse((e,r)=>{mP(r)}),i.schema=105);for(let e of Object.values(i.shared.lib.components))yP(e);if(t<106&&(oF(i),i.schema=106),t<107&&(i.shared.lib.variables=ho.defaultData().variables,i.schema=107),t<109&&(sF(i),i.schema=109),t<110&&(lF(i),i.schema=110),t<111&&(i.scene.objects.traverse((e,r)=>{Jk(r)}),i.schema=111),t<112&&(cF(i),i.schema=112),t<113&&(dF(i),i.schema=113),t<114&&(i.scene.publish.settings.web.imageQuality===void 0&&(i.scene.publish.settings.web.imageQuality=70),i.schema=114),t<115&&(uF(i),i.schema=115),t<116&&(pF(i),i.schema=116),t<117&&(i.scene.publish.settings.web.pixelRatioMobile===void 0&&(i.scene.publish.settings.web.pixelRatioMobile=0),i.scene.publish.settings.web.pixelRatioDesktop===void 0&&(i.scene.publish.settings.web.pixelRatioDesktop=0),i.schema=117),t<118&&(i.shared.timelineAnimations=Mr({},ve.prototype),i.scene.objects.traverse((e,r)=>{gP(r)}),i.schema=118),t<119&&(i.scene.publish.settings.videoStatic.format=bs.defaultData.scene.publish.settings.videoStatic.format,i.scene.publish.settings.videoStatic.imageFormat=bs.defaultData.scene.publish.settings.videoStatic.imageFormat,i.schema=119),t<120&&(i.scene.publish.settings.image.colorSpace="display-p3",i.scene.publish.settings.videoStatic.colorSpace="display-p3",i.schema=120),t<121&&(i.scene.objects.traverse((e,r)=>{tS(r),r.type==="Page"&&r.camera!==void 0&&tS(r.camera)}),i.schema=121),t<122&&(delete i.scene.publish.settings.video,i.scene.publish.orbitControls.rotationSpeed=bs.defaultData.scene.publish.orbitControls.rotationSpeed,i.schema=122),t<123&&(i.scene.objects.traverse((e,r)=>{r.type==="Page"&&r.sky===void 0&&(r.sky=Go.defaultData)}),i.schema=123),t<124&&(t>=123&&i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(typeof n.exposure=="number"&&(n.exposure=Math.round(n.exposure/5e-4*1e4)/1e4),n.lighting===void 0&&(n.lighting=Go.defaultData.lighting))}),i.schema=124),t<125&&(i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingIntensity===void 0&&(n.lightingIntensity=Go.defaultData.lightingIntensity)}),i.schema=125),t<126&&(i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(n.mode===void 0&&(n.mode="physical"),n.hdri===void 0?n.hdri={...Go.defaultData.hdri}:(n.hdri.blur===void 0&&(n.hdri.blur=Go.defaultData.hdri.blur),Array.isArray(n.hdri.rotation)&&(n.hdri.rotation=n.hdri.rotation[1]??0)))}),i.schema=126),t<127&&(i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n?.hdri!==void 0&&n.hdri.showBackground===void 0&&(n.hdri.showBackground=!0)}),i.schema=127),t<128&&(i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingQuality===void 0&&(n.lightingQuality="full")}),i.schema=128),t<129&&(i.scene.objects.traverse((e,r)=>{if(r.type==="Page"){r.camera===void 0&&(r.camera=po.defaultData.camera);let n=r.camera;n.far=1e5,n.perspective?n.perspective.near=70:n.perspective={near:70,fov:45,zoom:1}}}),i.schema=129),t<130&&($0(i,rS),i.schema=130),t<131&&(mF(i),fF(i),pP(i,gF),pP(i,SF),i.schema=131),t<132&&(i.scene.objects.traverse((e,r)=>hP(r)),i.schema=132),t<133){let e=wF(i.shared.variables),r=new Map;i.scene.objects.traverse((n,o)=>{let a=o;if(!(a.type!=="Page"||!a.timelines))for(let s of Object.values(a.timelines))for(let[l,c]of Object.entries(s.objectTimelines??{})){let d=r.get(l)??[];d.push(c.keyframes),r.set(l,d)}}),i.scene.objects.traverse((n,o)=>vP(o,e,r.get(n))),i.schema=133}t<134&&(i.scene.objects.traverse((e,r)=>fP(r)),i.schema=134),t<135&&($0(i,nS),i.schema=135)}}var An,Zk,El,$k,yF,ly=xe(()=>{"use strict";An=require("three");W0();yt();Km();zT();Op();Cp();_n();gr();Ym();Mp();Fm();Np();Q0();lP();Zk=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]);El=180/Math.PI,$k=Math.PI/180;yF=["position","rotation","scale","shape size"]});var xP,cy,iS,SP,dy,Da,_p,Kc,uy,oS,Qc,aS,sS,AP,kp,lS,Ra,py,wP=xe(()=>{"use strict";_n();yt();gr();(t=>{function i(e){return!0}t.is=i})(xP||(xP={}));(r=>{r.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(n,o){return{position:o?.position??n.position,rotation:o?.rotation??n.rotation,scale:o?.scale??n.scale,shear:o?.shear??n.shear}}r.merge=t;function e(n,o){return Xf({position:hi.isEqual(n.position,o.position)?void 0:o.position,rotation:n.rotation===o.rotation?void 0:o.rotation,scale:hi.isEqual(n.scale,o.scale)?void 0:o.scale,shear:n.shear&&o.shear&&hi.isEqual(n.shear,o.shear)?void 0:o.shear})}r.diff=e})(cy||(cy={}));(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(iS||(iS={}));(t=>t.defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8})(SP||(SP={}));(t=>t.defaultData={opacity:1,fill:{color:Ve.fromHexAndA(Ir,1),enabled:!0},stroke:{color:Ve.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:Ve.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Ve.from0to1([0,0,0,1]),enabled:!1,spread:0}})(dy||(dy={}));(o=>{function i(a,s){return{name:s}}o.newEmpty=i;function t(a,s){if(s===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let d of c)d in l&&d in s&&s[d]!==void 0&&Object.assign(l,{[d]:s[d]});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,cy.merge(l,s)),l=t(l,s),l=e(l,s),l}o.patch=r;function n(a,s){let l,c=[];for(let[d,u]of Object.entries(s))d!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},c.push(l)),l.props[d]=u);return c}o.toOps=n})(Da||(Da={}));(t=>t.defaultData={...cy.defaultData,...iS.defaultData,states:new oe,events:new oe,visible:!0,raycastLock:!1})(_p||(_p={}));(t=>t.defaultData={..._p.defaultData,...dy.defaultData})(Kc||(Kc={}));(t=>t.defaultData={cornerRadius:[0,0,0,0]})(uy||(uy={}));(t=>t.defaultData={...Kc.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(oS||(oS={}));(t=>t.defaultData={...Kc.defaultData,...uy.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(Qc||(Qc={}));(t=>t.defaultData={...Kc.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"})(aS||(aS={}));(t=>t.defaultData={...Kc.defaultData,type:"path2d",path:"",name:"Path"})(sS||(sS={}));(t=>{function i(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=i})(AP||(AP={}));(t=>t.defaultData={..._p.defaultData,name:"Group",type:"group2d"})(kp||(kp={}));(t=>t.defaultData=()=>({..._p.defaultData,...uy.defaultData,...dy.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Ve.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Ve.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(lS||(lS={}));(o=>{function i(a){switch(a){case"rectangle2d":return{...Qc.defaultData};case"ellipse2d":return{...oS.defaultData};case"text2d":return{...aS.defaultData};case"vector2d":return{...Qc.defaultData};case"path2d":return{...sS.defaultData};case"frame2d":return{...lS.defaultData()};case"group2d":return{...kp.defaultData}}}o.defaultData=i;function t(a){return"width"in a&&"height"in a?[typeof a.width=="number"?a.width*.5:0,typeof a.height=="number"?a.height*.5:0]:[0,0]}o.getPivot=t;function e(a){return a.type==="rectangle2d"||a.type==="ellipse2d"||a.type==="text2d"||a.type==="frame2d"}o.isResizeable=e;function r(a){return a.type==="frame2d"&&a.autoLayout!==void 0}o.isAutoLayoutable=r;function n(a){return a.type==="rectangle2d"||a.type==="frame2d"}o.hasCorners=n})(Ra||(Ra={}));(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new Rt},e.emptyData=function(){return{type:"scene2d",objects:new Rt}}))(py||(py={}))});var K0=xe(()=>{"use strict";dT();pT();v0();x0();W0();u0();P0();M0();B0();Fm();ly();j0();km();Dm();S0();Cp();T0();L0();_n();Op();Mp();Q0();Wm();R0();Ym();qm();gT();D0();Qm();Um();A0();w0();wP()});var jO=Hf((b1,zO)=>{(function(i,t){typeof b1=="object"?zO.exports=t():typeof define=="function"&&define.amd?define(t):i.Alea=t()})(b1,function(){"use strict";return i.importState=function(e){var r=new i;return r.importState(e),r},i;function i(){return function(e){var r=0,n=0,o=0,a=1;e.length==0&&(e=[+new Date]);var s=t();r=s(" "),n=s(" "),o=s(" ");for(var l=0;l<e.length;l++)r-=s(e[l]),r<0&&(r+=1),n-=s(e[l]),n<0&&(n+=1),o-=s(e[l]),o<0&&(o+=1);s=null;var c=function(){var d=2091639*r+a*23283064365386963e-26;return r=n,n=o,o=d-(a=d|0)};return c.next=c,c.uint32=function(){return c()*4294967296},c.fract53=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.version="Alea 0.9",c.args=e,c.exportState=function(){return[r,n,o,a]},c.importState=function(d){r=+d[0]||0,n=+d[1]||0,o=+d[2]||0,a=+d[3]||0},c}(Array.prototype.slice.call(arguments))}function t(){var e=4022871197,r=function(n){n=n.toString();for(var o=0;o<n.length;o++){e+=n.charCodeAt(o);var a=.02519603282416938*e;e=a>>>0,a-=e,a*=e,e=a>>>0,a-=e,e+=a*4294967296}return(e>>>0)*23283064365386963e-26};return r.version="Mash 0.9",r}})});var FI=Hf((Voe,kI)=>{"use strict";function nU(i,t){function e(){this.constructor=i}e.prototype=t.prototype,i.prototype=new e}function ql(i,t,e,r){this.message=i,this.expected=t,this.found=e,this.location=r,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ql)}nU(ql,Error);ql.buildMessage=function(i,t){var e={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var d="",u;for(u=0;u<c.parts.length;u++)d+=c.parts[u]instanceof Array?o(c.parts[u][0])+"-"+o(c.parts[u][1]):o(c.parts[u]);return"["+(c.inverted?"^":"")+d+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function n(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+r(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+r(d)})}function o(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+r(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+r(d)})}function a(c){return e[c.type](c)}function s(c){var d=new Array(c.length),u,p;for(u=0;u<c.length;u++)d[u]=a(c[u]);if(d.sort(),d.length>0){for(u=1,p=1;u<d.length;u++)d[u-1]!==d[u]&&(d[p]=d[u],p++);d.length=p}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}function l(c){return c?'"'+n(c)+'"':"end of input"}return"Expected "+s(i)+" but "+l(t)+" found."};function iU(i,t){t=t!==void 0?t:{};var e={},r={svg_path:cn},n=cn,o=function(P){if(!P)return[];for(var O=[],V=0;V<P.length;V++)O=O.concat.apply(O,P[V]);var N=O[0];return N&&N.code=="m"&&(delete N.relative,N.code="M"),O},a=function(P,O){return r_(P,O)},s=/^[Mm]/,l=nt(["M","m"],!1,!1),c=function(P,O,V){var N=wc(P,[O]);return V&&(N=N.concat(wc(P=="M"?"L":"l",V[1]))),N},d=/^[Zz]/,u=nt(["Z","z"],!1,!1),p=function(){return wc("Z")},h=/^[Ll]/,f=nt(["L","l"],!1,!1),m=function(P,O){return wc(P,O)},y=/^[Hh]/,g=nt(["H","h"],!1,!1),v=function(P,O){return wc(P,O.map(function(V){return{x:V}}))},b=/^[Vv]/,S=nt(["V","v"],!1,!1),x=function(P,O){return wc(P,O.map(function(V){return{y:V}}))},A=/^[Cc]/,w=nt(["C","c"],!1,!1),C=function(P,O,V){return{x1:P.x,y1:P.y,x2:O.x,y2:O.y,x:V.x,y:V.y}},T=/^[Ss]/,M=nt(["S","s"],!1,!1),D=function(P,O){return{x2:P.x,y2:P.y,x:O.x,y:O.y}},I=/^[Qq]/,_=nt(["Q","q"],!1,!1),E=function(P,O){return{x1:P.x,y1:P.y,x:O.x,y:O.y}},B=/^[Tt]/,L=nt(["T","t"],!1,!1),k=/^[Aa]/,F=nt(["A","a"],!1,!1),W=function(P,O,V,N,j,ae){return{rx:P,ry:O,xAxisRotation:V,largeArc:N,sweep:j,x:ae.x,y:ae.y}},U=function(P,O){return{x:P,y:O}},G=function(P){return P*1},q=function(P){return P.join("")*1},X=/^[01]/,Y=nt(["0","1"],!1,!1),Q=function(P){return P=="1"},te=function(){return""},ue=",",le=wt(",",!1),ce=function(P){return P.join("")},de=".",ge=wt(".",!1),Se=/^[eE]/,ye=nt(["e","E"],!1,!1),Z=/^[+\-]/,pe=nt(["+","-"],!1,!1),re=/^[0-9]/,Ae=nt([["0","9"]],!1,!1),Ee=function(P){return P.join("")},se=/^[ \t\n\r]/,be=nt([" "," ",`
1
+ "use strict";var n_=Object.create;var dp=Object.defineProperty;var i_=Object.getOwnPropertyDescriptor;var o_=Object.getOwnPropertyNames;var a_=Object.getPrototypeOf,s_=Object.prototype.hasOwnProperty;var l_=(i,t,e)=>t in i?dp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var xe=(i,t)=>()=>(i&&(t=i(i=0)),t);var Hf=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),DC=(i,t)=>{for(var e in t)dp(i,e,{get:t[e],enumerable:!0})},RC=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of o_(t))!s_.call(i,n)&&n!==e&&dp(i,n,{get:()=>t[n],enumerable:!(r=i_(t,n))||r.enumerable});return i};var Ec=(i,t,e)=>(e=i!=null?n_(a_(i)):{},RC(t||!i||!i.__esModule?dp(e,"default",{value:i,enumerable:!0}):e,i)),c_=i=>RC(dp({},"__esModule",{value:!0}),i);var bn=(i,t,e)=>(l_(i,typeof t!="symbol"?t+"":t,e),e);var BC=xe(()=>{"use strict"});function Wf(i){return Array.isArray(i)?i:[i]}function ll(i,t){let e=0;for(;e<i.length&&e<t.length;){if(i[e]<t[e])return-1;if(i[e]>t[e])return 1;e+=1}return e!==t.length?-1:e!==i.length?1:0}var NC=xe(()=>{"use strict"});function Mr(i,t){return Object.setPrototypeOf(i,t),i}function qf(i){let t={...i};return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}function No(i,t,e){if(i===void 0?t===void 0?(i=0,t=10):i=t-10:t===void 0&&(t=i+10),i>t){let o=i;i=t,t=o}let r=[],n=1/(e+1);for(let o=0;o<e;o++){let a=i+(t-i)*(o+.75+Math.random()*.5)*n;r.push(a)}return r}function Qn(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function LC(){return typeof process<"u"}var _C=xe(()=>{"use strict"});function up(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let t=Object.getOwnPropertyNames(i);for(let e of t){let r=i[e];r&&typeof r=="object"&&up(r)}return Object.freeze(i)}function Xf(i){for(let t of Object.keys(i))i[t]===void 0&&delete i[t];return i}var kC=xe(()=>{"use strict"});var gr=xe(()=>{BC();NC();_C();kC()});var Yf,cl,pp,Kf=xe(()=>{"use strict";Yf=class{},cl=class extends Yf{constructor(e){super();this.id=e}},pp=class extends Yf{constructor(e){super();this.data=e}}});var FC=xe(()=>{"use strict"});var ve,hp=xe(()=>{"use strict";ve=class{modifyById(t,e){let r=this;if(r[t]===void 0)throw new Error("not expected");{let o={...r,[t]:e};return Object.setPrototypeOf(o,ve.prototype),o}}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],n;r===void 0?n={type:2,id:t.id}:n={type:1,id:t.id,data:r};let{id:o,data:a}=t,s={...e,[o]:a};return Object.setPrototypeOf(s,ve.prototype),{data:s,actual:t,reverse:n}}else if(t.type===2){let{id:r}=t,n=e[r];if(n===void 0)return null;{let o={...e};return Object.setPrototypeOf(o,ve.prototype),delete o[r],{data:o,actual:t,reverse:{type:1,id:r,data:n}}}}return null}}});var Tc,Qf=xe(()=>{"use strict";Tc=class extends Error{}});function VC(i,t){for(let e of i)t(e.id,e.data)!==!0&&VC(e.children,t)}function GC(i,t){if(t(i.id,i.data)!==!0)for(let e of i.children)GC(e,t)}var Rt,ds=xe(()=>{"use strict";gr();Qf();gr();Rt=class extends Array{constructor(...e){super(...e);bn(this,"partialObjectCaches");bn(this,"objCaches");bn(this,"parentCaches");Object.setPrototypeOf(this,Rt.prototype)}deepFreeze(){let e=0;for(;e<this.length;)up(this[e]),e++}fillCaches0(e,r){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,r);for(let n of e.children)this.fillCaches0(n,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 n=this.parent(e);if(n===r)return!0;e=n}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 n=this.parent(e);if(n===r)return!0;e=n}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let r=this.get(e);r!==void 0&&this.partialObjectCaches.set(e,r)}get(e){if(this.partialObjectCaches!==void 0){let r=this.partialObjectCaches.get(e);if(r!==void 0)return r}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 n=this.get(e);n&&GC(n,r)}}traverse(e){VC(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 o=this.parent(e),a=this.childrenArray(o),s=a.findIndex(u=>u.id===e);if(s<0)throw new Error("not expected");let l=a[s];a=[...a],a[s]={...l,data:r};let c=new Map;return c.set(e,a[s]),this.modifyArrayBy(o,a,c)}}modifyArrayBy(e,r,n=void 0){let o=e,a=r;for(;o!==null;){let l=a,c=o;if(o=this.parent(o),o===void 0)throw new Error;a=this.childrenArray(o);let d=a.findIndex(u=>u.id===c);if(d<0)throw new Error;a=[...a],a[d]={...a[d],children:l},n&&n.set(c,a[d])}Object.setPrototypeOf(a,Rt.prototype);let s=a;if(n&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[l,c]of n)s.objCaches.set(l,c);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}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 n of r)if(this.checkDuplicatedIdRec(n))return!0;return!1}addOp(e){let{parent:r,fi:n,id:o,data:a,children:s}=e;if(r!==null&&this.get(r)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=r,c=this.childrenArray(l),d={fi:n,id:o,data:a,children:s};return c=[...c,d],c.sort((p,h)=>p.fi-h.fi),e.localIndex=c.indexOf(d),{data:this.modifyArrayBy(l,c),actual:e,reverse:{type:8,id:o}}}}deleteOp(e){let{id:r}=e;if(this.get(r)===null)return null;{let n=this.parent(r);if(n===void 0)return null;let o=this.childrenArray(n),a=o.findIndex(c=>c.id===r);e.localIndex=a,o=[...o];let s=o.splice(a,1)[0];return{data:this.modifyArrayBy(n,o),actual:e,reverse:{type:7,...s,parent:n}}}}moveOp(e){let{parent:r,fi:n,id:o}=e;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:o});if(r!==null){let h=r;for(;h!==null;){if(h===void 0)throw new Error;if(h===o)throw new Tc("cyclic tree");h=this.parent(h)}}let a=this.parent(o);if(a===void 0)return null;let s=a,l=this.childrenArray(a),c=l.findIndex(h=>h.id===o);l=[...l];let d=l.splice(c,1)[0],u=this.modifyArrayBy(a,l);a=r,l=u.childrenArray(a);let p=d.fi;return d={...d,fi:n},l=[...l,d],l.sort((h,f)=>h.fi-f.fi),e.localIndex=l.indexOf(d),u=u.modifyArrayBy(a,l),{data:u,actual:e,reverse:{type:9,parent:s,fi:p,id:o}}}previous(e,r){if(r===null){let o=this.childrenArray(e);return o.length===0?null:o[o.length-1].id}let n=null;for(let o of this.childrenArray(e)){if(o.id===r)return n;n=o.id}return null}traverseSortNext(e){let r=this.parent(e);if(r!==void 0){let n=this.childrenArray(r),o=n.findIndex(a=>a.id===e)+1;if(o<n.length)return n[o].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 n=this.childrenArray(r),o=n.findIndex(a=>a.id===e)-1;return o>=0?this.traverseSortPrevious(n[o].id):r}}getAllSorted(e){let r=[];for(let n of e){let o=this.getWithSortKey(n.id);o!==void 0&&r.push({...n,...o})}r.sort((n,o)=>ll(n.sortKey,o.sortKey));for(let n of r)delete n.sortKey;return r}getAllIdSorted(e){let r=[];for(let n of e){let o=this.getWithSortKey(n);o!==void 0&&r.push(o)}r.sort((n,o)=>ll(n.sortKey,o.sortKey));for(let n of r)delete n.sortKey;return r.map(n=>n.id)}getWithSortKey(e){let r=e,n=[],o=this.get(r),a=o;if(o!==void 0){for(;r;)n.splice(0,0,o.fi),r=this.parent(r),r!==null&&(o=this.get(r));return{...a,sortKey:n}}}insertBeforeHelper(e,r,n){return this.insertAfterHelper(e,this.previous(e,r),n)}insertAfterHelper(e,r,n){let o=this.childrenArray(e);if(r===null){if(o.length===0)return No(0,n,n);{let a=o[0].fi;return No(a-n,a,n)}}else{let a=this.get(r);if(a===void 0||this.parent(r)!==e)throw new Error("illegal args");let s=o.find(l=>l.fi>a.fi);if(s===void 0){let l=o[o.length-1].fi;return No(l,l+n,n)}else return No(a.fi,s.fi,n)}}}});var kx,us,Zf=xe(()=>{"use strict";gr();kx=null;(r=>{function i(n){kx=n}r.setPreservePrototype=i;function t(n,o){return Object.getPrototypeOf(n)===kx&&Object.setPrototypeOf(o,kx),o}r.tryPreservePrototype=t;function e(n,o){if(o.type!==0)return null;if(Array.isArray(n)||Qn(n)){let a=o.props,s={},l=Qn(n)?n.slice():[...n],c=!1;if(a)for(let d of Object.keys(a)){let u=parseInt(d);if(isNaN(u))throw new Error("wrong index");s[d]=l[u],l[u]=a[d],c=!0}return c?{data:l,actual:o,reverse:{type:0,props:s}}:null}else{let a=o.props,s={},l={...n},c=!1;if(a)for(let d of Object.keys(a)){s[d]=l[d];let u=a[d];u===void 0?delete l[d]:l[d]=u,c=!0}return c?{data:r.tryPreservePrototype(n,l),actual:o,reverse:{type:0,props:s}}:null}}r.runOp=e})(us||(us={}))});var oe,ps=xe(()=>{"use strict";gr();gr();oe=class extends Array{constructor(...e){super(...e);bn(this,"objCaches");Object.setPrototypeOf(this,oe.prototype)}deepFreeze(){let e=0;for(;e<this.length;)up(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 o=this,a=o.findIndex(c=>c.id===e);if(a<0)throw new Error("not expected");let s=o[a];return o=[...o],o[a]={...s,data:r},this.modifyArrayBy(o)}}modifyArrayBy(e){Object.setPrototypeOf(e,oe.prototype);let r=e;return LC()||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:n,data:o}=e,a=this,s={fi:r,id:n,data:o};return a=[...a,s],a.sort((c,d)=>c.fi-d.fi),e.localIndex=a.indexOf(s),{data:this.modifyArrayBy(a),actual:e,reverse:{type:5,id:n}}}deleteOp(e){let{id:r}=e,n=this,o=n.findIndex(l=>l.id===r);if(o===-1)return null;e.localIndex=o,n=[...n];let a=n.splice(o,1)[0];return{data:this.modifyArrayBy(n),actual:e,reverse:{type:4,...a}}}moveOp(e){let{fi:r,id:n}=e,o=this;o=[...o];let a=o.findIndex(d=>d.id===n);if(a===-1)return null;let s=o[a].fi,l={...o[a],fi:r};return o[a]=l,o.sort((d,u)=>d.fi-u.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(o),actual:e,reverse:{type:6,fi:s,id:n}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let n of this){if(n.id===e)return r;r=n.id}return null}insertBeforeHelper(e,r){return this.insertAfterHelper(this.previous(e),r)}insertAfterHelper(e,r){let n=this;if(e===null){if(n.length===0)return No(0,r,r);{let o=n[0].fi;return No(o-r,o,r)}}else{let o=this.get(e);if(o===void 0)throw new Error("illegal args");let a=n.find(s=>s.fi>o.fi);if(a===void 0){let s=n[n.length-1].fi;return No(s,s+r,r)}else return No(o.fi,a.fi,r)}}}});function UC(i,t){let e={cur:[],result:[],len:0};return i=fp(i,t,e)??i,[i,e.result]}function Jf(i,t){return i===null?null:(i.cur[i.len]=t,i.len+=1,i)}function $f(i){i&&(i.len-=1)}function d_(i){if(i===null)return null;i.result.push(i.cur.slice(0,i.len))}function zC(i,t,e){let r=!1,n=i.map(o=>{let a=o.id,s=t[a];if(s!==void 0&&typeof s=="string"&&(r=!0,a=s,e!==null))throw new Error("not supported");let l=fp(o.data,t,Jf(e,a));$f(e),r=r||l!==void 0,l===void 0&&(l=o.data);let c=zC(o.children,t,e);return c!==void 0?r=!0:c=o.children,{...o,id:a,data:l,children:c}});if(r)return n}function u_(i,t,e){let r=!1,n=i.map(o=>{let a=o.id,s=t[a];if(s!==void 0&&typeof s=="string"&&(r=!0,a=s,e!==null))throw new Error("not supported");let l=fp(o.data,t,Jf(e,a));return $f(e),r=r||l!==void 0,l===void 0&&(l=o.data),{...o,id:a,data:l}});if(r)return Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}function fp(i,t,e){if(i instanceof Rt){let r=zC(i,t,e);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}else{if(i instanceof oe)return u_(i,t,e);if(Array.isArray(i)){let r=!1,n=i.map((o,a)=>{let s=fp(o,t,Jf(e,a));return $f(e),r=r||s!==void 0,s===void 0&&(s=o),s});return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else if(i&&typeof i=="object"&&!Qn(i)){let r={},n=!1;for(let[o,a]of Object.entries(i))if(o!=="name"&&o!=="variableId"){let s=t[o];if(typeof s=="string"){if(e!==null)throw new Error("not supported");n=!0,o=s}let l=fp(a,t,Jf(e,o));$f(e),n=n||l!==void 0,l===void 0&&(l=a),r[o]=l}else r[o]=a;return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else if(typeof i=="string"){let r=t[i];return r!==void 0&&d_(e),r}else return}}var Fx=xe(()=>{"use strict";ds();ps();gr()});function Pc(i){return i&&typeof i=="object"&&i instanceof vt}function Vx(i,t){if(t===void 0)return;let e=!1,r=i.map(n=>{let o=n.id,a=mp(n.data,t[o]);if(e=e||a!==void 0,a===void 0&&(a=n.data),n.children){let s=Vx(n.children,t);return s!==void 0?e=!0:s=n.children,{...n,id:o,data:a,children:s}}else return{...n,id:o,data:a}});if(e)return r}function p_(i,t){if(t===void 0)return;let e=!1,r=i.map(n=>{let o=n.id,a=mp(n.data,t[o]);return e=e||a!==void 0,a===void 0&&(a=n.data),{...n,id:o,data:a}});if(e)return Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}function mp(i,t){if(!Pc(t))return t;if(i instanceof Rt){let e=Vx(i,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e}else{if(i instanceof oe)return p_(i,t);if(Array.isArray(i)){let e=!1,r=i.map((n,o)=>{let a=mp(n,t[o]);return e=e||a!==void 0,a===void 0&&(a=n),a});return e?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else{if(i instanceof vt)return Gx(i,t);if(i&&typeof i=="object"){let e={},r=!1;for(let[n,o]of Object.entries(i)){let a=mp(o,t[n]);r=r||a!==void 0,a===void 0&&(a=o),e[n]=a}return r?(Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e):void 0}}}}function Gx(i,t){if(i===void 0)return t;if(t===void 0)return i;if(!Pc(t))return t;if(!Pc(i))return Lo.apply(i,t);let e=new Set;for(let n of Object.keys(i))e.add(n);for(let n of Object.keys(t))e.add(n);let r=new vt;for(let n of e){let o=Gx(i===void 0?void 0:i[n],t===void 0?void 0:t[n]);r[n]=o}return r}var vt,Lo,yp=xe(()=>{"use strict";ds();ps();gp();gr();vt=class{unusedFunOverridesTable(t){}runOp(t){let e=[],r=this,n=0,o={};for(;n<t.path.length;){if(e.push(r),r=r===void 0?void 0:r[t.path[n]],r!==void 0&&!Pc(r))return null;n+=1}r=r?qf(r):new vt;for(let[l,c]of Object.entries(t.props)){let d=r[l];o[l]=d,c===void 0?delete r[l]:r[l]=c}for(;n>0;){if(Object.keys(r).length===0){let l=e[n-1];l&&(r=qf(l),delete r[t.path[n-1]])}else{let l=e[n-1];if(l){let c=qf(l);c[t.path[n-1]]=r,r=c}else{let c=new vt;c[t.path[n-1]]=r,r=c}}n-=1}let a=Object.setPrototypeOf(r,vt.prototype),s={...t,props:o};return{data:a,actual:t,reverse:s}}};(r=>{function i(n,o){return mp(n,o)??n}r.apply=i;function t(n,o){return Gx(n,o)}r.merge=t;function e(n,o){let a=0,s=o.path,l=n;for(;a<s.length&&l!==void 0;){if(l=jt.zoomOnce(l,s[a]),l===void 0)return o;if(!Pc(l))return;a+=1}if(l===void 0)return o;if(!!Pc(l))if(o.type===0){let c={...o.props};for(let d of Object.keys(l))delete c[d];return{...o,props:c}}else if(o.type===1||o.type===4||o.type===7){let c=Vx([o],l);return c?c[0]:o}else return o}r.filterOp=e})(Lo||(Lo={}))});var Mc,or,Ux,jC=xe(()=>{"use strict";gr();gp();hp();ds();Qf();Zf();ps();Fx();yp();(t=>{function i(e,r){let n=jt.zoom(r,e.path);if(typeof n=="object"){let o={};for(let a of Object.keys(e.props))o[a]=n[a];return{...e,props:o}}else return{...e,props:{}}}t.replaceProps=i})(Mc||(Mc={}));(s=>{function i(l,c){return{...l,path:l.path.slice(c)}}s.drop=i;function t(l,c){return e(l,c)?.data??l}s.applySimple=t;function e(l,c){let d=c.path,u=[];for(;;){let p;if(l instanceof vt&&c.type===0&&(p=l.runOp({...c,path:d.slice(u.length)}),p===null&&(p=void 0)),p===void 0&&u.length===d.length&&(l instanceof Rt||l instanceof oe||l instanceof ve?p=l.runOp(c):p=us.runOp(l,c)),p!==void 0)if(p!==null){let m=p.data;for(let y=u.length-1;y>=0;y--){let g=d[y],v=u[y];if(v instanceof Rt){if(typeof g=="number")throw new Error("illegal arg");m=v.modifyById(g,m)}else if(v instanceof oe){if(typeof g=="number")throw new Error("illegal arg");m=v.modifyById(g,m)}else if(v instanceof ve){if(typeof g=="number")throw new Error("illegal arg");m=v.modifyById(g,m)}else if(v instanceof vt){let b={...v,[g]:m};m=Object.setPrototypeOf(b,vt.prototype)}else if(typeof v=="object")if(Array.isArray(v)||Qn(v)){if(typeof g=="string"&&(g=parseInt(g),isNaN(g)))throw new Error("Invalid path");let b=m;m=Qn(v)?v.slice():[...v],m[g]=b}else m=us.tryPreservePrototype(v,{...v,[g]:m});else return null}return{data:m,actual:{...p.actual,path:d},reverse:{...p.reverse,path:d}}}else return null;let h=d[u.length],f;if(l instanceof Rt){if(typeof h=="number")throw new Error("");f=l.get(h)?.data}else if(l instanceof oe){if(typeof h=="number")throw new Error("");f=l.get(h)?.data}else l!==null&&(f=l[h]);if(f!==void 0)u.push(l),l=f;else return null}}s.apply=e;function r(l,c){for(let d=0;d<l.length&&d<c.length;d++)if(l[d]!==c[d])return!0;return!1}s.pathDisjoint=r;function n(l,c){if(l.length!==c.length)return!1;for(let d=0;d<l.length;d++)if(l[d]!==c[d])return!1;return!0}s.pathEq=n;function o(l,c){return r(l.path,c.path)}s.commutative=o;function a(l,c){return l.type===0&&c.type===0&&n(l.path,c.path)?Object.keys(l.props).every(d=>c.props[d]!==void 0):!1}s.subsumed=a})(or||(or={}));(l=>{function i(){return[]}l.empty=i;function t(c,d){let u=[];for(let p of c){let[h,...f]=p.path;h===d&&u.push({...p,path:f})}return u}l.removePrefix=t;function e(c,d){return c.map(u=>({...u,path:[d,...u.path]}))}l.addPrefix=e;function r(c,d){return[...c,...d]}l.concat=r;function n(c,d){return[...c.filter(p=>!d.some(h=>or.subsumed(p,h))),...d]}l.compress=n;function o(c,d){return c.every(u=>d.every(p=>or.commutative(u,p)))}l.commutative=o;function a(c,d){for(let u of d){let p=s(c,u);p!==null&&(c=p.data)}return c}l.applyAll=a;function s(c,d){let u=c,p=[],h=[];for(let f of d)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let m,y;if(f.type===3?(m=jt.zoom(u,[...f.path,f.id]),y=or.apply(u,{...f,type:2})):(m=jt.zoom(u,[...f.path,f.id,"value"]),y=or.apply(u,f)),y!==null){u=y.data;let[g,v]=UC(u,{[f.id]:m});u=g;for(let b=0;b<v.length;b++){let S=v[b],x=S.pop(),A,w;if(typeof x=="number"){let C=[x];for(let M=b+1;M<v.length;M++){let D=v[M],I=D[D.length-1];if(typeof I=="number"&&jt.equal(S,D.slice(0,D.length-1)))C.push(I),v.splice(M,1);else break}let T=jt.zoom(u,S);w=T.map((M,D)=>C.includes(D)?f.id:M),A=T,x=S.pop()}else{if(A=m,x==="alphaOverride"||x==="alpha"){A=m/100;let C=jt.zoom(u,S);C[x]=A}w=f.id}p.push({type:0,path:S,props:{[x]:A}}),h.push({type:0,path:S,props:{[x]:w}})}h.push(y.reverse),p.push(y.actual)}}else{let m=or.apply(u,f);m!==null&&(p.push(m.actual),u=m.data,h.push(m.reverse))}}catch(m){if(m instanceof Tc)return null;throw m}return{data:u,actual:p,reverse:h.reverse()}}l.apply=s})(Ux||(Ux={}))});function HC(i,t){return i instanceof vt?Object.setPrototypeOf(t,vt.prototype):us.tryPreservePrototype(i,t)}function zx(i,t,e){if(i.length>0){let r=i[i.length-1];if(r.type===0&&t.type===0&&jt.equal(r.path,e)){Object.assign(r.props,t.props);return}}i.push({...t,path:e})}function rm(i,t,e){return e instanceof Rt?new ul(i,t,e):e instanceof oe?new pl(i,t,e):e instanceof ve?new Proxy(new Hx(i,t,e),m_):e!==null&&typeof e=="object"?Qn(e)?e:new Proxy(new jx(i,t,e),f_):e}function qx(i){let t=new em(i);return[rm(t,"",i),t]}function Oc(i,t){let[e,r]=qx(i);return t(e),r.result()}function ar(i){return i instanceof ul||i instanceof pl?i._current:i!==null&&typeof i=="object"?i[Wx]:i}function hl(i){if(i instanceof ul)return i._current;if(i instanceof pl)return i._current;if(i!==null&&typeof i=="object"){let t=i[Wx];return t!==void 0?t:i}else return i}var Wx,h_,tm,dl,jx,Hx,WC,f_,m_,ul,pl,em,Xx=xe(()=>{"use strict";hp();ds();Zf();ps();gr();gp();yp();Wx=Symbol(),h_=Symbol(),tm=Symbol(),dl=class{reportOp(t,e,r=[]){let n=this;if(e===null)return;n._current=e.data;let o=r;for(;!(n instanceof em);){let a=n._path,s=n._current;if(a!==""&&o.splice(0,0,a),n=n._parent,n===null)return;n.update(a,s)}n.push(o,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let r=e[tm];r&&r(),delete this._children[t]}}}};jx=class extends dl{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=HC(this._current,{...this._current,[t]:e})}runOp(t){let e=us.runOp(this._current,t);e!==null&&(e.data=HC(this._current,e.data)),this.reportOp(t,e,t.path)}},Hx=class extends dl{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,ve.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},WC={get(i,t){if(t===tm)return()=>{i._parent=null};if(t===Wx)return i._current;if(t===h_)return i;let{_current:e,_children:r}=i;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[t];if(n!==void 0)return n;let o=e[t],a=rm(i,t,o);return a!==o?(r===void 0&&(r={},i._children=r),r[t]=a,a):o},has(i,t){return t in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,t){let e=i._current,r=Reflect.getOwnPropertyDescriptor(e,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:e[t]}}},f_={...WC,set(i,t,e){let r={type:0,props:{[t]:ar(e)??e}};return i.deleteChildren(t),i.runOp(r),!0},deleteProperty(i,t){let e={type:0,props:{[t]:void 0}};return i.deleteChildren(t),i.runOp(e),!0}},m_={...WC,set(i,t,e){return e===void 0?this.deleteProperty(i,t):(i.deleteChildren(t),i.runOp({type:1,id:t,data:e})),!0},deleteProperty(i,t){return i.runOp({type:2,id:t}),!0}},ul=class extends dl{constructor(t,e,r){super(),this._children={},this._parent=t,this._path=e,this._current=r,this[tm]=()=>{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)}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,n=r===void 0?void 0:r[t];if(n!==void 0)return n;let o=e.get(t)?.data,a=rm(this,t,o);return a!==o?(r===void 0&&(r={},this._children=r),r[t]=a,a):o}add(t,e,r,n,o){this.runOp({type:7,parent:t,fi:e,id:r,data:n,children:o})}move(t,e,r){this.runOp({type:9,parent:t,fi:e,id:r})}insertAfter(t,e,r){let n=this._current.insertAfterHelper(t,e,r.length);for(let o=0;o<r.length;o++){let a=r[o];this.add(t,n[o],a.id,a.data,a.children)}}insertBefore(t,e,r){let n=this._current.insertBeforeHelper(t,e,r.length);for(let o=0;o<r.length;o++){let a=r[o];this.add(t,n[o],a.id,a.data,a.children)}}moveAfter(t,e,r){let n=this._current.insertAfterHelper(t,e,r.length);for(let o=0;o<r.length;o++){let a=r[o];this.move(t,n[o],a)}}moveBefore(t,e,r){let n=this._current.insertBeforeHelper(t,e,r.length);for(let o=0;o<r.length;o++){let a=r[o];this.move(t,n[o],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)}},pl=class extends dl{constructor(t,e,r){super(),this._children={},this._parent=t,this._path=e,this._current=r,this[tm]=()=>{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 n=this._current[r].id,o=this._current[r].fi;t(this.data(this._current[r].id),n,o,r)}}find(t){let e=this.length;for(let r=0;r<e;r++){let n=this._current[r].id;if(t(this.data(n),n))return this.get(n)}}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)}}at(t){let{id:e,fi:r}=this._current.at(t);return{id:e,fi:r,data:this.data(e)}}data(t){let{_current:e,_children:r}=this,n=r===void 0?void 0:r[t];if(n!==void 0)return n;let o=e.get(t)?.data,a=rm(this,t,o);return a!==o?(r===void 0&&(r={},this._children=r),r[t]=a,a):o}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 n=0;n<e.length;n++){let o=e[n];this.add(r[n],o.id,o.data)}}insertBefore(t,e){let r=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let o=e[n];this.add(r[n],o.id,o.data)}}moveAfter(t,e){let r=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let o=e[n];this.move(r[n],o)}}moveBefore(t,e){let r=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let o=e[n];this.move(r[n],o)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};em=class extends dl{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,n){zx(this.ts,e,t),zx(this.actual,r,t),zx(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}});var jt,gp=xe(()=>{"use strict";Kf();Xx();ps();ds();gr();(o=>{function i(a,s){if(s.length===a.length){let l=0;for(;l<a.length;){if(a[l]!==s[l])return!1;l+=1}}else return!1;return!0}o.equal=i;function t(a,s,l){let c=r(l,a);if(c!==void 0&&typeof c=="object"&&c!==null){let d={...s};return Object.keys(c).forEach(u=>{delete d[u]}),d}else return s}o.removeOverridden=t;function e(a,s){if((a instanceof Rt||a instanceof ul)&&typeof s=="string")return a.data(s);if((a instanceof oe||a instanceof pl)&&typeof s=="string")return a.data(s);if(typeof s=="number"&&Array.isArray(a))return a[s];if(typeof s=="string"&&typeof a=="object"&&a!==null)return a[s]}o.zoomOnce=e;function r(a,s,l=0){for(;l<s.length&&a!==void 0;)a=e(a,s[l]),l+=1;return a}o.zoom=r;function n(a,s){let l=[];function c(d,u){if(d instanceof cl&&d.id===s.id)l.push(u);else if(d instanceof oe)for(let p=0;p<d.length;p++)c(d[p].data,[...u,d[p].id]);else if(d instanceof Rt)d.traverse((p,h)=>{c(h,[...u,p])});else if(Array.isArray(d)){if(typeof d[0]=="number")return;for(let p=0;p<d.length;p++)c(d[p],[...u,p])}else{if(Qn(d))return;if(typeof d=="object"&&d!==null)for(let p in d)c(d[p],[...u,p])}}return c(a,[]),l}o.findPathes=n})(jt||(jt={}))});var qC=xe(()=>{"use strict"});function XC(i,t){let e=[];if(t.length===i.length){let r=0;for(;r<i.length;){if(t[r]==="*")e.push(i[r]);else if(i[r]!==t[r])return null;r+=1}}else return null;return e}function Ye(i,t){let e=[];if(t.length<=i.length){let r=0;for(;r<t.length;){if(t[r]==="*")e.push(i[r]);else if(i[r]!==t[r])return null;r+=1}}else return null;return e}var YC=xe(()=>{"use strict"});function nm(i){try{if(!Ht.trusted&&!fs){let e=ct.sharedLength||0;e<ct.length&&(ct.length=e)}let t;if(Ht.randomAccessStructure&&fe[z]<64&&fe[z]>=32&&ZC?(t=ZC(fe,z,Pi,Ht),fe=null,!(i&&i.lazy)&&t&&(t=t.toJSON()),z=Pi):t=Or(),en&&(z=en.postBundlePosition,en=null),fs&&(ct.restoreStructures=null),z==Pi)ct&&ct.restoreStructures&&eE(),ct=null,fe=null,Aa&&(Aa=null);else{if(z>Pi)throw new Error("Unexpected end of MessagePack data");if(!fs){let e;try{e=JSON.stringify(t,(r,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(r){e="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+e)}}return t}catch(t){throw ct&&ct.restoreStructures&&eE(),im(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||z>Pi)&&(t.incomplete=!0),t}}function eE(){for(let i in ct.restoreStructures)ct[i]=ct.restoreStructures[i];ct.restoreStructures=null}function Or(){let i=fe[z++];if(i<160)if(i<128){if(i<64)return i;{let t=ct[i&63]||Ht.getStructures&&cE()[i&63];return t?(t.read||(t.read=e0(t,i&63)),t.read()):i}}else if(i<144)if(i-=128,Ht.mapsAsObjects){let t={};for(let e=0;e<i;e++){let r=uE();r==="__proto__"&&(r="__proto_"),t[r]=Or()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(Or(),Or());return t}else{i-=144;let t=new Array(i);for(let e=0;e<i;e++)t[e]=Or();return Ht.freezeData?Object.freeze(t):t}else if(i<192){let t=i-160;if(_o>=z)return hs.slice(z-Ti,(z+=t)-Ti);if(_o==0&&Pi<140){let e=t<16?t0(t):dE(t);if(e!=null)return e}return Jx(t)}else{let t;switch(i){case 192:return null;case 193:return en?(t=Or(),t>0?en[1].slice(en.position1,en.position1+=t):en[0].slice(en.position0,en.position0-=t)):$x;case 194:return!1;case 195:return!0;case 196:if(t=fe[z++],t===void 0)throw new Error("Unexpected end of buffer");return Yx(t);case 197:return t=st.getUint16(z),z+=2,Yx(t);case 198:return t=st.getUint32(z),z+=4,Yx(t);case 199:return fl(fe[z++]);case 200:return t=st.getUint16(z),z+=2,fl(t);case 201:return t=st.getUint32(z),z+=4,fl(t);case 202:if(t=st.getFloat32(z),Ht.useFloat32>2){let e=am[(fe[z]&127)<<1|fe[z+1]>>7];return z+=4,(e*t+(t>0?.5:-.5)>>0)/e}return z+=4,t;case 203:return t=st.getFloat64(z),z+=8,t;case 204:return fe[z++];case 205:return t=st.getUint16(z),z+=2,t;case 206:return t=st.getUint32(z),z+=4,t;case 207:return Ht.int64AsType==="number"?(t=st.getUint32(z)*4294967296,t+=st.getUint32(z+4)):Ht.int64AsType==="string"?t=st.getBigUint64(z).toString():Ht.int64AsType==="auto"?(t=st.getBigUint64(z),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=st.getBigUint64(z),z+=8,t;case 208:return st.getInt8(z++);case 209:return t=st.getInt16(z),z+=2,t;case 210:return t=st.getInt32(z),z+=4,t;case 211:return Ht.int64AsType==="number"?(t=st.getInt32(z)*4294967296,t+=st.getUint32(z+4)):Ht.int64AsType==="string"?t=st.getBigInt64(z).toString():Ht.int64AsType==="auto"?(t=st.getBigInt64(z),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=st.getBigInt64(z),z+=8,t;case 212:if(t=fe[z++],t==114)return aE(fe[z++]&63);{let e=xn[t];if(e)return e.read?(z++,e.read(Or())):e.noBuffer?(z++,e()):e(fe.subarray(z,++z));throw new Error("Unknown extension "+t)}case 213:return t=fe[z],t==114?(z++,aE(fe[z++]&63,fe[z++])):fl(2);case 214:return fl(4);case 215:return fl(8);case 216:return fl(16);case 217:return t=fe[z++],_o>=z?hs.slice(z-Ti,(z+=t)-Ti):g_(t);case 218:return t=st.getUint16(z),z+=2,_o>=z?hs.slice(z-Ti,(z+=t)-Ti):v_(t);case 219:return t=st.getUint32(z),z+=4,_o>=z?hs.slice(z-Ti,(z+=t)-Ti):b_(t);case 220:return t=st.getUint16(z),z+=2,rE(t);case 221:return t=st.getUint32(z),z+=4,rE(t);case 222:return t=st.getUint16(z),z+=2,nE(t);case 223:return t=st.getUint32(z),z+=4,nE(t);default:if(i>=224)return i-256;if(i===void 0){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+i)}}}function e0(i,t){function e(){if(e.count++>QC){let n;try{n=i.read=new Function("r","return function(){return "+(Ht.freezeData?"Object.freeze":"")+"({"+i.map(o=>o==="__proto__"?"__proto_:r()":y_.test(o)?o+":r()":"["+JSON.stringify(o)+"]:r()").join(",")+"})}")(Or)}catch{return QC=1/0,e()}return i.read0=n,i.highByte===0&&(i.read=tE(t,i.read)),n()}let r={};for(let n=0,o=i.length;n<o;n++){let a=i[n];a==="__proto__"&&(a="__proto_"),r[a]=Or()}return Ht.freezeData?Object.freeze(r):r}return e.count=0,i.read0=e,i.highByte===0?tE(t,e):e}function cE(){let i=hE(()=>(fe=null,Ht.getStructures()));return ct=Ht._mergeStructures(i,ct)}function bp(i){let t;if(i<16&&(t=t0(i)))return t;if(i>64&&Kx)return Kx.decode(fe.subarray(z,z+=i));let e=z+i,r=[];for(t="";z<e;){let n=fe[z++];if((n&128)===0)r.push(n);else if((n&224)===192){let o=fe[z++]&63,a=(n&31)<<6|o;a<128?r.push(65533):r.push(a)}else if((n&240)===224){let o=fe[z++]&63,a=fe[z++]&63,s=(n&31)<<12|o<<6|a;s<2048||s>=55296&&s<=57343?r.push(65533):r.push(s)}else if((n&248)===240){let o=fe[z++]&63,a=fe[z++]&63,s=fe[z++]&63,l=(n&7)<<18|o<<12|a<<6|s;l<65536||l>1114111?r.push(65533):(l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l))}else r.push(65533);r.length>=4096&&(t+=$r.apply(String,r),r.length=0)}return r.length>0&&(t+=$r.apply(String,r)),t}function rE(i){let t=new Array(i);for(let e=0;e<i;e++)t[e]=Or();return Ht.freezeData?Object.freeze(t):t}function nE(i){if(Ht.mapsAsObjects){let t={};for(let e=0;e<i;e++){let r=uE();r==="__proto__"&&(r="__proto_"),t[r]=Or()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(Or(),Or());return t}}function dE(i){let t=z,e=new Array(i);for(let r=0;r<i;r++){let n=fe[z++];if((n&128)>0){z=t;return}e[r]=n}return $r.apply(String,e)}function t0(i){if(i<4)if(i<2){if(i===0)return"";{let t=fe[z++];if((t&128)>1){z-=1;return}return $r(t)}}else{let t=fe[z++],e=fe[z++];if((t&128)>0||(e&128)>0){z-=2;return}if(i<3)return $r(t,e);let r=fe[z++];if((r&128)>0){z-=3;return}return $r(t,e,r)}else{let t=fe[z++],e=fe[z++],r=fe[z++],n=fe[z++];if((t&128)>0||(e&128)>0||(r&128)>0||(n&128)>0){z-=4;return}if(i<6){if(i===4)return $r(t,e,r,n);{let o=fe[z++];if((o&128)>0){z-=5;return}return $r(t,e,r,n,o)}}else if(i<8){let o=fe[z++],a=fe[z++];if((o&128)>0||(a&128)>0){z-=6;return}if(i<7)return $r(t,e,r,n,o,a);let s=fe[z++];if((s&128)>0){z-=7;return}return $r(t,e,r,n,o,a,s)}else{let o=fe[z++],a=fe[z++],s=fe[z++],l=fe[z++];if((o&128)>0||(a&128)>0||(s&128)>0||(l&128)>0){z-=8;return}if(i<10){if(i===8)return $r(t,e,r,n,o,a,s,l);{let c=fe[z++];if((c&128)>0){z-=9;return}return $r(t,e,r,n,o,a,s,l,c)}}else if(i<12){let c=fe[z++],d=fe[z++];if((c&128)>0||(d&128)>0){z-=10;return}if(i<11)return $r(t,e,r,n,o,a,s,l,c,d);let u=fe[z++];if((u&128)>0){z-=11;return}return $r(t,e,r,n,o,a,s,l,c,d,u)}else{let c=fe[z++],d=fe[z++],u=fe[z++],p=fe[z++];if((c&128)>0||(d&128)>0||(u&128)>0||(p&128)>0){z-=12;return}if(i<14){if(i===12)return $r(t,e,r,n,o,a,s,l,c,d,u,p);{let h=fe[z++];if((h&128)>0){z-=13;return}return $r(t,e,r,n,o,a,s,l,c,d,u,p,h)}}else{let h=fe[z++],f=fe[z++];if((h&128)>0||(f&128)>0){z-=14;return}if(i<15)return $r(t,e,r,n,o,a,s,l,c,d,u,p,h,f);let m=fe[z++];if((m&128)>0){z-=15;return}return $r(t,e,r,n,o,a,s,l,c,d,u,p,h,f,m)}}}}}function iE(){let i=fe[z++],t;if(i<192)t=i-160;else switch(i){case 217:t=fe[z++];break;case 218:t=st.getUint16(z),z+=2;break;case 219:t=st.getUint32(z),z+=4;break;default:throw new Error("Expected string")}return bp(t)}function Yx(i){return Ht.copyBuffers?Uint8Array.prototype.slice.call(fe,z,z+=i):fe.subarray(z,z+=i)}function fl(i){let t=fe[z++];if(xn[t]){let e;return xn[t](fe.subarray(z,e=z+=i),r=>{z=r;try{return Or()}finally{z=e}})}else throw new Error("Unknown extension type "+t)}function uE(){let i=fe[z++];if(i>=160&&i<192){if(i=i-160,_o>=z)return hs.slice(z-Ti,(z+=i)-Ti);if(!(_o==0&&Pi<180))return Jx(i)}else return z--,pE(Or());let t=(i<<5^(i>1?st.getUint16(z):i>0?fe[z]:0))&4095,e=oE[t],r=z,n=z+i-3,o,a=0;if(e&&e.bytes==i){for(;r<n;){if(o=st.getUint32(r),o!=e[a++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(o=fe[r++],o!=e[a++]){r=1879048192;break}if(r===n)return z=r,e.string;n-=3,r=z}for(e=[],oE[t]=e,e.bytes=i;r<n;)o=st.getUint32(r),e.push(o),r+=4;for(n+=3;r<n;)o=fe[r++],e.push(o);let s=i<16?t0(i):dE(i);return s!=null?e.string=s:e.string=Jx(i)}function pE(i){if(typeof i=="string")return i;if(typeof i=="number"||typeof i=="boolean"||typeof i=="bigint")return i.toString();if(i==null)return i+"";if(Ht.allowArraysInMapKeys&&Array.isArray(i)&&i.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return i.flat().toString();throw new Error(`Invalid property type for record: ${typeof i}`)}function hE(i){$C&&$C();let t=Pi,e=z,r=Zx,n=Ti,o=_o,a=hs,s=Qx,l=Aa,c=en,d=new Uint8Array(fe.slice(0,Pi)),u=ct,p=ct.slice(0,ct.length),h=Ht,f=fs,m=i();return Pi=t,z=e,Zx=r,Ti=n,_o=o,hs=a,Qx=s,Aa=l,en=c,fe=d,fs=f,ct=u,ct.splice(0,ct.length,...p),Ht=h,st=new DataView(fe.buffer,fe.byteOffset,fe.byteLength),m}function im(){fe=null,Aa=null,ct=null}function om(i){i.unpack?xn[i.type]=i.unpack:xn[i.type]=i}var Kx,fe,Pi,z,lE,Qx,Zx,Ht,ct,hs,Ti,_o,en,Aa,xn,st,KC,vp,$x,fs,QC,ZC,JC,$C,Mi,y_,tE,Jx,g_,v_,b_,$r,oE,aE,sE,r0,x_,S_,am,sm,A_,w_,C_,lm,E_,XW,ml=xe(()=>{try{Kx=new TextDecoder}catch{}z=0,lE=[],Qx=lE,Zx=0,Ht={},Ti=0,_o=0,xn=[],KC={useRecords:!1,mapsAsObjects:!0},vp=class{},$x=new vp;$x.name="MessagePack 0xC1";fs=!1,QC=2,Mi=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(fe)return hE(()=>(im(),this?this.unpack(t,e):Mi.prototype.unpack.call(KC,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(Pi=e.end||t.length,z=e.start||0):(z=0,Pi=e>-1?e:t.length),Zx=0,_o=0,hs=null,Qx=lE,en=null,fe=t;try{st=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(r){throw fe=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 Mi){if(Ht=this,this.structures)return ct=this.structures,nm(e);(!ct||ct.length>0)&&(ct=[])}else Ht=KC,(!ct||ct.length>0)&&(ct=[]);return nm(e)}unpackMultiple(t,e){let r,n=0;try{fs=!0;let o=t.length,a=this?this.unpack(t,o):sm.unpack(t,o);if(e){if(e(a,n,z)===!1)return;for(;z<o;)if(n=z,e(nm(),n,z)===!1)return}else{for(r=[a];z<o;)n=z,r.push(nm());return r}}catch(o){throw o.lastPosition=n,o.values=r,o}finally{fs=!1,im()}}_mergeStructures(t,e){JC&&(t=JC.call(this,t)),t=t||[],Object.isFrozen(t)&&(t=t.map(r=>r.slice(0)));for(let r=0,n=t.length;r<n;r++){let o=t[r];o&&(o.isShared=!0,r>=32&&(o.highByte=r-32>>5))}t.sharedLength=t.length;for(let r in e||[])if(r>=0){let n=t[r],o=e[r];o&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[r]=n),t[r]=o)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};y_=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;tE=(i,t)=>function(){let e=fe[z++];if(e===0)return t();let r=i<32?-(i+(e<<5)):i+(e<<5),n=ct[r]||cE()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=e0(n,i)),n.read()};Jx=bp,g_=bp,v_=bp,b_=bp;$r=String.fromCharCode;oE=new Array(4096);aE=(i,t)=>{let e=Or().map(pE),r=i;t!==void 0&&(i=i<32?-((t<<5)+i):(t<<5)+i,e.highByte=t);let n=ct[i];return n&&(n.isShared||fs)&&((ct.restoreStructures||(ct.restoreStructures=[]))[i]=n),ct[i]=e,e.read=e0(e,r),(e.read0||e.read)()};xn[0]=()=>{};xn[0].noBuffer=!0;xn[66]=i=>{let t=i.byteLength%8||8,e=BigInt(i[0]&128?i[0]-256:i[0]);for(let r=1;r<t;r++)e<<=BigInt(8),e+=BigInt(i[r]);if(i.byteLength!==t){let r=new DataView(i.buffer,i.byteOffset,i.byteLength),n=(o,a)=>{let s=a-o;if(s<=40){let u=r.getBigUint64(o);for(let p=o+8;p<a;p+=8)u<<=BigInt(64),u|=r.getBigUint64(p);return u}let l=o+(s>>4<<3),c=n(o,l),d=n(l,a);return c<<BigInt((a-l)*8)|d};e=e<<BigInt((r.byteLength-t)*8)|n(t,r.byteLength)}return e};sE={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};xn[101]=()=>{let i=Or();if(!sE[i[0]]){let t=Error(i[1],{cause:i[2]});return t.name=i[0],t}return sE[i[0]](i[1],{cause:i[2]})};xn[105]=i=>{if(Ht.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=st.getUint32(z-4);Aa||(Aa=new Map);let e=fe[z],r;e>=144&&e<160||e==220||e==221?r=[]:e>=128&&e<144||e==222||e==223?r=new Map:(e>=199&&e<=201||e>=212&&e<=216)&&fe[z+1]===115?r=new Set:r={};let n={target:r};Aa.set(t,n);let o=Or();if(n.used)Object.assign(r,o);else return n.target=o;if(r instanceof Map)for(let[a,s]of o.entries())r.set(a,s);if(r instanceof Set)for(let a of Array.from(o))r.add(a);return r};xn[112]=i=>{if(Ht.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=st.getUint32(z-4),e=Aa.get(t);return e.used=!0,e.target};xn[115]=()=>new Set(Or());r0=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array"),x_=typeof globalThis=="object"?globalThis:window;xn[116]=i=>{let t=i[0],e=Uint8Array.prototype.slice.call(i,1).buffer,r=r0[t];if(!r){if(t===16)return e;if(t===17)return new DataView(e);throw new Error("Could not find typed array for code "+t)}return new x_[r](e)};xn[120]=()=>{let i=Or();return new RegExp(i[0],i[1])};S_=[];xn[98]=i=>{let t=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],e=z;return z+=t-i.length,en=S_,en=[iE(),iE()],en.position0=0,en.position1=0,en.postBundlePosition=z,z=e,Or()};xn[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");am=new Array(147);for(let i=0;i<256;i++)am[i]=+("1e"+Math.floor(45.15-i*.30103));sm=new Mi({useRecords:!1}),A_=sm.unpack,w_=sm.unpackMultiple,C_=sm.unpack,lm={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},E_=new Float32Array(1),XW=new Uint8Array(E_.buffer,0,4)});function n0(i,t,e,r){let n=i.byteLength;if(n+1<256){var{target:o,position:a}=e(4+n);o[a++]=199,o[a++]=n+1}else if(n+1<65536){var{target:o,position:a}=e(5+n);o[a++]=200,o[a++]=n+1>>8,o[a++]=n+1&255}else{var{target:o,position:a,targetView:s}=e(7+n);o[a++]=201,s.setUint32(a,n+1),a+=4}o[a++]=116,o[a++]=t,i.buffer||(i=new Uint8Array(i)),o.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),a)}function i0(i,t){let e=i.byteLength;var r,n;if(e<256){var{target:r,position:n}=t(e+2);r[n++]=196,r[n++]=e}else if(e<65536){var{target:r,position:n}=t(e+3);r[n++]=197,r[n++]=e>>8,r[n++]=e&255}else{var{target:r,position:n,targetView:o}=t(e+5);r[n++]=198,o.setUint32(n,e),n+=4}r.set(i,n)}function mE(i,t,e,r){let n=i.length;switch(n){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:n<256?(t[e++]=199,t[e++]=n):n<65536?(t[e++]=200,t[e++]=n>>8,t[e++]=n&255):(t[e++]=201,t[e++]=n>>24,t[e++]=n>>16&255,t[e++]=n>>8&255,t[e++]=n&255)}return t[e++]=r,t.set(i,e),e+=n,e}function O_(i,t){let e,r=t.length*6,n=i.length-r;for(;e=t.pop();){let o=e.offset,a=e.id;i.copyWithin(o+r,o,n),r-=6;let s=o+r;i[s++]=214,i[s++]=105,i[s++]=a>>24,i[s++]=a>>16&255,i[s++]=a>>8&255,i[s++]=a&255,n=o}return i}function yE(i,t,e){if(ur.length>0){Wt.setUint32(ur.position+i,H+e-ur.position-i),ur.stringsPosition=H-i;let r=ur;ur=null,t(r[0]),t(r[1])}}function o0(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");pm.unshift(i.Class),um.unshift(i)}om(i)}function I_(i,t){return i.isCompatible=e=>{let r=!e||(t.lastNamedStructuresLength||0)===e.length;return r||t._mergeStructures(e),r},i}var dm,um,pm,Dc,cm,gE,fE,K,xp,Wt,H,Sn,ur,T_,P_,M_,Ic,yl,vE,D_,R_,B_,N_,L_,__,bE,xE,SE,a0=xe(()=>{ml();ml();ml();try{dm=new TextEncoder}catch{}Dc=typeof Buffer<"u",cm=Dc?function(i){return Buffer.allocUnsafeSlow(i)}:Uint8Array,gE=Dc?Buffer:Uint8Array,fE=Dc?4294967296:2144337920,H=0,ur=null,P_=21760,M_=/[\u0080-\uFFFF]/,Ic=Symbol("record-id"),yl=class extends Mi{constructor(t){super(t),this.offset=0;let e,r,n,o,a,s=gE.prototype.utf8Write?function(E,B){return K.utf8Write(E,B,K.byteLength-B)}:dm&&dm.encodeInto?function(E,B){return dm.encodeInto(E,K.subarray(B)).written}:!1,l=this;t||(t={});let c=t&&t.sequential,d=t.structures||t.saveStructures,u=t.maxSharedStructures;if(u==null&&(u=d?32:0),u>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let p=t.maxOwnStructures;p==null&&(p=d?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let h=u>32||p+u>64,f=u+64,m=u+p+64;if(m>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let y=[],g=0,v=0;this.pack=this.encode=function(E,B){if(K||(K=new cm(8192),Wt=K.dataView||(K.dataView=new DataView(K.buffer,0,8192)),H=0),Sn=K.length-10,Sn-H<2048?(K=new cm(K.length),Wt=K.dataView||(K.dataView=new DataView(K.buffer,0,K.length)),Sn=K.length-10,H=0):H=H+7&2147483640,r=H,B&SE&&(H+=B&255),a=l.structuredClone?new Map:null,l.bundleStrings&&typeof E!="string"?(ur=[],ur.size=1/0):ur=null,o=l.structures,o){o.uninitialized&&(o=l._mergeStructures(l.getStructures()));let k=o.sharedLength||0;if(k>u)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 F=0;F<k;F++){let W=o[F];if(!W)continue;let U,G=o.transitions;for(let q=0,X=W.length;q<X;q++){let Y=W[q];U=G[Y],U||(U=G[Y]=Object.create(null)),G=U}G[Ic]=F+64}this.lastNamedStructuresLength=k}c||(o.nextId=k+64)}n&&(n=!1);let L;try{l.randomAccessStructure&&!l.readOnlyStructures&&E&&typeof E=="object"?E.constructor===Object?_(E):E.constructor!==Map&&!Array.isArray(E)&&!pm.some(F=>E instanceof F)?_(E.toJSON?E.toJSON():E):x(E):x(E);let k=ur;if(ur&&yE(r,x,0),a&&a.idsToInsert){let F=a.idsToInsert.sort((q,X)=>q.offset>X.offset?1:-1),W=F.length,U=-1;for(;k&&W>0;){let q=F[--W].offset+r;q<k.stringsPosition+r&&U===-1&&(U=0),q>k.position+r?U>=0&&(U+=6):(U>=0&&(Wt.setUint32(k.position+r,Wt.getUint32(k.position+r)+U),U=-1),k=k.previous,W++)}U>=0&&k&&Wt.setUint32(k.position+r,Wt.getUint32(k.position+r)+U),H+=F.length*6,H>Sn&&M(H),l.offset=H;let G=O_(K.subarray(r,H),F);return a=null,G}return l.offset=H,B&bE?(K.start=r,K.end=H,K):K.subarray(r,H)}catch(k){throw L=k,k}finally{if(o&&(b(),n&&l.saveStructures)){let k=o.sharedLength||0,F=K.subarray(r,H),W=I_(o,l);if(!L)return l.saveStructures(W,W.isCompatible)===!1?(o.uninitialized=!0,l.pack(E,B)):(l.lastNamedStructuresLength=k,K.length>1073741824&&(K=null),F)}K.length>1073741824&&(K=null),B&xE&&(H=r)}};let b=()=>{v<10&&v++;let E=o.sharedLength||0;if(o.length>E&&!c&&(o.length=E),g>1e4)o.transitions=null,v=0,g=0,y.length>0&&(y=[]);else if(y.length>0&&!c){for(let B=0,L=y.length;B<L;B++)y[B][Ic]=0;y=[]}},S=E=>{var B=E.length;B<16?K[H++]=144|B:B<65536?(K[H++]=220,K[H++]=B>>8,K[H++]=B&255):(K[H++]=221,Wt.setUint32(H,B),H+=4);for(let L=0;L<B;L++)x(E[L])},x=E=>{H>Sn&&(K=M(H));var B=typeof E,L;if(B==="string"){let k=E.length;if(ur&&k>=4&&k<4096){if((ur.size+=k)>P_){let G,q=(ur[0]?ur[0].length*3+ur[1].length:0)+10;H+q>Sn&&(K=M(H+q));let X;ur.position?(X=ur,K[H]=200,H+=3,K[H++]=98,G=H-r,H+=4,yE(r,x,0),Wt.setUint16(G+r-3,H-r-G)):(K[H++]=214,K[H++]=98,G=H-r,H+=4),ur=["",""],ur.previous=X,ur.size=0,ur.position=G}let U=M_.test(E);ur[U?0:1]+=E,K[H++]=193,x(U?-k:k);return}let F;k<32?F=1:k<256?F=2:k<65536?F=3:F=5;let W=k*3;if(H+W>Sn&&(K=M(H+W)),k<64||!s){let U,G,q,X=H+F;for(U=0;U<k;U++)G=E.charCodeAt(U),G<128?K[X++]=G:G<2048?(K[X++]=G>>6|192,K[X++]=G&63|128):(G&64512)===55296&&((q=E.charCodeAt(U+1))&64512)===56320?(G=65536+((G&1023)<<10)+(q&1023),U++,K[X++]=G>>18|240,K[X++]=G>>12&63|128,K[X++]=G>>6&63|128,K[X++]=G&63|128):(K[X++]=G>>12|224,K[X++]=G>>6&63|128,K[X++]=G&63|128);L=X-H-F}else L=s(E,H+F);L<32?K[H++]=160|L:L<256?(F<2&&K.copyWithin(H+2,H+1,H+1+L),K[H++]=217,K[H++]=L):L<65536?(F<3&&K.copyWithin(H+3,H+2,H+2+L),K[H++]=218,K[H++]=L>>8,K[H++]=L&255):(F<5&&K.copyWithin(H+5,H+3,H+3+L),K[H++]=219,Wt.setUint32(H,L),H+=4),H+=L}else if(B==="number")if(E>>>0===E)E<32||E<128&&this.useRecords===!1||E<64&&!this.randomAccessStructure?K[H++]=E:E<256?(K[H++]=204,K[H++]=E):E<65536?(K[H++]=205,K[H++]=E>>8,K[H++]=E&255):(K[H++]=206,Wt.setUint32(H,E),H+=4);else if(E>>0===E)E>=-32?K[H++]=256+E:E>=-128?(K[H++]=208,K[H++]=E+256):E>=-32768?(K[H++]=209,Wt.setInt16(H,E),H+=2):(K[H++]=210,Wt.setInt32(H,E),H+=4);else{let k;if((k=this.useFloat32)>0&&E<4294967296&&E>=-2147483648){K[H++]=202,Wt.setFloat32(H,E);let F;if(k<4||(F=E*am[(K[H]&127)<<1|K[H+1]>>7])>>0===F){H+=4;return}else H--}K[H++]=203,Wt.setFloat64(H,E),H+=8}else if(B==="object"||B==="function")if(!E)K[H++]=192;else{if(a){let F=a.get(E);if(F){if(!F.id){let W=a.idsToInsert||(a.idsToInsert=[]);F.id=W.push(F)}K[H++]=214,K[H++]=112,Wt.setUint32(H,F.id),H+=4;return}else a.set(E,{offset:H-r})}let k=E.constructor;if(k===Object)T(E);else if(k===Array)S(E);else if(k===Map)if(this.mapAsEmptyObject)K[H++]=128;else{L=E.size,L<16?K[H++]=128|L:L<65536?(K[H++]=222,K[H++]=L>>8,K[H++]=L&255):(K[H++]=223,Wt.setUint32(H,L),H+=4);for(let[F,W]of E)x(F),x(W)}else{for(let F=0,W=um.length;F<W;F++){let U=pm[F];if(E instanceof U){let G=um[F];if(G.write){G.type&&(K[H++]=212,K[H++]=G.type,K[H++]=0);let te=G.write.call(this,E);te===E?Array.isArray(E)?S(E):T(E):x(te);return}let q=K,X=Wt,Y=H;K=null;let Q;try{Q=G.pack.call(this,E,te=>(K=q,q=null,H+=te,H>Sn&&M(H),{target:K,targetView:Wt,position:H-te}),x)}finally{q&&(K=q,Wt=X,H=Y,Sn=K.length-10)}Q&&(Q.length+H>Sn&&M(Q.length+H),H=mE(Q,K,H,G.type));return}}if(Array.isArray(E))S(E);else{if(E.toJSON){let F=E.toJSON();if(F!==E)return x(F)}if(B==="function")return x(this.writeFunction&&this.writeFunction(E));T(E)}}}else if(B==="boolean")K[H++]=E?195:194;else if(B==="bigint"){if(E<9223372036854776e3&&E>=-9223372036854776e3)K[H++]=211,Wt.setBigInt64(H,E);else if(E<18446744073709552e3&&E>0)K[H++]=207,Wt.setBigUint64(H,E);else if(this.largeBigIntToFloat)K[H++]=203,Wt.setFloat64(H,Number(E));else{if(this.largeBigIntToString)return x(E.toString());if(this.useBigIntExtension||this.moreTypes){let k=E<0?BigInt(-1):BigInt(0),F;if(E>>BigInt(65536)===k){let W=BigInt(18446744073709552e3)-BigInt(1),U=[];for(;U.push(E&W),E>>BigInt(63)!==k;)E>>=BigInt(64);F=new Uint8Array(new BigUint64Array(U).buffer),F.reverse()}else{let W=E<0,U=(W?~E:E).toString(16);if(U.length%2?U="0"+U:parseInt(U.charAt(0),16)>=8&&(U="00"+U),Dc)F=Buffer.from(U,"hex");else{F=new Uint8Array(U.length/2);for(let G=0;G<F.length;G++)F[G]=parseInt(U.slice(G*2,G*2+2),16)}if(W)for(let G=0;G<F.length;G++)F[G]=~F[G]}F.length+H>Sn&&M(F.length+H),H=mE(F,K,H,66);return}else throw new RangeError(E+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string")}H+=8}else if(B==="undefined")this.encodeUndefinedAsNil?K[H++]=192:(K[H++]=212,K[H++]=0,K[H++]=0);else throw new Error("Unknown type: "+B)},A=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?E=>{let B;if(this.skipValues){B=[];for(let F in E)(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(F))&&!this.skipValues.includes(E[F])&&B.push(F)}else B=Object.keys(E);let L=B.length;L<16?K[H++]=128|L:L<65536?(K[H++]=222,K[H++]=L>>8,K[H++]=L&255):(K[H++]=223,Wt.setUint32(H,L),H+=4);let k;if(this.coercibleKeyAsNumber)for(let F=0;F<L;F++){k=B[F];let W=Number(k);x(isNaN(W)?k:W),x(E[k])}else for(let F=0;F<L;F++)x(k=B[F]),x(E[k])}:E=>{K[H++]=222;let B=H-r;H+=2;let L=0;for(let k in E)(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(k))&&(x(k),x(E[k]),L++);if(L>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');K[B+++r]=L>>8,K[B+r]=L&255},w=this.useRecords===!1?A:t.progressiveRecords&&!h?E=>{let B,L=o.transitions||(o.transitions=Object.create(null)),k=H++-r,F;for(let W in E)if(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(W)){if(B=L[W],B)L=B;else{let U=Object.keys(E),G=L;L=o.transitions;let q=0;for(let X=0,Y=U.length;X<Y;X++){let Q=U[X];B=L[Q],B||(B=L[Q]=Object.create(null),q++),L=B}k+r+1==H?(H--,D(L,U,q)):I(L,U,k,q),F=!0,L=G[W]}x(E[W])}if(!F){let W=L[Ic];W?K[k+r]=W:I(L,Object.keys(E),k,0)}}:E=>{let B,L=o.transitions||(o.transitions=Object.create(null)),k=0;for(let W in E)(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(W))&&(B=L[W],B||(B=L[W]=Object.create(null),k++),L=B);let F=L[Ic];F?F>=96&&h?(K[H++]=((F-=96)&31)+96,K[H++]=F>>5):K[H++]=F:D(L,L.__keys__||Object.keys(E),k);for(let W in E)(typeof E.hasOwnProperty!="function"||E.hasOwnProperty(W))&&x(E[W])},C=typeof this.useRecords=="function"&&this.useRecords,T=C?E=>{C(E)?w(E):A(E)}:w,M=E=>{let B;if(E>16777216){if(E-r>fE)throw new Error("Packed buffer would be larger than maximum buffer size");B=Math.min(fE,Math.round(Math.max((E-r)*(E>67108864?1.25:2),4194304)/4096)*4096)}else B=(Math.max(E-r<<2,K.length-1)>>12)+1<<12;let L=new cm(B);return Wt=L.dataView||(L.dataView=new DataView(L.buffer,0,B)),E=Math.min(E,K.length),K.copy?K.copy(L,0,r,E):L.set(K.slice(r,E)),H-=r,r=0,Sn=L.length-10,K=L},D=(E,B,L)=>{let k=o.nextId;k||(k=64),k<f&&this.shouldShareStructure&&!this.shouldShareStructure(B)?(k=o.nextOwnId,k<m||(k=f),o.nextOwnId=k+1):(k>=m&&(k=f),o.nextId=k+1);let F=B.highByte=k>=96&&h?k-96>>5:-1;E[Ic]=k,E.__keys__=B,o[k-64]=B,k<f?(B.isShared=!0,o.sharedLength=k-63,n=!0,F>=0?(K[H++]=(k&31)+96,K[H++]=F):K[H++]=k):(F>=0?(K[H++]=213,K[H++]=114,K[H++]=(k&31)+96,K[H++]=F):(K[H++]=212,K[H++]=114,K[H++]=k),L&&(g+=v*L),y.length>=p&&(y.shift()[Ic]=0),y.push(E),x(B))},I=(E,B,L,k)=>{let F=K,W=H,U=Sn,G=r;K=xp,H=0,r=0,K||(xp=K=new cm(8192)),Sn=K.length-10,D(E,B,k),xp=K;let q=H;if(K=F,H=W,Sn=U,r=G,q>1){let X=H+q-1;X>Sn&&M(X);let Y=L+r;K.copyWithin(Y+q,Y+1,H),K.set(xp.slice(0,q),Y),H=X}else K[L+r]=xp[0]},_=E=>{let B=T_(E,K,r,H,o,M,(L,k,F)=>{if(F)return n=!0;H=k;let W=K;return x(L),b(),W!==K?{position:H,targetView:Wt,target:K}:H},this);if(B===0)return T(E);H=B}}useBuffer(t){K=t,K.dataView||(K.dataView=new DataView(K.buffer,K.byteOffset,K.byteLength)),Wt=K.dataView,H=0}set position(t){H=t}get position(){return H}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}};pm=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,vp];um=[{pack(i,t,e){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:o,position:a}=t(6);n[a++]=214,n[a++]=255,o.setUint32(a,r)}else if(r>0&&r<4294967296){let{target:n,targetView:o,position:a}=t(10);n[a++]=215,n[a++]=255,o.setUint32(a,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),o.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),e(this.onInvalidDate());let{target:n,targetView:o,position:a}=t(3);n[a++]=212,n[a++]=255,n[a++]=255}else{let{target:n,targetView:o,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,o.setUint32(a,i.getMilliseconds()*1e6),o.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(i,t,e){if(this.setAsEmptyObject)return t(0),e({});let r=Array.from(i),{target:n,position:o}=t(this.moreTypes?3:0);this.moreTypes&&(n[o++]=212,n[o++]=115,n[o++]=0),e(r)}},{pack(i,t,e){let{target:r,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(r[n++]=212,r[n++]=101,r[n++]=0),e([i.name,i.message,i.cause])}},{pack(i,t,e){let{target:r,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(r[n++]=212,r[n++]=120,r[n++]=0),e([i.source,i.flags])}},{pack(i,t){this.moreTypes?n0(i,16,t):i0(Dc?Buffer.from(i):new Uint8Array(i),t)}},{pack(i,t){let e=i.constructor;e!==gE&&this.moreTypes?n0(i,r0.indexOf(e.name),t):i0(i,t)}},{pack(i,t){this.moreTypes?n0(i,17,t):i0(Dc?Buffer.from(i):new Uint8Array(i),t)}},{pack(i,t){let{target:e,position:r}=t(1);e[r]=193}}];vE=new yl({useRecords:!1}),D_=vE.pack,R_=vE.pack,{NEVER:B_,ALWAYS:N_,DECIMAL_ROUND:L_,DECIMAL_FIT:__}=lm,bE=512,xE=1024,SE=2048});var AE=xe(()=>{a0();ml()});var wE=xe(()=>{a0();ml();AE()});var s0,k_,hm,CE=xe(()=>{"use strict";ml();Kf();yp();ps();hp();ds();s0=[{Class:ve.prototype.constructor,type:1,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,ve.prototype),i}},{Class:oe.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,oe.prototype),i}},{Class:Rt.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Rt.prototype),i}},{Class:cl.prototype.constructor,type:4,write(i){return i.id},read(i){return new cl(i)}},{Class:pp.prototype.constructor,type:5,write(i){return i.data},read(i){return new pp(i)}},{Class:vt.prototype.constructor,type:6,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,vt.prototype),i}}];for(let i of s0)om(i);k_=new Mi({structuredClone:!0});(t=>{function i(e){return k_.unpack(e)}t.deserialize=i})(hm||(hm={}))});function V_(i){let t=0;if(i.length===0)return t;for(let e=0;e<i.length;e++){let r=i[e];t=(t<<5)-t+r,t=t&t}return t}function l0(i){if(Qn(i))return i;if(Array.isArray(i))return i.map(l0);if(typeof i=="object"&&i!==null){let t={};for(let e of Object.keys(i).sort())t[e]=l0(i[e]);return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}else return i}var F_,gl,EE=xe(()=>{"use strict";wE();gr();CE();F_=new yl({structuredClone:!0});for(let i of s0)o0(i);(r=>{function i(n){return F_.pack(n)}r.serialize=i;function t(n){return hm.deserialize(n)}r.deserialize=t;function e(n){return V_(i(l0(n))).toString()}r.checksum=e})(gl||(gl={}))});var yt=xe(()=>{gp();FC();Qf();ds();hp();Zf();ps();jC();qC();Xx();YC();Kf();EE();Fx();yp()});function Sp(i){return i==="MouseDown"||i==="MouseUp"||i==="KeyDown"||i==="KeyUp"||i==="Collision"||i==="Trigger"}var fm,TE,d0,Rc,mm,c0,PE,ME,OE,ym,gm,IE,DE,RE,BE,NE,vm,bm,LE,_E,kE,FE,u0=xe(()=>{"use strict";yt();fm=require("three");(e=>{function i(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type}e.toEventUIType=i;function t(r){return r==="Distance"||r==="StateChange"?"Conditional":r}e.fromEventUIType=t})(TE||(TE={}));d0={["LookAt"]:[],["Follow"]:["Create"],["DragDrop"]:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseHover"]:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Scroll"]:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Start"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Conditional"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MousePress"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyPress"]:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["GameControl"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],["Collision"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Trigger"]:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Resize"]:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["VariableChange"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["API"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["WEBHOOK"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["AIAssistantListener"]:["SetVariable"],["AIAssistantTrigger"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(e=>{function i(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"}e.is=i;function t(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new oe}:{type:r,disabled:!1,name:"",key:void 0,actions:new oe}}e.defaultData=t})(Rc||(Rc={}));(e=>{function i(r){return{type:"Property",value:[r??null,"position","x"]}}e.propertyDefaultData=i,e.valueDefaultData={type:"Literal",value:0}})(mm||(mm={}));(r=>{function i(n){return{type:"Comparison",operator:"==",lOperand:mm.propertyDefaultData(n),rOperand:{...mm.valueDefaultData}}}r.comparisonDefaultData=i;function t(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}}r.distanceDefaultData=t;function e(n,o){return{type:"State",object:n??null,state:o??null}}r.stateDefaultData=e})(c0||(c0={}));(t=>{function i(e){return e.find(r=>r==="ifActions"||r==="elseActions")!==void 0}t.isConditionalSubActions=i})(PE||(PE={}));(e=>{function i(r){return r.type==="Conditional"}e.is=i;function t(r){return{type:"Conditional",disabled:!1,name:"",inActions:new oe,outActions:new oe,condition:c0.distanceDefaultData(r)}}e.defaultData=t})(ME||(ME={}));(t=>t.defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new oe,drop:new oe}})(OE||(OE={}));(t=>t.defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new oe})(ym||(ym={}));(t=>t.defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5})(gm||(gm={}));(e=>{function i(r){return r.type==="MouseHover"}e.is=i;function t(){return{type:"MouseHover",disabled:!1,name:"",actions:new oe}}e.defaultData=t})(IE||(IE={}));(e=>{function i(r){return r.type==="Scroll"}e.is=i;function t(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new oe}}e.defaultData=t})(DE||(DE={}));(e=>{function i(r){return r.type==="Start"}e.is=i;function t(){return{type:"Start",disabled:!1,name:"",actions:new oe}}e.defaultData=t})(RE||(RE={}));(e=>{function i(r){return r.type==="Collision"}e.is=i;function t(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new oe}}e.defaultData=t})(BE||(BE={}));(e=>{function i(r){return r.type==="Trigger"}e.is=i;function t(r,n){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new oe,triggerZone:"box",position:n.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}e.defaultData=t})(NE||(NE={}));(a=>{a.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(s){return s.type==="Resize"}a.is=t;function e(s){return typeof s=="string"?s:"custom"}a.sizeToDevice=e;function r(s){return typeof s=="string"?[...a.defaultSizes[s]]:[...s]}a.deviceToSize=r;function n(){let s={size:"mobile",operator:"<",actions:new oe},l={size:"tablet",operator:"<",actions:new oe},c={size:[...a.defaultSizes.custom],operator:"<>",actions:new oe},d=new oe;return d.push({id:fm.MathUtils.generateUUID(),fi:0,data:s},{id:fm.MathUtils.generateUUID(),fi:1,data:l},{id:fm.MathUtils.generateUUID(),fi:2,data:c}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:d}}a.defaultData=n;function o(){return{size:[...a.defaultSizes.custom],operator:"<>",actions:new oe}}a.defaultBreakpointData=o})(vm||(vm={}));(r=>{r.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]};function t(n){return n.type==="VariableChange"}r.is=t;function e(){return{disabled:!1,type:"VariableChange",name:"",actions:new oe,variableId:"",objectId:null,property:"Position X"}}r.defaultData=e})(bm||(bm={}));(e=>{function i(r){return r.type==="API"}e.is=i;function t(){return{disabled:!1,type:"API",name:"",successActions:new oe,errorActions:new oe,userAPIId:""}}e.defaultData=t})(LE||(LE={}));(e=>{function i(r){return r.type==="WEBHOOK"}e.is=i;function t(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new oe,userWebhookId:""}}e.defaultData=t})(_E||(_E={}));(e=>{function i(r){return r.type==="AIAssistantListener"}e.is=i;function t(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new oe,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=t})(kE||(kE={}));(e=>{function i(r){return r.type==="AIAssistantTrigger"}e.is=i;function t(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new oe}}e.defaultData=t})(FE||(FE={}))});function UE(i){let t=typeof i;return i!==null&&(t==="object"||t==="function")}function Ap(i){return typeof i=="string"&&i.length===36?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(i):!1}var ko,ms,zE,Ir,hi,Oi,vl,VE,p0,tn,Jt,Ve,xm,wa,bl,GE,_n=xe(()=>{"use strict";ko="personal camera",ms="a218fcc3-276b-49b9-b485-49037fd14f5f",zE=2500134,Ir=5526619;(h=>{function i(f,m){return f[0]===m[0]&&f[1]===m[1]}h.isEqual=i;function t(f,m,y){return[f[0]+(m[0]-f[0])*y,f[1]+(m[1]-f[1])*y]}h.lerp=t;function e(f,m){return[f[0]+m[0],f[1]+m[1]]}h.add=e;function r(f,m){return[f[0]-m[0],f[1]-m[1]]}h.sub=r;function n(f,m){return[f[0]*m[0],f[1]*m[1]]}h.multiply=n;function o(f,m){return[f[0]/m[0],f[1]/m[1]]}h.divide=o;function a(f,m){return Math.pow(m[0]-f[0],2)+Math.pow(m[1]-f[1],2)}h.distanceSquared=a;function s(f,m){return Math.sqrt(a(f,m))}h.distance=s;function l(f,m){return f[0]*m[0]+f[1]*m[1]}h.dot=l;function c(f,m){return[f[0]*m,f[1]*m]}h.scalarMultiply=c;function d(f,m,y){let g=h.sub(m,f),v=h.sub(y,f),b=h.dot(g,v)/h.dot(g,g),S=h.scalarMultiply(g,b);return h.add(f,S)}h.projectionOnto=d;function u(f,m,y){return s(f,d(f,m,y))}h.projectionOntoDistance=u;function p(f,m){return[(f[0]+m[0])*.5,(f[1]+m[1])*.5]}h.center=p})(hi||(hi={}));(s=>{function i(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]}s.isEqual=i;function t(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}s.add=t;function e(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]}s.sub=e;function r(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]}s.div=r;function n(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]}s.mul=n;function o(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])}s.dist=o;function a(l,c,d){return[l[0]+(c[0]-l[0])*d,l[1]+(c[1]-l[1])*d,l[2]+(c[2]-l[2])*d]}s.lerp=a})(Oi||(Oi={}));(e=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}e.isEqual=i;function t(r,n,o){return[r[0]+(n[0]-r[0])*o,r[1]+(n[1]-r[1])*o,r[2]+(n[2]-r[2])*o,r[3]+(n[3]-r[3])*o]}e.lerp=t})(vl||(vl={}));(a=>{let i=180/Math.PI,t=Math.PI/180;function e(s){return typeof s=="number"?s*i:s}function r(s){return typeof s=="number"?s*t:s}function n(s){return[e(s[0]),e(s[1]),e(s[2])]}a.radToDeg=n;function o(s){return[r(s[0]),r(s[1]),r(s[2])]}a.degToRad=o})(VE||(VE={}));(n=>{n.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(o,a){for(let s=0;s<16;s++)if(o[s]!==a[s])return!1;return!0}n.isEqual=t;function e(o){return o??n.identity}n.simplify=e;function r(o,a){let s=a.slice(0);for(let l=0,c=a.length;l<c;l+=3){let d=o[3]*a[l]+o[7]*a[l+1]+o[11]*a[l+2]+o[15];s[l]=(o[0]*a[l]+o[4]*a[l+1]+o[8]*a[l+2]+o[12])/d,s[l+1]=(o[1]*a[l]+o[5]*a[l+1]+o[9]*a[l+2]+o[13])/d,s[l+2]=(o[2]*a[l]+o[6]*a[l+1]+o[10]*a[l+2]+o[14])/d}return s}n.applyMatrix4=r})(p0||(p0={}));(n=>{n.zero=[0,0,0,0,0,0],n.INDEX_MAP=[4,8,1,9,2,6];function e(o){let a=[...p0.identity];for(let s=0;s<6;s++)a[n.INDEX_MAP[s]]=o[s];return a}n.toMatrix=e;function r(o){return[o[n.INDEX_MAP[0]],o[n.INDEX_MAP[1]],o[n.INDEX_MAP[2]],o[n.INDEX_MAP[3]],o[n.INDEX_MAP[4]],o[n.INDEX_MAP[5]]]}n.fromMatrix=r})(tn||(tn={}));(p=>{function i(h){return typeof h=="object"&&typeof h.r=="number"&&typeof h.g=="number"&&typeof h.b=="number"}p.isRGB=i,p.white={r:1,g:1,b:1},p.red={r:1,g:0,b:0},p.black={r:0,g:0,b:0};function n(h){return{r:Math.round(h.r*255),g:Math.round(h.g*255),b:Math.round(h.b*255),a:1}}p.toRgb255a1=n;function o(h){return{r:h.r,g:h.g,b:h.b}}p.clone=o;function a(h){return h=Math.floor(h),{r:(h>>16&255)/255,g:(h>>8&255)/255,b:(h&255)/255}}p.fromHex=a;function s(h){return Math.round(h.r*255)*65536+Math.round(h.g*255)*256+Math.round(h.b*255)}p.toHex=s;function l(h,f){return h.r===f.r&&h.g===f.g&&h.b===f.b}p.equals=l;function c(h,f){return h.r.toFixed(2)===f.r.toFixed(2)&&h.g.toFixed(2)===f.g.toFixed(2)&&h.b.toFixed(2)===f.b.toFixed(2)}p.equalsFixed=c;function d(h,f,m){return{r:h.r+(f.r-h.r)*m,g:h.g+(f.g-h.g)*m,b:h.b+(f.b-h.b)*m}}p.lerp=d;function u(h){return UE(h)?"r"in h&&"g"in h&&"b"in h&&!("a"in h):!1}p.is=u})(Jt||(Jt={}));(d=>{d.white={...Jt.white,a:1};function t(u){return UE(u)?"r"in u&&"g"in u&&"b"in u&&"a"in u:!1}d.is=t,d.transparent={...Jt.white,a:0};function r(u){return{r:u[0],g:u[1],b:u[2],a:u[3]}}d.from0to1=r;function n(u,p){return{...Jt.fromHex(u),a:p}}d.fromHexAndA=n;function o(u){return{r:Math.round(u.r*255),g:Math.round(u.g*255),b:Math.round(u.b*255),a:u.a}}d.toRgb255a1=o;function a(u,p){return Jt.equals(u,p)&&u.a===p.a}d.equals=a;function s(u,p){return Jt.equalsFixed(u,p)&&u.a.toFixed(2)===p.a.toFixed(2)}d.equalsFixed=s;function l(u,p,h){return{r:u.r+(p.r-u.r)*h,g:u.g+(p.g-u.g)*h,b:u.b+(p.b-u.b)*h,a:u.a+(p.a-u.a)*h}}d.lerp=l;function c({r:u,g:p,b:h,a:f}=d.white){return`rgba(${u*255}, ${p*255}, ${h*255}, ${f})`}d.toStyle=c})(Ve||(Ve={}));(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(xm||(xm={}));(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(wa||(wa={}));(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})(bl||(bl={}));(o=>(o.linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]))(GE||(GE={}))});var jE,HE,WE,qE,XE,YE,KE,h0,QE,ZE,f0,JE,$E,eT,m0,tT,y0,rT,nT,g0,iT,Sm,oT,aT,sT,lT,cT,dT=xe(()=>{"use strict";yt();u0();(t=>t.defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"})(jE||(jE={}));(t=>t.defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"})(HE||(HE={}));(t=>t.defaultData={type:"Link",name:"",url:null,context:"tab"})(WE||(WE={}));(t=>t.defaultData={type:"Destroy",name:"",objects:[],delay:0})(qE||(qE={}));(t=>t.defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"})(XE||(XE={}));(t=>t.defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"})(YE||(YE={}));(t=>t.defaultData={type:"Reset",name:"",delay:0})(KE||(KE={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1})(h0||(h0={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(QE||(QE={}));(o=>(o.defaultData={type:"Audio",name:"",...h0.defaultData},o.hasAudioByActions=a=>a.some(({data:s})=>s.type==="Audio"&&s.interaction==="play"&&s.audio),o.hasAudioByEvents=a=>o.getAudiosByEvents(a).length>0,o.getAudiosByActions=a=>{let s=[];return a.forEach(l=>{let c=l.data;c.type==="Audio"&&c.interaction==="play"&&c.audio&&s.push(l),c.type==="Conditional"&&(s.push(...o.getAudiosByActions(c.ifActions)),s.push(...o.getAudiosByActions(c.elseActions)))}),s},o.getAudiosByEvents=a=>{let s=[];return a.forEach(({data:l})=>{Rc.is(l)||l.type==="Collision"||l.type==="Start"||l.type==="Trigger"||l.type==="VariableChange"||l.type==="WEBHOOK"||l.type==="AIAssistantTrigger"?s.push(...o.getAudiosByActions(l.actions)):l.type==="Conditional"?(s.push(...o.getAudiosByActions(l.inActions)),s.push(...o.getAudiosByActions(l.outActions))):l.type==="GameControl"?Object.values(l.gameActions).forEach(c=>{s.push(...o.getAudiosByActions(c))}):l.type==="DragDrop"?(s.push(...o.getAudiosByActions(l.dragDropActions.drag)),s.push(...o.getAudiosByActions(l.dragDropActions.drop))):l.type==="Resize"?l.breakpoints.forEach(({data:c})=>{s.push(...o.getAudiosByActions(c.actions))}):l.type==="API"&&(s.push(...o.getAudiosByActions(l.successActions)),s.push(...o.getAudiosByActions(l.errorActions)))}),s}))(ZE||(ZE={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1/0})(f0||(f0={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(JE||(JE={}));(o=>(o.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...f0.defaultData},o.hasVideoByActions=a=>a.some(({data:s})=>s.type==="Video"&&s.interaction==="play"&&s.layerId),o.hasVideoByObject=a=>{if(a.events){for(let{data:s}of a.events)if((Rc.is(s)||s.type==="Start")&&o.hasVideoByActions(s.actions))return!0}},o.getVideosByActions=a=>{let s=[];return a.forEach(l=>{let c=l.data;c.type==="Video"&&c.interaction==="play"&&c.layerId&&s.push(l)}),s},o.getVideosByEvents=a=>{let s=[];return a.forEach(({data:l})=>{(Rc.is(l)||l.type==="Start")&&s.push(...o.getVideosByActions(l.actions))}),s}))($E||($E={}));(t=>{function i(e){return{state:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}}t.defaultData=i})(eT||(eT={}));(t=>{function i(){return{tweens:new oe,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}}t.defaultData=i})(m0||(m0={}));(t=>{function i(e){return{type:"Transition",name:"",runMode:"Once",object:e??null,...m0.defaultData()}}t.defaultData=i})(tT||(tT={}));(t=>{function i(e){return{interaction:"play",timeline:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}}t.defaultData=i})(y0||(y0={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(rT||(rT={}));(t=>{function i(e){return{type:"TimelineAnimation",name:"",...y0.defaultData(e)}}t.defaultData=i})(nT||(nT={}));(t=>{function i(e,r,n){return{interaction:"play",object:e,clipId:r,crop:n,crop2:n,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}}t.defaultData=i})(g0||(g0={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(iT||(iT={}));(e=>{function i(r,n,o){return{type:"Animation",name:"",...g0.defaultData(r,n,o)}}e.defaultData=i;function t(r){return r.interaction==="pause"||r.interaction==="stop"}e.isPause=t})(Sm||(Sm={}));(t=>t.defaultData={type:"SetVariable",name:"",variableId:"",expression:[]})(oT||(oT={}));(t=>t.defaultData=()=>({type:"Conditional",name:"",ifActions:new oe,elseActions:new oe,condition:[]}))(aT||(aT={}));(t=>t.defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0})(sT||(sT={}));(t=>t.defaultData={type:"ClearLocalStorage",name:"",target:"all"})(lT||(lT={}));(t=>t.defaultData={name:"",type:"UserAPI"})(cT||(cT={}))});var uT,pT=xe(()=>{"use strict";(e=>(e.emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),r=>r.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6))(uT||(uT={}))});var co,uo,v0=xe(()=>{"use strict";(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(r){return e.all.includes(r)}e.is=t})(co||(co={}));(h=>{h.DefaultUp=[0,1,0],h.DefaultTargetOffset=1e3,h.MinTargetOffset=.001;function r(f){return f===void 0||!Number.isFinite(f)||f<h.MinTargetOffset?h.DefaultTargetOffset:f}h.sanitizeTargetOffset=r,h.DefaultAzimuth=-24,h.DefaultElevation=15;let a=h.DefaultAzimuth*Math.PI/180,s=h.DefaultElevation*Math.PI/180,l=180/Math.PI;h.DefaultPosition=[h.DefaultTargetOffset*Math.sin(a)*Math.cos(s),h.DefaultTargetOffset*Math.sin(s),h.DefaultTargetOffset*Math.cos(a)*Math.cos(s)],h.DefaultRotation=[Math.atan2(-Math.sin(s),Math.cos(a)*Math.cos(s))*l,Math.asin(Math.sin(a)*Math.cos(s))*l,Math.atan2(Math.sin(a)*Math.sin(s),Math.cos(a))*l],h.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:h.DefaultUp,isUpVectorFlipped:!1,targetOffset:h.DefaultTargetOffset};function p(f){return f.type==="PerspectiveCamera"?f.perspective?.zoom??1:f.orthographic?.zoom??1}h.getZoom=p})(uo||(uo={}))});var Fo,Am,b0,wm,Cm,Em,Tm,Pm,x0=xe(()=>{"use strict";(r=>{function i(n,o=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:Math.max(typeof n[0]=="number"?n[0]:1,typeof n[1]=="number"?n[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[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",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof n[0]=="number"?n[0]+n[0]:1)*o,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:n.map(a=>(typeof a=="number"?a:1)*(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"}}}r.defaultData=i;function t(n,o){let a={...n};if(b0.forEach(s=>{Object.assign(a,{[s]:o[s]??n[s]})}),a.radial={...n.radial},o.radial){let s=n.radial,l=o.radial;wm.forEach(c=>{Object.assign(a.radial,{[c]:l[c]??s[c]})})}if(a.linear={...n.linear},o.linear){let s=n.linear,l=o.linear;Cm.forEach(c=>{Object.assign(a.linear,{[c]:l[c]??s[c]})})}if(a.grid={...n.grid},o.grid){let s=n.grid,l=o.grid;Em.forEach(c=>{Object.assign(a.grid,{[c]:l[c]??s[c]})})}if(a.toObject={...n.toObject},o.toObject){let s=n.toObject,l=o.toObject;Tm.forEach(c=>{Object.assign(a.toObject,{[c]:l[c]??s[c]})})}if(a.randomnessObject={...n.randomnessObject},o.randomnessObject){let s=n.randomnessObject,l=o.randomnessObject;Pm.forEach(c=>{Object.assign(a.randomnessObject,{[c]:l[c]??s[c]})})}return a}r.merge=t;function e(n){return!!(n.randomnessObject||n.toObject)}r.isPartial=e})(Fo||(Fo={}));(r=>{r.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(n,o){let a=[];n.count!==void 0&&a.push({type:0,path:o,props:{count:n.count}});for(let s of t){let l=n[s];l&&Object.keys(l).length>0&&a.push({type:0,path:[...o,s],props:l})}return a}r.toOps=e})(Am||(Am={}));b0=["count"],wm=["radius","start","end","position","scale","rotation"],Cm=["position","scale","rotation"],Em=["count","size"],Tm=["count","position","scale","rotation"],Pm=["strength","scale","rotation","position","movement","seed","freqScale"]});var Mm,Om,S0=xe(()=>{"use strict";_n();(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(r){return e.all.includes(r)}e.is=t})(Mm||(Mm={}));(e=>{function i(r){return t(r)}e.defaultData=i;function t(r){if(r==="PointLight")return{type:r,color:Ve.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(r==="SpotLight")return{type:r,color:Ve.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:Ve.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(Om||(Om={}))});var Bc,A0=xe(()=>{"use strict";(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",emitTimeDuration:1,...r.defaultCollisionData}))(Bc||(Bc={}))});var Im,w0=xe(()=>{"use strict";(e=>(e.defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]))(Im||(Im={}))});var ys,Dm=xe(()=>{"use strict";(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]})(ys||(ys={}))});var C0,E0,Rm,hT,T0=xe(()=>{"use strict";(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}e.equals=t})(C0||(C0={}));(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0};function t(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe&&(r.shadowCatcher??!1)===(n.shadowCatcher??!1)}e.equals=t})(E0||(E0={}));(t=>t.defaultData={...E0.defaultData,...C0.defaultData})(Rm||(Rm={}));(t=>{function i(e,r){let n=[];if("material"in e){let o=typeof e.material=="string"?r.materials[e.material]??r.lib.materials[e.material]?.asset:e.material;o&&n.push(o)}else if("materials"in e)for(let o of e.materials){let a=typeof o=="string"?r.materials[o]??r.lib.materials[o]?.asset:o;a&&n.push(a)}return n}t.getMaterialData=i})(hT||(hT={}))});var Nc,P0=xe(()=>{"use strict";(e=>{function i(r){if(typeof r!="object"||r===null||Array.isArray(r)||ArrayBuffer.isView(r)||typeof r[0]!="number")return null;let n=Object.getPrototypeOf(r);if(n!==Object.prototype&&n!==null)return null;let o=Object.keys(r),a=new Uint8Array(o.length),s=r;for(let l=0;l<o.length;l++){let c=s[l];if(o[l]!==String(l)||typeof c!="number"||!Number.isInteger(c)||c<0||c>255)return null;a[l]=c}return a}e.bytesFromFlattened=i,e.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}})(Nc||(Nc={}))});var Lc,M0=xe(()=>{"use strict";(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(Lc||(Lc={}))});function mT(i){return i.type!=="displace"}var O0,fT,wp,I0,Bm,yT,qt,sr,Cp=xe(()=>{"use strict";yt();_n();P0();M0();_n();(t=>{function i(e){return e==="texture"||e==="video"||e==="color"||e==="depth"||e==="normal"||e==="gradient"||e==="noise"||e==="fresnel"||e==="cavity"||e==="dust"||e==="rainbow"||e==="toon"||e==="outline"||e==="particle"||e==="transmission"||e==="reflection"||e==="matcap"||e==="displace"||e==="pattern"||e==="vertexColor"||e==="light"}t.is=i})(O0||(O0={}));(t=>{function i(e){return e==="luminance"||e==="r"||e==="g"||e==="b"||e==="a"}t.is=i})(fT||(fT={}));(t=>{function i(e){return typeof e=="object"&&e!==null&&e.image!=null}t.is=i})(wp||(wp={}));(t=>{function i(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=i})(I0||(I0={}));Bm=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],yT=["wrapping","image","video","name","minFilter","magFilter"];(a=>{function i(s,l){let{texture:c,...d}=l;if(Object.assign(s,d),c){let u=s.texture;u&&Object.assign(u,c)}}a.patch=i;function t(s){return{...a.defaultData("color"),color:s}}a.defaultColorLayer=t;function e(s,l){return s==="light"&&l?n(l):o(s)}a.defaultData=e;function r(s,l){return s!=="light"?e(s):e("light",typeof l=="string"&&I0.is(l)?l:"physical")}a.defaultDataFor=r;function n(s){let l={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(s){case"phong":return{...l,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...l,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...l,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...l,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}function o(s){let l={alpha:1,mode:0,isMask:!1,visible:!0};switch(s){case"texture":return{...l,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,magFilter:1006},crop:!1};case"video":return{...l,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Lc.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:Jt.fromHex(Ir)};case"vertexColor":return{...l,type:"vertexColor"};case"depth":return{...l,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{...l,type:"normal",cnormal:[1,1,1]};case"gradient":return{...l,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{...l,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Jt.fromHex(6710886),a:1},colorB:{...Jt.fromHex(6710886),a:1},colorC:{...Jt.fromHex(16777215),a:1},colorD:{...Jt.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"cavity":return{...l,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...l,type:"fresnel",color:Ve.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Ve.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...l,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...l,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:Ve.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Ve.fromHexAndA(0,1),contourColor:Ve.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{...l,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...l,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...l,type:"reflection",blur:0,thickness:10/1e4,steps:60,stepSize:5/1e3,tracingMode:1,mirror:0};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{...l,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Jt.fromHex(0),a:1},colorB:{...Jt.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}}}})(qt||(qt={}));(m=>{function i(y){let g=[],v=new Map,b=(A,w)=>{let C=hl(A);if(typeof C!="object"||C===null||ArrayBuffer.isView(C))return A;if(v.has(C))return v.get(C)??A;v.set(C,void 0);let T=S(C,w)??A;return v.set(C,T),T},S=(A,w)=>{let C=A;if(!Array.isArray(A)){if(typeof C[0]=="number")return;if(typeof C.name=="string"){let M=Nc.bytesFromFlattened(hl(C.data));if(M!==null)return g.push({path:`${w}/data`,bytes:M.byteLength}),Object.setPrototypeOf({...C,data:M},Object.getPrototypeOf(A))}}let T=null;for(let M of Object.keys(A)){let D=C[M],I=b(D,`${w}/${M}`);I!==D&&(T===null&&(T=Array.isArray(A)?[...A]:{...C},Object.setPrototypeOf(T,Object.getPrototypeOf(A))),T[M]=I)}return T??void 0};return{material:b(y,""),restored:g}}m.restoreImageBytes=i;function t(y){let g=hl(y.layers);if(!Array.isArray(g)||g instanceof oe||!g.every(S=>typeof S=="object"&&S!==null&&typeof S.id=="string"&&typeof S.data=="object"))return{material:y,restored:!1};let v=Object.setPrototypeOf([...g],oe.prototype),b=hl(y);return{material:Object.setPrototypeOf({...b,layers:v},Object.getPrototypeOf(b)),restored:!0}}m.restoreLayersSeq=t;function e(y){return!y.layers.some(v=>v.data.type==="texture"&&v.data.projection!==0||v.data.type==="depth"&&!v.data.isWorldSpace||v.data.type==="noise"||v.data.type==="dust"&&v.data.noiseStrength!==0||v.data.type==="displace")}m.isMergable=e;function r(y){let g="";return y.layers.forEach(v=>{Object.entries(v.data).forEach(([b,S])=>{g+=`${b}${S}`,Array.isArray(S)?S.forEach(x=>g+=`${x}`):typeof S=="object"?Object.values(S).forEach(x=>{typeof x=="number"?g+=`${x.toFixed(4)}`:g+=`${x}`}):g+=`${S}`})}),g}m.getHash=r;function n(){return{layers:new oe}}m.defaultEmptyData=n;function o(y="layer1",g="layer2"){return d("physical",y,g)}m.defaultData=o;function a(y,g){return{...y,name:g}}m.withName=a;function s(y,g){if(typeof y!="string"||!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(y))return y;let{r:v,g:b,b:S}=Jt.fromHex(parseInt(y.slice(1,7),16)),x=y.length===9?parseInt(y.slice(7),16)/255:void 0;if(Array.isArray(g))return g.length>3?[v,b,S,x??g[3]]:[v,b,S];let A=g;return typeof A?.r!="number"?y:typeof A.a=="number"?{r:v,g:b,b:S,a:x??A.a}:{r:v,g:b,b:S}}function l(y){let g=y?.data;return typeof g=="object"&&g!==null}m.isLayerEntry=l;function c(y){if(y.layers===void 0)return{...y,layers:d("phong").layers};let g=Array.from(y.layers);if(g.every(l))return y;let v=new oe;return g.forEach((b,S)=>{if(l(b)){v.push(b);return}let{id:x,fi:A,...w}=b??{};if(typeof w.type!="string"||!O0.is(w.type))return;let C=qt.defaultDataFor(w.type,w.category),T={...C,...w};for(let[M,D]of Object.entries(w)){let I=C[M];T[M]=Array.isArray(D)&&Array.isArray(I)&&Array.isArray(I[0])?D.map(_=>s(_,I[0])):s(D,I)}v.push({id:typeof x=="string"&&x?x:`layer${S+1}`,fi:typeof A=="number"?A:S,data:T})}),{...y,layers:v}}m.withRepairedLayers=c;function d(y,g="layer1",v="layer2",b=Jt.fromHex(16777215)){let S=new oe;return S.push({fi:0,data:qt.defaultData("light",y),id:g}),S.push({fi:1,data:qt.defaultData("color"),id:v}),{layers:S}}m.defaultTwoLayerData=d;function u(y,g,v="layer1",b="layer2"){let S=new oe;return S.push({fi:0,data:qt.defaultData("light",g),id:v}),S.push({fi:1,data:qt.defaultColorLayer(y),id:b}),{layers:S}}m.defaultColorMaterial=u;function p(y){let g=qt.defaultData("texture");y&&Object.assign(g.texture,{image:y});let v=new oe;return v.push({fi:0,data:g,id:"layer1"}),v.push({fi:1,data:{...qt.defaultData("transmission"),alpha:1},id:"layer2"}),v.push({fi:2,data:{...qt.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:v}}m.defaultUIObjectMaterial=p;function h(y,g="physical",v="layer1",b="layer2"){let S=qt.defaultData("texture");Object.assign(S.texture,{image:y});let x=new oe;return x.push({fi:0,data:S,id:v}),x.push({fi:1,data:qt.defaultData("light",g),id:b}),{layers:x}}m.defaultTwoLayerTextureData=h;function f(y,g="physical",v="layer1",b="layer2"){let S=qt.defaultData("video");Object.assign(S.texture,{video:y});let x=new oe;return x.push({fi:0,data:S,id:v}),x.push({fi:1,data:qt.defaultData("light",g),id:b}),{layers:x}}m.defaultTwoLayerVideoTextureData=f})(sr||(sr={}))});var gT=xe(()=>{"use strict"});var gs,D0=xe(()=>{"use strict";yt();(e=>{function i(){return{points:new oe,roundness:0,shapeHoles:[],isClosed:!1}}e.defaultData=i;function t(r,n,o){let a=s=>[s[0]*n,s[1]*o];return{...r,points:new oe(...r.points.map(({id:s,fi:l,data:c})=>({id:s,fi:l,data:{...c,position:a(c.position),controlPrevious:{position:a(c.controlPrevious.position)},controlNext:{position:a(c.controlNext.position)}}}))),shapeHoles:r.shapeHoles.map(s=>t(s,n,o))}}e.scaled=t})(gs||(gs={}))});var _c,Sl,Nm,Lm,Ep,R0=xe(()=>{"use strict";yt();(t=>{function i(){return{points:new oe,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}t.defaultData=i})(_c||(_c={}));Sl={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(t=>{function i(e,r){let n={...e};return Ep.forEach(o=>{Object.assign(n,{[o]:r[o]??e[o]})}),n}t.merge=i})(Nm||(Nm={}));Lm={shape:Sl,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},Ep=["depth","offset","angle","twist","startScale","endScale"]});var Tp,kc,Vo,_m,km=xe(()=>{"use strict";D0();R0();(r=>{function i(n){return n==="PolygonGeometry"||n==="RectangleGeometry"||n==="StarGeometry"||n==="TriangleGeometry"||n==="EllipseGeometry"||n==="UIGeometry"}r.is2DParametricMesh=i;function t(n){return n==="PolygonGeometry"||n==="RectangleGeometry"||n==="StarGeometry"||n==="TriangleGeometry"||n==="EllipseGeometry"||n==="PathGeometry"||n==="VectorGeometry"||n==="ConeGeometry"||n==="CubeGeometry"||n==="CylinderGeometry"||n==="DodecahedronGeometry"||n==="HelixGeometry"||n==="IcosahedronGeometry"||n==="LatheGeometry"||n==="PyramidGeometry"||n==="SphereGeometry"||n==="PlaneGeometry"||n==="BackdropGeometry"||n==="TorusGeometry"||n==="TorusKnotGeometry"||n==="BooleanGeometry"||n==="TextGeometry"||n==="InputGeometry"||n==="DecalGeometry"}r.isParametricMesh=t;function e(n){return n==="PolygonGeometry"||n==="RectangleGeometry"||n==="StarGeometry"||n==="TriangleGeometry"||n==="EllipseGeometry"||n==="PathGeometry"||n==="VectorGeometry"||n==="ConeGeometry"||n==="CubeGeometry"||n==="CylinderGeometry"||n==="DodecahedronGeometry"||n==="HelixGeometry"||n==="IcosahedronGeometry"||n==="LatheGeometry"||n==="PyramidGeometry"||n==="SphereGeometry"||n==="PlaneGeometry"||n==="BackdropGeometry"||n==="TorusGeometry"||n==="TorusKnotGeometry"||n==="TextGeometry"||n==="SubdivGeometry"||n==="NonParametricGeometry"}r.isSwappableGeometry=e})(Tp||(Tp={}));(t=>{function i(e,r){let n={...e};if(Object.assign(n,r),n.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(n.extrusion={...e.extrusion},Object.assign(n.extrusion,Nm.merge(n.extrusion,r.extrusion))),e.type==="VectorGeometry"&&n.type==="VectorGeometry"){let o=(l,c)=>typeof l=="number"&&typeof c=="number"&&c!==0?l/c:1,a=o(n.width,e.width),s=o(n.height,e.height);(a!==1||s!==1)&&(n.shape=gs.scaled(e.shape,a,s))}return n}t.merge=i})(kc||(kc={}));(t=>{function i(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:_c.defaultData(),extrusion:Lm};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:gs.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==="ShapeBlendGeometry")return{type:e,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(e==="DecalGeometry")return{type:e,width:200,height:200,depth:200,offset:1,projection:"all",projectionTargets:[]};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",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="InputGeometry")return{...t.defaultData("TextGeometry"),type:e,editable:!0};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=i})(Vo||(Vo={}));_m=["width","height","depth"]});var Ii,B0=xe(()=>{"use strict";_n();(a=>{a.defaultData={enabled:!1,useBackgroundColor:!1,color:Jt.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0};function t(s){return s.mode??"linear"}a.getMode=t;function e(s){let l=t(s);return l==="height"?1:l==="both"?2:0}a.getModeIndex=e;function r(s){return s.density??a.defaultData.density}a.getDensity=r;function n(s){return s.heightFalloff??a.defaultData.heightFalloff}a.getHeightFalloff=n;function o(s){return s.heightBase??a.defaultData.heightBase}a.getHeightBase=o})(Ii||(Ii={}))});var N0,Go,Fm=xe(()=>{"use strict";(t=>t.defaultData={image:null,rotation:0,blur:32,showBackground:!0})(N0||(N0={}));(t=>t.defaultData={enabled:!1,mode:"hdri",hdri:N0.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2})(Go||(Go={}))});var Vm,L0=xe(()=>{"use strict";(e=>{let i={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...i,blendFunction:16,granularity:15},bloom:{...i,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...i,offset:[2,2]},vignette:{...i,darkness:1,offset:0},hueSaturation:{...i,hue:3,saturation:0},brightnessContrast:{...i,brightness:.25,contrast:0},depthOfField:{...i,focusDistance:100,focalLength:20,bokehScale:5},noise:{...i,blendFunction:16}}})(Vm||(Vm={}))});var Pp,_0,k0,F0,vs,V0,Gm,Um=xe(()=>{"use strict";B0();Fm();L0();_n();(e=>{e.defaultData={type:"normal",softShadowQuality:"low"};function t(r){return r==null?!1:r.type===void 0||r.type==="soft"}e.isSoft=t})(Pp||(Pp={}));(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(_0||(_0={}));(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(k0||(k0={}));(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1};function t(r){return r===void 0||r.pipeline==="classic"&&(r.toneMapping==="none"||r.toneMapping==="aces")&&r.exposure===1}e.isUntouched=t})(F0||(F0={}));(t=>t.defaultData={usePhysics:!1,gravity:-10})(vs||(vs={}));(t=>t.defaultData={playCamera:ko,gameControlObject:null})(V0||(V0={}));(t=>t.defaultData={backgroundColor:Ve.fromHexAndA(zE,1),postprocessing:Vm.defaultData,fog:Ii.defaultData,sky:Go.defaultData,globalPhysics:vs.defaultData,ambient:_0.defaultData,ao:k0.defaultData,shadow:Pp.defaultData,publish:V0.defaultData,grading:F0.defaultData})(Gm||(Gm={}))});var zm,vT=xe(()=>{"use strict";(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(zm||(zm={}))});var bT,Fc,ET,vr,jm,xT,ST,AT,wT,Ca,Al,Hm,Vc,Uo,po,CT,Ea,Mp=xe(()=>{"use strict";yt();v0();S0();A0();w0();Dm();T0();_n();Cp();km();x0();gr();Um();vT();(e=>{function i(r){return r==="Component"||r==="Instance"}e.isComponentRelated=i;function t(r){return r==="Empty"||r==="Instance"}e.isEmptyOrComponent=t})(bT||(bT={}));(n=>{n.identity={...xm.identity,shear:tn.zero};function t(o){return{position:o.position,rotation:o.rotation,scale:o.scale,pivot:o.pivot,pivotRotation:o.pivotRotation,shear:o.shear}}n.fromObject=t;function e(o,a){return{position:a?.position||o.position,rotation:a?.rotation||o.rotation,pivot:a?.pivot||o.pivot,pivotRotation:a?.pivotRotation||o.pivotRotation,scale:a?.scale||o.scale,shear:a?.shear||o.shear}}n.merge=e;function r(o,a){return Xf({position:Oi.isEqual(o.position,a.position)?void 0:a.position,rotation:Oi.isEqual(o.rotation,a.rotation)?void 0:a.rotation,scale:Oi.isEqual(o.scale,a.scale)?null:a.scale,shear:a.shear?.every((s,l)=>s===o.shear?.[l])?void 0:a.shear})}n.diff=r})(Fc||(Fc={}));ET=["slide","offset"];(t=>t.defaultData={states:new oe,events:new oe,visible:!0,raycastLock:!1,physics:ys.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Fc.identity,cloner:null})(vr||(vr={}));(t=>t.defaultData={type:"Empty",...vr.defaultData})(jm||(jm={}));(t=>t.defaultData={type:"ParticleCollider",...zm.defaultData,...vr.defaultData})(xT||(xT={}));(t=>t.defaultData={type:"Component",...vr.defaultData})(ST||(ST={}));(t=>t.defaultData={type:"Particle",...vr.defaultData,...Bc.defaultData})(AT||(AT={}));(t=>t.defaultData={type:"Hair",...vr.defaultData,...Im.defaultData})(wT||(wT={}));(t=>t.defaultData={type:"Mesh",...vr.defaultData,...Rm.defaultData})(Ca||(Ca={}));(t=>t.defaultData={...vr.defaultData,...Fc.identity,position:uo.DefaultPosition,rotation:uo.DefaultRotation,...uo.defaultData})(Al||(Al={}));(e=>{function i(r){return{...vr.defaultData,...Om.defaultData(r)}}e.defaultData=i,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(Hm||(Hm={}));(e=>{function i(r,n,o=0){for(;o<n.length;){let a=r?r[n[o]]:void 0;if(n.length===o+1)return a;if(a)r=a.descendants,o+=1;else return}}e.resolveWithDes=i;function t(r,n,o=0){let a=i(r,n,o);if(a){let s=Object.keys(a);if(s.length===1&&s[0]==="descendants")return}return a}e.resolve=t})(Vc||(Vc={}));(o=>{o.rootOverrideProps=["physics","events"],o.compositeNonOptionalOverrideProps=["geometry"],o.compositeEntireOverrideOverrideProps=["material"];function r(a,s){return{...vr.defaultData,...s,component:a,overrides:new vt,physics:void 0,events:void 0,type:"Instance"}}o.ofComponent=r;function n(a){let s=Fc.fromObject(a.data);return r(a.id,s)}o.fromComponentData=n})(Uo||(Uo={}));(e=>{e.defaultData={type:"Page",...vr.defaultData,physics:{...ys.defaultData,fusedBody:!1},...Gm.defaultData,camera:Al.defaultData,timelines:new ve};function t(r){return r.uiScene!==void 0}e.isUIPage=t})(po||(po={}));(s=>(s.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],shear:tn.zero,name:"Play Camera",visible:!0,raycastLock:!1,physics:ys.defaultData,states:new oe,events:new oe,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...uo.defaultData},s.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","shear"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},s.defaultMeshObject={name:"Rectangle",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("RectangleGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")},s.defaultBooleanObject={name:"Boolean",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("BooleanGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")},s.defaultShapeBlendObject={name:"Shape Blend",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("ShapeBlendGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")},s.defaultTextObject={name:"Text",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("TextGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")},s.defaultInputObject={name:"Input",...vr.defaultData,...Ca.defaultData,geometry:Vo.defaultData("InputGeometry"),material:sr.defaultTwoLayerData("physical","layer1","layer2")}))(CT||(CT={}));(n=>{function i(o,a){let s={name:a};return o.type==="Mesh"?(s.geometry={},"material"in o&&(s.material={layers:new vt}),"materials"in o&&(s.materials=o.materials.map(l=>({layers:new vt})))):co.is(o.type)&&(s.perspective={},s.orthographic={}),s}n.newEmpty=i;function t(o,a){if(a===void 0)return o;let s={...o};return"material"in s&&"material"in a&&a.material&&(s.material=Oc(s.material,l=>{if(typeof l!="string")for(let[c,d]of Object.entries(a.material.layers)){let u=l.layers.data(c);u&&qt.patch(u,d)}}).data),s.materials&&a.materials&&(s.materials=Oc(s.materials,l=>{for(let c=0;c<s.materials.length;c++){let d=a.materials[c];if(typeof d!="string")for(let[u,p]of Object.entries(d.layers)){let h=l[c]?.layers?.data(u);h&&qt.patch(h,p)}}}).data),s}function e(o,a){let s,l=[],c={orthographic:0,perspective:0,geometry:0};function d(u,p){for(let[h,f]of Object.entries(p.layers)){let{texture:m,...y}=f;if(m!==void 0&&Object.keys(m).length>0){let g={path:[...u,"layers",h,"texture"],props:m,type:0};l.push(g)}if(Object.keys(y).length>0){let g={path:[...u,"layers",h],props:y,type:0};l.push(g)}}}for(let[u,p]of Object.entries(a)){let h=p;if(u!=="name")if(u==="cloner")l.push(...Am.toOps(h,["cloner"]));else if(u==="pathSnapping")l.push({path:[u],props:{slide:h.slide,offset:h.offset},type:0});else if(u==="material")d(["material"],h);else if(u==="materials")for(let[f,m]of Object.entries(h))d(["materials",f],m);else if(c[u]===0){if(u==="geometry"&&h.extrusion!==void 0){let f={path:[u,"extrusion"],props:h.extrusion,type:0};l.push(f),h={...h},delete h.extrusion}if(Object.keys(h).length>0){let f={path:[u],props:h,type:0};l.push(f)}}else s===void 0&&(s={path:[],props:{},type:0},l.push(s)),s.props[u]=h}return l}n.toOps=e;function r(o,a){if(a===void 0)return o;let s={...o};if(Object.assign(s,Fc.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})}),co.is(o.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(o.type==="Mesh")"geometry"in a&&Object.assign(s,{geometry:kc.merge(s.geometry,a.geometry)}),(a.material||a.materials)&&(s=t(s,a)),s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Fo.merge(s.cloner,a.cloner)});else if(o.type==="Empty")s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Fo.merge(s.cloner,a.cloner)});else if(Mm.is(o.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=Jt.clone(l.color))}return s}n.patch=r})(Ea||(Ea={}))});var Gc,Wm=xe(()=>{"use strict";(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,rotationSpeed:1,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})(Gc||(Gc={}))});var Ri,Op=xe(()=>{"use strict";Wm();_n();(t=>t.defaultData={orbitControls:Gc.defaultData,playPage:ms,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,r)=>{let n=0,o=0;return r<5?o=-30:r<10&&(o=30),r===0||r===10||r===5?n=30:(r===4||r===11||r===9)&&(n=-30),[120,[n,o],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0})(Ri||(Ri={}))});var G0,U0,Ta,z0=xe(()=>{"use strict";(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(G0||(G0={}));(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(U0||(U0={}));(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...G0.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:U0.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(Ta||(Ta={}))});var Uc,Pa,qm=xe(()=>{"use strict";Mp();yt();Op();_n();gr();z0();(n=>{function i(o){return o.find(a=>a.data.type==="Page"&&a.data.globalPhysics.usePhysics)!==void 0}n.physicsEnabled=i;function t(o,a){let s=o.find(l=>l.data.type==="Page"&&l.data.timelines?.[a]!==void 0);return s&&s.data.timelines?.[a]}n.findTimeline=t;function e(o,a){let s=o.scene.objects.get(a);if(s&&s.data.type==="Component")return s;{let l=o.shared.lib.components[a];if(l)return{...l.asset,id:a}}}n.getComponentData=e;function r(o,a,s){o.scene.objects.traverseFrom(a,(l,c)=>{if(c.type==="Instance"){let d=e(o,c.component)?.data;d&&s(l,c,d.events)}else s(l,c,c.events)})}n.traverseModuleInstances=r})(Uc||(Uc={}));(c=>{c.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",c.defaultLight={fi:-1,data:Hm.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]};function e(d=!0,u=[]){let p=[];d&&p.push({...c.defaultLight}),p.push(...u);let h=new Rt;return h.push({fi:1,id:ms,data:{...po.defaultData,name:"Scene 1"},children:p}),h}c.createDefaultObjectTreeWithPage=e,c.defaultData={objects:e(),publish:Ri.defaultData,styles:Ta.defaultData()},c.emptyDataWithoutPage=function(){return{objects:new Rt,publish:Ri.defaultData,styles:Ta.defaultData()}},c.emptyDataWithPage=function(d=!0){return{objects:e(d),publish:Ri.defaultData,styles:Ta.defaultData()}},c.emptyData=function(){return{objects:new Rt,publish:{...Ri.defaultData},styles:Ta.defaultData()}};function s(d){return{...c.defaultData,objects:Mr(d,Rt.prototype)}}c.withObjs=s;function l(d,u){return s([{id:d,data:u,children:[],fi:0}])}c.withObj=l})(Pa||(Pa={}))});var zc,j0=xe(()=>{"use strict";(t=>t.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})(zc||(zc={}))});var Xm,TT,Dr,H0,PT,MT,ho,kn,Ym=xe(()=>{"use strict";yt();gr();(e=>(e.defaultData=r=>({url:r,name:"New Webhook",parametersSchemas:new oe}),e.defaultParameterValueByType=r=>r==="number"?0:r==="boolean"?!1:""))(Xm||(Xm={}));(t=>t.defaultData=(e,r="GET")=>({url:e,method:r,name:"New API",headers:new oe,queries:new oe,autoStart:!0}))(TT||(TT={}));(o=>{function i(a){return a.textValue!==void 0}o.isTextValue=i;function t(a){return typeof a=="number"}o.isNumber=t;function e(a){return typeof a=="boolean"}o.isBoolean=e;function r(a){return i(a)?"string":e(a)?"boolean":"number"}o.typeOfVariable=r;function n(a){return o.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():o.isBoolean(a)?a?"True":"False":o.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}o.getDisplayedValue=n})(Dr||(Dr={}));(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(H0||(H0={}));(t=>t.all=[...H0.all,"components"])(PT||(PT={}));(t=>{function i(){return{images:new ve,videos:new ve,colors:new ve,audios:new ve,particles:new ve,fonts:new ve,materials:new ve,components:new ve,variables:new ve,userAPIs:new ve,userWebhooks:new ve}}t.defaultData=i})(MT||(MT={}));(t=>{function i(){return{images:new ve,videos:new ve,colors:new ve,audios:new ve,particles:new ve,fonts:new ve,materials:new ve,components:new ve,variables:new ve,userAPIs:new ve,userWebhooks:new ve}}t.defaultData=i})(ho||(ho={}));(o=>{function i(){let a={};return a["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},Mr(a,ve.prototype)}o.defaultColors=i;function t(){return Mr({},ve.prototype)}o.defaultImages=t;function e(){return{catelogs:new ve,materials:new ve,images:new ve,videos:new ve,colors:new ve,audios:new ve,particles:new ve,fonts:new ve,variables:new oe,userAPIs:new ve,userWebhooks:new ve,lib:ho.defaultData()}}o.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)}}o.defaultVariables=r;function n(a,s){if(s.format==="HH:mm:ss"){let l=Math.floor(a/3600),c=Math.floor((a-l*3600)/60),d=Math.round(a-l*3600-c*60);return{textValue:[l,c,d]}}else if(s.format==="mm:ss"){let l=Math.floor(a/60),c=Math.round(a-l*60);return{textValue:[l,c]}}else return s.format==="number"?a=Math.round(a):a=Math.round(a*1e3)/1e3,a}o.getFormattedTimerTime=n})(kn||(kn={}))});var OT=xe(()=>{"use strict"});var bs,W0=xe(()=>{"use strict";yt();qm();j0();Ym();(l=>{l.defaultData={schema:135,scene:Pa.defaultData,frames:new ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",zc.defaultData),shared:{...kn.emptyData(),colors:kn.defaultColors()}},l.createDefaultData=function(){return gl.deserialize(gl.serialize(l.defaultData))},l.emptyDataForImports=function(){let c=Pa.emptyDataWithPage();return{schema:135,scene:c,frames:new ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",zc.defaultData),shared:{...kn.emptyData(),colors:kn.defaultColors(),images:kn.defaultImages()}}},l.emptyData=function(){return{schema:135,scene:Pa.emptyDataWithPage(),frames:new ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",zc.defaultData),shared:kn.emptyData()}},l.clipboard2dData=function(){return{schema:135,scene:Pa.emptyData(),frames:new ve,shared:kn.emptyData()}};function o(c){return{...c,shared:{...c.shared,lib:ho.defaultData()}}}l.withoutLib=o;function a(c,d){return Uc.getComponentData(c,d)}l.getComponentData=a;function s(c){let d=Object.values(c.shared.userAPIs);for(let u of d){let p=u.headers;for(let h of p)if(h.data.key.toLowerCase()==="authorization"&&h.data.value!=="")return!0}return!1}l.hasSensitiveData=s})(bs||(bs={}))});function Bi(i,t=[0,0]){let e=i&&!isNaN(i[0])?i[0]:t[0],r=i&&!isNaN(i[1])?i[1]:t[1];return[e,r]}function Ip(i,t,e){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:r,control2:n}=t??{...bl.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`}case 6:{let{mass:r,stiffness:n,damping:o,velocity:a}=e??{...wa.defaultData},s=new q0(r,n,o,a),l=s.solve(1);return()=>c=>s.solve(c)/l}case 8:return()=>r=>Math.floor(r)}}var IT,DT,fo,jc,q0,Km=xe(()=>{"use strict";yt();_n();(t=>{function i(e,r){return{id:e,name:r,duration:5,objectTimelines:new ve}}t.defaultData=i})(IT||(IT={}));(t=>{function i(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"}t.is=i})(DT||(DT={}));(S=>{function i(x,A){let w=[0,0],C=[1,1];if(x?.cubicControls)w=Bi(x.cubicControls.control1,w);else switch(x?.type){case 2:w=[.42,0];break;case 3:w=[0,0];break;case 4:w=[.42,0];break;case 1:w=[.25,.1];break;case 0:w=[0,0];break;case 7:w=[.25,1];break}if(A?.cubicControls)C=Bi(A.cubicControls.control2,C);else switch(A?.type){case 2:C=[1,1];break;case 3:C=[.58,1];break;case 4:C=[.58,1];break;case 1:C=[.25,1];break;case 0:C=[1,1];break;case 7:C=[.5,1];break}return{control1:w,control2:C}}S.getControlsWithDefault=i,S.BEZIER_PRESETS=[0,1,2,3,4,7];function e(x){if(!S.BEZIER_PRESETS.includes(x))return;let A={type:x};return{control1:i(A).control1,control2:i(void 0,A).control2}}S.presetHandles=e;let r=.001;function n(x,A){return Math.abs(x[0]-A[0])<r&&Math.abs(x[1]-A[1])<r}function o(x){return S.BEZIER_PRESETS.find(A=>{let w=e(A);return w!==void 0&&n(w.control1,x.control1)&&n(w.control2,x.control2)})}S.presetForHandles=o;function a(x){return{id:x,keyframes:new oe}}S.defaultData=a,S.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"];function l(x){let A=S.ROOT_PROPERTY_ORDER.indexOf(x[0]);return A===-1?S.ROOT_PROPERTY_ORDER.length:A}S.rowOrder=l;function c(x){return x.layerId??x.path.join(".")}S.propertyKey=c;function d(x,A){let w=new Map;for(let C of x){let T=C.data;if(A?.(T))continue;let M=c(T),D=w.get(M);D||(D={id:M,path:T.path,keyframes:[],layerId:T.layerId,index:T.index},w.set(M,D)),T.isPlaceholder?D.placeholder=C.id:D.keyframes.push(C)}return[...w.values()].sort((C,T)=>{let M=l(C.path)-l(T.path);return M!==0?M:(C.index??0)-(T.index??0)})}S.groupKeyframes=d;function u(x){let A=x[x.length-1];return jc.includes(A)?A:void 0}S.rowAxis=u;function p(x){return x.layerId?x.layerId:(u(x.path)?x.path.slice(0,-1):x.path).join(".")}S.drawnRowKey=p;function h(x){let A=new Map;for(let w of x){let C=u(w.path),T=C?w.path.slice(0,-1):w.path,M=p(w),D=A.get(M);D||(D={id:M,path:T,layerId:w.layerId,index:w.index,tracks:[]},A.set(M,D)),D.tracks.push({axis:C,property:w})}return[...A.values()]}S.drawnRows=h;function f(x){return[...x].sort((A,w)=>A.data.time-w.data.time)}S.sortedKeyframes=f;function m(x){return["material",x.type==="light"?`${x.category} lighting`:x.type]}S.materialLayerPath=m;function y(x,A){return x.map(({data:w,id:C},T)=>g(A(),m(w),{layerId:C,index:T}))}S.createMaterialGroup=y;function g(x,A,w){return{id:x,data:{id:x,time:w?.time??0,path:A,value:{},layerId:w?.layerId,index:w?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}S.placeholderKeyframe=g;function v(x){return Object.entries(x).reduce((A,[w,C])=>(typeof C!="string"&&A.push({name:C.name}),A),[])}S.createName=v,S.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Ip(3),duration:1e3},opacity:{value:[0,1],easing:Ip(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Ip(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Ip(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:Ip(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(fo||(fo={}));jc=["x","y","z"],q0=class{constructor(t=1,e=100,r=10,n=0){this.mass=t,this.stiffness=e,this.damping=r,this.initialVelocity=n,this.m_w0=Math.sqrt(e/t),this.m_zeta=r/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-n)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-n+this.m_w0)}solve(t){return this.m_zeta<1?t=Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):t=(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0),1-t}getDuration(){let t=.16666666666666666,e=0,r=0;for(;;)if(e+=t,this.solve(e)===1){if(r++,r>=16)break}else r=0;return e*t*1e3}}});var Hc,Wc,Qm=xe(()=>{"use strict";_n();yt();(t=>t.list=["idle","move","jump","run"])(Hc||(Hc={}));(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 oe,move:new oe,jump:new oe,run:new oe},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Ve.fromHexAndA(3728051,1)}}))(Wc||(Wc={}))});function wl(i,...t){let e={};for(let r of t.flat())i!=null&&r in i&&(e[r]=i[r]);return e}function RT(i){i.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,r=t.colorB,n=[[e.r,e.g,e.b,e.a],[r.r,r.g,r.b,r.a]],o=[0,1];for(let s=2;s<10;s++)n.push(n[1]),o.push(1);let a={...wl(ar(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:o,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={...ar(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,e)}})}function jo(i,t){Object.values(i.shared.materials).forEach(e=>t(e))}function Ho(i,t){i.scene.objects.traverse((e,r)=>{"materials"in r?r.materials.forEach((n,o)=>{n===void 0&&(r.materials[o]=sr.defaultTwoLayerData("phong"),n=r.materials[o]),typeof n!="string"&&t(n)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=sr.defaultTwoLayerData("phong")),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=sr.defaultTwoLayerData("phong")),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(n=>{n.material&&typeof n.material!="string"&&Object.getPrototypeOf(n.material)!==vt.prototype&&t(n.material)})})}function G_(i){Object.assign(i.scene.publish,{orbitControls:{...Gc.defaultData,...ar(i.scene.publish.orbitControls)}})}function U_(i){Object.assign(i.scene.publish.settings,{video:{...Ri.defaultData.settings.video,...ar(i.scene.publish.settings.video)}})}function z_(i){function t(e){if(e.layers){for(let r of Object.values(e.layers))if(r){for(let[n,o]of Object.entries(r))if((Bm.includes(n)||typeof o=="boolean")&&delete r[n],n==="texture")for(let[a,s]of Object.entries(o))(yT.includes(a)||typeof s=="boolean")&&delete o[a]}}}i.scene.objects.traverse((e,r)=>{r.states.forEach(n=>{let o=n;o.material?t(o.material):o.materials&&o.materials.forEach(a=>{t(a)})})})}function j_(i){i.scene.publish.withBackground=!0}function H_(i){i.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function W_(i){i.scene.objects.traverse((t,e)=>{let r=e.cloner;r&&(r.radial.scale=r.radial.scale.map(n=>n+1),r.linear.scale=r.linear.scale.map(n=>n+1))})}function q_(i){i.scene.objects.traverse((t,e)=>{let r=e.geometry;r&&(r.type==="DodecahedronGeometry"||r.type==="IcosahedronGeometry")&&(r.detail=Math.round(r.detail))})}function X_(i){i.scene.objects.traverse((t,e)=>{let r=i.scene.objects.unproxy().parent(t);if(r){let n=ar(i.scene.objects.data(r));n&&n.type==="Mesh"&&n.geometry.type==="BooleanGeometry"&&e.type==="Mesh"&&(e.visible=ar(e).booleanExclude!==!0)}})}function Y_(i){i.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 K_(i){function t(r){Object.setPrototypeOf(r,vt.prototype),r.texture&&Object.setPrototypeOf(r.texture,vt.prototype)}function e(r){Object.setPrototypeOf(r,vt.prototype);for(let n in r)t(r[n])}i.scene.objects.traverse((r,n)=>{n.states.forEach(o=>{let a=o;if(a.material){let s=ar(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],c=ar(l).layers;e(c),l.layers=c}})})}function BT(i){i.layers===void 0&&Object.assign(i,sr.defaultTwoLayerData("lambert"))}function Y0(i){!i.layers||i.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 n={...ar(t),colors:e,steps:r};Object.assign(t,n)}})}function Q_(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function NT(i){i.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(r=>{typeof r!="string"&&Y0(r)}):"material"in e&&typeof e.material!="string"&&Y0(e.material)}),Object.values(i.shared.materials).forEach(t=>Y0(t))}function Z_(i){i.scene.environment.ambientLight.softShadows=!1,i.scene.environment.ambientLight.softShadowQuality="low",i.scene.objects.traverse((t,e)=>{(e.type==="DirectionalLight"||e.type==="SpotLight")&&(e.shadowResolution=1024,e.shadowRadius=1,e.depth=1e5)}),i.shared.penumbraSize=new Array(5).fill(.5)}function J_(i){i.shared.audios=Mr({},ve.prototype)}function $_(i){i.shared.videos=Mr({},ve.prototype)}function ek(i){let t=i.shared.materials;Object.entries(t).forEach(([e,r])=>{if(!r.layers){let n={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]:n})}})}function tk(i){Object.entries(ar(i.shared.images)).filter(r=>r[1].asset===!1).map(r=>r[0]).forEach(r=>{delete i.shared.images[r]}),Object.entries(ar(i.shared.audios)).filter(r=>r[1].asset===!1).map(r=>r[0]).forEach(r=>{delete i.shared.audios[r]})}function rk(i){i.scene.publish.settings.web.preload=!1}function LT(i){i.layers&&i.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 _T(i){i.layers&&i.layers.forEach(t=>{mT(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 nk(i){i.shared.fonts=Mr({},ve.prototype)}function ik(i){return i.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 ok(i){let t=[];i.scene.objects.traverse((e,r)=>{let n=r;if(n.type==="TextFrame"){let o=sr.defaultTwoLayerData("phong"),a=typeof n.color=="string"?i.shared.colors[n.color]:n.color;o.layers[1].data.color={r:a.r,g:a.g,b:a.b},o.layers[1].data.alpha=n.alpha;let s=ik(n.font);i.shared.fonts[s]===void 0&&(i.shared.fonts[s]={name:s});let l={name:n.name,...vr.defaultData,...Ca.defaultData,flatShading:!1,wireframe:!1,geometry:{...Vo.defaultData("TextGeometry"),width:n.width,height:n.height,font:s,depth:0,horizontalAlign:n.horizontalAlign,verticalAlign:n.verticalAlign,fontSize:n.fontSize*1.40625,lineHeight:n.lineHeight/1.40625,letterSpacing:n.letterSpacing-1,text:n.text,textTransform:n.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:o,states:ar(n.states),events:ar(n.events),visible:n.visible,raycastLock:n.raycastLock,position:n.position,rotation:n.rotation,scale:n.scale,hiddenMatrix:n.hiddenMatrix},c=ar(i.scene.objects).parent(e);i.scene.objects.insertAfter(c??null,e,[{id:e+"new",data:l,children:[]}]),t.push(e)}}),t.forEach(e=>{i.scene.objects.delete(e)})}function ak(i){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};i.scene.objects.traverse((e,r)=>{r.events.forEach(n=>{if(!!t[Number(n.type)])if(Object.assign(n,{type:t[Number(n.type)]}),n.type==="Audio"&&"audioEvent"in n&&(Object.assign(n,{playAudio:n.audioEvent}),delete n.audioEvent),n.type==="GameControl")Object.assign(n,{gameActions:{idle:new oe,move:new oe,jump:new oe}});else{let o=new oe;Object.assign(n,{actions:o}),(n.type==="MouseDown"||n.type==="MouseUp"||n.type==="KeyDown"||n.type==="KeyUp")&&"url"in n&&o.push({fi:0,id:Dp.MathUtils.generateUUID(),data:{type:"Link",url:n.url,delay:0}}),"targets"in n&&(n.targets.forEach((a,s,l)=>{let c={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},d={easing:a.easing,duration:a.duration};a.easing===6?Object.assign(d,wl(a,"mass","stiffness","damping","velocity")):a.easing===5&&Object.assign(d,{control1:{...a.control1},control2:{...a.control2}});let u={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,...u,...d},h={allowSlerp:!0,type:"Transition",object:a.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new oe({fi:0,id:Dp.MathUtils.generateUUID(),data:c},{fi:1,id:Dp.MathUtils.generateUUID(),data:p})};o.push({fi:l,id:s,data:h})}),delete n.targets)}})})}function sk(i){i.scene.objects.traverse((t,e)=>{function r(n,o){let a=new oe,s=[];if(e.events.forEach((l,c,d)=>{if(l.type==="Audio"&&l.trigger===o){let u;s.push(c),l.interaction==="play"?u={...wl(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")&&(u={...wl(l,"interaction","delay","object","playAudio"),type:"Audio"}),u&&a.push({fi:d,id:c,data:u})}}),s.forEach(l=>e.events.delete(l)),a.length){let l=e.events.find(c=>c.type===n)?.data;l?"actions"in l&&l.actions.insertBefore(null,a):e.events.insertBefore(null,[{id:Dp.MathUtils.generateUUID(),data:{type:n,actions:a}}])}}r("Start","start"),r("MouseDown","mouseDown"),r("MouseUp","mouseUp"),r("KeyDown","keyDown"),r("KeyUp","keyUp")})}function kT(i){let t=i.layers.find(e=>e.type==="light")?.data;if(t?.category==="basic"){let e=qt.defaultData("light","phong"),r=t;Object.assign(r,e),r.visible=!1}}function FT(i){jo(i,kT),Ho(i,kT)}function lk(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function ck(i){i.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 dk(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="NonParametricGeometry"&&!("material"in e)&&!("materials"in e)&&(e.material=sr.defaultTwoLayerData("phong"))})}function uk(i){i.scene.publish.orbitControls.autoZoom===void 0&&(i.scene.publish.orbitControls.autoZoom=!1),i.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 pk(i){i.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 hk(i){i.scene.publish.mouseEventTarget===void 0&&(i.scene.publish.mouseEventTarget="canvas"),i.scene.publish.settings.web.hint===void 0&&(i.scene.publish.settings.web.hint=!1)}function fk(i){let{video:t}=i.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function mk(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.resetYPosition=Math.abs(r.resetYPosition-e.position[1]))})})}function yk(i){let t=i.scene.environment.usePhysics;i.scene.objects.traverse((e,r)=>{t&&r.physics===null?r.collision=!1:r.collision="visibility"})}function gk(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.navmesh=Wc.defaultDataThirdPerson.navmesh)})})}function vk(i){i.scene.styles||(i.scene.styles=Ta.defaultData())}function VT(i){i.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function bk(i){i.scene.environment.ambientLight.occlusion===void 0&&(i.scene.environment.ambientLight.occlusion=!1),i.scene.environment.ambientLight.aoFullRes===void 0&&(i.scene.environment.ambientLight.aoFullRes=!1),i.scene.environment.ambientLight.radius===void 0&&(i.scene.environment.ambientLight.radius=256),i.scene.environment.ambientLight.bias===void 0&&(i.scene.environment.ambientLight.bias=.5),i.scene.environment.ambientLight.aoColor===void 0&&(i.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Ho(i,VT),jo(i,VT)}function xk(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&Object.assign(r.gameActions,{run:new oe})})})}function Sk(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(r=>{r.type==="GameControl"&&(r.keyAssignments=[...r.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function GT(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function UT(i,t){if(t<1&&(Ho(i,RT),jo(i,RT),i.schema=1),t<2&&(G_(i),i.schema=2),t<3&&(z_(i),i.schema=3),t<4&&(j_(i),i.schema=4),t<5&&(H_(i),i.schema=5),t<6&&(W_(i),i.schema=6),t<7&&(q_(i),i.schema=7),t<8&&(i.schema=8),t<9&&(NT(i),i.schema=9),t<10&&(Q_(i),i.schema=10),t<11&&(Z_(i),i.schema=11),t<12&&(NT(i),i.schema=12),t<13&&(J_(i),i.schema=13),t<14&&(ek(i),i.schema=14),t<15&&(tk(i),i.schema=15),t<16&&(rk(i),i.schema=16),t<17&&(Ho(i,LT),jo(i,LT),i.schema=17),t<18&&(Ho(i,BT),jo(i,BT),i.schema=18),t<19&&(U_(i),i.schema=19),t<20&&(nk(i),ok(i),i.schema=20),t<21&&(ak(i),sk(i),i.schema=21),t<22&&(FT(i),i.schema=22),t<23&&(lk(i),i.schema=23),t<24&&(ck(i),i.schema=24),(t<25||i.shared.videos===void 0)&&($_(i),t<25&&(i.schema=25)),t<26&&(X_(i),i.schema=26),t<27&&(Y_(i),i.schema=27),t<28&&(FT(i),i.schema=28),t<29&&(K_(i),i.schema=29),t<30&&(dk(i),i.schema=30),t<31&&(uk(i),i.schema=31),t<33&&(pk(i),i.schema=33),t<34&&(hk(i),i.schema=34),t<35&&(fk(i),i.schema=35),t<36&&(mk(i),i.schema=36),t<37&&(yk(i),i.schema=37),t<38&&(Ho(i,_T),jo(i,_T),i.schema=38),t<39&&(gk(i),i.schema=39),t<40&&(vk(i),i.schema=40),t<41&&(bk(i),i.schema=41),t<42&&(xk(i),i.schema=42),t<43&&(Sk(i),i.schema=43),t<99){Ho(i,GT),jo(i,GT),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=ko);let e=ar(i.scene.objects),r=i.scene.objects;i.scene.publish.playPage=ms,r.insertBefore(null,null,[{id:ms,data:{...po.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:wl(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:wl(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...vs.defaultData,...wl(i.scene.environment,"usePhysics","gravity")},camera:ar(i.scene.ownerCamera)??po.defaultData.camera,name:"Scene"},children:[]}]);for(let a of e)a.id!==Pa.TRASH_CAN_ID&&r.move(ms,a.fi,a.id);let n=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((a,s)=>{s.type==="DirectionalLight"?(s.penumbraSize=i.shared.penumbraSize[Math.min(n,2)],n+=1):s.type==="SpotLight"&&(s.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(s.physics===void 0||s.physics===null)&&s.type!=="Instance"&&(s.physics={},Object.assign(s.physics,ys.defaultData)),s.physics!==void 0&&s.physics!==null&&(s.physics.enabled=s.collision??"visibility",delete s.collision)}),i.schema=99}}var Dp,zT=xe(()=>{"use strict";Cp();_n();Wm();Mp();yt();Op();gr();Dp=require("three");km();Qm();z0();qm();Dm();Um()});function jT(i){let t=i.elements;Wo.set(t[0],t[1],t[2]),qo.set(t[4],t[5],t[6]),Ma.set(t[8],t[9],t[10])}function wk(i,t){i.set(1,0,0).cross(t),i.lengthSq()<=Jm&&i.set(0,1,0).cross(t),i.normalize()}function HT(){let i=Math.max(Wo.lengthSq(),qo.lengthSq(),Ma.lengthSq());Wo.lengthSq()>Jm*i?Ni.copy(Wo).normalize():Ni.set(1,0,0),Li.crossVectors(Ma,Ni),Li.lengthSq()<=Jm*i&&(Li.copy(qo).addScaledVector(Ni,-qo.dot(Ni)),Li.lengthSq()<=Jm*i&&wk(Li,Ni)),Li.normalize(),qc.crossVectors(Ni,Li)}function Ck(){let i=Wo.length(),t=qo.length(),e=Ma.length(),r=Math.max(i,t,e);if(r-i>Zm||r-t>Zm||r-e>Zm)return!0;let n=Zm*r*r;return Math.abs(Wo.dot(qo))>n||Math.abs(Wo.dot(Ma))>n||Math.abs(qo.dot(Ma))>n}function $m(i,t,e){return jT(i),HT(),t.makeBasis(Ni,Li,qc),e.set(Ni.dot(Wo),Ni.dot(qo),Ni.dot(Ma),0,Li.dot(Wo),Li.dot(qo),Li.dot(Ma),0,qc.dot(Wo),qc.dot(qo),qc.dot(Ma),0,0,0,0,1),Ck()}function WT(i){return jT(i),HT(),Ak.makeBasis(Ni,Li,qc)}var Oa,Wo,qo,Ma,Ni,Li,qc,Ak,Jm,Zm,ey=xe(()=>{Oa=require("three"),Wo=new Oa.Vector3,qo=new Oa.Vector3,Ma=new Oa.Vector3,Ni=new Oa.Vector3,Li=new Oa.Vector3,qc=new Oa.Vector3,Ak=new Oa.Matrix4,Jm=1e-12,Zm=.01});function Ek(i,t,e){let r=Math.PI*2,n=l=>l-r*Math.round(l/r),o=n(i+Math.PI),a=n(Math.PI-t),s=n(e+Math.PI);return Math.abs(o)+Math.abs(s)<Math.abs(i)+Math.abs(e)-1e-9?[o,a,s]:[i,t,e]}function Xc(i,t){return t===0?0:i/t}function Bp(i){$m(i,XT,qT),Rp.setFromRotationMatrix(XT);let t=Ek(Rp.x,Rp.y,Rp.z),e=qT.elements;return{position:[i.elements[12],i.elements[13],i.elements[14]],rotation:[t[0]*_i.MathUtils.RAD2DEG,t[1]*_i.MathUtils.RAD2DEG,t[2]*_i.MathUtils.RAD2DEG],scale:[e[0],e[5],e[10]],shear:[Xc(e[4],e[5]),Xc(e[8],e[10]),Xc(e[1],e[0]),Xc(e[9],e[10]),Xc(e[2],e[0]),Xc(e[6],e[5])]}}function Ia(i,{translation:t,quaternion:e,scale:r,shearMatrix:n}={}){let o=Bp(i);if(t!==void 0&&t.fromArray(o.position),e!==void 0){let a=o.rotation;e.setFromEuler(Rp.set(a[0]*_i.MathUtils.DEG2RAD,a[1]*_i.MathUtils.DEG2RAD,a[2]*_i.MathUtils.DEG2RAD))}r!==void 0&&r.fromArray(o.scale),n!==void 0&&n.fromArray(tn.toMatrix(o.shear))}var _i,qT,XT,Rp,Np=xe(()=>{_i=require("three");ey();K0();qT=new _i.Matrix4,XT=new _i.Matrix4,Rp=new _i.Euler});function Pk(i,t,e){let r={name:t,duration:e.duration,tracks:[],uuid:i};return e.blendMode!==void 0&&(r.blendMode=e.blendMode),JSON.stringify(r)}function Mk(i,t,e){for(let r=0;r<e.length;r++)if(!Object.is(i[t+r],e[r]))return!1;return!0}function Ok(i,t,e){let r=[],n=0,o=p=>{let h=[n,p.length];return r.push(p),n+=p.length,h},a=new Map,s=p=>{let h=Float32Array.from(p),f=h.length+":"+h[0]+":"+h[h.length-1],m=a.get(f)??[];for(let g of m)if(Mk(g.run,0,h))return g.span;let y=o(h);return m.push({span:y,run:h}),a.set(f,m),y},l=e.tracks.map(p=>{let h=s(p.times),f=!Tk.has(p.type),m={name:p.name,type:p.type,times:h,values:f?o(Float32Array.from(p.values)):[0,0]};return f||(m.list=Array.from(p.values)),p.interpolation!==void 0&&(m.interpolation=p.interpolation),m}),c=new Float32Array(n),d=0;for(let p of r)c.set(p,d),d+=p.length;let u={v:1,duration:e.duration,data:c,tracks:l};return e.blendMode!==void 0&&(u.blendMode=e.blendMode),e.userData!==void 0&&e.userData!=="{}"&&(u.userData=e.userData),[i,t,Pk(i,t,u),u]}function YT(i){if(!Array.isArray(i)||i.length>3)return i;let[t,e,r]=i;if(typeof t!="string"||typeof r!="string")return i;let n;try{n=JSON.parse(r)}catch{return i}return!n||!Array.isArray(n.tracks)||n.tracks.some(o=>!o?.type||!o.times||!o.values)?i:Ok(t,typeof n.name=="string"?n.name:e,n)}var Tk,Q0=xe(()=>{"use strict";Tk=new Set(["bool","string"])});function ty(i,[t,e]){return Math.min(Math.max(i,t),e)}function QT(i,t,e,r,n){i=ty(i,Ik),t=ty(t,Dk),e=ty(e,Rk),r=ty(r,Bk);let o=Math.sqrt(t/i),a=e/(2*Math.sqrt(t*i)),s=a<1?o*Math.sqrt(1-a*a):0,l=1,c=a<1?(a*o+-r)/s:-r+o;return d=>{let u=n!==void 0?n*d:d;return a<1?u=Math.exp(-u*a*o)*(l*Math.cos(s*u)+c*Math.sin(s*u)):u=(l+c*u)*Math.exp(-u*o),d===0||d===1?d:1-u}}function Nk(i,t,e,r){let n=.16666666666666666,o=0,a=0,s=QT(i,t,e,r),l=1e5;for(let c=0;c<l;c++)if(o+=n,s(o)===1){if(a+=1,a>=16)break}else a=0;return Ge(o*n)}function ZT(i,t){return Ge(Ge(1-Ge(3*t))+Ge(3*i))}function JT(i,t){return Ge(Ge(3*t)-Ge(6*i))}function $T(i){return Ge(3*i)}function iy(i,t,e){return Ge(Ge(Ge(Ge(Ge(ZT(t,e)*i)+JT(t,e))*i)+$T(t))*i)}function eP(i,t,e){let r=Ge(Ge(Ge(3*ZT(t,e))*i)*i),n=Ge(Ge(2*JT(t,e))*i);return Ge(Ge(r+n)+$T(t))}function Vk(i,t,e,r,n){let o,a=0,s=0;do a=Ge(t+Ge(Ge(e-t)/2)),o=Ge(iy(a,r,n)-i),o>0?e=a:t=a,s+=1;while(Math.abs(o)>kk&&s<Fk);return a}function Gk(i,t,e,r){for(let n=0;n<Lk;n++){let o=eP(t,e,r);if(o===0)return t;let a=Ge(iy(t,e,r)-i);t=Ge(t-Ge(a/o))}return t}function Yc(i,t,e,r){if(i=Ge(i),t=Ge(t),e=Ge(e),r=Ge(r),i<0||i>1||e<0||e>1||i===t&&e===r)return KT;let n=new Float32Array(ny);for(let a=0;a<ny;a++)n[a]=iy(Ge(a*ry),i,e);let o=a=>{let s=0,l=1,c=ny-1;for(;l!==c&&n[l]<=a;)s=Ge(s+ry),l+=1;l-=1;let d=Ge(Ge(a-n[l])/Ge(n[l+1]-n[l])),u=Ge(s+Ge(d*ry)),p=eP(u,i,e);return p>=_k?Gk(a,u,i,e):p===0?u:Vk(a,s,Ge(s+ry),i,e)};return a=>(a=Ge(a),a===0||a===1?a:iy(o(a),t,r))}function oy(i,t,e){switch(i.easing){case 0:return e;case 1:return Yc(.25,.1,.25,1)(e);case 2:return Yc(.42,0,1,1)(e);case 3:return Yc(0,0,.58,1)(e);case 4:return Yc(.42,0,.58,1)(e);case 7:return Yc(.25,1,.5,1)(e);case 8:return Math.floor(e);case 5:{let{control1:r,control2:n}=i;return!r||!n?e:Yc(r[0],r[1],n[0],n[1])(e)}case 6:{let{mass:r,stiffness:n,damping:o,velocity:a}=i;return r===void 0||n===void 0||o===void 0||a===void 0?e:Ge(QT(r,n,o,a,t)(e))}default:return e}}function Z0(i,t){if(i.easing!==6)return t;let{mass:e,stiffness:r,damping:n,velocity:o}=i;return e===void 0||r===void 0||n===void 0||o===void 0?t:Nk(e,r,n,o)}var Ge,Ik,Dk,Rk,Bk,Lk,_k,kk,Fk,ny,ry,KT,Uk,n7,tP=xe(()=>{"use strict";Ge=Math.fround,Ik=[.01,100],Dk=[.01,1e4],Rk=[.01,1e3],Bk=[.01,1e3];Lk=4,_k=Ge(.001),kk=Ge(1e-7),Fk=10,ny=11,ry=Ge(1/(ny-1));KT=i=>i;Uk=Ge(1.70158),n7=Ge(Uk+1)});function zk(i,t){let e=i.length,r=0,n=e;for(;r<n;){let o=r+Math.floor(e/2),a=i[o].time;if(a<t)r=o+1;else if(a>t)n=o;else return{found:!0,index:o};e=n-r}return{found:!1,index:r}}function ay(i,t){if(i.length===0)throw new Error("sampleKeyframes requires at least one keyframe");if(t<=i[0].time)return{index0:0,index1:0,t:1};let{found:e,index:r}=zk(i,t);if(e)return{index0:r,index1:r,t:1};if(r>=i.length){let u=i.length-1;return{index0:u,index1:u,t:1}}let n=r-1,o=r,a=i[n].time,s=i[o].time;if(s===a)return{index0:n,index1:o,t:.5};let l=J0(s-a),c={...i[n].ease,control2:i[o].ease.control2},d=oy(c,l,J0(J0(t-a)/l));return{index0:n,index1:o,t:d}}function sy(i){return[...i].sort((t,e)=>t.time-e.time)}var J0,rP=xe(()=>{"use strict";tP();J0=Math.fround});function jk(i){if(i?.length!==2)return;let t=`${i[0]}.${i[1]}`;return iP.includes(t)?t:void 0}function oP(i){return i.slice(0,i.indexOf("."))}function aP(i){return Cl.indexOf(i.slice(-1))}function Hk(i){return{easing:i?.type,control1:Bi(i?.cubicControls?.control1,[0,0]),control2:Bi(i?.cubicControls?.control2,[1,1]),...i?.springParameters}}function Wk(i){let t=i?.cubicControls;return{...i,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...i?.springParameters?{springParameters:{...i.springParameters}}:{}}}function qk(i,t){let{index0:e,index1:r,t:n}=ay(i.sampled,t),o=i.sampled[e].value,a=i.sampled[r].value;return o+(a-o)*n}function Xk(i){let t=i.elements,e=[0,4,8].map(o=>new Fn.Vector3(t[o],t[o+1],t[o+2])),r=e[0].lengthSq(),n=1e-9*Math.max(1,r);return Math.abs(e[1].lengthSq()-r)<n&&Math.abs(e[2].lengthSq()-r)<n&&Math.abs(e[0].dot(e[1]))<n&&Math.abs(e[0].dot(e[2]))<n&&Math.abs(e[1].dot(e[2]))<n}function nP(i,t,e){let r=oP(i);if(r==="position"){let o=aP(i);return Cl.flatMap((a,s)=>Math.abs(t.elements[s*4+o])>1e-9?[`position.${a}`]:[])}return(e?[r]:["rotation","scale"]).flatMap(o=>Cl.map(a=>`${o}.${a}`))}function Yk(i,t){let[e,r,n]=i,o=[[e,r,n],[e+180,180-r,n+180]],a=[e,r,n],s=1/0;for(let l of o){let c=l.map((u,p)=>u+360*Math.round((t[p]-u)/360)),d=c.reduce((u,p,h)=>u+Math.abs(p-t[h]),0);d<s-1e-9&&(a=c,s=d)}return a}function Kk(i,t,e){if(i==="rotation"){let r=((t-e)%360+540)%360-180;return Math.abs(r)<1e-6}return Math.abs(t-e)<1e-9*Math.max(1,Math.abs(t),Math.abs(e))}function sP(i,t,e,r){let n=new Map;for(let{id:f,data:m}of i.unproxy()){if(m.isPlaceholder)continue;let y=jk(m.path);if(!y){if(Lp.includes(m.path?.[0]))return;continue}if(typeof m.value!="number"||!Number.isFinite(m.value))return;let g=n.get(y)??{keys:[],sampled:[]};g.keys.push({id:f,time:m.time,value:m.value,keyframe:m}),n.set(y,g)}if(n.size===0)return;for(let f of n.values())f.keys.sort((m,y)=>m.time-y.time),f.sampled=sy(f.keys.map(m=>({time:m.time,ease:Hk(m.keyframe.easing),value:m.value})));let o=(f,m)=>{let y=n.get(f);return y?qk(y,m):e[oP(f)][aP(f)]},a=new Fn.Quaternion,s=new Fn.Euler,l=new Fn.Matrix4,c=new Fn.Vector3,d=new Fn.Vector3,u=f=>{let m={};for(let y of Lp)m[y]=Cl.map((g,v)=>o(iP[Lp.indexOf(y)*3+v],f));return m},p=f=>{let m=u(f);return s.set(m.rotation[0]*Fn.MathUtils.DEG2RAD,m.rotation[1]*Fn.MathUtils.DEG2RAD,m.rotation[2]*Fn.MathUtils.DEG2RAD),l.compose(c.fromArray(m.position),a.setFromEuler(s),d.fromArray(m.scale)).premultiply(t),{pose:m,out:Bp(l)}},h=Xk(t);for(let f of Lp){let m=Cl.map(S=>`${f}.${S}`),y=S=>{let x=new Set;for(let A of nP(S,t,h))for(let w of n.get(A)?.keys??[])x.add(w.time);return[...x].sort((A,w)=>A-w)},g=[...new Set(m.flatMap(S=>y(S)))].sort((S,x)=>S-x),v=new Map,b;for(let S of g){let{pose:x,out:A}=p(S),w=[...A[f]];if(f==="rotation"){let C=b?b.out.map((T,M)=>T+x.rotation[M]-b.in[M]):x.rotation;w=Yk(w,C),b={in:x.rotation,out:w}}v.set(S,w)}m.forEach((S,x)=>{let A=n.get(S)?.keys??[],w=y(S),C=new Set(w);if(!(A.length===0&&w.every(T=>Kk(f,v.get(T)[x],r[f][x])))){for(let T of A)C.has(T.time)||i.delete(T.id);for(let T of w){let M=v.get(T)[x],D=A.find(E=>E.time===T);if(D){let E=i.data(D.id);E&&(E.value=M);continue}let I=nP(S,t,h).sort((E,B)=>Number(B===S)-Number(E===S)).map(E=>n.get(E)?.keys.find(B=>B.time===T)).find(E=>E!==void 0),_=Fn.MathUtils.generateUUID();i.insertBefore(null,[{id:_,data:{id:_,time:T,path:[f,Cl[x]],value:M,easing:Wk(I.keyframe.easing),index:fo.rowOrder([f])}}])}}})}}var Fn,Lp,Cl,iP,lP=xe(()=>{"use strict";Fn=require("three");Km();rP();Np();Lp=["position","rotation","scale"],Cl=["x","y","z"],iP=Lp.flatMap(i=>Cl.map(t=>`${i}.${t}`))});var bP={};DC(bP,{updateAllMaterials:()=>$0,updateDocumentSchema:()=>EF,updateLibSchema:()=>CF,updateMaterialSchema:()=>aF,updateObjectStateRec:()=>Xo,updateObjectsSchema:()=>yP,updateTextValues:()=>iF});function cP(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function Qk(i){i.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 hP(i){let t=i.geometry;t!==void 0&&Zk.has(t.type)&&t.extrusionVersion===void 0&&(t.extrusionVersion=1)}function fP(i){if(i.type!=="Empty")return;let t=ar(i.animations);if(!Array.isArray(t))return;let e=t.map(YT);e.some((r,n)=>r!==t[n])&&(i.animations=e)}function Jk(i){Array.isArray(ar(i.events))&&i.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),(t.type==="MouseDown"||t.type==="MouseUp"||t.type==="MousePress")&&(t.mode=t.mode||"Object")})}function eF(i){i.rotation=i.rotation.slice(0,3).map(t=>t*El)}function dP(i,t){let[e,r,n]=i,o=Math.cos(e),a=Math.sin(e),s=Math.cos(r),l=Math.sin(r),c=Math.cos(n),d=Math.sin(n),u=[s*c,o*d+a*c*l,a*d-o*c*l],p=Math.hypot(t[0],t[1],t[2])||1;return Math.abs((u[0]*t[0]+u[1]*t[1]+u[2]*t[2])/p)}function tF(i,t){let e=Array.isArray(t)&&t.length>=3&&t.every(o=>typeof o=="number"&&Number.isFinite(o))?t:[0,1,0],r=dP(i,e),n=dP(i.map(o=>o*$k),e);return Math.abs(r-n)<1e-6?i.some(o=>Math.abs(o)>Math.PI):n<r}function rF(i){let t=i.rotation.slice(0,3);if(tF(t,i.up)){i.rotation=t;return}i.rotation=t.map(e=>e*El)}function mP(i){eF(i),i.type==="Page"&&rF(i.camera),i.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(r=>r*El))});let t=i.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*El),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*El),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=El,t.extrusion.twist*=El),i.type==="Mesh"&&i.geometry.type==="TextGeometry"&&(i.geometry.text={textValue:i.geometry.text}),Array.isArray(ar(i.events))&&i.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 nF(i){i.shared.variables=Mr({},ve.prototype)}function iF(i){i.scene.objects.traverse((t,e)=>{})}function oF(i){let t=ar(i.shared.variables);i.shared.variables=Mr(Object.entries(t??{}).map(([e,r],n)=>({fi:n,id:e,data:r})),oe.prototype)}function aF(i){let t=i.schema??104;t!==135&&(t<130&&(rS(i.asset),i.schema=130),t<135&&(nS(i.asset),i.schema=135))}function Xo(i,t){t(i.data);for(let e of i.children)Xo(e,t)}function yP(i){let t=i.schema??104;t!==135&&(t<105&&(Xo(i.asset,mP),i.schema=105),t<118&&(Xo(i.asset,gP),i.schema=118),t<121&&(Xo(i.asset,tS),i.schema=121),t<130&&(Xo(i.asset,e=>uP(e,rS)),i.schema=130),t<132&&(Xo(i.asset,hP),i.schema=132),t<133&&(Xo(i.asset,e=>vP(e,()=>{})),i.schema=133),t<134&&(Xo(i.asset,fP),i.schema=134),t<135&&(Xo(i.asset,e=>uP(e,nS)),i.schema=135))}function $0(i,t){Ho(i,t),jo(i,t),Object.values(i.shared.lib.materials).forEach(e=>t(e.asset))}function rS(i){i.layers===void 0&&Object.assign(i,sr.defaultTwoLayerData("phong"))}function nS(i){let t=hl(i),e=sr.withRepairedLayers(t);e!==t&&(i.layers=e.layers)}function uP(i,t){"materials"in i?i.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&t(e)}):"material"in i&&i.material!==void 0&&typeof i.material!="string"&&t(i.material)}function sF(i){i.shared.particles=Mr({},ve.prototype),i.shared.lib&&(i.shared.lib.particles=ho.defaultData().particles)}function lF(i){i.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 cF(i){i.scene.objects.traverse((t,e)=>{e.type==="Page"&&(e.postprocessing.depthOfField.focusDistance=100,e.postprocessing.depthOfField.focalLength=20,e.postprocessing.depthOfField.bokehScale=5)})}function dF(i){i.scene.objects.traverse((t,e)=>{Array.isArray(ar(e.events))!==!1&&e.events?.forEach(r=>{let n=r.runMode;r.type==="MouseDown"||r.type==="MouseUp"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="Collision"||r.type==="Trigger"?r.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=n??"Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode=n==="Toggle"?"Toggle":"Normal")}):r.type==="MouseHover"||r.type==="MousePress"||r.type==="KeyPress"?r.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):r.type==="GameControl"?(delete r.actions,Object.keys(r.gameActions).forEach(a=>{r.gameActions[a]?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),s.type==="Animation"&&"runMode"in s&&(s.runMode="Normal")})})):r.type==="DragDrop"?(delete r.actions,r.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),r.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):r.type==="Resize"?(delete r.actions,r.breakpoints?.forEach(o=>{o.actions?.forEach(a=>{(a.type==="Transition"||a.type==="Animation"&&"runMode"in a||a.type==="SwitchCamera")&&(a.runMode="Toggle")})})):r.type==="Start"?r.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):r.type==="VariableChange"||r.type==="Scroll"?r.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):r.type==="Conditional"&&(delete r.actions,r.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}),r.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}function uF(i){i.shared.userAPIs=Mr({},ve.prototype),i.shared.userWebhooks=Mr({},ve.prototype),i.shared.lib&&(i.shared.lib.userAPIs=ho.defaultData().userAPIs,i.shared.lib.userWebhooks=ho.defaultData().userWebhooks)}function pF(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=Ri.defaultData.settings.videoStatic)}function gP(i){i.timelineAnimations=Mr({},ve.prototype)}function hF(i){let t=[];return i?(i.forEach((e,r)=>{let{path:n,keyframes:o}=e.data,a=n[0]==="material"?e.id:void 0;if(!o?.length){t.push(fo.placeholderKeyframe(e.id,n,{layerId:a,index:r}));return}o.forEach(({id:s,data:l})=>{t.push({id:s,data:{...l,path:n,layerId:a,index:r}})})}),t.sort((e,r)=>e.data.time-r.data.time),new oe(...t.map((e,r)=>({...e,fi:r})))):new oe}function fF(i){let t=i.shared,e=t.timelineAnimations;if(!e)return;let r=i.scene.objects,n=r.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,a]of Object.entries(e)){let s=Mr({},ve.prototype),l=0,c=Boolean(a.loop);for(let[h,f]of Object.entries(a.mapping??{})){let y=r.data(h)?.timelineAnimations?.[f];!y||(l=Math.max(l,y.to??0),c=c||Boolean(y.loop),s[h]={id:h,keyframes:hF(y.properties?.unproxy())})}let d=a.page??n,u=d?r.data(d):void 0;if(!u||u.type!=="Page")continue;let p=u.timelines??(u.timelines=Mr({},ve.prototype));p[o]={id:o,name:a.name,duration:l||5,...c?{loop:c}:{},objectTimelines:s}}delete t.timelineAnimations,r.traverse((o,a)=>{delete a.timelineAnimations})}function mF(i){i.scene.objects.traverse((t,e)=>{let r=e.states;if(!r)return;let n=e.timelineAnimations,o=[];r.forEach((a,s)=>{(a.isAnimation||n?.[s])&&o.push(s)}),o.forEach(a=>r.delete(a))})}function gF(i){for(let{id:t,data:e}of[...i.unproxy()]){let r=e.path?.[0];if(!r||!yF.includes(r))continue;let n=eS(e.value);if(!n.length)continue;let o=i.data(t);if(!o)continue;let a=e.value,[s,...l]=n;for(let c of l){let d=An.MathUtils.generateUUID();i.insertBefore(null,[{id:d,data:{...e,id:d,path:[r,c],value:a[c],easing:vF(e.easing)}}])}o.path=[r,s],o.value=a[s]}}function eS(i){return i===null||typeof i!="object"?[]:jc.filter(t=>t in i)}function vF(i){let t=i?.cubicControls;return{...i,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...i?.springParameters?{springParameters:{...i.springParameters}}:{}}}function bF(i,t){return Math.abs(i[0]-t[0])<1e-6&&Math.abs(i[1]-t[1])<1e-6}function xF(i){let t=[];for(let e of fo.groupKeyframes(i)){let r=new Set(e.keyframes.flatMap(o=>eS(o.data.value))),n=r.size?[...r].map(o=>e.keyframes.filter(a=>eS(a.data.value).includes(o))):[e.keyframes];for(let o of n){let a=[...o].sort((s,l)=>s.data.time-l.data.time);for(let s=0;s+1<a.length;s++)t.push({left:a[s],right:a[s+1]})}}return t}function SF(i){let t=xF([...i.unproxy()]),e=new Map,r=new Set;for(let{left:o,right:a}of t){let s=o.data.easing?.type,c=(s===void 0?void 0:fo.presetHandles(s))?.control2??(s===5?Bi(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!c)continue;let d=e.get(a.id);d?bF(d,c)||r.add(a.id):e.set(a.id,c)}let n=new Map;for(let{id:o,data:a}of i.unproxy()){let s=a.easing?.type,l=s===void 0?void 0:fo.presetHandles(s);l&&n.set(o,l.control1)}for(let{left:o,right:a}of t)r.has(a.id)&&n.delete(o.id);for(let[o,a]of n){let s=i.data(o);!s?.easing||(s.easing.cubicControls={control1:a,control2:Bi(s.easing.cubicControls?.control2,[1,1])},s.easing.type=5)}for(let{left:o,right:a}of t){if(!n.has(o.id))continue;let s=i.data(a.id),l=e.get(a.id);!s?.easing||!l||(s.easing.cubicControls={control1:Bi(s.easing.cubicControls?.control1,[0,0]),control2:l})}}function pP(i,t){i.scene.objects.traverse((e,r)=>{let n=r;if(!(n.type!=="Page"||!n.timelines))for(let o of Object.values(n.timelines))for(let a of Object.values(o.objectTimelines??{}))t(a.keyframes)})}function tS(i){i.pivot=[0,0,0],i.pivotRotation=[0,0,0]}function AF(i){return i.every((e,r)=>Math.abs(e-(r%5===0?1:0))<1e-6)}function wF(i){return t=>i.get(t)?.data?.value}function vP(i,t,e=[]){let r=["position","rotation","scale","shear"];function n(p,h,f){return p?.map(m=>typeof m=="string"?t(m)??f:m)??[...h]}function o(p,h){if(!p||AF(p))return;let f=new An.Matrix4().fromArray(p).multiply(new An.Matrix4().compose(new An.Vector3().fromArray(h.position),new An.Quaternion().setFromEuler(new An.Euler(h.rotation[0]*An.MathUtils.DEG2RAD,h.rotation[1]*An.MathUtils.DEG2RAD,h.rotation[2]*An.MathUtils.DEG2RAD)),new An.Vector3().fromArray(h.scale)));return Bp(f)}function a(p,h){return p.length===h.length&&p.every((f,m)=>f===h[m])}i.shear=tn.zero;let s=i,l=s.hiddenMatrix;l!==void 0&&delete s.hiddenMatrix;let c={position:n(s.position,[0,0,0],0),rotation:n(s.rotation,[0,0,0],0),scale:n(s.scale,[1,1,1],1)},d=o(l,c);if(d&&Object.assign(s,d),d){let p=new An.Matrix4().fromArray(l);for(let h of e)sP(h,p,c,d)}let u=d??{...c,shear:[...tn.zero]};s.states?.forEach(p=>{let h=p.hiddenMatrix;if(h!==void 0&&delete p.hiddenMatrix,!(h!==void 0||p.position!=null||p.rotation!=null||p.scale!=null))return;let m={position:n(p.position,c.position,0),rotation:n(p.rotation,c.rotation,0),scale:n(p.scale,c.scale,1)},y=o(h??l,m);if(!d&&!y)return;let g=y??{...m,shear:[...tn.zero]};for(let v of r)(p[v]!=null||!a(g[v],u[v]))&&(p[v]=g[v])})}function CF(i){}function EF(i){let t=i.schema??0;if(t!==135){if(t>135){console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads ${135}). Update @splinetool/runtime to the latest version to load it correctly.`);return}console.warn("updating from ",t,"to ",135),UT(i,t),t<100&&(i.scene.publish.joystickSizeAndXYOffset===void 0&&(i.scene.publish.joystickSizeAndXYOffset=Ri.defaultData.joystickSizeAndXYOffset),i.schema=100),t<101&&(Ho(i,cP),jo(i,cP),i.schema=101),t<102&&(Qk(i),i.schema=102),t<104&&(i.shared.catelogs=new ve,i.shared.lib=ho.defaultData(),i.schema=104),t<105&&(nF(i),i.scene.objects.traverse((e,r)=>{mP(r)}),i.schema=105);for(let e of Object.values(i.shared.lib.components))yP(e);if(t<106&&(oF(i),i.schema=106),t<107&&(i.shared.lib.variables=ho.defaultData().variables,i.schema=107),t<109&&(sF(i),i.schema=109),t<110&&(lF(i),i.schema=110),t<111&&(i.scene.objects.traverse((e,r)=>{Jk(r)}),i.schema=111),t<112&&(cF(i),i.schema=112),t<113&&(dF(i),i.schema=113),t<114&&(i.scene.publish.settings.web.imageQuality===void 0&&(i.scene.publish.settings.web.imageQuality=70),i.schema=114),t<115&&(uF(i),i.schema=115),t<116&&(pF(i),i.schema=116),t<117&&(i.scene.publish.settings.web.pixelRatioMobile===void 0&&(i.scene.publish.settings.web.pixelRatioMobile=0),i.scene.publish.settings.web.pixelRatioDesktop===void 0&&(i.scene.publish.settings.web.pixelRatioDesktop=0),i.schema=117),t<118&&(i.shared.timelineAnimations=Mr({},ve.prototype),i.scene.objects.traverse((e,r)=>{gP(r)}),i.schema=118),t<119&&(i.scene.publish.settings.videoStatic.format=bs.defaultData.scene.publish.settings.videoStatic.format,i.scene.publish.settings.videoStatic.imageFormat=bs.defaultData.scene.publish.settings.videoStatic.imageFormat,i.schema=119),t<120&&(i.scene.publish.settings.image.colorSpace="display-p3",i.scene.publish.settings.videoStatic.colorSpace="display-p3",i.schema=120),t<121&&(i.scene.objects.traverse((e,r)=>{tS(r),r.type==="Page"&&r.camera!==void 0&&tS(r.camera)}),i.schema=121),t<122&&(delete i.scene.publish.settings.video,i.scene.publish.orbitControls.rotationSpeed=bs.defaultData.scene.publish.orbitControls.rotationSpeed,i.schema=122),t<123&&(i.scene.objects.traverse((e,r)=>{r.type==="Page"&&r.sky===void 0&&(r.sky=Go.defaultData)}),i.schema=123),t<124&&(t>=123&&i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(typeof n.exposure=="number"&&(n.exposure=Math.round(n.exposure/5e-4*1e4)/1e4),n.lighting===void 0&&(n.lighting=Go.defaultData.lighting))}),i.schema=124),t<125&&(i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingIntensity===void 0&&(n.lightingIntensity=Go.defaultData.lightingIntensity)}),i.schema=125),t<126&&(i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(n.mode===void 0&&(n.mode="physical"),n.hdri===void 0?n.hdri={...Go.defaultData.hdri}:(n.hdri.blur===void 0&&(n.hdri.blur=Go.defaultData.hdri.blur),Array.isArray(n.hdri.rotation)&&(n.hdri.rotation=n.hdri.rotation[1]??0)))}),i.schema=126),t<127&&(i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n?.hdri!==void 0&&n.hdri.showBackground===void 0&&(n.hdri.showBackground=!0)}),i.schema=127),t<128&&(i.scene.objects.traverse((e,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingQuality===void 0&&(n.lightingQuality="full")}),i.schema=128),t<129&&(i.scene.objects.traverse((e,r)=>{if(r.type==="Page"){r.camera===void 0&&(r.camera=po.defaultData.camera);let n=r.camera;n.far=1e5,n.perspective?n.perspective.near=70:n.perspective={near:70,fov:45,zoom:1}}}),i.schema=129),t<130&&($0(i,rS),i.schema=130),t<131&&(mF(i),fF(i),pP(i,gF),pP(i,SF),i.schema=131),t<132&&(i.scene.objects.traverse((e,r)=>hP(r)),i.schema=132),t<133){let e=wF(i.shared.variables),r=new Map;i.scene.objects.traverse((n,o)=>{let a=o;if(!(a.type!=="Page"||!a.timelines))for(let s of Object.values(a.timelines))for(let[l,c]of Object.entries(s.objectTimelines??{})){let d=r.get(l)??[];d.push(c.keyframes),r.set(l,d)}}),i.scene.objects.traverse((n,o)=>vP(o,e,r.get(n))),i.schema=133}t<134&&(i.scene.objects.traverse((e,r)=>fP(r)),i.schema=134),t<135&&($0(i,nS),i.schema=135)}}var An,Zk,El,$k,yF,ly=xe(()=>{"use strict";An=require("three");W0();yt();Km();zT();Op();Cp();_n();gr();Ym();Mp();Fm();Np();Q0();lP();Zk=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]);El=180/Math.PI,$k=Math.PI/180;yF=["position","rotation","scale","shape size"]});var xP,cy,iS,SP,dy,Da,_p,Kc,uy,oS,Qc,aS,sS,AP,kp,lS,Ra,py,wP=xe(()=>{"use strict";_n();yt();gr();(t=>{function i(e){return!0}t.is=i})(xP||(xP={}));(r=>{r.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(n,o){return{position:o?.position??n.position,rotation:o?.rotation??n.rotation,scale:o?.scale??n.scale,shear:o?.shear??n.shear}}r.merge=t;function e(n,o){return Xf({position:hi.isEqual(n.position,o.position)?void 0:o.position,rotation:n.rotation===o.rotation?void 0:o.rotation,scale:hi.isEqual(n.scale,o.scale)?void 0:o.scale,shear:n.shear&&o.shear&&hi.isEqual(n.shear,o.shear)?void 0:o.shear})}r.diff=e})(cy||(cy={}));(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(iS||(iS={}));(t=>t.defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8})(SP||(SP={}));(t=>t.defaultData={opacity:1,fill:{color:Ve.fromHexAndA(Ir,1),enabled:!0},stroke:{color:Ve.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:Ve.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Ve.from0to1([0,0,0,1]),enabled:!1,spread:0}})(dy||(dy={}));(o=>{function i(a,s){return{name:s}}o.newEmpty=i;function t(a,s){if(s===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let d of c)d in l&&d in s&&s[d]!==void 0&&Object.assign(l,{[d]:s[d]});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,cy.merge(l,s)),l=t(l,s),l=e(l,s),l}o.patch=r;function n(a,s){let l,c=[];for(let[d,u]of Object.entries(s))d!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},c.push(l)),l.props[d]=u);return c}o.toOps=n})(Da||(Da={}));(t=>t.defaultData={...cy.defaultData,...iS.defaultData,states:new oe,events:new oe,visible:!0,raycastLock:!1})(_p||(_p={}));(t=>t.defaultData={..._p.defaultData,...dy.defaultData})(Kc||(Kc={}));(t=>t.defaultData={cornerRadius:[0,0,0,0]})(uy||(uy={}));(t=>t.defaultData={...Kc.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(oS||(oS={}));(t=>t.defaultData={...Kc.defaultData,...uy.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(Qc||(Qc={}));(t=>t.defaultData={...Kc.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"})(aS||(aS={}));(t=>t.defaultData={...Kc.defaultData,type:"path2d",path:"",name:"Path"})(sS||(sS={}));(t=>{function i(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=i})(AP||(AP={}));(t=>t.defaultData={..._p.defaultData,name:"Group",type:"group2d"})(kp||(kp={}));(t=>t.defaultData=()=>({..._p.defaultData,...uy.defaultData,...dy.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Ve.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Ve.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(lS||(lS={}));(o=>{function i(a){switch(a){case"rectangle2d":return{...Qc.defaultData};case"ellipse2d":return{...oS.defaultData};case"text2d":return{...aS.defaultData};case"vector2d":return{...Qc.defaultData};case"path2d":return{...sS.defaultData};case"frame2d":return{...lS.defaultData()};case"group2d":return{...kp.defaultData}}}o.defaultData=i;function t(a){return"width"in a&&"height"in a?[typeof a.width=="number"?a.width*.5:0,typeof a.height=="number"?a.height*.5:0]:[0,0]}o.getPivot=t;function e(a){return a.type==="rectangle2d"||a.type==="ellipse2d"||a.type==="text2d"||a.type==="frame2d"}o.isResizeable=e;function r(a){return a.type==="frame2d"&&a.autoLayout!==void 0}o.isAutoLayoutable=r;function n(a){return a.type==="rectangle2d"||a.type==="frame2d"}o.hasCorners=n})(Ra||(Ra={}));(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new Rt},e.emptyData=function(){return{type:"scene2d",objects:new Rt}}))(py||(py={}))});var K0=xe(()=>{"use strict";dT();pT();v0();x0();W0();u0();P0();M0();B0();Fm();ly();j0();km();Dm();S0();Cp();T0();L0();_n();Op();Mp();Q0();Wm();R0();Ym();qm();gT();D0();Qm();Um();A0();w0();wP()});var jO=Hf((b1,zO)=>{(function(i,t){typeof b1=="object"?zO.exports=t():typeof define=="function"&&define.amd?define(t):i.Alea=t()})(b1,function(){"use strict";return i.importState=function(e){var r=new i;return r.importState(e),r},i;function i(){return function(e){var r=0,n=0,o=0,a=1;e.length==0&&(e=[+new Date]);var s=t();r=s(" "),n=s(" "),o=s(" ");for(var l=0;l<e.length;l++)r-=s(e[l]),r<0&&(r+=1),n-=s(e[l]),n<0&&(n+=1),o-=s(e[l]),o<0&&(o+=1);s=null;var c=function(){var d=2091639*r+a*23283064365386963e-26;return r=n,n=o,o=d-(a=d|0)};return c.next=c,c.uint32=function(){return c()*4294967296},c.fract53=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.version="Alea 0.9",c.args=e,c.exportState=function(){return[r,n,o,a]},c.importState=function(d){r=+d[0]||0,n=+d[1]||0,o=+d[2]||0,a=+d[3]||0},c}(Array.prototype.slice.call(arguments))}function t(){var e=4022871197,r=function(n){n=n.toString();for(var o=0;o<n.length;o++){e+=n.charCodeAt(o);var a=.02519603282416938*e;e=a>>>0,a-=e,a*=e,e=a>>>0,a-=e,e+=a*4294967296}return(e>>>0)*23283064365386963e-26};return r.version="Mash 0.9",r}})});var FI=Hf((Voe,kI)=>{"use strict";function nU(i,t){function e(){this.constructor=i}e.prototype=t.prototype,i.prototype=new e}function ql(i,t,e,r){this.message=i,this.expected=t,this.found=e,this.location=r,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ql)}nU(ql,Error);ql.buildMessage=function(i,t){var e={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var d="",u;for(u=0;u<c.parts.length;u++)d+=c.parts[u]instanceof Array?o(c.parts[u][0])+"-"+o(c.parts[u][1]):o(c.parts[u]);return"["+(c.inverted?"^":"")+d+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function n(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+r(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+r(d)})}function o(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+r(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+r(d)})}function a(c){return e[c.type](c)}function s(c){var d=new Array(c.length),u,p;for(u=0;u<c.length;u++)d[u]=a(c[u]);if(d.sort(),d.length>0){for(u=1,p=1;u<d.length;u++)d[u-1]!==d[u]&&(d[p]=d[u],p++);d.length=p}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}function l(c){return c?'"'+n(c)+'"':"end of input"}return"Expected "+s(i)+" but "+l(t)+" found."};function iU(i,t){t=t!==void 0?t:{};var e={},r={svg_path:cn},n=cn,o=function(P){if(!P)return[];for(var O=[],V=0;V<P.length;V++)O=O.concat.apply(O,P[V]);var N=O[0];return N&&N.code=="m"&&(delete N.relative,N.code="M"),O},a=function(P,O){return r_(P,O)},s=/^[Mm]/,l=nt(["M","m"],!1,!1),c=function(P,O,V){var N=wc(P,[O]);return V&&(N=N.concat(wc(P=="M"?"L":"l",V[1]))),N},d=/^[Zz]/,u=nt(["Z","z"],!1,!1),p=function(){return wc("Z")},h=/^[Ll]/,f=nt(["L","l"],!1,!1),m=function(P,O){return wc(P,O)},y=/^[Hh]/,g=nt(["H","h"],!1,!1),v=function(P,O){return wc(P,O.map(function(V){return{x:V}}))},b=/^[Vv]/,S=nt(["V","v"],!1,!1),x=function(P,O){return wc(P,O.map(function(V){return{y:V}}))},A=/^[Cc]/,w=nt(["C","c"],!1,!1),C=function(P,O,V){return{x1:P.x,y1:P.y,x2:O.x,y2:O.y,x:V.x,y:V.y}},T=/^[Ss]/,M=nt(["S","s"],!1,!1),D=function(P,O){return{x2:P.x,y2:P.y,x:O.x,y:O.y}},I=/^[Qq]/,_=nt(["Q","q"],!1,!1),E=function(P,O){return{x1:P.x,y1:P.y,x:O.x,y:O.y}},B=/^[Tt]/,L=nt(["T","t"],!1,!1),k=/^[Aa]/,F=nt(["A","a"],!1,!1),W=function(P,O,V,N,j,ae){return{rx:P,ry:O,xAxisRotation:V,largeArc:N,sweep:j,x:ae.x,y:ae.y}},U=function(P,O){return{x:P,y:O}},G=function(P){return P*1},q=function(P){return P.join("")*1},X=/^[01]/,Y=nt(["0","1"],!1,!1),Q=function(P){return P=="1"},te=function(){return""},ue=",",le=wt(",",!1),ce=function(P){return P.join("")},de=".",ge=wt(".",!1),Se=/^[eE]/,ye=nt(["e","E"],!1,!1),Z=/^[+\-]/,pe=nt(["+","-"],!1,!1),re=/^[0-9]/,Ae=nt([["0","9"]],!1,!1),Ee=function(P){return P.join("")},se=/^[ \t\n\r]/,be=nt([" "," ",`
2
2
  `,"\r"],!1,!1),R=0,ie=0,Qe=[{line:1,column:1}],Ie=0,Xe=[],Te=0,Ue;if("startRule"in t){if(!(t.startRule in r))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');n=r[t.startRule]}function qe(){return i.substring(ie,R)}function Je(){return ol(ie,R)}function kt(P,O){throw O=O!==void 0?O:ol(ie,R),sp([Mx(P)],i.substring(ie,R),O)}function De(P,O){throw O=O!==void 0?O:ol(ie,R),lo(P,O)}function wt(P,O){return{type:"literal",text:P,ignoreCase:O}}function nt(P,O,V){return{type:"class",parts:P,inverted:O,ignoreCase:V}}function il(){return{type:"any"}}function ap(){return{type:"end"}}function Mx(P){return{type:"other",description:P}}function Gf(P){var O=Qe[P],V;if(O)return O;for(V=P-1;!Qe[V];)V--;for(O=Qe[V],O={line:O.line,column:O.column};V<P;)i.charCodeAt(V)===10?(O.line++,O.column=1):O.column++,V++;return Qe[P]=O,O}function ol(P,O){var V=Gf(P),N=Gf(O);return{start:{offset:P,line:V.line,column:V.column},end:{offset:O,line:N.line,column:N.column}}}function yr(P){R<Ie||(R>Ie&&(Ie=R,Xe=[]),Xe.push(P))}function lo(P,O){return new ql(P,null,null,O)}function sp(P,O,V){return new ql(ql.buildMessage(P,O),P,O,V)}function cn(){var P,O,V,N,j;for(P=R,O=[],V=at();V!==e;)O.push(V),V=at();if(O!==e)if(V=lp(),V===e&&(V=null),V!==e){for(N=[],j=at();j!==e;)N.push(j),j=at();N!==e?(ie=P,O=o(V),P=O):(R=P,P=e)}else R=P,P=e;else R=P,P=e;return P}function lp(){var P,O,V,N,j,ae;if(P=R,O=cp(),O!==e){for(V=[],N=R,j=[],ae=at();ae!==e;)j.push(ae),ae=at();for(j!==e?(ae=cp(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;){for(V.push(N),N=R,j=[],ae=at();ae!==e;)j.push(ae),ae=at();j!==e?(ae=cp(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e)}V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function cp(){var P,O,V,N,j,ae;if(P=R,O=G3(),O!==e){for(V=[],N=R,j=[],ae=at();ae!==e;)j.push(ae),ae=at();for(j!==e?(ae=al(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;){for(V.push(N),N=R,j=[],ae=at();ae!==e;)j.push(ae),ae=at();j!==e?(ae=al(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e)}V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function al(){var P;return P=U3(),P===e&&(P=z3(),P===e&&(P=j3(),P===e&&(P=H3(),P===e&&(P=W3(),P===e&&(P=X3(),P===e&&(P=K3(),P===e&&(P=Z3(),P===e&&(P=$3())))))))),P}function G3(){var P,O,V,N,j,ae,Cc;if(P=R,s.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(l)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=Ln(),N!==e?(j=R,ae=nr(),ae===e&&(ae=null),ae!==e?(Cc=wC(),Cc!==e?(ae=[ae,Cc],j=ae):(R=j,j=e)):(R=j,j=e),j===e&&(j=null),j!==e?(ie=P,O=c(O,N,j),P=O):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function U3(){var P,O;return P=R,d.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(u)),O!==e&&(ie=P,O=p()),P=O,P}function z3(){var P,O,V,N;if(P=R,h.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(f)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=wC(),N!==e?(ie=P,O=m(O,N),P=O):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function wC(){var P,O,V,N,j,ae;if(P=R,O=Ln(),O!==e){for(V=[],N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ln(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;)V.push(N),N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ln(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function j3(){var P,O,V,N;if(P=R,y.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(g)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=CC(),N!==e?(ie=P,O=v(O,N),P=O):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function CC(){var P,O,V,N,j,ae;if(P=R,O=Ac(),O!==e){for(V=[],N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ac(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;)V.push(N),N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ac(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function H3(){var P,O,V,N;if(P=R,b.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(S)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=CC(),N!==e?(ie=P,O=x(O,N),P=O):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function W3(){var P,O,V,N;if(P=R,A.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(w)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=q3(),N!==e?(ie=P,O=m(O,N),P=O):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function q3(){var P,O,V,N,j,ae;if(P=R,O=Ox(),O!==e){for(V=[],N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ox(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;)V.push(N),N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ox(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function Ox(){var P,O,V,N,j,ae;return P=R,O=Ln(),O!==e?(V=nr(),V===e&&(V=null),V!==e?(N=Ln(),N!==e?(j=nr(),j===e&&(j=null),j!==e?(ae=Ln(),ae!==e?(ie=P,O=C(O,N,ae),P=O):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e),P}function X3(){var P,O,V,N;if(P=R,T.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(M)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=Y3(),N!==e?(ie=P,O=m(O,N),P=O):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function Y3(){var P,O,V,N,j,ae;if(P=R,O=Ix(),O!==e){for(V=[],N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ix(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;)V.push(N),N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ix(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function Ix(){var P,O,V,N;return P=R,O=Ln(),O!==e?(V=nr(),V===e&&(V=null),V!==e?(N=Ln(),N!==e?(ie=P,O=D(O,N),P=O):(R=P,P=e)):(R=P,P=e)):(R=P,P=e),P}function K3(){var P,O,V,N;if(P=R,I.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(_)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=Q3(),N!==e?(ie=P,O=m(O,N),P=O):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function Q3(){var P,O,V,N,j,ae;if(P=R,O=Dx(),O!==e){for(V=[],N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Dx(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;)V.push(N),N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Dx(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function Dx(){var P,O,V,N;return P=R,O=Ln(),O!==e?(V=nr(),V===e&&(V=null),V!==e?(N=Ln(),N!==e?(ie=P,O=E(O,N),P=O):(R=P,P=e)):(R=P,P=e)):(R=P,P=e),P}function Z3(){var P,O,V,N;if(P=R,B.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(L)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=J3(),N!==e?(ie=P,O=m(O,N),P=O):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function J3(){var P,O,V,N,j,ae;if(P=R,O=Ln(),O!==e){for(V=[],N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ln(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;)V.push(N),N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Ln(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function $3(){var P,O,V,N;if(P=R,k.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(F)),O!==e){for(V=[],N=at();N!==e;)V.push(N),N=at();V!==e?(N=e_(),N!==e?(ie=P,O=m(O,N),P=O):(R=P,P=e)):(R=P,P=e)}else R=P,P=e;return P}function e_(){var P,O,V,N,j,ae;if(P=R,O=Rx(),O!==e){for(V=[],N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Rx(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);N!==e;)V.push(N),N=R,j=nr(),j===e&&(j=null),j!==e?(ae=Rx(),ae!==e?(j=[j,ae],N=j):(R=N,N=e)):(R=N,N=e);V!==e?(ie=P,O=a(O,V),P=O):(R=P,P=e)}else R=P,P=e;return P}function Rx(){var P,O,V,N,j,ae,Cc,Nx,zf,Lx,jf,_x;return P=R,O=EC(),O!==e?(V=nr(),V===e&&(V=null),V!==e?(N=EC(),N!==e?(j=nr(),j===e&&(j=null),j!==e?(ae=Ac(),ae!==e?(Cc=nr(),Cc!==e?(Nx=TC(),Nx!==e?(zf=nr(),zf===e&&(zf=null),zf!==e?(Lx=TC(),Lx!==e?(jf=nr(),jf===e&&(jf=null),jf!==e?(_x=Ln(),_x!==e?(ie=P,O=W(O,N,ae,Nx,Lx,_x),P=O):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e)):(R=P,P=e),P}function Ln(){var P,O,V,N;return P=R,O=Ac(),O!==e?(V=nr(),V===e&&(V=null),V!==e?(N=Ac(),N!==e?(ie=P,O=U(O,N),P=O):(R=P,P=e)):(R=P,P=e)):(R=P,P=e),P}function EC(){var P,O;return P=R,O=MC(),O===e&&(O=sl()),O!==e&&(ie=P,O=G(O)),P=O,P}function Ac(){var P,O,V,N;return P=R,O=R,V=Bx(),V===e&&(V=null),V!==e?(N=MC(),N!==e?(V=[V,N],O=V):(R=O,O=e)):(R=O,O=e),O===e&&(O=R,V=Bx(),V===e&&(V=null),V!==e?(N=sl(),N!==e?(V=[V,N],O=V):(R=O,O=e)):(R=O,O=e)),O!==e&&(ie=P,O=q(O)),P=O,P}function TC(){var P,O;return P=R,X.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(Y)),O!==e&&(ie=P,O=Q(O)),P=O,P}function nr(){var P,O,V,N,j;if(P=R,O=[],V=at(),V!==e)for(;V!==e;)O.push(V),V=at();else O=e;if(O!==e)if(V=PC(),V===e&&(V=null),V!==e){for(N=[],j=at();j!==e;)N.push(j),j=at();N!==e?(O=[O,V,N],P=O):(R=P,P=e)}else R=P,P=e;else R=P,P=e;if(P===e){if(P=R,O=R,V=PC(),V!==e){for(N=[],j=at();j!==e;)N.push(j),j=at();N!==e?(V=[V,N],O=V):(R=O,O=e)}else R=O,O=e;O!==e&&(ie=P,O=te()),P=O}return P}function PC(){var P;return i.charCodeAt(R)===44?(P=ue,R++):(P=e,Te===0&&yr(le)),P}function MC(){var P,O,V,N;return P=R,O=R,V=t_(),V!==e?(N=OC(),N===e&&(N=null),N!==e?(V=[V,N],O=V):(R=O,O=e)):(R=O,O=e),O===e&&(O=R,V=sl(),V!==e?(N=OC(),N!==e?(V=[V,N],O=V):(R=O,O=e)):(R=O,O=e)),O!==e&&(ie=P,O=ce(O)),P=O,P}function t_(){var P,O,V,N,j;return P=R,O=R,V=sl(),V===e&&(V=null),V!==e?(i.charCodeAt(R)===46?(N=de,R++):(N=e,Te===0&&yr(ge)),N!==e?(j=sl(),j!==e?(V=[V,N,j],O=V):(R=O,O=e)):(R=O,O=e)):(R=O,O=e),O===e&&(O=R,V=sl(),V!==e?(i.charCodeAt(R)===46?(N=de,R++):(N=e,Te===0&&yr(ge)),N!==e?(V=[V,N],O=V):(R=O,O=e)):(R=O,O=e)),O!==e&&(ie=P,O=ce(O)),P=O,P}function OC(){var P,O,V,N,j;return P=R,O=R,Se.test(i.charAt(R))?(V=i.charAt(R),R++):(V=e,Te===0&&yr(ye)),V!==e?(N=Bx(),N===e&&(N=null),N!==e?(j=sl(),j!==e?(V=[V,N,j],O=V):(R=O,O=e)):(R=O,O=e)):(R=O,O=e),O!==e&&(ie=P,O=ce(O)),P=O,P}function Bx(){var P;return Z.test(i.charAt(R))?(P=i.charAt(R),R++):(P=e,Te===0&&yr(pe)),P}function sl(){var P,O,V;if(P=R,O=[],re.test(i.charAt(R))?(V=i.charAt(R),R++):(V=e,Te===0&&yr(Ae)),V!==e)for(;V!==e;)O.push(V),re.test(i.charAt(R))?(V=i.charAt(R),R++):(V=e,Te===0&&yr(Ae));else O=e;return O!==e&&(ie=P,O=Ee(O)),P=O,P}function at(){var P,O;return P=R,se.test(i.charAt(R))?(O=i.charAt(R),R++):(O=e,Te===0&&yr(be)),O!==e&&(ie=P,O=te()),P=O,P}function r_(P,O){if(!O)return[P];for(var V=[P],N=0,j=O.length;N<j;N++)V[N+1]=O[N][1];return V}var Uf={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var IC in Uf)Uf[IC.toUpperCase()]=Uf[IC];function wc(P,O){O||(O=[{}]);for(var V=O.length;V--;){var N={code:P,command:Uf[P]};P==P.toLowerCase()&&(N.relative=!0);for(var j in O[V])N[j]=O[V][j];O[V]=N}return O}if(Ue=n(),Ue!==e&&R===i.length)return Ue;throw Ue!==e&&R<i.length&&yr(ap()),sp(Xe,Ie<i.length?i.charAt(Ie):null,Ie<i.length?ol(Ie,Ie+1):ol(Ie,Ie))}kI.exports={SyntaxError:ql,parse:iU}});var kg=Hf((Goe,VI)=>{var _g=FI().parse;_g.parseSVG=_g;_g.makeAbsolute=oU;VI.exports=_g;function oU(i){var t,e={x:0,y:0},r={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return i.forEach(function(n){n.command==="moveto"&&(t=n),n.x0=e.x,n.y0=e.y;for(var o in r)o in n&&(n[o]+=n.relative?n[r[o]]:0);"x"in n||(n.x=e.x),"y"in n||(n.y=e.y),n.relative=!1,n.code=n.code.toUpperCase(),n.command=="closepath"&&(n.x=t.x,n.y=t.y),e=n}),i}});var A3=Hf((dNe,S3)=>{S3.exports=function(t,e){for(var r=t.split("."),n=e.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(n[o]);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 T5={};DC(T5,{default:()=>Tx});module.exports=c_(T5);var Px=require("three");var ld=require("three");var Py=require("three");var wn=require("three");K0();OT();ly();Km();Qm();yt();var br=require("three"),Tl=new br.Vector3,Pl=new br.Vector3,xs=new br.Matrix4,EP=[new br.Vector3(-1,1,1),new br.Vector3(-1,-1,1),new br.Vector3(1,-1,1),new br.Vector3(1,1,1),new br.Vector3(-1,1,-1),new br.Vector3(-1,-1,-1),new br.Vector3(1,-1,-1),new br.Vector3(1,1,-1)],TF=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],PF=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],CP=(i,t,e)=>{i.updateEntityBoxSize(Tl,Pl),xs.copy(t).multiply(i.matrixWorld),Pl.x===0&&Pl.y===0&&Pl.z===0?e.push(new br.Vector3(Tl.x,Tl.y,Tl.z).applyMatrix4(xs)):EP.forEach(r=>{e.push(r.clone().multiply(Pl).add(Tl).applyMatrix4(xs))})},Fp=class extends br.Box3{constructor(){super(...arguments);this.matrix=new br.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 n=new br.Matrix4().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,n,r)}expandByObjectSize(e,r,n=!1){let o=[];if(n===!0){let a=[];e.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s)){xs.copy(r).multiply(s.matrixWorld),a.push(new br.Vector3().applyMatrix4(xs));return}CP(s,r,o)}}),o.length===0&&o.push(...a)}else CP(e,r,o);return this.setFromPoints(o)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(xs.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(Pl).multiplyScalar(.5),this.getCenter(Tl),xs.copy(this.matrix).setPosition(Tl),this.vertices=EP.map(e=>e.clone().multiply(Pl).applyMatrix4(xs))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=TF.map(([e,r])=>new br.Line3(this.vertices[e],this.vertices[r])),this.centerEdges=this.edges.map(e=>e.getCenter(new br.Vector3))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=PF.map(([e,r])=>this.vertices[e].clone().add(this.vertices[r]).multiplyScalar(.5))}};yt();var MF=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),OF=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),IF=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||FF&&"ontouchend"in document,DF=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,RF=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,BF=()=>{if(typeof window>"u")return!1;let i=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(i)&&/Apple Computer/.test(t)},NF=()=>{if(typeof window>"u")return null;let t=navigator.userAgent.match(/Version\/(\d+\.\d)/);return t&&t[1]},LF=()=>{if(typeof window>"u")return;let t=new URLSearchParams(window.location.search).get("desktop-app-version");return t?(window.localStorage.setItem("desktop-app-version",t),t):window.localStorage.getItem("desktop-app-version")??"0.0.6"},cS=MF(),FX=cS?LF():void 0,_F=()=>{if(!(typeof window>"u"))return window.spline},kF=_F(),VX=!!kF?.isShellTabs,FF=OF(),Zc=IF(),GX=DF(),Zn=RF(),dS=BF(),TP=Number(NF());var Rr=[];function PP(){Rr.splice(0,Rr.length)}function hy(i,t=0,e={}){let r=e.leading===!0,n=e.trailing!==!1,o=e.maxWait!==void 0?Math.max(e.maxWait,t):void 0,a,s,l,c,d,u=0,p=v=>{let b=s,S=l;return s=l=void 0,u=v,c=i.apply(S,b),c},h=v=>{if(d===void 0)return!0;let b=v-d,S=v-u;return b>=t||b<0||o!==void 0&&S>=o},f=v=>{let b=t-(v-d);return o!==void 0?Math.min(b,o-(v-u)):b},m=v=>(a=void 0,n&&s?p(v):(s=l=void 0,c)),y=()=>{let v=Date.now();h(v)?m(v):a=setTimeout(y,f(v))},g=function(...v){let b=Date.now(),S=h(b);if(s=v,l=this,d=b,S){if(a===void 0)return u=b,a=setTimeout(y,t),r?p(b):c;if(o!==void 0)return a=setTimeout(y,t),p(b)}return a===void 0&&(a=setTimeout(y,t)),c};return g.cancel=()=>{a!==void 0&&clearTimeout(a),u=0,s=d=l=a=void 0},g.flush=()=>a===void 0?c:m(Date.now()),g}function MP(i,t=0,e={}){return hy(i,t,{leading:e.leading!==!1,trailing:e.trailing!==!1,maxWait:t})}function Ss(i){return Jc(i,new Map)}function Jc(i,t){if(i===null||typeof i!="object")return i;if(t.has(i))return t.get(i);if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){let r=new RegExp(i.source,i.flags);return r.lastIndex=i.lastIndex,r}if(i instanceof ArrayBuffer)return i.slice(0);if(ArrayBuffer.isView(i))return new i.constructor(i.buffer.slice(0),i.byteOffset,i instanceof DataView?i.byteLength:i.length);if(i instanceof Map){let r=new Map;return t.set(i,r),i.forEach((n,o)=>r.set(Jc(o,t),Jc(n,t))),r}if(i instanceof Set){let r=new Set;return t.set(i,r),i.forEach(n=>r.add(Jc(n,t))),r}if(Array.isArray(i)){let r=new i.constructor(i.length);t.set(i,r);for(let[n,o]of Object.entries(i))r[n]=Jc(o,t);return r}let e=Object.create(Object.getPrototypeOf(i));t.set(i,e);for(let[r,n]of Object.entries(i))e[r]=Jc(n,t);return e}function mo(i,t){if(Object.is(i,t)||i!==i&&t!==t)return!0;if(i===null||t===null||typeof i!="object"||typeof t!="object")return!1;if(i instanceof Date||t instanceof Date)return i instanceof Date&&t instanceof Date&&i.getTime()===t.getTime();if(i instanceof RegExp||t instanceof RegExp)return i instanceof RegExp&&t instanceof RegExp&&i.source===t.source&&i.flags===t.flags;if(Array.isArray(i)||Array.isArray(t))return!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length?!1:i.every((n,o)=>mo(n,t[o]));if(ArrayBuffer.isView(i)||ArrayBuffer.isView(t))return!ArrayBuffer.isView(i)||!ArrayBuffer.isView(t)||i.constructor!==t.constructor||i.length!==t.length?!1:i.every((n,o)=>Object.is(n,t[o]));if(i instanceof Map||t instanceof Map){if(!(i instanceof Map)||!(t instanceof Map)||i.size!==t.size)return!1;for(let[n,o]of i)if(!t.has(n)||!mo(o,t.get(n)))return!1;return!0}if(i instanceof Set||t instanceof Set){if(!(i instanceof Set)||!(t instanceof Set)||i.size!==t.size)return!1;for(let n of i)if(!t.has(n))return!1;return!0}let e=Object.keys(i),r=Object.keys(t);return e.length!==r.length?!1:e.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&mo(i[n],t[n]))}function Vp(i,t){let e={};for(let r of t)r in i&&(e[r]=i[r]);return e}function Gp(i,t){let e=new Set(t),r={};for(let[n,o]of Object.entries(i))e.has(n)||(r[n]=o);return r}function OP(i){if(!i||i.length===0)return;let t;for(let e of i)e===e&&(t===void 0||e>t)&&(t=e);return t}var VF=Array.isArray,uS=VF;var ki={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}};function Up(i){return i?.isParticleSystem===!0}function $c(i){return i?.isHairSystem===!0}function fi(i){return i?.isShapeBlendEntity===!0}function Ml(i){return i?.isPathObject===!0}function dn(i){return i?.isObject2D===!0}function Vn(i){return i?.isUIObject===!0}function ed(i){return i?.isCloner===!0}function td(i){return i?.isClone===!0}function rd(i){return i?.isComponentObject===!0}var GF=new Set;function Pe(i){GF.add(i)}var IP=new Set;function xr(i,t){let e=`${i}:${t}`;IP.has(e)||IP.add(e)}var RP=new Map,BP=new Map;function Ol(i,t){RP.set(i,t)}function fy(i){return RP.get(i)}function Fi(i,t){BP.set(i,t)}function my(i){return BP.get(i)}var NP=new Map;function zp(i,t){NP.set(i,t)}function yy(i){return NP.get(i)}var LP=null,DP=null;function _P(i){LP=i,DP!==null&&i.setHanaUIWasmUrl(DP)}function pS(){return LP}var Jn=require("three");ey();var UF=new Jn.Vector3(1,1,1);function hS(i,t,e,r,n=new Jn.Matrix4){return n.compose(i,t,UF).multiply(e).scale(r)}var kP=new Jn.Matrix4,Ba;(t=>{function i(e){return e&&e.__isSPEObject}t.is=i})(Ba||(Ba={}));var nd=i=>class extends i{constructor(){super(...arguments);this.previousModelViewMatrix=new Jn.Matrix4;this.copyPreviousMatrix=!0;this.pivotMatrix=new Jn.Matrix4;this.matrixWorldRigid=new Jn.Matrix4;this.shearScale=new Jn.Matrix4;this.shearScaleInv=new Jn.Matrix4;this.shearMatrix=new Jn.Matrix4}get __isSPEObject(){return!0}getPhysicsLocalMatrix(r){return this.rigidBody?.isDynamic()?(r.copy(this.matrixWorld),this.hasNonUniformScale&&r.multiply(this.shearScaleInv),this.parent&&r.premultiply(kP.copy(this.parent.matrixWorld).invert()),r.multiply(kP.copy(this.pivotMatrix).invert()),!0):!1}isDescendantOf(r){r instanceof Jn.Object3D&&(r=r.uuid);let n=this;for(;n.parent;){if(n.parent.uuid===r)return!0;n=n.parent}return!1}updateMatrix(){!this.shearMatrix||(hS(this.position,this.quaternion,this.shearMatrix,this.scale,this.matrix),this.matrixWorldNeedsUpdate=!0)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,r=!0);for(let n of this.children)n.updateMatrixWorld(r)}updateWorldMatrix(r,n){let o=this.parent;if(r&&o!==null&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),n)for(let a of this.children)a.updateWorldMatrix(!1,!0)}traverseChildren(r,n=0){for(let o of this.children)Ba.is(o)&&o.traverseObject(r,n+1)}traverseObject(r,n=0){if(r(this,n)!==!0)for(let a of this.children)Ba.is(a)&&a.traverseObject(r,n+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=$m(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(r,n){this.updateWorldMatrix(!0,!1);let o=new Jn.Matrix4().copy(this.matrixWorld).invert();return r.parent!==null&&(r.parent.updateWorldMatrix(!0,!1),o.multiply(r.parent.matrixWorld)),r.applyMatrix4(o),r.updateWorldMatrix(!1,!1),this.add(r),n!==void 0&&(this.children.pop(),this.children.splice(n,0,r)),this}copy(r,n=!1){return super.copy(r,n),this}onAfterRender(r,n,o,a,s,l){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}};var pr=require("three"),mS=class extends pr.CurvePath{constructor(){super()}getPoints(t=12){let e=[],r,n=this.getCurveLengths(),a=n[n.length-1]/n.length;for(let s=0,l=this.curves;s<l.length;s++){let c=l[s],d=s===0?n[s]:n[s]-n[s-1],u=Math.ceil(t*d/a),p=c.getPoints(u);for(let h=0;h<p.length;h++){let f=p[h];r&&r.equals(f)||(e.push(f),r=f)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}};var gy=.001,Il=new pr.Vector3,vy=new pr.Vector3,id=new pr.Vector3,od=new pr.Vector3,jp=new pr.Vector3,fS=new pr.Vector3,Hp=new pr.Vector3,FP=new pr.Vector3,VP=new pr.Vector3;function GP(i,t,e){return Il.subVectors(t,i),vy.subVectors(t,e),Il.cross(vy).length()<=gy}var UP=new WeakMap;function by(i){let t=UP.get(i.points);if(t!==void 0&&t.isClosed===i.isClosed)return t.curve;let e=zF(i);return UP.set(i.points,{isClosed:i.isClosed,curve:e}),e}function zF(i){let t=i.points,e=[t[0]],r=[new pr.Vector3(...t[0].data.position)];id.copy(r[0]);for(let f=0;f<t.length-1;f++)Il.fromArray(t[f].data.position),vy.fromArray(t[f+1].data.position),jp.subVectors(Il,id),Hp.subVectors(Il,vy),jp.cross(Hp).length()>gy&&(e.push(t[f]),r.push(new pr.Vector3().copy(Il)),id.copy(Il));let n=t[t.length-1];e.push(n),r.push(new pr.Vector3(...n.data.position));let o=i.isClosed,a=e.length-(o?0:1),s=e.length,l=[],c=[];for(let f=0;f<s;f++){let m=e[f].data;l.push(new pr.Vector3(...m.controlPrevious.position)),c.push(new pr.Vector3(...m.controlNext.position))}let d=[];for(let f=0;f<a;f++){let m=f===s-1?0:f+1;d.push(GP(r[f],c[f],r[m])&&GP(r[f],l[m],r[m]))}let u=[];for(let f=0;f<s;f++){let m=e[f].data,y=r[f],g={position:y,prevDir:void 0,nextDir:void 0,controlPrevious:l[f],controlNext:c[f],tan:void 0,baseRoundness:m.roundness,removedLength:0};if(u.push(g),m.roundness===0||!o&&(f===0||f===s-1))continue;let v=o&&f==0?s-1:f-1,b=o&&f==s-1?0:f+1,S=new pr.Vector3().subVectors(r[v],y).normalize(),x=new pr.Vector3().subVectors(r[b],y).normalize();g.prevDir=S,g.nextDir=x;let A=d[o&&f===0?s-1:f-1],w=d[f];if(A&&w){od.addVectors(S,x).normalize();let C=id.crossVectors(od,S).length()/S.dot(od);g.tan=C,g.removedLength=m.roundness/C}}for(let f=0;f<a;f++){let m=f,y=o&&f===s-1?0:f+1,g=u[m],v=u[y];if(g.removedLength!==0||v.removedLength!==0){let b=g.position.distanceTo(v.position);g.removedLength=Math.min(g.removedLength,b/2),v.removedLength=Math.min(v.removedLength,b/2)}}let p=new Array(2*s).fill(null);for(let f=0;f<a;f++){let m=f,y=o&&f===s-1?0:f+1,g=u[m],v=u[y],b=null;if(!d[f])g.position.distanceTo(v.position)>gy&&(b=new pr.CubicBezierCurve3(g.position,g.controlNext,v.controlPrevious,v.position));else{let S=g.position.clone(),x=v.position.clone();(g.removedLength!==0||v.removedLength!==0)&&(g.nextDir&&S.add(id.copy(g.nextDir).setLength(g.removedLength)),v.prevDir&&x.add(id.copy(v.prevDir).setLength(v.removedLength))),S.distanceTo(x)>gy&&(b=new pr.CubicBezierCurve3(S,S.clone().lerp(x,.3),x.clone().lerp(S,.3),x))}p[2*f+1]=b}for(let f=0;f<s;f++){let m=u[f];if(m.removedLength===0)continue;let y=m.position,g=m.prevDir.clone().multiplyScalar(m.removedLength).add(y),v=m.nextDir.clone().multiplyScalar(m.removedLength).add(y),b=m.tan*m.removedLength;od.addVectors(m.prevDir,m.nextDir).normalize(),jp.copy(g).lerp(v,.5);let S=g.distanceTo(v)/2;VP.copy(od).multiplyScalar(Math.sqrt(Math.pow(b,2)-Math.pow(S,2))).add(jp),fS.copy(od).multiplyScalar(-b).add(VP);let x=y.distanceTo(fS)/y.distanceTo(jp);Hp.copy(m.prevDir).multiplyScalar(x*y.distanceTo(g)).add(y),FP.copy(Hp).lerp(fS,2);let A=g.clone().lerp(Hp,4/3),w=v.clone().lerp(FP,4/3);p[2*f]=new pr.CubicBezierCurve3(g,A,w,v)}let h=new mS;for(let f=0;f<p.length;f++){let m=p[f];m&&h.add(m)}return h}var mi=require("three"),Wp=new mi.Matrix4,zP=new mi.Quaternion,yS=new mi.Quaternion,jF=new mi.Euler,HF=new mi.Vector3,WF=new mi.Vector3(0,1,0);function jP(i){let t=i%1;return t<0?t+1:t===0&&i>0?1:t}function HP(i,t,e,r){zP.setFromRotationMatrix(Wp.extractRotation(r));let n=i.clone().applyMatrix4(Wp.copy(r).invert().multiply(e));if(t===null)yS.setFromRotationMatrix(Wp.extractRotation(e));else{let a=t.clone().applyMatrix4(Wp.extractRotation(e));yS.setFromRotationMatrix(Wp.lookAt(HF.set(0,0,0),a,WF))}let o=new mi.Vector3().setFromEuler(jF.setFromQuaternion(zP.invert().multiply(yS))).multiplyScalar(mi.MathUtils.RAD2DEG);return{position:n,rotation:o}}var Ne;(t=>{function i(e){return e&&e.__isEntity}t.is=i})(Ne||(Ne={}));var Yo=i=>Ne.is(i),qF={type:"completeState",isfromEntity:!0},XF=["x","y","z"],xy=new wn.Vector3,WP=new wn.Vector3(1,1,1),gS=new wn.Quaternion,qP=new wn.Euler,XP=new wn.Matrix4,ad=i=>class extends nd(i){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.currentAnimationAction=null;this.reversibleToState=null;this.transitionState={settled:!0,state:null};this.currentTransitionEvent=null;this.previousAction=null;this._singleBBox=new Fp;this._recursiveBBox=new Fp;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this._needApplyPathSnapping=!0;this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(r){let n=this.children[r];if(Ne.is(n))return n}entityChildrenCount(){let r=this.children.length;for(;r--;)if(Ne.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 n=r.parent;if(Ne.is(n))r=n;else return}return r}forInstancesRec(r){this.instances.forEach(n=>{n.disposed||r(n),n.forInstancesRec(r)})}super_Entity(r,n){typeof r=="string"&&(this.uuid=r),this.identity=r,this.data=n,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(r,n,o=!1){if(!(this.data.states.length===0&&!o)){for(let a of this.data.states)Ea.toOps(this.data,a.data).forEach(l=>{let c=Mc.replaceProps(l,this.data);this.dataPatched=this.data,this.updateByPatchedOp(c,this.data,n)});if(r!==null){let a=this.data.states.data(r);a&&(this.dataPatched=Ea.patch(this.data,a),Ea.toOps(this.data,a).forEach(l=>{this.updateByPatchedOp(l,this.dataPatched,n)}))}o&&this.updateTransformState(this.dataPatched,n),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,n){r.setScalar(0),n.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(r=>{Yo(r)&&r.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(r=>{r.resetBBoxNeedsUpdateSelf()})}find(r){let n;return this.traverseEntity(o=>{o.uuid===r&&(n=o)}),n}traverseSortNextHelper(){let r=this.parent;if(r){let n=r.children,o=n.indexOf(this)+1;if(Ne.is(n[o]))return n[o];if(Ne.is(r))return r.traverseSortNextHelper()}}sortNext(){let r=this.children;return this.children.length>0&&Ne.is(this.children[0])?r[0]:this.traverseSortNextHelper()}goUp(r){let n=this;for(;r>0&&n!==null;)n=n.parent,r-=1;return n}hasAnccestorOrSelf(r){return this===r||this.hasAnccestor(r)}hasAnccestor(r){let n=this.parent;for(;n;){if(r===n)return!0;n=n.parent}return!1}countToAccestor(r){let n=0,o=this;for(;o!==r;){if(o===null)return-1;o=o.parent,n+=1}return n}forEachEntity(r){for(let n of this.children)Yo(n)&&r(n)}traverseEntityAncestors(r){this.traverseAncestors(n=>{Ne.is(n)&&r(n)})}traverseConcreteEntity(r,n=0){if(r(this,n)!==!0)for(let a of this.children)Yo(a)&&a.isConcreteEntity&&a.traverseEntity(r,n+1)}traverseEntity(r,n=0){if(r(this,n)!==!0)for(let a of this.children)Yo(a)&&a.traverseEntity(r,n+1)}traverseVisibleEntity(r){r(this);for(let n of this.children)Yo(n)&&n.visible&&n.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,n=!1){return super.copy(r,n),this.dataPatched=r.dataPatched,this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this}hasEntityChild(){return this.children.some(r=>Yo(r))}isAncestorOf(r){if(this.uuid===r)return!1;let n=!1;return this.traverseEntity(o=>{o.uuid===r&&(n=!0)}),n}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let n={position:this.position.toArray(),rotation:[this.rotation.x*wn.MathUtils.RAD2DEG,this.rotation.y*wn.MathUtils.RAD2DEG,this.rotation.z*wn.MathUtils.RAD2DEG],scale:this.scale.toArray(),shear:tn.fromMatrix(this.shearMatrix.toArray()),pivot:[0,0,0],pivotRotation:[0,0,0]};return Gp(n,r)}getTransformValues(r,n,o){return n[r].map((a,s)=>o?.shared.getVariable(a,[this.uuid,r,XF[s]])??a)}updateTransformState(r,n){let o=!1;if(r.position&&(this.position.fromArray(this.getTransformValues("position",r,n)),o=!0),r.rotation&&(xy.fromArray(this.getTransformValues("rotation",r,n)).multiplyScalar(wn.MathUtils.DEG2RAD),this.rotation.setFromVector3(xy),o=!0),r.scale&&(this.scale.fromArray(this.getTransformValues("scale",r,n)),o=!0),r.shear&&(this.shearMatrix.fromArray(tn.toMatrix(r.shear)),o=!0),r.pivot!==void 0||r.pivotRotation!==void 0){if(o=!0,r.pivot!==void 0&&r.pivotRotation!==void 0)this.pivotMatrix.compose(xy.fromArray(r.pivot).negate(),gS.setFromEuler(qP.fromArray(r.pivotRotation.map(a=>a*wn.MathUtils.DEG2RAD))).invert(),WP);else if(r.pivot!==void 0)this.pivotMatrix.setPosition(-r.pivot[0],-r.pivot[1],-r.pivot[2]);else if(r.pivotRotation!==void 0){let a=xy.setFromMatrixPosition(this.pivotMatrix);gS.setFromEuler(qP.fromArray(r.pivotRotation.map(s=>s*wn.MathUtils.DEG2RAD))).invert(),this.pivotMatrix.compose(a,gS,WP)}}return o&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(a=>{a.invalidateClonerTransform(this)})),r.position&&r.rotation&&r.scale&&this.updateWorldMatrix(!1,!0),o}onVariableUpdate(r=!1){if(r){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(n=>{n.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let r of this.children)Ne.is(r)&&r.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(r=>{Ne.is(r)&&r.disposeRecursively()})}toState(r=[]){let n={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(r)};return Gp(n,r)}updateByObjUpdateOp(r,n){r!==void 0&&this.updateByOp({type:0,props:r,path:[]},{...this.data,...r},n,!1)}updateByOp(r,n,o,a){let s=this.data;this.data=n;let l=r,c=Ye(r.path,["states","*"]);if(c!==null){if(r.type===0){let[d]=c;if(this?.stateSelection===d){let u={...r.props};if(delete u.name,Object.values(r.props).some(p=>p===void 0)){let p=this.data;if(p!==void 0){let h=jt.zoom(p,r.path.slice(2));if(h)for(let f in r.props)r.props[f]===void 0&&f in h&&(u[f]=h[f])}}l={...r,props:u,path:r.path.slice(2)}}}}else if(r.type===0){let d=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(d!==void 0){if(r.props.name!==void 0&&d.name){let{name:p,...h}=d;d=h}if(r.props.material!==void 0&&"material"in d){let{material:p,...h}=d;d=h}let u=jt.removeOverridden(r.path,r.props,d);l={...r,props:u}}}if(this.updateByPatchedOpBase(l,Ea.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),o),Ye(r.path,["overrides"])){let d=[],u=[...r.path];for(d.push(u[1]),u.splice(0,2);u.length>0&&u[0]==="descendants";)d.push(u[1]),u.splice(0,2);if(d[d.length-1]===void 0){if(r.type===0)for(let p of Object.keys(r.props)){d[d.length-1]=p;let h=o.scene.findInstance([this.uuid,...d]);h&&(h.overrideData=r.props[p],h.updateState(Lo.apply(h.component.data,h.overrideData),o))}}else{let p=o.scene.findInstance([this.uuid,...d]);if(p){let h=jt.zoom(p.component.data,u);if(r={...r,path:u},r.type===0){let f=r.props;if(h)for(let[m,y]of Object.entries(r.props))y===void 0&&(f===r.props&&(f={...r.props}),f[m]=h[m]);r={...r,props:f}}p.overrideData=Vc.resolve(n.overrides,d),p.updateByOp(r,or.applySimple(p.data,r),o,!1)}}}else if(this.instances.length>0){let d;if(r.path.length===0&&r.type===0){let u;for(let p of Uo.rootOverrideProps)p in r.props&&(u===void 0&&(u={}),u[p]=r.props[p]);u&&(d={...r,props:u})}else for(let u of Uo.rootOverrideProps)if(Ye(r.path,[u])){d=r;break}d!==void 0&&this.instances.forEach(u=>{if(u.isInstanceRoot){let p=Lo.filterOp(u.overrideData,d);p&&u.updateByOp(p,or.applySimple(u.data,p),o,!0)}}),this.instances.forEach(u=>{if(!u.isInstanceRoot){let p=Lo.filterOp(u.overrideData,r);if(p){let h;s===u.data&&r===p?h=n:h=or.applySimple(u.data,p),u.updateByOp(p,h,o,!0)}}})}}updateByPatchedOpBase(r,n,o){if(this.dataPatched=n,r.path.length===0&&r.type===0)r.props.type!==void 0&&!co.is(r.props.type)&&ki.changeEntityProptotype(this,this.data,o);else if(r.path.length===1&&r.path[0]==="geometry"&&r.type===0&&"type"in r.props){ki.changeEntityProptotype(this,this.data,o);for(let a of this.children)Ne.is(a)&&a.updateVisible(o.scene)}this.updateByPatchedOp(r,n,o)}updateByPatchedOp(r,n,o){if(r.path.length===0&&r.type===0?this.updateState(r.props,o):r.type===0&&("resolutionLevel"in r.props||"useChildrenColors"in r.props)&&this.updateState(n,o),r.path[0]==="morphTargetInfluences"&&r.type===0){let s=n.morphTargetInfluences.get(r.path[1])?.data.name;s&&this.updateMorphInfluences(s,o.shared.getVariable(r.props.value,[this.uuid,"morphTargetInfluences",s]))}if(Ye(r.path,["pathSnapping"])!==null&&(this.updatePathSnapping(n.pathSnapping),this.isVirtualEntity&&o.scene?.syncInstancePathConstraint(this)),Ye(r.path,["cloner"])!==null){let a=or.drop(r,1);a.path.length===0&&a.type===0&&a.props.disabled===!0?this.setFromClonerState(null,o):this.cloner?this.cloner.updateState(n.cloner,o):(this.setFromClonerState(n.cloner,o),this.expandCloner(o)),this.updateVisible(o.scene)}}updatePathSnapping(r=this.dataPatched.pathSnapping){this._updatedPathSnapping=r,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(r){if(this._needApplyPathSnapping===!1)return;let n=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,o=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(n===null)return;let l=r.find(this.isVirtualEntity&&r.pathConstraints.getConstraint(this.uuid)||n);if(!l)return;this._needApplyPathSnapping=!1;let c=l.data;if(c.geometry.path.points.length<=1)return;let d=by(c.geometry.path),u=jP(o+a),p=null;try{p=d.curves.length?d.getPointAt(u):null}catch(m){!1&&(console.warn(`The aligned path on ${this.name} is invalid. (${l.name})`),console.error(m))}if(p===null)return;l.updateMatrixWorld();let h=this.parent?XP.copy(this.parent.matrixWorld):XP.identity(),f=HP(p,s==="tangential"?d.getTangentAt(u):null,l.matrixWorld,h);this.updateTransformState({position:f.position.toArray(),rotation:f.rotation.toArray()}),this.traverseEntity(m=>{m._cameraType&&m.dispatchEvent(qF)})}updateVisible(r){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!r)return;let n=!1;this.traverseEntity(o=>{if(o.data.type==="Splat")return n=!0,!0}),n&&r.reloadSplats()}updateState_Entity(r,n){r.name!==void 0&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.visible!==void 0&&(this.updateVisible(n?.scene),this.resetBBoxNeedsUpdate()),n&&"cloner"in r&&r.cloner!==void 0&&(this.setFromClonerState(r.cloner,n),this.updateVisible(n.scene)),this.updateTransformState(r,n)}get attachedSurfaceCloners(){return this.children.filter(r=>ed(r)&&r.parameters.type==="toObject")}setFromClonerState(r,n){if(!this.disposed)if(r===null||r.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(ki.Cloner===null){xr("cloners","a cloner");return}this.cloner=new ki.Cloner(this,r),n.scene.addPendingExpandCloner(this)}else this.cloner.updateState(r,n)}expandCloner(r){!this.disposed&&this.cloner&&this.cloner.expandClones(r)}invalidateClonerTransform(r){this.cloner&&this.cloner.invalidateTransform(r)}requestRender(){this.dispatchEvent({type:"requestRender"})}};var Xp=require("three");var yo=require("three"),YP=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),r=Math.abs(e.width),n=Math.abs(e.height??r),o=Math.abs(e.depth??r),a=Math.abs(Math.min(r,o))/2;return{parameters:Object.assign(e,{width:r,height:n,depth:o,radius:a,segments:Math.round(e.segments),pathSegments:Math.round(e.pathSegments),cornerSegments:Math.round(e.cornerSegments)})}}static build(i){let{width:t,height:e,depth:r,radius:n,revolutions:o,segments:a,pathRadius:s,pathType:l,pathSegments:c,cornerRadius:d,cornerSegments:u}=i.parameters,p=new qp(!1,t,e,r,n,o,a,s,l,c,d,u);return Object.assign(p,{userData:{...i,type:"HelixGeometry"}})}},vS=new yo.Uint32BufferAttribute([0,0,0],1);function Sy(i){return i.type==="TorusGeometry"&&i.arc===360}var qp=class extends yo.BufferGeometry{constructor(t=!0,e=1,r=1,n=1,o=1,a=1,s=1,l=1,c=1,d=1,u=1,p=1){if(super(),a===0)return;let h=t&&a===1;h&&(p=0),u>100&&(u=100),u===0&&(p=0);let f=()=>new yo.Vector3,m=new yo.Vector3,y=f(),g=f(),v=f(),b,S,x,A,w,C,T,M,D=f(),I=f(),_=f(),E=f(),B=f(),L=f(),k=f(),F=f(),W=r-2*l+.001,U=W/a,G=Math.ceil(s*a),q=G+1,X=W/G,Y=-W/2,Q=d+1,te=2*Math.PI/d,ue=Math.PI/2/p,le=.01,ce=Math.min((1-u/100)*l,l-le),de=l-ce,ge=0,Se=2,ye=p*Se+Se,Z=Q*ye/Se,pe=Z+Q*q,re=Math.max(0,Q*(q+ye)),[Ae,Ee,se]=[3,3,2].map(De=>Array(re*De).fill(0)),be=[],R=o-l;function ie(De,wt){let nt=Math.PI/2;C=wt*X,M=2*Math.PI*(C%U)/U+nt,C+=Y,T=Math.sin(M)*R,w=Math.cos(M)*R,t?De.set(w,T,C):De.set(w,C,T)}ie(m,-1e-10),ie(y,0),D.copy(m),ie(m,1);let Qe=m.distanceTo(y),Ie=h?0:de+ce,Xe=Qe*G+2*Ie,Te=ce,Ue=Xe-Ie;for(let De=0;De<=G;De++){ie(g,De),F.subVectors(g,D).normalize(),D.copy(g),L.copy(g).setComponent(+t+1,0).normalize(),k.crossVectors(F,L).normalize();let wt=De===0,nt=De===G,il=wt?3*Math.PI/2:ue,ap=wt?Te:Ue,Mx=wt?Q:pe,Gf=wt?0:re-Q,ol=F.clone().multiplyScalar(wt?-de:de).add(g),yr=F.clone().multiplyScalar(wt?-1:1).normalize();for(let lo=0;lo<Q;lo++){let sp=lo*te;if(I.addVectors(m.copy(L).multiplyScalar(l*Math.cos(sp)),y.copy(k).multiplyScalar(l*Math.sin(sp))),_.copy(I).normalize(),wt||nt){h||(ge=Gf+lo,[0,1,2].forEach(cn=>{Ae[ge*3+cn]=ol.getComponent(cn),Ee[ge*3+cn]=yr.getComponent(cn)}),se[ge*2]=+nt,se[ge*2+1]=lo/d),y.copy(_).multiplyScalar(ce),v.addVectors(g,y);for(let cn=0;cn<p;cn++){let lp=cn*ue+il;E.addVectors(m.copy(F).multiplyScalar(de*Math.sin(lp)),y.copy(_).multiplyScalar(de*Math.cos(lp))),B.copy(E).normalize(),y.addVectors(v,E),E.normalize(),ge=Mx+cn*Q+lo,[0,1,2].forEach(al=>{Ae[ge*3+al]=y.getComponent(al),Ee[ge*3+al]=B.getComponent(al)});let cp=+wt+Math.sin(lp);se[ge*2]=(ap+de*cp)/Xe,se[ge*2+1]=lo/d}}y.addVectors(g,I),ge=Z+De*Q+lo,[0,1,2].forEach(cn=>{Ae[ge*3+cn]=y.getComponent(cn),Ee[ge*3+cn]=_.getComponent(cn)}),se[ge*2]=(Ie+De*Qe)/Xe,se[ge*2+1]=lo/d}}let qe=q+2*p+Se,[Je,kt]=[+h,qe-1];for(let De=Je;De<=kt-1;De++){let wt=h&&De===kt-1;for(let nt=0;nt<Q-1;nt++)b=De*Q+nt,S=b+1,x=(wt?nt:b)+Q,A=(wt?nt+1:S)+Q,De===0?be.push(S,A,x):De===qe-2?be.push(b,S,x):be.push(b,S,x,S,A,x)}this.setIndex(be),this.setAttribute("position",new yo.Float32BufferAttribute(Ae,3)),this.setAttribute("normal",new yo.Float32BufferAttribute(Ee,3)),this.setAttribute("uv",new yo.Float32BufferAttribute(se,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t=this.userData.parameters,e=Math.ceil(t.tubularSegments),r=t.radialSegments,n=r+1,o=[],a,s,l,c;for(let d=1;d<e;d++)for(let u=0;u<r;u++)a=d*n+u,s=a+1,l=a+n,c=s+n,o.push(a,s,l,s,c,l);for(let d=0;d<r;d++)a=e*n+d,s=a+1,l=d+n,c=d+1+n,o.push(a,s,l,s,c,l);return vS.array=new Uint32Array(o),vS.count=o.length,vS}};var Ay,wy=new Map,KP=0;function Cy(){if(Ay===void 0)throw new Error("boolean-wasm is not loaded");return Ay}function bS(i){let t=wy.get(i);if(t===void 0)throw new Error("Unknown csg mesh set handle "+i);return t}function xS(i){return wy.set(++KP,i),KP}var YF={[0]:0,[1]:1,[2]:2};function KF(i,t){if(t&&i.userData.positions!==void 0){let s=i.userData,l=[];for(let c=0,d=0;c<s.verticesPerFace.length;c++){let u=s.verticesPerFace[c];for(let p=1;p<u-1;p++)l.push(s.indices[d],s.indices[d+p],s.indices[d+p+1]);d+=u}return{positions:s.positions instanceof Float32Array?s.positions:new Float32Array(s.positions),indices:new Uint32Array(l)}}let e;Sy(i.userData.parameters)?e=i.getClosedTorusIndicesForBooleanOrSubdiv():e=i.getIndex();let r=i.getAttribute("position"),n;if(e===null){n=new Uint32Array(r.count);for(let s=0;s<n.length;s++)n[s]=s}else e.array instanceof Uint32Array?n=e.array:n=new Uint32Array(e.array);let o=i.getAttribute("normal"),a=o!==void 0&&o.itemSize===3&&o.count===r.count&&o.array instanceof Float32Array&&o.isInterleavedBufferAttribute!==!0?o.array:void 0;return{positions:r.array,indices:n,normals:a}}function QP(i,t,e){if(Ay===void 0)return-1;let{positions:r,indices:n,normals:o}=KF(i,t);return xS(new Ay.CsgMesh(r,n,o))}function ZP(i,t){let e=Cy(),r=YF[t];if(r===void 0)throw new Error("Unknown boolean operation "+t);let n=i.map(bS);if(n.length===1)return e.clone_mesh(n[0]);let o=[],a;if(t===2&&n.length>2){let s=n[0];for(let l=1;l<n.length-1;l++)s=e.boolean_mesh(s,n[l],0),o.push(s);a=e.boolean_mesh(n[n.length-1],s,2)}else if(t===2)a=e.boolean_mesh(n[1],n[0],2);else{let s=n[n.length-1];for(let l=0;l<n.length-1&&(s=e.boolean_mesh(s,n[l],r),o.push(s),s.tri_count()!==0);l++);a=s,o.pop()}for(let s of o)s.free();return a}function JP(i,t,e,r){let n=Cy(),o=ZP(i,t),a=n.mesh_render_data(o,Math.max(r,0));if(e.setAttribute("position",new Xp.Float32BufferAttribute(a.positions(),3)),e.setAttribute("normal",new Xp.Float32BufferAttribute(a.normals(),3)),a.free(),e.boundingSphere===null&&(e.boundingSphere=new Xp.Sphere),o.tri_count()===0)e.boundingSphere.center.set(0,0,0),e.boundingSphere.radius=0,e.userData.parameters={width:0,height:0,depth:0};else{let s=o.bounds();e.boundingSphere.center.set(s[0],s[1],s[2]),e.boundingSphere.radius=(s[3]**2+s[4]**2+s[5]**2)**.5,e.userData.parameters={width:s[3]*2,height:s[4]*2,depth:s[5]*2}}return xS(o)}function $P(i,t){let e=Cy(),r=ZP(i,t),n=e.mesh_topological_data(r),o=n.positions(),a=n.indices();n.free(),r.free();let s=new Uint8Array(a.length/3).fill(3);return{positions:o,indices:a,verticesPerFace:s}}function Ey(i,t){bS(i).transform(new Float32Array(t.elements))}function Ty(i){let t=wy.get(i);t!==void 0&&(t.free(),wy.delete(i))}function eM(i,t){let e=Cy();return xS(e.instanced_union(bS(i),t))}function Dl(i){return i!==null&&"booleanOp"in i}var sd=class extends ad(Py.Mesh){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Py.Matrix4}updateVisible(e){super.updateVisible(e),this.visible=!Dl(this.parent)&&this.visible,Dl(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Dl(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Ty(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}dispose(){super.dispose(),this.freeBooleanPointer()}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Dl(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof sd&&(e.freeBooleanPointer(),Dl(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,r){let n=super.updateTransformState(e,r);return n&&Dl(this.parent)&&this.invalidateDownstreamBooleanData(!0),n}onVariableUpdate(e=!1){super.onVariableUpdate(e),Dl(this.parent)&&this.invalidateDownstreamBooleanData(!0)}};var QF=null;function tM(){return QF}var My=new ld.Box3;function Yp(i,t=0,e=i.count,r,n){let o=1/0,a=1/0,s=1/0,l=-1/0,c=-1/0,d=-1/0;for(let u=t;u<e;u++){let p=i.getX(u),h=i.getY(u),f=i.getZ(u);p<o&&(o=p),h<a&&(a=h),f<s&&(s=f),p>l&&(l=p),h>c&&(c=h),f>d&&(d=f)}My.min.set(o,a,s),My.max.set(l,c,d),My.getCenter(r),My.getSize(n).multiplyScalar(.5)}var ZF=new ld.BufferGeometry,JF=new ld.MeshBasicMaterial,it=class extends sd{constructor(t,e){super(ZF,JF),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){if(this.raycastDeformed(t,e))return;let r=tM();if(r!==null){r(this,t,e);return}super.raycast(t,e)}raycastDeformed(t,e){return!1}updateEntityBoxSize(t,e){let r=this.geometry.getAttribute("position");r!==void 0?Yp(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,t,e):super.updateEntityBoxSize(t,e)}};var Ze=require("three");var Hr=require("three"),rM=require("three/examples/jsm/math/MeshSurfaceSampler.js");function nM(i){let t=new Float32Array(i*i*2);for(let e=0;e<i;e++)for(let r=0;r<i;r++){let n=e*i+r;t[n*2+0]=e/(i-1),t[n*2+1]=r/(i-1)}return t}function iM(i){let t=Math.ceil(Math.sqrt(i));return Math.max(t,1)}function oM(i,t){let e=new Hr.Mesh(i.geometry,i.material),r=[],n=[],o=new Hr.Vector3,a=new Hr.Vector3;e.geometry.index!==null&&(e.geometry=e.geometry.toNonIndexed());let s=new rM.MeshSurfaceSampler(e).build();for(let d=0;d<t;d++)s.sample(o,a),r.push(o.x,o.y,o.z),n.push(a.x,a.y,a.z);let l=new Float32Array(r),c=new Float32Array(n);return{positions:l,normals:c}}function AS(i,t){let e=i,r=new Float32Array(4*t*t);for(let o=0;o<t*t;o++)r[4*o]=e[3*o],r[4*o+1]=e[3*o+1],r[4*o+2]=e[3*o+2],r[4*o+3]=0;let n=new Hr.DataTexture(r,t,t,Hr.RGBAFormat,Hr.FloatType);return n.needsUpdate=!0,n}function aM({size:i}){let t=new Float32Array(4*i*i);for(let r=0;r<i*i;r++)t[4*r]=r,t[4*r+1]=0,t[4*r+2]=0,t[4*r+3]=0;let e=new Hr.DataTexture(t,i,i,Hr.RGBAFormat,Hr.FloatType);return e.needsUpdate=!0,e}function sM(i){let t=new Float32Array(4*i*i);for(let r=0;r<i*i;r++)t[4*r]=0,t[4*r+1]=0,t[4*r+2]=0,t[4*r+3]=0;let e=new Hr.DataTexture(t,i,i,Hr.RGBAFormat,Hr.FloatType);return e.needsUpdate=!0,e}var lM=`
3
3
  // uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU
4
4
  // uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU
@@ -725,7 +725,7 @@ void main() {
725
725
  }
726
726
  `;this.pyramidPassMaterial.fragmentShader=t,this.pyramidPassMaterial.uniforms=this.pyramidPassUniforms,this.pyramidPassMaterial.depthTest=!1,this.pyramidPassMaterial.depthWrite=!1;let e=new rn.Mesh(pd,this.pyramidPassMaterial);e.frustumCulled=!1,this.pyramidPassScene.add(e)}renderPyramid(t,e,r,n,o){new rn.Box2().min.setScalar(0);let s=e.length-1,l=new rn.Vector4;r.getViewport(l),this.pyramidPassUniforms.inputShiftX.value=0,this.pyramidPassUniforms.outputShiftX.value=0;let c=s-1;for(let u=c;u>=0;u--){let p=u%2===c%2?o[0]:o[1],h=u===c?n:u%2===c%2?o[1]:o[0];this.pyramidPassUniforms.inputTexture.value=h.textures.length>1?h.textures[1]:h.texture,this.pyramidPassUniforms.inputWidth.value="width"in h?h.width:1,this.pyramidPassUniforms.inputHeight.value="height"in h?h.height:1,r.setRenderTarget(p);let f=e[u],m=r.getPixelRatio();r.setViewport(this.pyramidPassUniforms.outputShiftX.value/m,0,f/m,f/m),u===2&&t%2!==0&&r.setViewport(this.pyramidPassUniforms.outputShiftX.value/m,0,3/m,3/m),r.render(this.pyramidPassScene,Zp);let y=this.pyramidPassUniforms.inputShiftX.value;this.pyramidPassUniforms.inputShiftX.value=this.pyramidPassUniforms.outputShiftX.value,this.pyramidPassUniforms.outputShiftX.value=y,u<c&&(this.pyramidPassUniforms.outputShiftX.value+=e[u+1])}r.setViewport(l);let d=e.length%2===0?0:1;return r.readRenderTargetPixelsAsync(o[d],o[d].width-1,0,1,1,this.pyramidTopLevelReadPixelBuffer).then(()=>this.pyramidTopLevelReadPixelBuffer[0])}};yt();var BM=require("three"),Vt=class extends BM.Color{constructor(e,r,n,o){super(e,r,n);this.isColorA=!0;this.a=o}setRGBA(e,r,n,o){super.setRGB(e,r,n),this.a=o}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 n;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(n=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let o,a=n[1],s=n[2];switch(a){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=a==="rgba"?parseFloat(o[4]):1,super.setStyle(e,r);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=a==="hsla"?parseFloat(o[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 La=class extends Vt{};var jy=require("three");var Gy=class{constructor(t=1e3*10){this.timeout=t;this.cache=new Map;this.head={data:null,time:0,src:null,next:null,prev:null};this.tail={data:null,time:1/0,src:null,next:null,prev:null};this.hasClean=!1;this.cleanupTimer=null;this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let r=e;e=e.next,e.prev=this.head,this.head.next=e,r.next=null,r.prev=null,r.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),r=this.cache.get(t);return r===void 0?(r={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,r)):(r.time=e,r.prev.next=r.next,r.next.prev=r.prev),r.prev=this.tail.prev,r.next=this.tail,this.tail.prev.next=r,this.tail.prev=r,this.scheduleCleanup(),r.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}};var RS=class extends Gy{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}},DS;function NM(i){return typeof i=="string"?i:(DS||(DS=new RS),DS.load(i))}var Uy=class{constructor(t,e){this.data=t;this.cache=e;this.refCount=0}deref(){if(this.refCount===0&&!1)throw new Error("ref count -1?");this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){if(this.refCount!==0&&!1)throw new Error("ref count is not 0")}},zy=class{constructor(){this.cache=new Map}remove(t){if(this.cache.delete(t.data)===!1&&!1)throw new Error("ref count remove non-exists")}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}};var _a=require("three"),LM=require("three/examples/jsm/loaders/HDRLoader.js");function BS(i){return i.length>2&&i[0]===35&&i[1]===63}function _M(i){try{let t=new LM.HDRLoader().parse(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength));if(!t||!t.width||!t.height)return null;let{width:e,height:r}=t,n=t.data,o=new Uint16Array(n.length),a=e*4,s=d=>_a.DataUtils.toHalfFloat(Math.pow(Math.max(_a.DataUtils.fromHalfFloat(d),0),1/2.2)),l=new Map,c=d=>{let u=l.get(d);return u===void 0&&(u=s(d),l.set(d,u)),u};for(let d=0;d<r;d++){let u=d*a,p=(r-1-d)*a;for(let h=0;h<a;h+=4)o[p+h]=c(n[u+h]),o[p+h+1]=c(n[u+h+1]),o[p+h+2]=c(n[u+h+2]),o[p+h+3]=n[u+h+3]}return{isSplineHdr:!0,data:o,width:e,height:r}}catch{return null}}function kM(i){let t=new _a.DataTexture(i.data,i.width,i.height,_a.RGBAFormat,_a.HalfFloatType);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var vV=0,hd=class extends Uy{constructor(e,r){super(e,r.imageHolderCache);this.data=e;this.shared=r;this.instanceId=++vV;this.loaded=!1;this.isVideo=!1;this.isBuffer=!1;this.isHdr=!1;this._cache={[1e3]:{},[1001]:{},[1002]:{}};this.isVideo=e.type==="video",this.isBuffer=e.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let r=()=>{this.loaded=!0;for(let n of Object.values(this._cache))for(let o of Object.values(n))for(let a of Object.values(o))a&&(a.image=this.img,a.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof e!="string"){let n=new FileReader;n.readAsDataURL(new Blob([e],{type:"video/mp4"}));let o;await new Promise(a=>{n.onloadend=s=>{o=s.target?.result,a(null)}}),this.img.src=o}else this.img.src=e;this.img.onloadeddata=()=>{r()}}else if(e instanceof Uint8Array?BS(e):typeof e=="string"&&/\.hdr($|[?#])/i.test(e)){let n=e instanceof Uint8Array?e:null;if(n===null)try{n=new Uint8Array(await(await fetch(e)).arrayBuffer())}catch{n=null}let o=n!==null&&BS(n)?_M(n):null;o!==null&&(this.isHdr=!0,this.img=o,r())}else this.img=new Image,this.img.src=NM(e),this.img.onload=r,await new Promise(n=>{this.img.onload=()=>{r(),n(null)}})}getTexture(e,r=1008,n=1006){let o=this._cache[e]?.[r]?.[n];if(o)return o;{let a;return this.isBuffer?a=this.img.texture:this.isVideo?a=new jy.VideoTexture(this.img,void 0,e,e):this.isHdr?(a=kM(this.img),a.wrapS=e,a.wrapT=e,a.magFilter=n,a.minFilter=r):a=new jy.Texture(this.img,void 0,e,e,n,r),this.isBuffer||(a.anisotropy=8,a.generateMipmaps=r===1008),this.loaded&&(a.needsUpdate=!0),this._cache[e]===void 0&&(this._cache[e]={}),this._cache[e][r]===void 0&&(this._cache[e][r]={}),this._cache[e][r][n]=a,a}}setNeedsUpdate(e){if(!this.isBuffer)for(let r of Object.values(this._cache))for(let n of Object.values(r))for(let o of Object.values(n))o&&(o.needsUpdate=e)}disposeTextures(){for(let[e,r]of Object.entries(this._cache))for(let[n,o]of Object.entries(r))for(let[a,s]of Object.entries(o))s?.dispose(),this._cache[e]!==void 0&&this._cache[e][n]!==void 0&&(this._cache[e][n][a]=void 0)}dispose(){super.dispose(),this.disposeTextures()}};var yi=class extends hd{};var FM=new Map;function VM(i){if(typeof i=="string")return i;let t=FM.get(i);return t||(t={url:URL.createObjectURL(new Blob([i]))},FM.set(i,t)),t.url}var bV,GM=new Promise(i=>{bV=i});var UM;GM.then(i=>UM=i);var ka=class{constructor({src:t,volume:e,delay:r,loop:n}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._status="stopped";this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let o;typeof t=="string"?o={src:t}:o={src:VM(t),format:"wav"},this.sound=new UM.Howl(o),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),r!==void 0&&(this.delay=r),n!==void 0&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,r){this.sound.on(t,e,r)}off(t,e,r){this.sound.off(t,e,r)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}};var zM=null;function jM(i){zM=i}function HM(){return zM}function NS(i){let t=!1;return i.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&(r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry")&&(t=!0)}),t}var $2=require("three");var ws=require("three");var Br=require("three"),Hy=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=i.parameters?.radiusTop,r=i.parameters?.radiusBottom,n=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},i.parameters);n.thetaLength=Br.MathUtils.clamp(n.thetaLength,0,360),n.hollow=Br.MathUtils.clamp(n.hollow??0,0,1);let o=n.width/2,a=n.radiusTop??o,s=n.radiusBottom??o;if(a===s?(a=o,s=o):a>s?(a=o,s=s*o/a):(a=a*o/s,s=o),n.shapeBlendNode){a=e??o,s=r??o;let l=Math.max(a,s)*2;n.width=l,n.depth=l}return{parameters:Object.assign(n,{width:Math.abs(n.width),height:Math.abs(n.height??n.width),depth:Math.abs(n.depth??n.width),radiusTop:a,radiusBottom:s})}}static build(i){let{width:t,depth:e,height:r,radialSegments:n,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:l,radiusTop:c,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:h}=i.parameters,f;l===0?(f=new Br.BufferGeometry,f.setAttribute("position",new Br.Float32BufferAttribute([],3))):u||h?f=new Jp(c,d,r,n,o,a,s,l*Math.PI/180,u,u,p,h):f=new Br.CylinderGeometry(c,d,r,n,o,a,s,l*Math.PI/180);let m=e/t;return m!==1&&f.scale(1,1,m),Object.assign(f,{userData:{...i,type:"CylinderGeometry"}})}};function WM(i){return new Br.Vector2(i.y,-i.x)}var Jp=class extends Br.BufferGeometry{constructor(t,e,r,n,o,a,s,l,c,d,u,p,h=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,r=r||1,n=Math.floor(n)||8,o=Math.floor(o)||1,a=a!==void 0?a:!1,s=s!==void 0?s:0,l=l!==void 0?l:Math.PI*2,a&&(c=0,d=0);let f=r/2;h&&t==0&&(t=c),h&&e==0&&(e=d);let m=new Br.Vector2(t,f),y=new Br.Vector2(e,-f),g=null,v=null,b=null,S=null,x=m.clone().sub(y),A=0,w=0,C=0;p>0&&(A=Math.min(t,e)*(1-p),w=t-A,C=e-A);let T=m.clone();T.x-=A;let M=Math.PI-x.angle(),D=x.angle(),I=Math.tan(D/2),_=Math.tan(M/2),E=I+_,B=p?E:_,L=p?E:I;if(c=Math.min(c,(t-w)/B,x.length()/E),d=Math.min(d,(e-C)/L,x.length()/E),c>0){let se=c/I;g=m.clone().sub(new Br.Vector2(se,c)),p&&(b=g.clone(),b.x-=A-E*c),m.sub(x.clone().setLength(se))}if(d>0){let se=d/_;v=y.clone().sub(new Br.Vector2(se,-d)),y.add(x.clone().setLength(se)),p&&(S=v.clone(),S.x-=A-E*d,T.sub(x.clone().setLength(se)))}x=m.clone().sub(y);let k=x.length()<.5,F=[],W=[],U=[],G=[],q=[],X=[],Y=(se,be,R,ie,Qe)=>{for(let Ie=0;Ie<u+1;Ie++){let Xe=Ie/u,Te=ie<0?Xe:1-Xe;Qe&&(Te-=1),Te*=se;let Ue=Math.sin(Te),qe=Math.cos(Te)*ie,Je=qe*be+R.y;F.push(Ue*be+R.x),W.push(Je),U.push(Ue),G.push(qe),q.push(.5+Je/r),X.push(!1)}},Q=(se,be,R)=>{let ie=[se,be];R<0&&ie.reverse();for(let Qe of ie)F.push(Qe),W.push(f*R),U.push(0),G.push(R),q.push(.5),X.push(!0)};if(S&&v?(Y(M,d,S,-1,!0),Y(D,d,v,-1,!1)):v?(Q(v.x,0,-1),Y(D,d,v,-1,!1)):a||Q(e,C,-1),!k){let se=WM(x).normalize();for(let be=0;be<=o;be++){let R=be/o,ie=x.y*R+y.y;F.push(x.x*R+y.x),W.push(ie),U.push(se.x),G.push(se.y),q.push(.5+ie/r),X.push(!1)}}if(b&&g?(Y(M,c,g,1,!1),Y(D,c,b,1,!0)):g?(Y(M,c,g,1,!1),Q(g.x,0,1)):a||Q(t,w,1),p&&!k){let se=WM(x).multiplyScalar(-1).normalize();for(let be=0;be<=o;be++){let R=be/o,ie=x.y*-R+T.y;F.push(x.x*-R+T.x),W.push(ie),U.push(se.x),G.push(se.y),q.push(.5+ie/r),X.push(!1)}}let te=F.length,le=te+(p&&!a?1:0),ce=(se,be)=>se*te+(be===te?0:be),de=l<Math.PI*2,ge=(n+1)*te+(de?2*(1+le):0),Se=new Float32Array(ge*3),ye=new Float32Array(ge*3),Z=new Float32Array(ge*2),pe=ge-1>65535?new Uint32Array(n*Math.max(0,le-1)*6+(de?2*(le+1)*3:0)):new Uint16Array(n*Math.max(0,le-1)*6+(de?2*(le+1)*3:0)),re=0,Ae=0;for(let se=0;se<=n;se++){let be=se/n,R=be*l+s,ie=Math.sin(R),Qe=Math.cos(R);for(let Ie=0;Ie<te;Ie++){let Xe=Ae*3,Te=Ae*2,Ue=F[Ie],qe=U[Ie];Se[Xe]=Ue*ie,Se[Xe+1]=W[Ie],Se[Xe+2]=Ue*Qe,ye[Xe]=qe*ie,ye[Xe+1]=G[Ie],ye[Xe+2]=qe*Qe,X[Ie]?(Z[Te]=.5,Z[Te+1]=.5):(Z[Te]=be,Z[Te+1]=q[Ie]),Ae++}}for(let se=0;se<n;se++)for(let be=0;be<le-1;be++){if(a&&p&&be==o)continue;let R=ce(se,be),ie=ce(se+1,be),Qe=ce(se+1,be+1),Ie=ce(se,be+1),Xe=Se[Qe*3+0],Te=Se[Qe*3+2];pe[re++]=R,pe[re++]=ie,pe[re++]=Ie,(Xe!=0||Te!=0)&&(pe[re++]=ie,pe[re++]=Qe,pe[re++]=Ie)}de&&(Ee(-1,0,s),Ee(1,n*te,s+l)),this.setIndex(new Br.BufferAttribute(pe.slice(0,re),1)),this.setAttribute("position",new Br.BufferAttribute(Se,3)),this.setAttribute("normal",new Br.BufferAttribute(ye,3)),this.setAttribute("uv",new Br.BufferAttribute(Z,2));function Ee(se,be,R){let ie=Math.sin(R),Qe=Math.cos(R),Ie=-Qe,Xe=ie,Te=se<0?(De,wt,nt)=>{pe[re++]=De,pe[re++]=wt,pe[re++]=nt}:(De,wt,nt)=>{pe[re++]=De,pe[re++]=nt,pe[re++]=wt},Ue=(t+e+w+C)/4,qe=Ae*3,Je=Ae*2;Se[qe]=Ue*ie,Se[qe+1]=0,Se[qe+2]=Ue*Qe,ye[qe]=Ie,ye[qe+1]=0,ye[qe+2]=Xe,Z[Je]=.5,Z[Je+1]=.5;let kt=Ae++;for(let De=0;De<le;De++){let wt=(be+(De===te?0:De))*3;qe=Ae*3,Je=Ae*2,Se[qe]=Se[wt],Se[qe+1]=Se[wt+1],Se[qe+2]=Se[wt+2],ye[qe]=Ie,ye[qe+1]=0,ye[qe+2]=Xe;let nt=wt/3*2|0;Z[Je]=Z[nt],Z[Je+1]=Z[nt+1],Ae++}for(let De=kt+1;De<Ae-1;De++)Te(kt,De,De+1);Te(kt,Ae-1,kt+1)}}};var qM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters);return e.thetaLength=ws.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(i){let{width:t,depth:e,height:r,radialSegments:n,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:d,cornerSegments:u}=i.parameters,p;l===0?(p=new ws.BufferGeometry,p.setAttribute("position",new ws.Float32BufferAttribute([],3))):c>0||d>0||l<360?p=new Jp(0,t/2,r,n,o,a,s,l*Math.PI/180,c,d,u,0,!0):p=new ws.ConeGeometry(t/2,r,n,o,a);let h=e/t;return h!==1&&p.scale(1,1,h),Object.assign(p,{userData:{...i,type:"ConeGeometry"}})}};var $n=require("three"),XM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},i.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(i){let{width:t,height:e,depth:r,widthSegments:n,heightSegments:o,depthSegments:a,cornerRadius:s,cornerSegments:l}=i.parameters,c;return s===0?c=new $n.BoxGeometry(t,e,r,n,o,a):c=new _S(t,e,r,n,o,a,s,l),Object.assign(c,{userData:{...i,type:"CubeGeometry"}})}},LS=Math.PI/2,_S=class extends $n.BufferGeometry{constructor(t=1,e=1,r=1,n=1,o=1,a=1,s=0,l=4){super(),this.type="BoxGeometry",n=Math.floor(n),o=Math.floor(o),a=Math.floor(a),l=Math.floor(l),s=Math.min(s,t/2,e/2,r/2);let c=s>0,d=l+1,p=2*((a+1)*(o+1)+(n+1)*(a+1)+(n+1)*(o+1))+(c?d*4*(a+1+(n+1)+(o+1))+8*(d*(d+1)/2):0),h=2*(a*o+n*a+n*o)+(c?l*4*(a+n+o):0),f=c?8*l*l:0,m=new Float32Array(p*3),y=new Float32Array(p*3),g=new Float32Array(p*2),v=p-1>65535?new Uint32Array(h*6+f*3):new Uint16Array(h*6+f*3),b=0,S=0,x=new Float64Array(d),A=new Float64Array(d),w=new Float64Array(d),C=new Float64Array(d);for(let B=0;B<d;B++){let L=B/l*LS;x[B]=Math.sin(L)*s,A[B]=(1-Math.cos(L))*s,w[B]=Math.sin(L),C[B]=Math.cos(L)}let T=d*(d+1)/2,M=new Float64Array(T*3),D=new Float64Array(T*3);{let B=new $n.Vector3(t/2,e/2,r/2);B.subScalar(s);let L=0;for(let k=0;k<=l;k++){let F=LS*(1-k/l),W=Math.cos(F),U=Math.sin(F),G=0;for(let q=0;q<=k;q++){let X=Math.cos(G),Y=Math.sin(G),Q=W*X,te=U,ue=W*Y;M[L*3]=Q,M[L*3+1]=te,M[L*3+2]=ue,D[L*3]=B.x+Q*s,D[L*3+1]=B.y+te*s,D[L*3+2]=B.z+ue*s,L++,G+=LS/k}}}I("z","y","x",-1,-1,r,e,t,a,o),I("z","y","x",1,-1,r,e,-t,a,o),I("x","z","y",1,1,t,r,e,n,a),I("x","z","y",1,-1,t,r,-e,n,a),I("x","y","z",1,-1,t,e,r,n,o),I("x","y","z",-1,-1,t,e,-r,n,o),s>0&&(_("z","y","x",-1,-1,1,r,e,t,a),_("z","y","x",1,-1,-1,r,e,t,a),_("z","y","x",-1,1,-1,r,e,t,a),_("z","y","x",1,1,1,r,e,t,a),_("x","y","z",-1,-1,-1,t,e,r,n),_("x","y","z",1,-1,1,t,e,r,n),_("x","y","z",-1,1,1,t,e,r,n),_("x","y","z",1,1,-1,t,e,r,n),_("y","x","z",-1,-1,1,e,t,r,o),_("y","x","z",1,-1,-1,e,t,r,o),_("y","x","z",1,1,1,e,t,r,o),_("y","x","z",-1,1,-1,e,t,r,o),E(1,1,1),E(-1,1,1),E(1,-1,1),E(-1,-1,1),E(1,1,-1),E(-1,1,-1),E(1,-1,-1),E(-1,-1,-1)),this.setIndex(new $n.BufferAttribute(v,1)),this.setAttribute("position",new $n.BufferAttribute(m,3)),this.setAttribute("normal",new $n.BufferAttribute(y,3)),this.setAttribute("uv",new $n.BufferAttribute(g,2));function I(B,L,k,F,W,U,G,q,X,Y){let Q=(U-2*s)/X,te=(G-2*s)/Y,ue=U/2-s,le=G/2-s,ce=q/2,de=X+1,ge=Y+1,Se=0,ye=new $n.Vector3;for(let Z=0;Z<ge;Z++){let pe=Z*te-le;for(let re=0;re<de;re++){let Ae=re*Q-ue,Ee=(b+Se)*3,se=(b+Se)*2;ye[B]=Ae*F,ye[L]=pe*W,ye[k]=ce,m[Ee]=ye.x,m[Ee+1]=ye.y,m[Ee+2]=ye.z,ye[B]=0,ye[L]=0,ye[k]=q>0?1:-1,y[Ee]=ye.x,y[Ee+1]=ye.y,y[Ee+2]=ye.z,g[se]=re/X,g[se+1]=1-Z/Y,Se+=1}}for(let Z=0;Z<Y;Z++)for(let pe=0;pe<X;pe++){let re=b+pe+de*Z,Ae=b+pe+de*(Z+1),Ee=b+(pe+1)+de*(Z+1),se=b+(pe+1)+de*Z;v[S++]=re,v[S++]=Ae,v[S++]=se,v[S++]=Ae,v[S++]=Ee,v[S++]=se}b+=Se}function _(B,L,k,F,W,U,G,q,X,Y){let Q=(G-2*s)/Y,te=G/2-s,ue=q/2-s,le=X/2,ce=Y+1,de=0,ge=new $n.Vector3,Se=new $n.Vector3;for(let ye=0;ye<l+1;ye++){ge[L]=(ue+x[ye])*W,ge[k]=(le-A[ye])*U,Se[B]=0,Se[L]=w[ye]*Math.sign(ge[L]),Se[k]=C[ye]*Math.sign(ge[k]);for(let Z=0;Z<ce;Z++){let pe=Z*Q-te;ge[B]=pe*F;let re=(b+de)*3,Ae=(b+de)*2;m[re]=ge.x,m[re+1]=ge.y,m[re+2]=ge.z,y[re]=Se.x,y[re+1]=Se.y,y[re+2]=Se.z,g[Ae]=Z/Y,g[Ae+1]=0,de+=1}}for(let ye=0;ye<l;ye++)for(let Z=0;Z<Y;Z++){let pe=b+Z+ce*ye,re=b+Z+ce*(ye+1),Ae=b+(Z+1)+ce*(ye+1),Ee=b+(Z+1)+ce*ye;v[S++]=pe,v[S++]=re,v[S++]=Ee,v[S++]=re,v[S++]=Ae,v[S++]=Ee}b+=de}function E(B,L,k){let W=B*L*k>0?(G,q,X)=>{v[S++]=G,v[S++]=q,v[S++]=X}:(G,q,X)=>{v[S++]=G,v[S++]=X,v[S++]=q},U=b;for(let G=0;G<T;G++){let q=G*3,X=b*3,Y=b*2;m[X]=B*D[q],m[X+1]=L*D[q+1],m[X+2]=k*D[q+2],y[X]=B*M[q],y[X+1]=L*M[q+1],y[X+2]=k*M[q+2],g[Y]=0,g[Y+1]=0,b++}for(let G=0;G<l;G++){let q=U+G*(G+1)/2,X=U+(G+1)*(G+2)/2;W(q,X+1,X);for(let Y=1;Y<=G;Y++)W(q+Y-1,q+Y,X+Y),W(q+Y,X+Y+1,X+Y)}}}};var hr=require("three"),Cs=class extends hr.BufferGeometry{constructor(t=[],e=[],r="",n=1,o=.2,a=4){super(),this.type="PolyhedronGeometryRound";let s,l,c,d=0;u(),p(),this.setAttribute("position",new hr.BufferAttribute(new Float32Array(s.subarray(0,d)),3)),this.setAttribute("normal",new hr.BufferAttribute(new Float32Array(l.subarray(0,d)),3)),this.setAttribute("uv",new hr.BufferAttribute(new Float32Array(c.subarray(0,d/3*2)),2));return;function u(){o=Math.min(1-1e-5,o),o==0&&(a=0);let f={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],m=new hr.Vector3,y=m.clone(),g=new hr.Triangle,v=o*n,b=n-v,S=a+1,x=new hr.Vector3,A=(Z,pe)=>x.subVectors(Z,pe).normalize(),w=(Z,pe)=>Array(Z).fill(void 0).map(pe),C=w(t.length/3,(Z,pe)=>new hr.Vector3().fromArray(t,pe*3).setLength(n)),T=[],M=1e6;for(let Z=0;Z<C.length;Z++){let pe=C[Z],re=[],Ae,Ee,se,be=1e10,R=-1;for(;(R=e.indexOf(Z,R+1))!=-1;){let Xe=R-R%3;Ae=e[Xe+(R+1)%3],Ee=e[Xe+(R+2)%3],se=pe.distanceToSquared(C[Ae]),be=Math.min(be,se),re.push([Ae,Ee,se])}be+=1e-6;let ie=[],Qe=0,Ie=re.length;for(let Xe=0;Xe<Ie;Xe++){[Ae,Ee,se]=re[Qe];let Te=T[Ae]?.includes(Z)==!0;se<=be&&ie.push(Ae+ +Te*M),Qe=re.findIndex(Ue=>Ue[0]==Ee)}T.push(ie)}let D=[];{let Z=0,pe=0,re,Ae,Ee=f==3;for(let se=0;se<=a;se++){re=se*(se+1)/2,Ae=(se+1)*(se+2)/2;for(let be=0;be<a-se;be++)[Z,pe]=[re+be+se+2,Ae+be+se+3],D.push(re,Ae,...Ee?[pe,re]:[Z,Ae],pe,Z),[re,Ae]=[Z,pe];D.push(re,Ae,re+a+2)}}let I=0;for(let Z=0;Z<T.length;Z++)for(let pe=0;pe<f;pe++)T[Z][pe]<M&&I++;let _=C.length*f*D.length*3,E=I*S*6*3,B=I*2*3*3,L=_+E+B;s=new Float64Array(L),l=new Float64Array(L),c=new Float64Array(L/3*2);let k=(Z,pe,re)=>{let Ae=d/3*2;c[Ae]=Math.atan2(re,-Z)/2/Math.PI+.5,c[Ae+1]=1-(Math.atan2(-pe,Math.sqrt(Z*Z+re*re))/Math.PI+.5)},F=Z=>{s[d]=Z.x,s[d+1]=Z.y,s[d+2]=Z.z,l[d]=x.x,l[d+1]=x.y,l[d+2]=x.z,k(Z.x,Z.y,Z.z),d+=3},W=Z=>{s[d]=Z[0].x,s[d+1]=Z[0].y,s[d+2]=Z[0].z,l[d]=Z[1].x,l[d+1]=Z[1].y,l[d+2]=Z[1].z,k(Z[0].x,Z[0].y,Z[0].z),d+=3},U=(a+2)*(a+3)/2,G=new Float64Array(U*3),q=new Float64Array(U*3),X=new Float64Array(U*2),Y=w(f*2*S,()=>new hr.Vector3),Q=w(a*Math.max(0,a-1)/2,()=>new hr.Vector3),te=m.clone(),ue=m.clone(),le=m.clone(),ce=m.clone(),de=m.clone(),ge=[],Se=w(C.length,()=>w(f,()=>m.clone()));for(let Z=0;Z<C.length;Z++){m.copy(C[Z]).normalize(),te.copy(m).multiplyScalar(b);let pe=T[Z];for(let ie=0;ie<pe.length;ie++){let Qe=pe[ie],Ie=pe[(ie+1)%f];g.setFromPointsAndIndices(C,Z,Qe%M,Ie%M),g.b.sub(g.a).setLength(1e10).add(g.a),g.c.sub(g.a).setLength(1e10).add(g.a),g.closestPointToPoint(te,Se[Z][ie])}let re=0,Ae=[],Ee=[],se=new hr.Vector3;a==0&&[...Se[Z]].reduce((ie,Qe)=>ie.add(Qe),se).multiplyScalar(1/f);for(let ie=0;ie<f;ie++){let Qe=[],Ie=(ie-1+f)%f,Xe=Se[Z][Ie],Te=Se[Z][ie];m.copy(Xe).sub(te),y.copy(Te).sub(te);let Ue=te.angleTo(m),qe=m.angleTo(y),Je=Math.cos(Ue)*v;a==0?ue.copy(se):ue.copy(te).setLength(b+Je),Ae.push(Je);let kt=[ue,Xe,Te];for(let De=0;De<2;De++){let wt=kt[De],nt=kt[De+1];ce.subVectors(wt,te),de.subVectors(nt,te),le.crossVectors(ce,de).normalize();for(let il=0;il<S;il++){let ap=[Ue,qe][De]*il/S;m.copy(ce).applyAxisAngle(le,ap).add(te),Y[re++].copy(m),De&&(A(m,te),Qe.push([il==0?wt:m.clone(),x.clone()]))}De&&(A(nt,te),Qe.push([nt,x.clone()]))}Ee.push(Qe)}ge.push(Ee);let be=2*S,R=2;for(let ie=0;ie<f;ie++){let Qe=be*ie,Ie=be*((ie+1)%f),Xe=0,Te=[Y[Qe]];for(let Ue=1;Ue<S;Ue++){let qe=Y[Qe+Ue],Je=Y[Ie+Ue];Te.push(qe);for(let kt=1,De=Ue-R+1;kt<=De;kt++)m.lerpVectors(qe,Je,kt/(De+1)),m.sub(te).setLength(Ae[ie]).add(te),Te.push(Q[Xe++].copy(m));Te.push(Je)}for(let Ue=0;Ue<S;Ue++)Te.push(Y[Ue+S+Qe]);Te.push(Y[Ie+S]);for(let Ue=0,qe=Te.length;Ue<qe;Ue++){let Je=Te[Ue],kt=Ue*3,De=Ue*2;G[kt]=Je.x,G[kt+1]=Je.y,G[kt+2]=Je.z,A(Je,te),q[kt]=x.x,q[kt+1]=x.y,q[kt+2]=x.z,X[De]=Math.atan2(Je.z,-Je.x)/2/Math.PI+.5,X[De+1]=1-(Math.atan2(-Je.y,Math.sqrt(Je.x*Je.x+Je.z*Je.z))/Math.PI+.5)}for(let Ue=0,qe=D.length;Ue<qe;Ue++){let Je=D[Ue]*3,kt=D[Ue]*2,De=d/3*2;s[d]=G[Je],s[d+1]=G[Je+1],s[d+2]=G[Je+2],l[d]=q[Je],l[d+1]=q[Je+1],l[d+2]=q[Je+2],c[De]=X[kt],c[De+1]=X[kt+1],d+=3}}}let ye=[];for(let Z=0;Z<T.length;Z++)for(let pe=0;pe<f;pe++){let re=T[Z][pe];if(re<M){let Ae=T[re].findIndex(be=>be%M==Z),Ee=ge[Z][pe],se=ge[re][Ae];for(let be=0;be<S;be++){let R=Ee[be],ie=se[S-be],Qe=Ee[be+1],Ie=se[S-(be+1)];W(R),W(ie),W(Qe),W(Qe),W(ie),W(Ie)}ye.push(Ee[0][0],se[S][0],Ee[S][0],se[0][0])}}for(;ye.length;){let Z,pe,re,[Ae,Ee]=ye.splice(0,2);Z=Ee;let se=[Ae];for(;Ae!=Z;)se.push(Z),pe=ye.indexOf(Z),re=pe%2,Z=ye.splice(pe-re,2)[1-re];x.subVectors(se[0],se[1]).cross(m.subVectors(se[0],se[2])).normalize();let be=x.dot(se[0])<0;be&&x.negate();for(let R=1;R<=se.length-2;R++)F(se[R+ +be]),F(se[R+1-+be]),F(se[0])}}function p(){let h=new hr.Vector3,f=new hr.Vector3,m=new hr.Vector3,y=new hr.Vector3,g=new hr.Vector2,v=new hr.Vector2,b=new hr.Vector2,S=(w,C,T,M)=>{M<0&&w.x===1&&(c[C]=w.x-1),T.x===0&&T.z===0&&(c[C]=M/2/Math.PI+.5)};for(let w=0,C=0;w<d;w+=9,C+=6){h.set(s[w+0],s[w+1],s[w+2]),f.set(s[w+3],s[w+4],s[w+5]),m.set(s[w+6],s[w+7],s[w+8]),g.set(c[C+0],c[C+1]),v.set(c[C+2],c[C+3]),b.set(c[C+4],c[C+5]),y.copy(h).add(f).add(m).divideScalar(3);let T=A(y);S(g,C+0,h,T),S(v,C+2,f,T),S(b,C+4,m,T)}let x=d/3*2;for(let w=0;w<x;w+=6){let C=c[w+0],T=c[w+2],M=c[w+4],D=Math.max(C,T,M),I=Math.min(C,T,M);D>.9&&I<.1&&(C<.2&&(c[w+0]+=1),T<.2&&(c[w+2]+=1),M<.2&&(c[w+4]+=1))}function A(w){return Math.atan2(w.z,-w.x)}}}static fromJSON(t){return new Cs(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}};var YM=require("three"),KM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.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(i){let{width:t,height:e,depth:r,detail:n,corner:o,cornerSides:a}=i.parameters,s=n===0&&o!==0?new $p(t*.5,o,a):new YM.DodecahedronGeometry(t*.5,n),l=e/t,c=r/t;return(l!==1||c!==1)&&s.scale(1,l,c),Object.assign(s,{userData:{...i,type:"DodecahedronGeometry"}})}},$p=class extends Cs{constructor(t=1,e=.2,r=4){let n=(1+Math.sqrt(5))/2,o=1/n,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,-o,-n,0,-o,n,0,o,-n,0,o,n,-o,-n,0,-o,n,0,o,-n,0,o,n,0,-n,0,-o,n,0,-o,-n,0,o,n,0,o],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 $p(t.radius,t.corner,t.cornerSides)}};var dt=require("three");var Ke=require("three"),eh=1e-12,fd=class{constructor(t){this.position=new Ke.Vector2;this.startPosition=new Ke.Vector2;this.uuid=Ke.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 fd(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},md=class extends fd{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new md(this.parent).copy(this)}},go=class extends fd{constructor(e,r){super(r);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new md(this),new md(this))}static create(e,r){let n=new go(e,new Ke.Vector2(...r.position));return n.controls[0].position.set(...r.controlPrevious.position),n.controls[1].position.set(...r.controlNext.position),n.roundness=r.roundness,n.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored,n}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 n=0,o=this.controls.length;n<o;n++){let a=this.controls[n];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 go(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 Ke.Vector2,r=new Ke.Vector2){let[n,o]=this.computeTangents();return n&&o&&(QM(n,e),QM(o,r)),[e,r]}computeTangent(e=new Ke.Vector2){let[r,n]=this.computeTangents();return r&&n&&e.copy(r).add(n).normalize(),e}computeNormal(e=new Ke.Vector2){let[r,n]=this.computeNormals();return e.copy(r).add(n).normalize(),e}};function QM(i,t=new Ke.Vector2){let e=i.length();return t.set(-i.y/e,i.x/e)}var FS=i=>i,yd=new Ke.Vector2,Wy=new Ke.Vector2,xV=new Ke.Vector2,SV=new Ke.Vector2,AV=new Ke.Vector2,wV=new Ke.Vector2,JM=new Ke.Vector3,$M=new Ke.Vector3;function e2(i){let t=new Ke.Vector2;t.addVectors(i.v0,yd.subVectors(i.v1,i.v0).multiplyScalar(2/3));let e=new Ke.Vector2;return e.addVectors(i.v2,Wy.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new Ke.CubicBezierCurve(i.v0,t,e,i.v2)}function th(i,t,e=Number.EPSILON){return Math.abs(i-t)<e}function CV(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function EV(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function VS(i,t,e){let r=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),n=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),o=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2));return Math.acos((n*n+r*r-o*o)/(2*n*r))}function t2(i,t,e){return ZM(i,t)&&ZM(t,e)&&kS(i.position,t.position,e.position)}function kS(i,t,e){return yd.copy(t).sub(i).cross(Wy.copy(e).sub(i))===0}function r2(i,t,e,r,n){let o=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),a=(i.y+t.y)/2,s=(i.x+t.x)/2,l=Math.sqrt(Math.pow(e,2)-Math.pow(o/2,2))*(i.y-t.y)/o,c=Math.sqrt(Math.pow(e,2)-Math.pow(o/2,2))*(t.x-i.x)/o;return r.set(s+l,a+c),n.set(s-l,a-c),[r,n]}function n2(i,t,e){let r=i.distanceTo(e),n=t.distanceTo(e);return r<n?t:i}function i2(i,t,e,r,n,o){let a=t.x-i.x,s=t.y-i.y,l=e.x-i.x,c=e.y-i.y,d=Math.sqrt((a+l)*(a+l)+(s+c)*(s+c)),u;return VS(t,i,e)>Math.PI&&(d*=-1),th(c,s)?u=(s+c)*(r/d-.5)*8/3/(a-l):u=(a+l)*(r/d-.5)*8/3/(c-s),n.set(t.x-u*s,t.y+u*a),o.set(e.x+u*c,e.y-u*l),[n,o]}function GS(i,t){return i.position.equals(i.controls[1].position)&&t.position.equals(t.controls[0].position)}function ZM(i,t){return kS(i.position,i.controls[1].position,t.position)&&kS(i.position,t.controls[0].position,t.position)}function o2(i,t,e,r,n=.5){let o=yd.subVectors(t,i).multiplyScalar(n).add(i),a=Wy.subVectors(e,t).multiplyScalar(n).add(t),s=xV.subVectors(r,e).multiplyScalar(n).add(e),l=o,c=SV.subVectors(a,o).multiplyScalar(n).add(o),d=AV.subVectors(s,a).multiplyScalar(n).add(a),u=s,p=wV.subVectors(d,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,p.x,p.y,d.x,d.y,u.x,u.y,r.x,r.y]}function a2(i,t,e=12,r=!0){let n=$M.set(0,0,0),o,a=0,s=[];for(let l=0;l<t.length;l++){let c=FS(t[l]),d=yd,u=Es(c,e);s.push(u);for(let p=0;p<=u;p++)if(c instanceof Ke.CubicBezierCurve||c instanceof Ke.QuadraticBezierCurve||c instanceof Ke.LineCurve){if(c.getPoint(p/u,d),n.set(d.x,d.y,0),o!==void 0&&EV(o,n))continue;o===void 0&&(o=JM),o.copy(n),i.setXYZ(a,n.x,n.y,n.z),a++}}return r&&a>1&&!(i.getX(a-1)===i.getX(0)&&i.getY(a-1)===i.getY(0)&&i.getZ(a-1)===i.getZ(0))&&(i.setXYZ(a,i.getX(0),i.getY(0),i.getZ(0)),a++),i}function s2(i,t,e,r=12,n=!0){let o=$M.set(0,0,0),a=0,s=[];for(let l=0;l<t.length;l++){if(e[l]===!1)continue;let c,d=FS(t[l]),u=yd,p=Es(d,r);s.push(p);for(let h=0;h<=p;h++)if(d instanceof Ke.CubicBezierCurve||d instanceof Ke.QuadraticBezierCurve||d instanceof Ke.LineCurve){if(d.getPoint(h/p,u),o.set(u.x,u.y,0),c?.equals(o))continue;c===void 0?c=JM:(i.setXYZ(a,c.x,c.y,c.z),a++,i.setXYZ(a,o.x,o.y,o.z),a++),c.copy(o)}}return n&&a>1&&!(i.getX(a-1)===i.getX(0)&&i.getY(a-1)===i.getY(0)&&i.getZ(a-1)===i.getZ(0))&&(i.setXYZ(a,i.getX(0),i.getY(0),i.getZ(0)),a++),s}function US(i,t=12,e=!1){let r=[];for(let n=0,o=i.length;n<o;n++){let a=i[n],s=0;if(e&&a.roundedCurveCorner!==void 0){let l=Es(a.roundedCurveCorner,t)*.5;n>0&&(r[n-1]+=l),s+=l}a.curveAfter!==void 0&&(s+=Es(a.curveAfter,t)),r.push(s)}return i.length>0&&e&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=Es(i[0].roundedCurveCorner,t)*.5),r}function Es(i,t=12){return i&&i instanceof Ke.EllipseCurve?t*2:i&&(i instanceof Ke.LineCurve||i instanceof Ke.LineCurve3)?1:i&&i instanceof Ke.SplineCurve?t*i.points.length:t}function l2(i,t,e=12,r=!0){let n,o=0;for(let a=0;a<t.length;a++){let s=FS(t[a]),l=Es(s,e),c=yd;for(let d=0;d<=l;d++)if(s instanceof Ke.CubicBezierCurve||s instanceof Ke.QuadraticBezierCurve||s instanceof Ke.LineCurve){if(s.getPoint(d/l,c),n!==void 0&&CV(n,c,eh))continue;n===void 0&&(n=Wy),n.copy(c),i.push(c.x,c.y),o++}}return th(i[0],i[i.length-2],eh)&&th(i[1],i[i.length-1],eh)&&(i.pop(),i.pop()),r&&o>1&&!(th(i[o-1],i[1],eh)&&th(i[o-2],i[0],eh))&&(i.push(i[0],i[1]),o++),i}var zS=new dt.Vector2,TV=new dt.Vector2,PV=new dt.Vector2,MV=new dt.Vector2,OV=new dt.Vector2,IV=new dt.Vector2,ht=class extends dt.Shape{constructor(e=100,r=100){super();this.points=[];this.shapeHoles=[];this.plane=new dt.Plane(new dt.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=dt.MathUtils.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=r}static createFromState(e,r,n){let o=new ht;return o.isClosed=e.isClosed,o.points=e.points.map(a=>go.create(a.id,a.data)),typeof e.roundness=="number"&&(o.roundness=e.roundness),o.shapeHoles=e.shapeHoles.map(a=>ht.createFromState(a)),r!==void 0&&n!==void 0&&o.applySize(r,n),o.update(),o}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,n=this.points.length;r<n;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,n=this.points.findIndex(o=>o.uuid===e);if(n<0){let o=r;for(let a=0,s=this.shapeHoles.length;a<s;a++){let l=this.shapeHoles[a],c=l.points.length,d=l.getPointIndexById(e);if(d<0)o+=c;else return d+o}}return n}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 n=0,o=this.shapeHoles.length;n<o;n++){let a=this.shapeHoles[n],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 n=0,o=this.shapeHoles.length;n<o;n++){let a=this.shapeHoles[n],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 n=zS.set(e,r);for(let o=0,a=this.points.length;o<a;o++){let s=this.points[o];s.position.multiply(n),s.controls[0].position.multiply(n),s.controls[1].position.multiply(n)}for(let o=0,a=this.shapeHoles.length;o<a;o++)this.shapeHoles[o].applyScale(e,r);this._update()}createPoint(e,r=0,n=dt.MathUtils.generateUUID()){let o;e instanceof dt.Vector2?o=e:o=new dt.Vector2(e,r);let a=new go(n,o);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,n=this.points.length;r<n;r++){let o=this.points[r];if(o.uuid===e)return o}for(let r=0,n=this.shapeHoles.length;r<n;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(n=>n.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,n=!1){this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r);let o=n?this.roundedCurveDivisions:this.curveDivisions;return a2(e,n?this.roundedCurves:this.curves,r,this.autoClose),o.reduce((a,s)=>a+s,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=US(this.points,e,!1),this.roundedCurveDivisions=US(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,r,n=12){return s2(e,this.curves,r,n,this.autoClose).reduce((a,s)=>a+s,0)*2}extractShapePointsToFlatArray(e,r=12){return this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r),l2(e,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(e,r=!1){let n=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let o=r?this.roundedCurveDivisions:this.curveDivisions,a=0;r&&this.points[0].roundedCurveCorner!==void 0&&(a=Es(this.points[0].roundedCurveCorner,this.subdivision)*.5);let s=e-a;s<0&&(s+=o.reduce((l,c)=>l+c,0));for(let l=0,c=o.length;l<c;l++){let d=o[l];if(s<n+d)return[l,(s-n+1)/d];n+=d}return[0,1]}getCurveT(e,r,n){let o=this.points[e],a=this.points[e>=this.points.length-1?0:e+1],s=this.curveDivisions,l=s[e];if(GS(o,a)){let u=o.position.distanceTo(a.position);return o.position.distanceTo(zS.set(n.x,n.y))/u}let c=0;for(let u=0;u<e;u++)c+=s[u];return(r-c)/l}dispose(){}_applyCurveForPoint(e,r){GS(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 n=this.curves[this.curves.length-1];e.curveBefore=n,r.curveAfter=n;let o=n.clone();e.roundedCurveBefore=o,r.roundedCurveAfter=o,e.roundedCurveCorner=void 0,this.roundedCurves.push(o)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let r=0,n=this.points.length;r<n;r++){let o=this.points[r];if(r===0)this.moveTo(o.position.x,o.position.y);else{let a=this.points[r-1];this._applyCurveForPoint(o,a)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let r=this.points[0],n=this.points[this.points.length-1];this._applyCurveForPoint(r,n)}if(this.points.length>2){let r=0;for(let n=0,o=this.points.length;n<o;n++){let a=this.points[n],s=this.points[n-1]??this.points[this.points.length-1],l=this.points[n+1]??this.points[0],c=a.roundness,d=s&&l&&t2(s,a,l);if(!a.controlsMoved()&&c>0&&!d){let u=a.curveBefore,p=a.curveAfter;if(u===void 0||p===void 0)continue;let h=a.roundedCurveBefore,f=a.roundedCurveAfter,m=u instanceof dt.LineCurve?u.v1.distanceTo(u.v2):u.getLength(),y=p instanceof dt.LineCurve?p.v1.distanceTo(p.v2):p.getLength(),g=Math.min(c,m*.499),v=Math.min(c,y*.499),b=Math.min(g,v),S=1-b/m,x=b/y,A=u.getPointAt(S,zS),w=p.getPointAt(x,TV);this._subSplitCurve(u,h,S,A,void 0),this._subSplitCurve(p,f,x,void 0,w);let C;if(this.useCubicForRoundedCorners){let T=VS(A,a.position,w)/2,M=Math.tan(T)*A.distanceTo(a.position),[D,I]=r2(A,w,M,PV,MV),_=n2(D,I,a.position),[E,B]=i2(_,A,w,M,OV,IV);C=new dt.CubicBezierCurve(A.clone(),E.clone(),B.clone(),w.clone())}else C=new dt.QuadraticBezierCurve(A.clone(),a.position.clone(),w.clone());a.roundedCurveCorner=C,this.roundedCurves.splice(n+r,0,C),r++}}}}_subSplitCurve(e,r,n,o,a){if(e instanceof dt.LineCurve)o!==void 0&&r.v2.copy(o),a!==void 0&&r.v1.copy(a);else{let s=e,l=r,c=s.getUtoTmapping(n,0),d=o2(s.v0,s.v1,s.v2,s.v3,c);return o!==void 0&&(l.v0.set(d[0],d[1]),l.v1.set(d[2],d[3]),l.v2.set(d[4],d[5]),l.v3.set(d[6],d[7])),a!==void 0&&(l.v0.set(d[6],d[7]),l.v1.set(d[8],d[9]),l.v2.set(d[10],d[11]),l.v3.set(d[12],d[13])),l}return r}clone(){let e=new ht(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 n=0;n<r;n++){let o=n*7,a=e.points[o+0],s=e.points[o+1],l=e.points[o+2],c=e.points[o+3],d=e.points[o+4],u=e.points[o+5],p=e.points[o+6],h=new go(dt.MathUtils.generateUUID(),new dt.Vector2(a,s));h.controls[0].position.set(l,c),h.controls[1].position.set(d,u),h.roundness=p,this.points.push(h)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(n=>{let o=new ht;return o.fromJSON(n),o}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,r=!1){this.isText=r;let n=(a,s)=>{s instanceof dt.CubicBezierCurve&&s.v3.equals(a.position)&&a.controls[0].position.copy(s.v2)},o=a=>{let s=[],l,c;for(l=0,c=a.length;l<c;l++)a[l]instanceof dt.QuadraticBezierCurve&&(a[l]=e2(a[l]));for(l=0,c=a.length;l<c;l++){let p=a[l],h=l>0?a[l-1]:null,f;p instanceof dt.CubicBezierCurve?(f=this.createPoint(p.v0),f.controls[1].position.copy(p.v1)):p instanceof dt.LineCurve&&(f=this.createPoint(p.v1)),f!==void 0&&(h!==null&&n(f,h),s.push(f))}let d=a[a.length-1],u=!1;return d instanceof dt.CubicBezierCurve?d.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(d.v2),u=!0):d instanceof dt.LineCurve&&d.v2.equals(s[0].position)&&(u=!0),this.isClosed=u,s};return this.points=o(e.curves),e instanceof dt.Shape&&(this.shapeHoles=e.holes.map(a=>{let s=new ht;return s.fromShape(a),s})),this.update(),this}updatePoint(e,r){let n=this.getPointByUuid(e);n&&(r.position!==void 0&&n.position.fromArray(r.position),r.roundness!==void 0&&(n.roundness=r.roundness),r.areControlsDirectionsMirrored!==void 0&&(n.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,r){let o=this.getPointByUuid(e)?.controls[0];o&&(r.position&&o.position.fromArray(r.position),this.needsUpdate=!0)}updateNextControl(e,r){let o=this.getPointByUuid(e)?.controls[1];o&&(r.position&&o.position.fromArray(r.position),this.needsUpdate=!0)}};var HS=Math.PI*2;function jS({x:i,y:t},e,r,n,o){return{x:i*e+n,y:t*r+o}}function DV(i,t){let e=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(i),n=Math.sin(i),o=Math.cos(i+t),a=Math.sin(i+t);return[{x:r-n*e,y:n+r*e},{x:o+a*e,y:a-o*e},{x:o,y:a}]}function c2(i,t,e,r){let n=i*r-t*e<0?-1:1,o=Math.min(1,Math.max(-1,i*e+t*r));return n*Math.acos(o)}function RV(i,t,e,r,n,o,a,s,l,c){let d=Math.pow(n,2),u=Math.pow(o,2),p=Math.pow(a,2),h=Math.pow(s,2),f=d*u-d*h-u*p;f<0&&(f=0),f/=d*h+u*p,f=Math.sqrt(f)*(l===c?-1:1);let m=f*n/o*s,y=f*-o/n*a,g=m+(i+e)/2,v=y+(t+r)/2,b=(a-m)/n,S=(s-y)/o,x=(-a-m)/n,A=(-s-y)/o,w=c2(1,0,b,S),C=c2(b,S,x,A);return!c&&C>0&&(C-=HS),c&&C<0&&(C+=HS),{centerx:g,centery:v,ang1:w,ang2:C}}function d2({px:i,py:t,cx:e,cy:r,rx:n,ry:o,largeArcFlag:a,sweepFlag:s}){let l=[];if(n===0||o===0)return[];let c=(i-e)/2,d=(t-r)/2;if(c===0&&d===0)return[];n=Math.abs(n),o=Math.abs(o);let u=Math.pow(c,2)/Math.pow(n,2)+Math.pow(d,2)/Math.pow(o,2);u>1&&(n*=Math.sqrt(u),o*=Math.sqrt(u));let p=RV(i,t,e,r,n,o,c,d,a,s),{ang1:h,ang2:f}=p,{centerx:m,centery:y}=p,g=Math.abs(f)/(HS/4);Math.abs(1-g)<1e-7&&(g=1);let v=Math.max(Math.ceil(g),1);f/=v;for(let b=0;b<v;b++)l.push(DV(h,f)),h+=f;return l.map(b=>{let{x:S,y:x}=jS(b[0],n,o,m,y),{x:A,y:w}=jS(b[1],n,o,m,y),{x:C,y:T}=jS(b[2],n,o,m,y);return{x1:S,y1:x,x2:A,y2:w,x:C,y:T}})}var _l=require("three");var Ct;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Ct||(Ct={}));var Vr;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Vr||(Vr={}));function Be(i,t){if(!i)throw t||"Assertion Failed!"}var Me=function(){function i(){}return i.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},i.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},i.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},i.edgeGoesLeft=function(t){return i.vertLeq(t.Dst,t.Org)},i.edgeGoesRight=function(t){return i.vertLeq(t.Org,t.Dst)},i.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},i.edgeEval=function(t,e,r){Be(i.vertLeq(t,e)&&i.vertLeq(e,r));var n=e.s-t.s,o=r.s-e.s;return n+o>0?n<o?e.t-t.t+(t.t-r.t)*(n/(n+o)):e.t-r.t+(r.t-t.t)*(o/(n+o)):0},i.edgeSign=function(t,e,r){Be(i.vertLeq(t,e)&&i.vertLeq(e,r));var n=e.s-t.s,o=r.s-e.s;return n+o>0?(e.t-r.t)*n+(e.t-t.t)*o:0},i.transEval=function(t,e,r){Be(i.transLeq(t,e)&&i.transLeq(e,r));var n=e.t-t.t,o=r.t-e.t;return n+o>0?n<o?e.s-t.s+(t.s-r.s)*(n/(n+o)):e.s-r.s+(r.s-t.s)*(o/(n+o)):0},i.transSign=function(t,e,r){Be(i.transLeq(t,e)&&i.transLeq(e,r));var n=e.t-t.t,o=r.t-e.t;return n+o>0?(e.s-r.s)*n+(e.s-t.s)*o:0},i.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},i.interpolate=function(t,e,r,n){return t=t<0?0:t,r=r<0?0:r,t<=r?r===0?(e+n)/2:e+(n-e)*(t/(t+r)):n+(e-n)*(r/(t+r))},i.intersect=function(t,e,r,n,o){var a,s,l;i.vertLeq(t,e)||(l=t,t=e,e=l),i.vertLeq(r,n)||(l=r,r=n,n=l),i.vertLeq(t,r)||(l=t,t=r,r=l,l=e,e=n,n=l),i.vertLeq(r,e)?i.vertLeq(e,n)?(a=i.edgeEval(t,r,e),s=i.edgeEval(r,e,n),a+s<0&&(a=-a,s=-s),o.s=i.interpolate(a,r.s,s,e.s)):(a=i.edgeSign(t,r,e),s=-i.edgeSign(t,n,e),a+s<0&&(a=-a,s=-s),o.s=i.interpolate(a,r.s,s,n.s)):o.s=(r.s+e.s)/2,i.transLeq(t,e)||(l=t,t=e,e=l),i.transLeq(r,n)||(l=r,r=n,n=l),i.transLeq(t,r)||(l=t,t=r,r=l,l=e,e=n,n=l),i.transLeq(r,e)?i.transLeq(e,n)?(a=i.transEval(t,r,e),s=i.transEval(r,e,n),a+s<0&&(a=-a,s=-s),o.t=i.interpolate(a,r.t,s,e.t)):(a=i.transSign(t,r,e),s=-i.transSign(t,n,e),a+s<0&&(a=-a,s=-s),o.t=i.interpolate(a,r.t,s,n.t)):o.t=(r.t+e.t)/2},i}(),rh=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),qy=function(){function i(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(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(t){this.Sym.Lface=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(t){this.Sym.Org=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(t){this.Sym.Lnext=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(t){this.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(t){this.Lnext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(t){this.Sym.Onext=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(t){this.Sym.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(t){this.Sym.Lnext.Sym=t},enumerable:!0,configurable:!0}),i}(),gd=function(){function i(){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 i}(),u2=function(){function i(){var t=new gd,e=new rh,r=new qy(0),n=new qy(1);t.next=t.prev=t,t.anEdge=null,e.next=e.prev=e,r.next=r,r.Sym=n,n.next=n,n.Sym=r,this.vHead=t,this.fHead=e,this.eHead=r,this.eHeadSym=n}return i.prototype.makeEdge_=function(t){var e=new qy(0),r=new qy(1);t.Sym.side<t.side&&(t=t.Sym);var n=t.Sym.next;return r.next=n,n.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},i.prototype.splice_=function(t,e){var r=t.Onext,n=e.Onext;r.Sym.Lnext=e,n.Sym.Lnext=t,t.Onext=n,e.Onext=r},i.prototype.makeVertex_=function(t,e,r){var n=t;Be(n,"Vertex can't be null!");var o=r.prev;n.prev=o,o.next=n,n.next=r,r.prev=n,n.anEdge=e;var a=e;do a.Org=n,a=a.Onext;while(a!==e)},i.prototype.makeFace_=function(t,e,r){var n=t;Be(n,"Face can't be null");var o=r.prev;n.prev=o,o.next=n,n.next=r,r.prev=n,n.anEdge=e,n.trail=null,n.marked=!1,n.inside=r.inside;var a=e;do a.Lface=n,a=a.Lnext;while(a!==e)},i.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},i.prototype.killVertex_=function(t,e){var r=t.anEdge,n=r;do n.Org=e,n=n.Onext;while(n!==r);var o=t.prev,a=t.next;a.prev=o,o.next=a},i.prototype.killFace_=function(t,e){var r=t.anEdge,n=r;do n.Lface=e,n=n.Lnext;while(n!==r);var o=t.prev,a=t.next;a.prev=o,o.next=a},i.prototype.makeEdge=function(){var t=new gd,e=new gd,r=new rh,n=this.makeEdge_(this.eHead);return this.makeVertex_(t,n,this.vHead),this.makeVertex_(e,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},i.prototype.splice=function(t,e){var r=!1,n=!1;if(t!==e){if(e.Org!==t.Org&&(n=!0,this.killVertex_(e.Org,t.Org)),e.Lface!==t.Lface&&(r=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(e,t),!n){var o=new gd;this.makeVertex_(o,e,t.Org),t.Org.anEdge=t}if(!r){var a=new rh;this.makeFace_(a,e,t.Lface),t.Lface.anEdge=t}}},i.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 n=new rh;this.makeFace_(n,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)},i.prototype.addEdgeVertex=function(t){var e=this.makeEdge_(t),r=e.Sym;this.splice_(e,t.Lnext),e.Org=t.Dst;var n=new gd;return this.makeVertex_(n,r,e.Org),e.Lface=r.Lface=t.Lface,e},i.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},i.prototype.connect=function(t,e){var r=!1,n=this.makeEdge_(t),o=n.Sym;if(e.Lface!==t.Lface&&(r=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(n,t.Lnext),this.splice_(o,e),n.Org=t.Dst,o.Org=e.Org,n.Lface=o.Lface=t.Lface,t.Lface.anEdge=o,!r){var a=new rh;this.makeFace_(a,n,t.Lface)}return n},i.prototype.zapFace=function(t){var e=t.anEdge,r,n,o,a,s;n=e.Lnext;do r=n,n=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)),o=r.Sym,o.Onext===o?this.killVertex_(o.Org,null):(o.Org.anEdge=o.Onext,this.splice_(o,o.Oprev)),this.killEdge_(r));while(r!=e);a=t.prev,s=t.next,s.prev=a,a.next=s},i.prototype.countFaceVerts_=function(t){var e=t.anEdge,r=0;do r++,e=e.Lnext;while(e!==t.anEdge);return r},i.prototype.mergeConvexFaces=function(t){var e,r,n,o,a,s,l;for(e=this.fHead.next;e!==this.fHead;e=e.next)if(!!e.inside)for(r=e.anEdge,a=r.Org;n=r.Lnext,o=r.Sym,o&&o.Lface&&o.Lface.inside&&(s=this.countFaceVerts_(e),l=this.countFaceVerts_(o.Lface),s+l-2<=t&&Me.vertCCW(r.Lprev.Org,r.Org,o.Lnext.Lnext.Org)&&Me.vertCCW(o.Lprev.Org,o.Org,r.Lnext.Lnext.Org)&&(n=o.Lnext,this.delete(o),r=null,o=null)),!(r&&r.Lnext.Org===a);)r=n;return!0},i.prototype.check=function(){var t=this.fHead,e=this.vHead,r=this.eHead,n,o,a,s,l,c;for(o=t,o=t;(n=o.next)!==t;o=n){Be(n.prev===o),l=n.anEdge;do Be(l.Sym!==l),Be(l.Sym.Sym===l),Be(l.Lnext.Onext.Sym===l),Be(l.Onext.Sym.Lnext===l),Be(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(Be(n.prev===o&&n.anEdge===null),s=e,s=e;(a=s.next)!==e;s=a){Be(a.prev===s),l=a.anEdge;do Be(l.Sym!==l),Be(l.Sym.Sym===l),Be(l.Lnext.Onext.Sym===l),Be(l.Onext.Sym.Lnext===l),Be(l.Org===a),l=l.Onext;while(l!==a.anEdge)}for(Be(a.prev===s&&a.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)Be(l.Sym.next===c.Sym),Be(l.Sym!==l),Be(l.Sym.Sym===l),Be(l.Org!==null),Be(l.Dst!==null),Be(l.Lnext.Onext.Sym===l),Be(l.Onext.Sym.Lnext===l);Be(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},i}(),p2=function(){function i(){this.handle=null}return i}(),h2=function(){function i(){this.key=null,this.node=0}return i}(),BV=function(){function i(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 p2,this.handles[r]=new h2;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(t){var e=this.nodes,r=this.handles,n,o,a;for(n=e[t].handle;;){if(a=t<<1,a<this.size&&this.leq(r[e[a+1].handle].key,r[e[a].handle].key)&&++a,Be(a<=this.max),o=e[a].handle,a>this.size||this.leq(r[n].key,r[o].key)){e[t].handle=n,r[n].node=t;break}e[t].handle=o,r[o].node=t,t=a}},i.prototype.floatUp_=function(t){var e=this.nodes,r=this.handles,n,o,a;for(n=e[t].handle;;){if(a=t>>1,o=e[a].handle,a===0||this.leq(r[o].key,r[n].key)){e[t].handle=n,r[n].node=t;break}e[t].handle=o,r[o].node=t,t=a}},i.prototype.init=function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(t){var e,r;if(e=++this.size,e*2>this.max){this.max*=2;var n,o;for(o=this.nodes.length,this.nodes.length=this.max+1,n=o;n<this.nodes.length;n++)this.nodes[n]=new p2;for(o=this.handles.length,this.handles.length=this.max+1,n=o;n<this.handles.length;n++)this.handles[n]=new h2}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},i.prototype.extractMin=function(){var t=this.nodes,e=this.handles,r=t[1].handle,n=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)),n},i.prototype.delete=function(t){var e=this.nodes,r=this.handles,n;Be(t>=1&&t<=this.max&&r[t].key!==null),n=r[t].node,e[n].handle=e[this.size].handle,r[e[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(r[e[n>>1].handle].key,r[e[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),r[t].key=null,r[t].node=this.freeList,this.freeList=t},i}(),WS=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),f2=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),NV=function(){function i(t,e){this.frame=t,this.leq=e,this.head=new f2,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(t){return this.insertBefore(this.head,t)},i.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},i.prototype.insertBefore=function(t,e){do t=t.prev;while(t.key!==null&&!this.leq(this.frame,t.key,e));var r=new f2;return r.key=e,r.next=t.next,t.next.prev=r,r.prev=t,t.next=r,r},i.prototype.delete=function(t){t.next.prev=t.prev,t.prev.next=t.next},i}(),LV=function(){function i(){}return i.regionBelow=function(t){return t.nodeUp.prev.key},i.regionAbove=function(t){return t.nodeUp.next.key},i.debugEvent=function(t){},i.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.edgeLeq=function(t,e,r){var n=t.event,o=e.eUp,a=r.eUp;if(o.Dst===n)return a.Dst===n?Me.vertLeq(o.Org,a.Org)?Me.edgeSign(a.Dst,o.Org,a.Org)<=0:Me.edgeSign(o.Dst,a.Org,o.Org)>=0:Me.edgeSign(a.Dst,n,a.Org)<=0;if(a.Dst===n)return Me.edgeSign(o.Dst,n,o.Org)>=0;var s=Me.edgeEval(o.Dst,n,o.Org),l=Me.edgeEval(a.Dst,n,a.Org);return s>=l},i.deleteRegion=function(t,e){e.fixUpperEdge&&Be(e.eUp.winding===0),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},i.fixUpperEdge=function(t,e,r){Be(e.fixUpperEdge),t.mesh.delete(e.eUp),e.fixUpperEdge=!1,e.eUp=r,r.activeRegion=e},i.topLeftRegion=function(t,e){var r=e.eUp.Org,n;do e=i.regionAbove(e);while(e.eUp.Org===r);if(e.fixUpperEdge){if(n=t.mesh.connect(i.regionBelow(e).eUp.Sym,e.eUp.Lnext),n===null)return null;i.fixUpperEdge(t,e,n),e=i.regionAbove(e)}return e},i.topRightRegion=function(t){var e=t.eUp.Dst;do t=i.regionAbove(t);while(t.eUp.Dst===e);return t},i.addRegionBelow=function(t,e,r){var n=new WS;return n.eUp=r,n.nodeUp=t.dict.insertBefore(e.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},i.isWindingInside=function(t,e){switch(t.windingRule){case Ct.ODD:return(e&1)!==0;case Ct.NONZERO:return e!==0;case Ct.POSITIVE:return e>0;case Ct.NEGATIVE:return e<0;case Ct.ABS_GEQ_TWO:return e>=2||e<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(t,e){e.windingNumber=i.regionAbove(e).windingNumber+e.eUp.winding,e.inside=i.isWindingInside(t,e.windingNumber)},i.finishRegion=function(t,e){var r=e.eUp,n=r.Lface;n.inside=e.inside,n.anEdge=r,i.deleteRegion(t,e)},i.finishLeftRegions=function(t,e,r){for(var n,o=null,a=e,s=e.eUp;a!==r;){if(a.fixUpperEdge=!1,o=i.regionBelow(a),n=o.eUp,n.Org!=s.Org){if(!o.fixUpperEdge){i.finishRegion(t,a);break}n=t.mesh.connect(s.Lprev,n.Sym),i.fixUpperEdge(t,o,n)}s.Onext!==n&&(t.mesh.splice(n.Oprev,n),t.mesh.splice(s,n)),i.finishRegion(t,a),s=o.eUp,a=o}return s},i.addRightEdges=function(t,e,r,n,o,a){var s,l,c,d,u=!0;c=r;do Be(Me.vertLeq(c.Org,c.Dst)),i.addRegionBelow(t,e,c.Sym),c=c.Onext;while(c!==n);for(o===null&&(o=i.regionBelow(e).eUp.Rprev),l=e,d=o;s=i.regionBelow(l),c=s.eUp.Sym,c.Org===d.Org;)c.Onext!==d&&(t.mesh.splice(c.Oprev,c),t.mesh.splice(d.Oprev,c)),s.windingNumber=l.windingNumber-c.winding,s.inside=i.isWindingInside(t,s.windingNumber),l.dirty=!0,!u&&i.checkForRightSplice(t,l)&&(i.addWinding(c,d),i.deleteRegion(t,l),t.mesh.delete(d)),u=!1,l=s,d=c;l.dirty=!0,Be(l.windingNumber-c.winding===s.windingNumber),a&&i.walkDirtyRegions(t,l)},i.spliceMergeVertices=function(t,e,r){t.mesh.splice(e,r)},i.vertexWeights=function(t,e,r){var n=Me.vertL1dist(e,t),o=Me.vertL1dist(r,t),a=.5*o/(n+o),s=.5*n/(n+o);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]},i.getIntersectData=function(t,e,r,n,o,a){e.coords[0]=e.coords[1]=e.coords[2]=0,e.idx=-1,i.vertexWeights(e,r,n),i.vertexWeights(e,o,a)},i.checkForRightSplice=function(t,e){var r=i.regionBelow(e),n=e.eUp,o=r.eUp;if(Me.vertLeq(n.Org,o.Org)){if(Me.edgeSign(o.Dst,n.Org,o.Org)>0)return!1;Me.vertEq(n.Org,o.Org)?n.Org!==o.Org&&(t.pq.delete(n.Org.pqHandle),i.spliceMergeVertices(t,o.Oprev,n)):(t.mesh.splitEdge(o.Sym),t.mesh.splice(n,o.Oprev),e.dirty=r.dirty=!0)}else{if(Me.edgeSign(n.Dst,o.Org,n.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(n.Sym),t.mesh.splice(o.Oprev,n)}return!0},i.checkForLeftSplice=function(t,e){var r=i.regionBelow(e),n=e.eUp,o=r.eUp,a;if(Be(!Me.vertEq(n.Dst,o.Dst)),Me.vertLeq(n.Dst,o.Dst)){if(Me.edgeSign(n.Dst,o.Dst,n.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,a=t.mesh.splitEdge(n),t.mesh.splice(o.Sym,a),a.Lface.inside=e.inside}else{if(Me.edgeSign(o.Dst,n.Dst,o.Org)>0)return!1;e.dirty=r.dirty=!0,a=t.mesh.splitEdge(o),t.mesh.splice(n.Lnext,o.Sym),a.Rface.inside=e.inside}return!0},i.checkForIntersect=function(t,e){var r=i.regionBelow(e),n=e.eUp,o=r.eUp,a=n.Org,s=o.Org,l=n.Dst,c=o.Dst,d,u,p=new gd,h,f;if(Be(!Me.vertEq(c,l)),Be(Me.edgeSign(l,t.event,a)<=0),Be(Me.edgeSign(c,t.event,s)>=0),Be(a!==t.event&&s!==t.event),Be(!e.fixUpperEdge&&!r.fixUpperEdge),a===s||(d=Math.min(a.t,l.t),u=Math.max(s.t,c.t),d>u))return!1;if(Me.vertLeq(a,s)){if(Me.edgeSign(c,a,s)>0)return!1}else if(Me.edgeSign(l,s,a)<0)return!1;return i.debugEvent(t),Me.intersect(l,a,c,s,p),Be(Math.min(a.t,l.t)<=p.t),Be(p.t<=Math.max(s.t,c.t)),Be(Math.min(c.s,l.s)<=p.s),Be(p.s<=Math.max(s.s,a.s)),Me.vertLeq(p,t.event)&&(p.s=t.event.s,p.t=t.event.t),h=Me.vertLeq(a,s)?a:s,Me.vertLeq(h,p)&&(p.s=h.s,p.t=h.t),Me.vertEq(p,a)||Me.vertEq(p,s)?(i.checkForRightSplice(t,e),!1):!Me.vertEq(l,t.event)&&Me.edgeSign(l,t.event,p)>=0||!Me.vertEq(c,t.event)&&Me.edgeSign(c,t.event,p)<=0?c===t.event?(t.mesh.splitEdge(n.Sym),t.mesh.splice(o.Sym,n),e=i.topLeftRegion(t,e),n=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),r),i.addRightEdges(t,e,n.Oprev,n,n,!0),!0):l===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(n.Lnext,o.Oprev),r=e,e=i.topRightRegion(e),f=i.regionBelow(e).eUp.Rprev,r.eUp=o.Oprev,o=i.finishLeftRegions(t,r,null),i.addRightEdges(t,e,o.Onext,n.Rprev,f,!0),!0):(Me.edgeSign(l,t.event,p)>=0&&(i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(n.Sym),n.Org.s=t.event.s,n.Org.t=t.event.t),Me.edgeSign(c,t.event,p)<=0&&(e.dirty=r.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),!1):(t.mesh.splitEdge(n.Sym),t.mesh.splitEdge(o.Sym),t.mesh.splice(o.Oprev,n),n.Org.s=p.s,n.Org.t=p.t,n.Org.pqHandle=t.pq.insert(n.Org),i.getIntersectData(t,n.Org,a,l,s,c),i.regionAbove(e).dirty=e.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(t,e){for(var r=i.regionBelow(e),n,o;;){for(;r.dirty;)e=r,r=i.regionBelow(r);if(!e.dirty&&(r=e,e=i.regionAbove(e),e===null||!e.dirty))return;if(e.dirty=!1,n=e.eUp,o=r.eUp,n.Dst!==o.Dst&&i.checkForLeftSplice(t,e)&&(r.fixUpperEdge?(i.deleteRegion(t,r),t.mesh.delete(o),r=i.regionBelow(e),o=r.eUp):e.fixUpperEdge&&(i.deleteRegion(t,e),t.mesh.delete(n),e=i.regionAbove(r),n=e.eUp)),n.Org!==o.Org)if(n.Dst!==o.Dst&&!e.fixUpperEdge&&!r.fixUpperEdge&&(n.Dst===t.event||o.Dst===t.event)){if(i.checkForIntersect(t,e))return}else i.checkForRightSplice(t,e);n.Org===o.Org&&n.Dst===o.Dst&&(i.addWinding(o,n),i.deleteRegion(t,e),t.mesh.delete(n),e=i.regionAbove(r))}},i.connectRightVertex=function(t,e,r){var n,o=r.Onext,a=i.regionBelow(e),s=e.eUp,l=a.eUp,c=!1;if(s.Dst!==l.Dst&&i.checkForIntersect(t,e),Me.vertEq(s.Org,t.event)&&(t.mesh.splice(o.Oprev,s),e=i.topLeftRegion(t,e),o=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),a),c=!0),Me.vertEq(l.Org,t.event)&&(t.mesh.splice(r,l.Oprev),r=i.finishLeftRegions(t,a,null),c=!0),c){i.addRightEdges(t,e,r.Onext,o,o,!0);return}Me.vertLeq(l.Org,s.Org)?n=l.Oprev:n=s,n=t.mesh.connect(r.Lprev,n),i.addRightEdges(t,e,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(t,e)},i.connectLeftDegenerate=function(t,e,r){var n,o,a,s,l;if(n=e.eUp,Me.vertEq(n.Org,r)){Be(!1),i.spliceMergeVertices(t,n,r.anEdge);return}if(!Me.vertEq(n.Dst,r)){t.mesh.splitEdge(n.Sym),e.fixUpperEdge&&(t.mesh.delete(n.Onext),e.fixUpperEdge=!1),t.mesh.splice(r.anEdge,n),i.sweepEvent(t,r);return}Be(!1),e=i.topRightRegion(e),l=i.regionBelow(e),a=l.eUp.Sym,o=s=a.Onext,l.fixUpperEdge&&(Be(o!==a),i.deleteRegion(t,l),t.mesh.delete(a),a=o.Oprev),t.mesh.splice(r.anEdge,a),Me.edgeGoesLeft(o)||(o=null),i.addRightEdges(t,e,a.Onext,s,o,!0)},i.connectLeftVertex=function(t,e){var r,n,o,a,s,l,c=new WS;if(c.eUp=e.anEdge.Sym,r=t.dict.search(c).key,n=i.regionBelow(r),!!n){if(a=r.eUp,s=n.eUp,Me.edgeSign(a.Dst,e,a.Org)===0){i.connectLeftDegenerate(t,r,e);return}if(o=Me.vertLeq(s.Dst,a.Dst)?r:n,r.inside||o.fixUpperEdge){if(o===r)l=t.mesh.connect(e.anEdge.Sym,a.Lnext);else{var d=t.mesh.connect(s.Dnext,e.anEdge);l=d.Sym}o.fixUpperEdge?i.fixUpperEdge(t,o,l):i.computeWinding(t,i.addRegionBelow(t,r,l)),i.sweepEvent(t,e)}else i.addRightEdges(t,r,e.anEdge,e.anEdge,null,!0)}},i.sweepEvent=function(t,e){t.event=e,i.debugEvent(t);for(var r=e.anEdge;r.activeRegion===null;)if(r=r.Onext,r===e.anEdge){i.connectLeftVertex(t,e);return}var n=i.topLeftRegion(t,r.activeRegion);Be(n!==null);var o=i.regionBelow(n),a=o.eUp,s=i.finishLeftRegions(t,o,null);s.Onext===a?i.connectRightVertex(t,n,s):i.addRightEdges(t,n,s.Onext,a,a,!0)},i.addSentinel=function(t,e,r,n){var o=new WS,a=t.mesh.makeEdge();a.Org.s=r,a.Org.t=n,a.Dst.s=e,a.Dst.t=n,t.event=a.Dst,o.eUp=a,o.windingNumber=0,o.inside=!1,o.fixUpperEdge=!1,o.sentinel=!0,o.dirty=!1,o.nodeUp=t.dict.insert(o)},i.initEdgeDict=function(t){t.dict=new NV(t,i.edgeLeq);var e=t.bmax[0]-t.bmin[0],r=t.bmax[1]-t.bmin[1],n=t.bmin[0]-e,o=t.bmax[0]+e,a=t.bmin[1]-r,s=t.bmax[1]+r;i.addSentinel(t,n,o,a),i.addSentinel(t,n,o,s)},i.doneEdgeDict=function(t){for(var e,r=0;(e=t.dict.min().key)!==null;)e.sentinel||(Be(e.fixUpperEdge),Be(++r===1)),Be(e.windingNumber===0),i.deleteRegion(t,e)},i.removeDegenerateEdges=function(t){var e,r,n,o=t.mesh.eHead;for(e=o.next;e!==o;e=r)r=e.next,n=e.Lnext,Me.vertEq(e.Org,e.Dst)&&e.Lnext.Lnext!==e&&(i.spliceMergeVertices(t,n,e),t.mesh.delete(e),e=n,n=e.Lnext),n.Lnext===e&&(n!==e&&((n===r||n===r.Sym)&&(r=r.next),t.mesh.delete(n)),(e===r||e===r.Sym)&&(r=r.next),t.mesh.delete(e))},i.initPriorityQ=function(t){var e,r,n,o=0;for(n=t.mesh.vHead,r=n.next;r!==n;r=r.next)o++;for(o+=8,e=t.pq=new BV(o,Me.vertLeq),n=t.mesh.vHead,r=n.next;r!==n;r=r.next)r.pqHandle=e.insert(r);return r!==n?!1:(e.init(),!0)},i.donePriorityQ=function(t){t.pq=null},i.removeDegenerateFaces=function(t,e){var r,n,o;for(r=e.fHead.next;r!==e.fHead;r=n)n=r.next,o=r.anEdge,Be(o.Lnext!==o),o.Lnext.Lnext===o&&(i.addWinding(o.Onext,o),t.mesh.delete(o));return!0},i.computeInterior=function(t,e){e===void 0&&(e=!0);var r,n;if(i.removeDegenerateEdges(t),!i.initPriorityQ(t))return!1;for(i.initEdgeDict(t);(r=t.pq.extractMin())!==null;){for(;n=t.pq.min(),!(n===null||!Me.vertEq(n,r));)n=t.pq.extractMin(),i.spliceMergeVertices(t,r.anEdge,n.anEdge);i.sweepEvent(t,r)}return t.event=t.dict.min().key.eUp.Org,i.debugEvent(t),i.doneEdgeDict(t),i.donePriorityQ(t),i.removeDegenerateFaces(t,t.mesh)?(e&&t.mesh.check(),!0):!1},i}(),_V=function(){function i(){this.mesh=new u2,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=Ct.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 i.prototype.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.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},i.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},i.prototype.computeNormal_=function(t){var e,r,n,o,a,s,l=[0,0,0],c=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],h=[null,null,null],f=[null,null,null],m=this.mesh.vHead;e=m.next;for(var y=0;y<3;++y)o=e.coords[y],c[y]=o,f[y]=e,l[y]=o,h[y]=e;for(e=m.next;e!==m;e=e.next)for(var g=0;g<3;++g)o=e.coords[g],o<c[g]&&(c[g]=o,f[g]=e),o>l[g]&&(l[g]=o,h[g]=e);var v=0;if(l[1]-c[1]>l[0]-c[0]&&(v=1),l[2]-c[2]>l[v]-c[v]&&(v=2),c[v]>=l[v]){t[0]=0,t[1]=0,t[2]=1;return}for(s=0,r=f[v],n=h[v],d[0]=r.coords[0]-n.coords[0],d[1]=r.coords[1]-n.coords[1],d[2]=r.coords[2]-n.coords[2],e=m.next;e!==m;e=e.next)u[0]=e.coords[0]-n.coords[0],u[1]=e.coords[1]-n.coords[1],u[2]=e.coords[2]-n.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[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_(d)]=1)},i.prototype.checkOrientation_=function(){for(var t=this.mesh.fHead,e,r=this.mesh.vHead,n,o=0,a=t.next;a!==t;a=a.next)if(n=a.anEdge,!(n.winding<=0))do o+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==a.anEdge);if(o<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]}},i.prototype.projectPolygon_=function(){var t=this.mesh.vHead,e=[0,0,0],r,n,o=!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),o=!0),r=this.sUnit,n=this.tUnit;var a=this.longAxis_(e);r[a]=0,r[(a+1)%3]=1,r[(a+2)%3]=0,n[a]=0,n[(a+1)%3]=0,n[(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,n);o&&this.checkOrientation_();for(var l=!0,c=t.next;c!==t;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.prototype.tessellateMonoRegion_=function(t,e){var r,n;if(r=e.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;Me.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;Me.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var o=void 0;r.Lnext!==n;)if(Me.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(Me.edgeGoesLeft(n.Lnext)||Me.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)o=t.connect(n.Lnext,n),n=o.Sym;n=n.Lprev}else{for(;n.Lnext!==r&&(Me.edgeGoesRight(r.Lprev)||Me.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)o=t.connect(r,r.Lprev),r=o.Sym;r=r.Lnext}if(n.Lnext===r)throw"Mono region invalid";for(;n.Lnext.Lnext!==r;)o=t.connect(n.Lnext,n),n=o.Sym;return!0},i.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},i.prototype.discardExterior_=function(t){for(var e,r=t.fHead.next;r!==t.fHead;r=e)e=r.next,r.inside||t.zapFace(r)},i.prototype.setWindingNumber_=function(t,e,r){for(var n,o=t.eHead.next;o!==t.eHead;o=n)n=o.next,o.Rface.inside!==o.Lface.inside?o.winding=o.Lface.inside?e:-e:r?t.delete(o):o.winding=0},i.prototype.getNeighbourFace_=function(t){return!t.Rface||!t.Rface.inside?-1:t.Rface.n},i.prototype.outputPolymesh_=function(t,e,r,n){var o,a=0,s=0,l;r>3&&t.mergeConvexFaces(r);for(var c=t.vHead.next;c!==t.vHead;c=c.next)c.n=-1;for(var d=t.fHead.next;d!==t.fHead;d=d.next)if(d.n=-1,!!d.inside){o=d.anEdge,l=0;do{var c=o.Org;c.n===-1&&(c.n=s,s++),l++,o=o.Lnext}while(o!==d.anEdge);if(l>r)throw"Face vertex greater that support polygon";d.n=a,++a}this.elementCount=a,e===Vr.CONNECTED_POLYGONS&&(a*=2),this.elements=[],this.elements.length=a*r,this.vertexCount=s,this.vertices=[],this.vertices.length=s*n,this.vertexIndices=[],this.vertexIndices.length=s;for(var c=t.vHead.next;c!==t.vHead;c=c.next)if(c.n!==-1){var u=c.n*n;this.vertices[u+0]=c.coords[0],this.vertices[u+1]=c.coords[1],n>2&&(this.vertices[u+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var p=0,d=t.fHead.next;d!==t.fHead;d=d.next)if(!!d.inside){o=d.anEdge,l=0;do{var c=o.Org;this.elements[p++]=c.n,l++,o=o.Lnext}while(o!==d.anEdge);for(var h=l;h<r;++h)this.elements[p++]=-1;if(e===Vr.CONNECTED_POLYGONS){o=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(o),o=o.Lnext;while(o!==d.anEdge);for(var f=l;f<r;++f)this.elements[p++]=-1}}},i.prototype.outputContours_=function(t,e){var r,n,o=0,a=0;this.vertexCount=0,this.elementCount=0;for(var s=t.fHead.next;s!==t.fHead;s=s.next)if(!!s.inside){n=r=s.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==n);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,c=0,d=0;o=0;for(var s=t.fHead.next;s!==t.fHead;s=s.next)if(!!s.inside){a=0,n=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[c++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,a++,r=r.Lnext;while(r!==n);this.elements[d++]=o,this.elements[d++]=a,o+=a}},i.prototype.addContour=function(t,e){this.mesh===null&&(this.mesh=new u2),t<2&&(t=2),t>3&&(t=3);for(var r=null,n=0;n<e.length;n+=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[n+0],r.Org.coords[1]=e[n+1],t>2?r.Org.coords[2]=e[n+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(t,e,r,n,o,a){if(t===void 0&&(t=Ct.ODD),e===void 0&&(e=Vr.POLYGONS),a===void 0&&(a=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,o&&(this.normal[0]=o[0],this.normal[1]=o[1],this.normal[2]=o[2]),this.windingRule=t,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),LV.computeInterior(this,a);var s=this.mesh;return e===Vr.BOUNDARY_CONTOURS?this.setWindingNumber_(s,1,!0):this.tessellateInterior_(s),a&&s.check(),e===Vr.BOUNDARY_CONTOURS?this.outputContours_(s,n):this.outputPolymesh_(s,e,r,n),!0},i}();function Ts(i){var t=i.windingRule,e=t===void 0?Ct.ODD:t,r=i.elementType,n=r===void 0?Vr.POLYGONS:r,o=i.polySize,a=o===void 0?3:o,s=i.vertexSize,l=s===void 0?2:s,c=i.normal,d=c===void 0?[0,0,1]:c,u=i.contours,p=u===void 0?[]:u,h=i.strict,f=h===void 0?!0:h,m=i.debug,y=m===void 0?!1:m;if(!p&&f)throw new Error("Contours can't be empty");if(!!p){var g=new _V;i.edgeCreateCallback&&(g.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(g.vertexIdCallback=i.vertexIdCallback);for(var v=0;v<p.length;v++)g.addContour(l||2,p[v]);return g.tesselate(e,n,a,l,d,f),{vertices:g.vertices,vertexIndices:g.vertexIndices,vertexCount:g.vertexCount,elements:g.elements,elementCount:g.elementCount,mesh:y?g.mesh:void 0}}}var AZ=Ct.ODD,wZ=Ct.NONZERO,CZ=Ct.POSITIVE,EZ=Ct.NEGATIVE,TZ=Ct.ABS_GEQ_TWO,PZ=Vr.POLYGONS,MZ=Vr.CONNECTED_POLYGONS,OZ=Vr.BOUNDARY_CONTOURS;function Xy(i,t){let e=i.length/2;if(e<2)return[];let r=0;for(let l=0;l<e;l++){let c=(l+1)%e;r+=i[l*2]*i[c*2+1]-i[c*2]*i[l*2+1]}let n=r>0!==t?1:-1,o=[];for(let l=0;l<e;l++){let c=(l+1)%e,d=i[c*2]-i[l*2],u=i[c*2+1]-i[l*2+1],p=Math.hypot(d,u);o.push(p>0?[n*u/p,-n*d/p]:[0,0])}let a=Math.cos(40*Math.PI/180),s=(l,c)=>{if(l[0]*c[0]+l[1]*c[1]<=a)return l;let[d,u]=[l[0]+c[0],l[1]+c[1]],p=Math.hypot(d,u);return p>0?[d/p,u/p]:l};return o.map((l,c)=>[s(l,o[(c+e-1)%e]),s(l,o[(c+1)%e])])}function Yy(i,t,e){let r=i.length/2,n=new Float32Array(r+1);if(!(t>0)||!(e>0)||r<2)return{u:n,vScale:0};let o=0;for(let a=0;a<r;a++){let s=(a+1)%r;o+=Math.hypot((i[s*2]-i[a*2])/t,(i[s*2+1]-i[a*2+1])/e),n[a+1]=o}return{u:n,vScale:Math.sqrt(t*e)}}function Ky(i,t,e){for(let r=0;r<e.length;r+=3){let n=e[r]*3,o=e[r+1]*3,a=e[r+2]*3,s=i[o]-i[n],l=i[o+1]-i[n+1],c=i[o+2]-i[n+2],d=i[a]-i[n],u=i[a+1]-i[n+1],p=i[a+2]-i[n+2],h=l*p-c*u,f=c*d-s*p,m=s*u-l*d,y=t[n]+t[o]+t[a],g=t[n+1]+t[o+1]+t[a+1],v=t[n+2]+t[o+2]+t[a+2];if(h*y+f*g+m*v<0){let b=e[r+1];e[r+1]=e[r+2],e[r+2]=b}}}var Qy={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},m2={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},Zy={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};function qS(i,t){return i.normals[t*3+2]<.9999}var y2=new WeakMap;function Jy(i){let t=y2.get(i);if(t!==void 0)return t;if(!(i.rise>0))return i;let e=new Float32Array(i.normals),r=i.positions.length/3;for(let o=0;o<r;o++){if(!qS(i,o))continue;let a=e[o*3],s=e[o*3+1],l=Math.hypot(a,s);if(l===0)continue;let c=i.rise-i.positions[o*3+2],d=Math.min(1,Math.max(0,1-c/i.rise)),u=Math.sqrt(1-d*d);e[o*3]=a/l*u,e[o*3+1]=s/l*u,e[o*3+2]=d}let n={...i,normals:e};return y2.set(i,n),n}function $y(i,t,e,r){let n=(t-i.minX)/i.spanX,o=(e-i.minY)/i.spanY;return r?[o,n]:[n,o]}var g2=2,kl=class extends _l.BufferGeometry{constructor(e,r,n=12,o=Ct.ODD,a,s=!1){super();this.type="FlatExtrusionGeometry";this._nearSide=new Uint8Array(0);this._vScale=0;this._shape=e,this._depth=r,this._curveSegments=n,this._windingRule=o,this._uvPitch=s?void 0:a,this._legacy=s;let l=[e.extractShapePointsToFlatArray([],n),...e.shapeHoles.map(W=>W.extractShapePointsToFlatArray([],n))],c;try{c=Ts({contours:l,windingRule:o,elementType:Vr.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{c=Zy}let d=c?.vertexCount??0,u=c?.elementCount??0,p=1/0,h=1/0,f=-1/0,m=-1/0;for(let W of l)for(let U=0;U<W.length;U+=2)W[U]<p&&(p=W[U]),W[U]>f&&(f=W[U]),W[U+1]<h&&(h=W[U+1]),W[U+1]>m&&(m=W[U+1]);let y=this._uvPitch,g=y??(f-p||1),v=y??(m-h||1),b=y===void 0?p:0,S=y===void 0?h:0,x=l.map((W,U)=>Xy(W,U>0)),A=0;for(let W of x)A+=W.length;let w=d*2+A*4,C=u*3*2+A*6,T=new Float32Array(w*3),M=new Float32Array(w*3),D=new Float32Array(w*2),I=new Uint32Array(C),_=new Uint8Array(w),E=0,B=0,L=0,k=!1,F=(W,U,G,q,X,Y,Q=(W-b)/g,te=(U-S)/v)=>{let ue=B*3;T[ue]=W,T[ue+1]=U,T[ue+2]=G,M[ue]=q,M[ue+1]=X,M[ue+2]=Y,_[B]=G===r?k?g2:1:0,D[B*2]=Q,D[B*2+1]=te,B++};if(c!==void 0)for(let[W,U]of[[r,1],[0,-1]]){let G=B;for(let q=0;q<d;q++)F(c.vertices[q*2],c.vertices[q*2+1],W,0,0,U);for(let q=0;q<u;q++){let[X,Y,Q]=[c.elements[q*3],c.elements[q*3+1],c.elements[q*3+2]];I[L++]=G+X,I[L++]=G+(U>0?Y:Q),I[L++]=G+(U>0?Q:Y)}}k=!0;for(let W=0;W<l.length;W++){let U=l[W],G=x[W],q=U.length/2,{u:X,vScale:Y}=s?{u:new Float32Array(q+1),vScale:0}:Yy(U,g,v);E=Y;let Q=Y===0?0:r/Y,te={minX:b,minY:S,spanX:g,spanY:v},ue=(le,[ce,de],ge,Se)=>{let ye=U[le*2],Z=U[le*2+1],[pe,re]=s?$y(te,ye,Z,ge):[Se,ge?0:Q];F(ye,Z,ge?0:r,ce,de,0,pe,re)};for(let le=0;le<G.length;le++){let ce=(le+1)%q,[de,ge]=G[le],[Se,ye]=[X[le],X[le+1]],Z=B;ue(le,de,!1,Se),ue(le,de,!0,Se),ue(ce,ge,!1,ye),ue(ce,ge,!0,ye),I[L++]=Z,I[L++]=Z+1,I[L++]=Z+2,I[L++]=Z+3,I[L++]=Z+2,I[L++]=Z+1}}Ky(T,M,I),this.setAttribute("position",new _l.BufferAttribute(T,3)),this.setAttribute("normal",new _l.BufferAttribute(M,3)),this.setAttribute("uv",new _l.BufferAttribute(D,2)),this.setIndex(new _l.BufferAttribute(I,1)),this._nearSide=_,this._vScale=E}takeDepthStateFrom(e){let r=e;r._nearSide!==void 0&&(this._depth=r._depth??this._depth,this._nearSide=r._nearSide,this._vScale=r._vScale??this._vScale)}canShiftDepthTo(e){return this._nearSide.length>0&&this._depth>0&&e>0}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let r=e-this._depth;if(this._depth=e,r===0)return!0;let n=this.getAttribute("position");if(n===void 0)return!1;let o=n.array,a=this.getAttribute("uv"),s=a?.array,l=this._vScale>0?r/this._vScale:0,c=this._nearSide;for(let d=0;d<c.length;d++){let u=c[d];u!==0&&(o[d*3+2]+=r,u===g2&&s!==void 0&&(s[d*2+1]+=l))}return n.needsUpdate=!0,a!==void 0&&l!==0&&(a.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let r=this.boundingBox;r.min.z=Math.min(0,e),r.max.z=Math.max(0,e),this.boundingSphere!==null&&r.getBoundingSphere(this.boundingSphere)}clone(){let e=new kl(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return e.userData=Ss(this.userData),e}};var Fl=require("three");var vd=class extends Fl.BufferGeometry{constructor(e,r=12,n={}){super();this.type="ShapeGeometry";this.windingRule=Ct.ODD;this.elementType=Vr.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=e,this._curveSegments=r,this._triangulationOptions=Object.assign({windingRule:Ct.ODD,elementType:Vr.POLYGONS,polySize:3,vertexSize:2,strict:!0},n);let o=this._shape.extractShapePointsToFlatArray([],this._curveSegments),a=this._shape.shapeHoles.map(f=>f.extractShapePointsToFlatArray([],this._curveSegments)),s,l=!0,c=!0,d,u;for(let f=0,m=o.length/2;f<m;f++){let y=f*2,g=o[y+0],v=o[y+1];if(d!==void 0&&g!==d&&(l=!1),u!==void 0&&v!==u&&(c=!1),d=g,u=v,!l&&!c)break}if(!l&&!c)try{s=Ts({contours:[o,...a],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{s=Qy}let p=s?.vertexCount??1,h=s?.elementCount??1;if(this._positionAttribute=new Fl.BufferAttribute(new Float32Array(p*3),3),this._normalAttribute=new Fl.BufferAttribute(new Float32Array(p*3),3),this._uvAttribute=new Fl.BufferAttribute(new Float32Array(p*2),2),this._indexAttribute=new Fl.BufferAttribute(new Uint32Array(h*3),1),s){let f=1/0,m=-1/0,y=1/0,g=-1/0;for(let S=0,x=p;S<x;S++){let A=S*2,w=s.vertices[A+0],C=s.vertices[A+1];w<f&&(f=w),w>m&&(m=w),C<y&&(y=C),C>g&&(g=C)}let v=m-f,b=g-y;for(let S=0,x=p;S<x;S++){let A=S*2,w=s.vertices[A+0],C=s.vertices[A+1],T=(w-f)/v,M=(C-y)/b;this._positionAttribute.setXYZ(S,w,C,0),this._normalAttribute.setXYZ(S,0,0,1),this._uvAttribute.setXY(S,T,M)}for(let S=0,x=h;S<x;S++){let A=S*3,w=s.elements[A+0],C=s.elements[A+1],T=s.elements[A+2];this._indexAttribute.setX(A+0,w),this._indexAttribute.setX(A+1,C),this._indexAttribute.setX(A+2,T)}}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 vd(this._shape,this._curveSegments);return e.userData=Ss(this.userData),e}};var gi=require("three");var eg;var FV=.4;function b2(){return eg!==void 0}function x2(i,t){let r=[i.extractShapePointsToFlatArray([],t)];for(let l of i.shapeHoles)r.push(l.extractShapePointsToFlatArray([],t));let n=0;for(let l of r)n+=l.length>>1;let o=new Float64Array(n*2),a=new Uint32Array(r.length),s=0;for(let l=0;l<r.length;l++)o.set(r[l],s*2),s+=r[l].length>>1,a[l]=s;return{points:o,ends:a}}function VV(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i[e],t=Math.imul(t,16777619)>>>0;return t}function GV(i,t){let e=[t],r=n=>{e.push(n.points.length,n.isClosed?1:0,n.roundness??0);for(let o of n.points){e.push(o.roundness??0,o.position.x,o.position.y);for(let a of o.controls)e.push(a.position.x,a.position.y)}e.push(n.shapeHoles.length);for(let o of n.shapeHoles)r(o)};return r(i),VV(new Uint8Array(new Float64Array(e).buffer))}var UV=new gi.Matrix3;function zV(i,t,e,r,n){let o=1/0;for(let a=2;a<i.length;a+=3)i[a]<o&&(o=i[a]);if(o===1/0&&(o=0),o!==0)for(let a=2;a<i.length;a+=3)i[a]-=o;return{positions:i,normals:t,uvs:e,indices:r,rise:n-o}}function nh(i,t,e,r,n,o){let a=i.positions.length/3,s=n.elements,l=UV.getNormalMatrix(n).elements;for(let d=0;d<a;d++){let u=d*3,p=(e+d)*3,h=i.positions[u],f=i.positions[u+1],m=i.positions[u+2];t.positions[p]=s[0]*h+s[4]*f+s[8]*m+s[12],t.positions[p+1]=s[1]*h+s[5]*f+s[9]*m+s[13],t.positions[p+2]=s[2]*h+s[6]*f+s[10]*m+s[14];let y=i.normals[u],g=i.normals[u+1],v=i.normals[u+2];t.normals[p]=l[0]*y+l[3]*g+l[6]*v,t.normals[p+1]=l[1]*y+l[4]*g+l[7]*v,t.normals[p+2]=l[2]*y+l[5]*g+l[8]*v;let b=(e+d)*2;if(o===void 0)t.uvs[b]=i.uvs[d*2],t.uvs[b+1]=i.uvs[d*2+1];else{let[S,x]=o(h,f,i.uvs[d*2],i.uvs[d*2+1],d);t.uvs[b]=S,t.uvs[b+1]=x}}let c=n.determinant()<0;for(let d=0;d<i.indices.length;d+=3)t.indices[r+d]=i.indices[d]+e,t.indices[r+d+1]=i.indices[d+(c?2:1)]+e,t.indices[r+d+2]=i.indices[d+(c?1:2)]+e}var jV=new gi.Matrix4,HV=new gi.Matrix4,WV=new gi.Matrix4().makeScale(1,1,-1);function qV(i,t,e,r,n,o=!1){let a=r.positions.length/3,s=e-r.rise,l=r.rise,{points:c,ends:d}=x2(i,t),u=1/0,p=1/0,h=-1/0,f=-1/0;for(let F=0;F<c.length;F+=2)c[F]<u&&(u=c[F]),c[F]>h&&(h=c[F]),c[F+1]<p&&(p=c[F+1]),c[F+1]>f&&(f=c[F+1]);o&&(n=void 0);let m=n??h-u,y=n??f-p,g={minX:u,minY:p,spanX:h-u||1,spanY:f-p||1},v=[],b=0;for(let F of d)v.push({at:b,count:F-b}),b=F;let S=0;for(let F of v)S+=F.count;let x=a*2+S*4,A=new Float32Array(x*3),w=new Float32Array(x*3),C=new Float32Array(x*2),T=new Uint32Array(r.indices.length*2+S*6),M=new Uint8Array(x),D=0,I=n===void 0?void 0:(F,W)=>[F/n,W/n],_=o?(F,W,U,G,q)=>qS(r,q)?[G,U]:[U,G]:I,E=o?Jy(r):r,B={positions:A,normals:w,uvs:C,indices:T};nh(E,B,0,0,jV.makeTranslation(0,0,s),I),nh(E,B,a,r.indices.length,HV.makeTranslation(0,0,l).multiply(WV),_),M.fill(1,0,a);let L=a*2,k=r.indices.length*2;for(let F=0;F<v.length;F++){let{at:W,count:U}=v[F],G=c.subarray(W*2,(W+U)*2),q=Xy(G,F>0),X=o?{u:new Float32Array(U+1),vScale:0}:Yy(G,m,y),Y=X.u;D=X.vScale;for(let Q=0;Q<U;Q++){let te=(Q+1)%U,[ue,le]=q[Q],ce=L;for(let[de,ge,Se,ye,Z,pe]of[[G[Q*2],G[Q*2+1],ue,s,Y[Q],XS],[G[te*2],G[te*2+1],le,s,Y[Q+1],XS],[G[te*2],G[te*2+1],le,l,Y[Q+1],0],[G[Q*2],G[Q*2+1],ue,l,Y[Q],0]]){let re=L*3;if(A[re]=de,A[re+1]=ge,A[re+2]=ye,w[re]=Se[0],w[re+1]=Se[1],w[re+2]=0,o){let[Ae,Ee]=$y(g,de,ge,pe===0);C[L*2]=Ae,C[L*2+1]=Ee}else C[L*2]=Z,C[L*2+1]=D===0?0:(ye-l)/D;M[L]=pe,L++}T[k++]=ce,T[k++]=ce+1,T[k++]=ce+2,T[k++]=ce,T[k++]=ce+2,T[k++]=ce+3}}return Ky(A,w,T),{positions:A,normals:w,uvs:C,indices:T,nearSide:M,vScale:D}}var XS=2,YS=new Map,v2={assemblies:0,placements:0};function S2(i){let{owner:t,shape:e,curveSegments:r,assembledAt:n,bevel:o,bevelSegments:a}=i,s=GV(e,r),l=t??`outline:${s}`,c=`${o}/${a}`,d=YS.get(l);if(d!==void 0&&d.outlineVersion===s&&d.capKey===c&&(i.stillServes?.(d)??!0))return v2.placements++,d.cap;let u=XV(e,r,n,o,a);v2.assemblies++;try{let p=YV(u,n);return YS.set(l,{outlineVersion:s,capKey:c,assembledAt:n,cap:p}),p}finally{u.free()}}function A2(i){YS.delete(i)}var bd=class extends gi.BufferGeometry{constructor(e,r,n=0,o=12,a=3,s,l,c=!1){super();this.type="ShapeGeometry";this._nearSide=new Uint8Array(0);this._effectiveBevel=0;this._vScale=0;if(eg===void 0)throw new Error("bevel-wasm is not loaded");this._shape=e,this._uvPitch=l,this._legacy=c,this._depth=r,this._bevel=n,this._curveSegments=o,this._bevelSegments=a,this._ownerId=s,this.rebuild()}takeDepthStateFrom(e){let r=e;r._nearSide!==void 0&&(this._depth=r._depth??this._depth,this._nearSide=r._nearSide,this._vScale=r._vScale??this._vScale,this._effectiveBevel=r._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length>0&&Vl(this._effectiveBevel,e)&&Vl(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let r=e-this._depth;if(this._depth=e,r===0)return!0;let n=this.getAttribute("position");if(n===void 0)return!1;let o=n.array,a=this.getAttribute("uv"),s=a?.array,l=this._vScale>0?r/this._vScale:0,c=this._nearSide;for(let d=0;d<c.length;d++){let u=c[d];u!==0&&(o[d*3+2]+=r,u===XS&&s!==void 0&&(s[d*2+1]+=l))}return n.needsUpdate=!0,a!==void 0&&l!==0&&(a.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let r=this.boundingBox;r.min.z=Math.min(0,e),r.max.z=Math.max(0,e),this.boundingSphere!==null&&r.getBoundingSphere(this.boundingSphere)}setDepth(e){e!==this._depth&&(this._depth=e,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let e=S2({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:l=>Vl(l.cap.rise,this._depth)&&Vl(l.cap.rise,l.assembledAt)}),r=qV(this._shape,this._curveSegments,this._depth,e,this._uvPitch,this._legacy);this._nearSide=r.nearSide,this._vScale=r.vScale,this._effectiveBevel=e.rise;let n=this.getAttribute("position"),o=this.getAttribute("normal"),a=this.getAttribute("uv"),s=this.getIndex();if(n!==void 0&&o!==void 0&&a!==void 0&&s!==null&&n.array.length===r.positions.length&&o.array.length===r.normals.length&&a.array.length===r.uvs.length&&s.array.length===r.indices.length){n.array.set(r.positions),o.array.set(r.normals),a.array.set(r.uvs),s.array.set(r.indices),n.needsUpdate=!0,o.needsUpdate=!0,a.needsUpdate=!0,s.needsUpdate=!0;return}this.setAttribute("position",new gi.BufferAttribute(r.positions,3)),this.setAttribute("normal",new gi.BufferAttribute(r.normals,3)),this.setAttribute("uv",new gi.BufferAttribute(r.uvs,2)),this.setIndex(new gi.BufferAttribute(r.indices,1))}clone(){let e=new bd(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return e.userData=Ss(this.userData),e}};function XV(i,t,e,r,n){let{points:o,ends:a}=x2(i,t);return eg.assemble_cap(o,a,e,r,0,Math.max(1,Math.floor(n)),FV,40)}function w2(i,t,e,r,n){if(!(eg===void 0||!(t>0)))return S2({owner:n,shape:i,curveSegments:r,assembledAt:2*t,bevel:t,bevelSegments:e})}function YV(i,t){return zV(i.positions(),i.normals(),i.uvs(),i.indices(),t)}function Vl(i,t){return t*.5>i*(1+.001)}var ei=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Ct.ODD},i.parameters),r=Math.abs(e.width),n=Math.abs(e.height??e.width),o=Math.abs(e.depth??0),a=i.shape??t?.shape,s=a?.roundness??e.roundness,l;a!==void 0&&(a instanceof ht?(l=a,(l.width!==r||l.height!==n)&&l.applySize(r,n)):l=new ht(r,n).fromJSON(a),i.parameters?.roundness!==void 0&&i.parameters?.roundness>0&&l.update());let c=l??new ht(r,n);return{parameters:Object.assign(e,{width:r,height:n,depth:o,roundness:s}),shape:c,ownerId:i.ownerId??t?.ownerId}}static build(i){let{depth:t,extrudeBevelSize:e,extrudeBevelSegments:r,subdivisions:n,roundness:o,windingRule:a,uvPitch:s,extrusionVersion:l}=i.parameters,c=l===1;i.shape.roundness=o;let d;return t<=0?d=new vd(i.shape,n,{windingRule:a}):e<=0?d=new kl(i.shape,t,n,a,s,c):b2()?d=new bd(i.shape,t,e,n,r,i.ownerId,s,c):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),d=new kl(i.shape,t,n,a,s,c)),Object.assign(d,{userData:{...i,type:"VectorGeometry"}})}};var vo=require("three"),E2=Math.PI*2,Sd=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return e.angle=vo.MathUtils.clamp(e.angle,0,360),{shape:i.shape&&i.shape instanceof ht?i.shape:new ht,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:r,angle:n,innerRadius:o,depth:a,extrudeBevelSize:s,extrudeBevelSegments:l,extrusionVersion:c}=i.parameters,d=i.shape,u=t*.5,p=e*.5,h=KV(d,u,p,n*Math.PI/180,r,o);d.isClosed=!0,d.update();let f;return n===0?(f=new vo.BufferGeometry,f.setAttribute("position",new vo.Float32BufferAttribute([],3))):f=ei.create({shape:d,parameters:{subdivisions:h,depth:a,extrudeBevelSize:s,extrudeBevelSegments:l,extrusionVersion:c}}),Object.assign(f,{userData:{...i,type:"EllipseGeometry"}})}};function KV(i,t,e,r,n,o){if(r>=E2)return n>30||n%4===0?(ZV(i,t,e,o),Math.round(n/4)):C2(i,r,n,t,e,o);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},c=d2({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:t,ry:e,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%c.length===0?QV(i,a.x,a.y,c,n,t,e,o):C2(i,r,n,t,e,o)}function QV(i,t,e,r,n,o,a,s){let l=Math.round(n/r.length);i.addPoint(xd(t,e));for(let c=0,d=r.length;c<d;c++){let u=r[c],p=i.points[c],h=xd(u.x,u.y);p.controls[1].position.set(u.x1,u.y1),h.controls[0].position.set(u.x2,u.y2),i.addPoint(h)}return s>0?T2(i,o,a,s):i.addPoint(xd(0,0)),l}function C2(i,t,e,r,n,o){let a=-t/e;for(let s=0;s<=e;s++){let l=a*s,c=Math.sin(l)*r,d=Math.cos(l)*n;i.addPoint(xd(c,d))}return t<E2?o>0?T2(i,r,n,o):i.addPoint(xd(0,0)):(i.removePoint(i.points[i.points.length-1]),o>0&&P2(i,r,n,o)),1}function ZV(i,t,e,r=0,n=0,o=0){let a=.5522847498,s=t*a,l=e*a;i.addPoint(tg(n-t,o,n-t,o-l,n-t,o+l)),i.addPoint(tg(n,o+e,n-s,o+e,n+s,o+e)),i.addPoint(tg(n+t,o,n+t,o+l,n+t,o-l)),i.addPoint(tg(n,o-e,n+s,o-e,n-s,o-e)),r>0&&P2(i,t,e,r)}function xd(i,t){return new go(vo.MathUtils.generateUUID(),new vo.Vector2(i,t))}function tg(i,t,e,r,n,o){let a=xd(i,t);return a.controls[0].position.set(e,r),a.controls[1].position.set(n,o),a}function T2(i,t,e,r){M2(i,t,e,r).forEach(o=>i.addPoint(o))}function P2(i,t,e,r){let n=M2(i,t,e,r),o=new ht;n.forEach(a=>o.addPoint(a)),o.isClosed=!0,i.shapeHoles.push(o)}function M2(i,t,e,r){let n=r*t/100,o=n*(Math.abs(e)/Math.abs(t)),a=new vo.Vector2(n/t,o/e),s=i.points.map(l=>{let c=l.clone();return c.uuid=vo.MathUtils.generateUUID(),c}).reverse();return s.forEach(l=>{l.position.multiply(a);let c=l.controls[0].position.clone().multiply(a),d=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(d),l.controls[1].position.copy(c)}),s}var O2=require("three");var I2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.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(i){let{width:t,height:e,depth:r,detail:n,corner:o,cornerSides:a}=i.parameters,s=n===0&&o!==0?new ih(t*.5,o,a):new O2.IcosahedronGeometry(t*.5,n),l=e/t,c=r/t;return(l!==1||c!==1)&&s.scale(1,l,c),Object.assign(s,{userData:{...i,type:"IcosahedronGeometry"}})}},ih=class extends Cs{constructor(t=1,e=.2,r=4){let n=(1+Math.sqrt(5))/2,o=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,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(o,a,s,t,e,r),this.type=s}static fromJSON(t){return new ih(t.radius,t.corner,t.cornerSides)}};var rg=require("three"),D2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){(i.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}]},i.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(i){let{points:t,segments:e,verticalSegments:r}=i.parameters,n=new rg.Shape;n.moveTo(t[0].x,t[0].y),n.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let o=new rg.LatheGeometry(n.extractPoints(r).shape,e);return o.rotateZ(Math.PI),Object.assign(o,{userData:{...i,type:"LatheGeometry"}})}};var Gi=require("three");var Gl=require("three"),KS=1e4;function Ad(i,t){return Math.abs(t-i)/2+Math.min(i,t)}var ng=class{constructor(t=1){this.subdivisions=t}modify(t){let e=JV(t),r=this.subdivisions;for(;r-- >0;)e=$V(e);return eG(e,t)}};function JV(i){let t=i.getAttribute("position");if(t===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let e=i.getAttribute("uv"),r=i.getIndex(),n=t.count,o=new Map,a=new Uint32Array(n),s=[],l=0;for(let m=0;m<n;m++){let y=t.getX(m),g=t.getY(m),v=t.getZ(m),b=Math.round(y*KS),S=Math.round(g*KS),x=Math.round(v*KS),A=o.get(b);A===void 0&&(A=new Map,o.set(b,A));let w=A.get(S);w===void 0&&(w=new Map,A.set(S,w));let C=w.get(x);C===void 0&&(C=l++,w.set(x,C),s.push(y,g,v)),a[m]=C}let c=[],d=[],u=e===void 0?null:[],p=r!==null?r.count:n,h=(m,y)=>{let g=r!==null?r.getX(m):m,v=r!==null?r.getX(m+1):m+1,b=r!==null?r.getX(m+2):m+2;if(!(g<n&&v<n&&b<n))return;let S=a[g],x=a[v],A=a[b];S===x||x===A||A===S||(c.push(S,x,A),d.push(y),u!==null&&u.push(e.getX(g),e.getY(g),e.getX(v),e.getY(v),e.getX(b),e.getY(b)))},f=i.groups;if(f.length>0)for(let m=0;m<f.length;m++){let y=f[m],g=y.materialIndex===void 0?0:y.materialIndex,v=Math.max(y.start,0),b=Math.min(y.start+y.count,p);for(let S=v;S<b&&S+2<p;S+=3)h(S,g)}else for(let m=0;m+2<p;m+=3)h(m,0);return{positions:Float64Array.from(s),faces:Uint32Array.from(c),materialIndices:d,uvs:u===null?null:Float64Array.from(u)}}function $V(i){let{positions:t,faces:e,materialIndices:r,uvs:n}=i,o=t.length/3,a=e.length/3,s=n!==null&&a>0,l=a*3,c=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),h=new Uint32Array(l),f=0,m=8;for(;m<l*2;)m*=2;let y=m-1,g=new Int32Array(m).fill(-1),v=(E,B)=>{let L=(Math.imul(E,2654435761)^B)&y;for(;;){let k=g[L];if(k===-1)return g[L]=f,c[f]=E,d[f]=B,f++;if(c[k]===E&&d[k]===B)return k;L=L+1&y}},b=(E,B)=>{let L=E<B?E:B,k=E<B?B:E,F=(Math.imul(L,2654435761)^k)&y;for(;;){let W=g[F];if(c[W]===L&&d[W]===k)return W;F=F+1&y}},S=new Uint32Array(o),x=new Float64Array(o*3),A=(E,B,L)=>{let k=E<B?v(E,B):v(B,E),F=++u[k];F===1?p[k]=L:F===2&&(h[k]=L),S[E]++,S[B]++,x[E*3]+=t[B*3],x[E*3+1]+=t[B*3+1],x[E*3+2]+=t[B*3+2],x[B*3]+=t[E*3],x[B*3+1]+=t[E*3+1],x[B*3+2]+=t[E*3+2]};for(let E=0;E<a;E++){let B=e[E*3],L=e[E*3+1],k=e[E*3+2];A(B,L,k),A(L,k,B),A(k,B,L)}let w=new Float64Array(f*3);for(let E=0;E<f;E++){let B=c[E]*3,L=d[E]*3;if(u[E]===2){let W=p[E]*3,U=h[E]*3;w[E*3]=(t[B]+t[L])*.375+(t[W]+t[U])*.125,w[E*3+1]=(t[B+1]+t[L+1])*.375+(t[W+1]+t[U+1])*.125,w[E*3+2]=(t[B+2]+t[L+2])*.375+(t[W+2]+t[U+2])*.125}else w[E*3]=(t[B]+t[L])*.5,w[E*3+1]=(t[B+1]+t[L+1])*.5,w[E*3+2]=(t[B+2]+t[L+2])*.5}let C=new Float64Array(o*3),T;for(let E=0;E<o;E++){let B=S[E];B===3?T=3/16:B>3&&(T=3/(8*B));let L=1-B*Number(T),k=Number(T);B===2&&(L=3/4,k=1/8),C[E*3]=t[E*3]*L+x[E*3]*k,C[E*3+1]=t[E*3+1]*L+x[E*3+1]*k,C[E*3+2]=t[E*3+2]*L+x[E*3+2]*k}let M=new Float64Array((o+f)*3);M.set(C),M.set(w,o*3);let D=new Uint32Array(a*12),I=new Array(a*4),_=s?new Float64Array(a*24):null;for(let E=0;E<a;E++){let B=e[E*3],L=e[E*3+1],k=e[E*3+2],F=b(B,L)+o,W=b(L,k)+o,U=b(k,B)+o,G=E*12;D[G++]=F,D[G++]=W,D[G++]=U,D[G++]=B,D[G++]=F,D[G++]=U,D[G++]=L,D[G++]=W,D[G++]=F,D[G++]=k,D[G++]=U,D[G++]=W;let q=r[E];if(I[E*4]=q,I[E*4+1]=q,I[E*4+2]=q,I[E*4+3]=q,_!==null){let X=E*6,Y=n[X],Q=n[X+1],te=n[X+2],ue=n[X+3],le=n[X+4],ce=n[X+5],de=Ad(Y,te),ge=Ad(Q,ue),Se=Ad(te,le),ye=Ad(ue,ce),Z=Ad(Y,le),pe=Ad(Q,ce),re=E*24;_[re++]=de,_[re++]=ge,_[re++]=Se,_[re++]=ye,_[re++]=Z,_[re++]=pe,_[re++]=Y,_[re++]=Q,_[re++]=de,_[re++]=ge,_[re++]=Z,_[re++]=pe,_[re++]=te,_[re++]=ue,_[re++]=Se,_[re++]=ye,_[re++]=de,_[re++]=ge,_[re++]=le,_[re++]=ce,_[re++]=Z,_[re++]=pe,_[re++]=Se,_[re++]=ye}}return{positions:M,faces:D,materialIndices:I,uvs:_}}function eG(i,t){let{positions:e,faces:r,materialIndices:n,uvs:o}=i,a=e.length/3,s=r.length/3,l=new Float64Array(a*3);for(let f=0;f<s;f++){let m=r[f*3]*3,y=r[f*3+1]*3,g=r[f*3+2]*3,v=e[g]-e[y],b=e[g+1]-e[y+1],S=e[g+2]-e[y+2],x=e[m]-e[y],A=e[m+1]-e[y+1],w=e[m+2]-e[y+2],C=b*w-S*A,T=S*x-v*w,M=v*A-b*x;l[m]+=C,l[m+1]+=T,l[m+2]+=M,l[y]+=C,l[y+1]+=T,l[y+2]+=M,l[g]+=C,l[g+1]+=T,l[g+2]+=M}for(let f=0;f<a;f++){let m=l[f*3],y=l[f*3+1],g=l[f*3+2],v=Math.sqrt(m*m+y*y+g*g)||1;l[f*3]=m/v,l[f*3+1]=y/v,l[f*3+2]=g/v}let c=s*3,d=new Float32Array(c*3),u=new Float32Array(c*3),p=o!==null&&o.length>0?new Float32Array(c*2):null;for(let f=0;f<c;f++){let m=r[f]*3;d[f*3]=e[m],d[f*3+1]=e[m+1],d[f*3+2]=e[m+2],u[f*3]=l[m],u[f*3+1]=l[m+1],u[f*3+2]=l[m+2]}p!==null&&p.set(o.subarray(0,c*2));let h=new Gl.BufferGeometry;h.setAttribute("position",new Gl.BufferAttribute(d,3)),c>0&&(h.setAttribute("normal",new Gl.BufferAttribute(u,3)),h.setAttribute("color",new Gl.BufferAttribute(new Float32Array(c*3).fill(1),3))),p!==null&&h.setAttribute("uv",new Gl.BufferAttribute(p,2));for(let f=0;f<s;){let m=n[f],y=f;do f++;while(f<s&&n[f]===m);h.addGroup(y*3,(f-y)*3,m)}return t.boundingBox!==null&&(h.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(h.boundingSphere=t.boundingSphere.clone()),h}var Wr=new Gi.Vector3,R2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=i.geometry??t?.geometry??new Gi.BufferGeometry().copy(new Gi.BoxGeometry(100,100,100)),r;t===void 0?(e.computeBoundingBox(),e.boundingBox.getSize(Wr),r={width:Wr.x,height:Wr.y,depth:Wr.z,subdivisions:0}):r=t.parameters;let n={...r,...i.parameters};return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:e}}static build(i){let{width:t,height:e,depth:r,subdivisions:n}=i.parameters,o=i.geometry??new Gi.BufferGeometry().copy(new Gi.BoxGeometry(100,100,100)),a=o.userData.parameters;a===void 0?(o.boundingBox=tG(o),o.boundingBox.getSize(Wr)):Wr.set(a.width,a.height,a.depth),(t!==Wr.x||e!==Wr.y||r!==Wr.z)&&o.scale(Wr.x===0?1:t/Wr.x,Wr.y===0?1:e/Wr.y,Wr.z===0?1:r/Wr.z);let s=o.originalGeometry;try{n>0?(s===void 0||a?.subdivisions!==n)&&(s===void 0&&(s=o),o=new ng(n).modify(s)):(s!==void 0&&(o=s),s=void 0,o.getAttribute("normal")===void 0&&o.computeVertexNormals())}catch{s!==void 0&&(o=s),s=void 0,o.getAttribute("normal")===void 0&&o.computeVertexNormals()}return s!==void 0&&Object.assign(o,{originalGeometry:s}),delete i.geometry,Object.assign(o,{userData:{...i,type:"NonParametricGeometry"}})}static loadFromUrl(i,t,e){new Gi.BufferGeometryLoader(e).load(i,n=>{let o=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Wr);let a=100/Wr.x;Object.assign(o.parameters,{width:100,height:Wr.y*a,depth:Wr.z*a}),t(this.build(o))})}};function tG(i){let t=new Gi.Box3,e=i.attributes.position;return e?(t.setFromBufferAttribute(e),t):(t.makeEmpty(),t)}var ig=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof ht?i.shape:new ht,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:r,cornerRadius:n,depth:o,extrudeBevelSize:a,extrudeBevelSegments:s,extrusionVersion:l}=i.parameters,c=i.shape,d=t*.5,u=e*.5,p=0,h=0,f=2*Math.PI/r;for(let y=0;y<r;y++){let g=f*y,v=p+Math.sin(g)*d,b=h+Math.cos(g)*u;c.addPoint(c.createPoint(v,b))}c.isClosed=!0;for(let y=0,g=c.points.length;y<g;y++)c.points[y].roundness=n;c.roundness=n,c.update();let m=ei.create({shape:c,parameters:{roundness:n,depth:o,extrudeBevelSize:a,extrudeBevelSegments:s,extrusionVersion:l}});return Object.assign(m,{userData:{...i,type:"PolygonGeometry"}})}};var et=require("three"),B2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.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(i){let{width:t,height:e,depth:r,radialSegments:n,heightSegments:o,openEnded:a,cornerRadius:s,cornerSegments:l}=i.parameters,c=new ZS(t*.5,e,n,o,a,s,l),d=r/t;return d!==1&&c.scale(1,1,d),Object.assign(c,{userData:{...i,type:"PyramidGeometry"}})}};function oh(i,t,e){e.x=i.x*t.x,e.y=i.y,e.z=i.x*t.y}var rG=new et.Vector3,nG=new et.Vector3;function QS(i,t,e,r,n,o){let a=rG.copy(t).sub(i),s=nG.copy(e).sub(i),l=a.angleTo(s);if(a.normalize(),s.normalize(),r===n){let c=a.add(s).normalize();o.copy(i).addScaledVector(c,r/Math.sin(l/2))}else{let c=a.angleTo(s);o.copy(i),o.addScaledVector(a,n/Math.sin(c)),o.addScaledVector(s,r/Math.sin(c))}}function iG(i,t,e){let r=i.clone().sub(t),n=e.clone().sub(t);return r.projectOnVector(n),r.add(t)}var ZS=class extends et.BufferGeometry{constructor(t=.5,e=1,r=4,n=1,o=!1,a=0,s=4){super(),r=Math.floor(Math.max(3,r)),n=Math.floor(n),s=Math.floor(s);let l=[],c=[],d=[],u=[],p=0,h=e/2,f=Math.PI/r,m=t*Math.cos(Math.PI/r),y=2*Math.PI/r,g=(r-2)*Math.PI/r,v=Math.PI-g,b=new et.Vector3(0,-h,0),S=new et.Vector3(0,h,0),x=new et.Vector2(t,-h),A=new et.Vector2(m,-h),w=new et.Vector2(0,S.y).sub(A),C=new et.Vector2(0,S.y).sub(x),T=new et.Vector2(w.y,-w.x).normalize(),M=new et.Vector2(C.y,-C.x).normalize(),I=t*Math.cos(Math.PI/r)*Math.tan((Math.PI-w.angle())/2)-1e-8;a=Math.min(a,I);let _;{let U=new et.Vector3(T.x,T.y,0),G=new et.Vector3(Math.cos(y)*U.x,U.y,Math.sin(y)*U.x);_=U.angleTo(G)}let E=a/Math.tan((Math.PI-w.angle())/2),B=a/Math.tan((Math.PI-_)/2),L=new et.Vector3;if(!o){c.push(b.x,b.y,b.z),d.push(0,-1,0),u.push(0,0);let U=p++,G=[],q=x.clone(),X=E/Math.cos(Math.PI/r);q.x-=X;for(let Y=0;Y<r;Y++){let Q=Y/r*Math.PI*2+f,te=new et.Vector2(Math.sin(Q),Math.cos(Q));oh(q,te,L),c.push(L.x,L.y,L.z),d.push(0,-1,0),u.push(0,0),G.push(p++)}for(let Y=0;Y<G.length;Y++)l.push(G[Y],U,G[(Y+1)%G.length])}let k=[];{let U=new et.Vector3,G=new et.Vector3,q=new et.Vector3,X=new et.Vector3,Y=new et.Vector3,Q=new et.Vector3;for(let te=0;te<r;te++){let ue=te/r*Math.PI*2+f,le=(te+.5)/r*Math.PI*2+f,ce=(te+1)/r*Math.PI*2+f,de=new et.Vector2(Math.sin(ue),Math.cos(ue)),ge=new et.Vector2(Math.sin(le),Math.cos(le)),Se=new et.Vector2(Math.sin(ce),Math.cos(ce));oh(x,de,G),oh(x,Se,q),oh(T,ge,U),QS(S,G,q,B,B,X),c.push(X.x,X.y,X.z),QS(G,S,q,B,E,Y),c.push(Y.x,Y.y,Y.z),QS(q,G,S,E,B,Q),c.push(Q.x,Q.y,Q.z),d.push(U.x,U.y,U.z),d.push(U.x,U.y,U.z),d.push(U.x,U.y,U.z),u.push(0,0),u.push(0,0),u.push(0,0);let ye=p++,Z=p++,pe=p++;if(l.push(ye,Z,pe),a>0){{let Ee=G.clone().add(q).multiplyScalar(.5),se=S.clone().sub(Ee).normalize(),R=b.clone().sub(Ee).normalize().add(se).normalize().multiplyScalar(-1),ie=Q.clone().sub(Y);F(Ee,ie,R,w.angle())}let re,Ae;{let Ee=new et.Vector3;oh(M,Se,Ee);let se=Q.clone().add(X).multiplyScalar(.5);se=iG(se,q,S);let be=Q.clone().sub(X);[re,Ae]=F(se,be,Ee,_,X.y)}{let Ee=re,se=Ee.clone().setY(0).normalize(),be=new et.Vector3(0,-1,0),R=se.clone().cross(be);W(Ee,se,be,R)}k.concat(Ae);{let Ee=w.angle(),se=Math.PI-Ee,be=S.clone();be.y-=a/Math.sin(Ee-Math.PI/2);let R=new et.Vector3,ie=[];for(let Ie=0;Ie<s;Ie++){let Xe=[],Te=Math.PI/2-se*Ie/s,Ue=Math.cos(Te),qe=Math.sin(Te),Je=le;for(let kt=0;kt<=Ie;kt++){let De=Math.cos(Je),wt=Math.sin(Je);U.x=Ue*wt,U.y=qe,U.z=Ue*De,R.copy(be).addScaledVector(U,a),c.push(R.x,R.y,R.z),d.push(U.x,U.y,U.z),u.push(0,0),Xe.push(p++),Je+=Math.PI*2/Ie/r}ie.push(Xe)}Ae.reverse(),ie.push(Ae);let Qe=ie.length-1;for(let Ie=0;Ie<Qe;Ie++){let Xe=ie[Ie],Te=ie[Ie+1],Ue=Xe.length-1;l.push(Te[1],Xe[0],Te[0]);for(let qe=1;qe<=Ue;qe++)l.push(Xe[qe],Xe[qe-1],Te[qe]),l.push(Te[qe+1],Xe[qe],Te[qe])}}}}}this.setIndex(l),this.setAttribute("position",new et.Float32BufferAttribute(c,3)),this.setAttribute("normal",new et.Float32BufferAttribute(d,3)),this.setAttribute("uv",new et.Float32BufferAttribute(u,2));function F(U,G,q,X,Y){let Q=-X/2,te=(Math.PI-X)/2,ue=G.clone().normalize().cross(q);U.addScaledVector(q,-a/Math.sin(te));let le=new et.Vector3,ce=new et.Vector3,de=1,ge=p,Se=[];for(let ye=0;ye<=s;ye++){let Z=Q+ye/s*X;ce.set(0,0,0),ce.addScaledVector(ue,Math.sin(Z)),ce.addScaledVector(q,Math.cos(Z));for(let pe=0;pe<=de;pe++){let re=pe/de-.5;if(le.copy(U),le.addScaledVector(G,re),le.addScaledVector(ce,a),Y!=null){let Ae=Math.max(0,le.y-Y);le.addScaledVector(G,-Ae/G.y)}c.push(le.x,le.y,le.z),d.push(ce.x,ce.y,ce.z),u.push(0,0),pe===0&&Se.push(p),p++}}for(let ye=0;ye<s;ye++)for(let Z=0;Z<de;Z++){let pe=ge+Z+(de+1)*ye,re=pe+(de+1),Ae=re+1,Ee=pe+1;l.push(pe,re,Ee),l.push(re,Ae,Ee)}return[U.clone().addScaledVector(G,.5),Se]}function W(U,G,q,X){let Y=Math.PI/2,Q=C.angle()-Y,te=[],ue=new et.Vector3,le=new et.Vector3;for(let de=0;de<=s;de++){let ge=[],Se=de/s;for(let ye=0;ye<=de;ye++){let pe=((de?ye/de:0)-.5)*v,re=Math.cos(pe),Ae=Math.sin(pe),Ee=Math.atan(Math.tan(Q)*re),se=(Y+Ee)*Se,be=Math.cos(se),R=Math.sin(se);ue.set(0,0,0),ue.addScaledVector(G,R*re),ue.addScaledVector(q,be),ue.addScaledVector(X,R*Ae),le.copy(U).addScaledVector(ue,a),c.push(le.x,le.y,le.z),d.push(ue.x,ue.y,ue.z),u.push(0,0),ge.push(p++)}te.push(ge)}let ce=te.length-1;for(let de=0;de<ce;de++){let ge=te[de],Se=te[de+1],ye=ge.length-1;l.push(ge[0],Se[1],Se[0]);for(let Z=1;Z<=ye;Z++)l.push(ge[Z-1],ge[Z],Se[Z]),l.push(ge[Z],Se[Z+1],Se[Z])}}}};var wd=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},i.ui);return{shape:i.shape&&i.shape instanceof ht?i.shape:new ht,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(i){let t=i.shape,{width:e,height:r,cornerRadius:n,cornerType:o,depth:a,extrudeBevelSize:s,extrudeBevelSegments:l,extrusionVersion:c}=i.parameters,d={x:e*.5,y:r*.5},u={x:-d.x,y:-d.y},p={x:d.x,y:d.y};function h(x,A,w){return A>e&&w>r?Math.min(x*e/A,x*r/w):A>e?x*e/A:w>r?x*r/w:x}let f=[];f[0]=n[0]===0?0:h(n[0],n[0]+n[3],n[0]+n[1]),f[1]=n[1]===0?0:h(n[1],n[1]+n[2],n[1]+n[0]),f[2]=n[2]===0?0:h(n[2],n[2]+n[1],n[2]+n[3]),f[3]=n[3]===0?0:h(n[3],n[3]+n[0],n[3]+n[2]);let m=u.x,y=p.x,g=p.y,v=u.y;t.addPoint(t.createPoint(m,g)),t.addPoint(t.createPoint(y,g)),t.addPoint(t.createPoint(y,v)),t.addPoint(t.createPoint(m,v)),t.isClosed=!0;let b=!0;for(let x=0,A=t.points.length;x<A;x++)t.points[x].roundness=f[x],x>0&&f[x]!==f[x-1]&&(b=!1);b&&(t.roundness=f[0]),t.useCubicForRoundedCorners=o!==1,t.update();let S=ei.create({shape:t,parameters:{depth:a,extrudeBevelSize:s,extrudeBevelSegments:l,extrusionVersion:c}});return Object.assign(S,{userData:{...i,type:"RectangleGeometry"}})}};var Fa=require("three"),N2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},i.parameters);return e.thetaLength=Fa.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(i){let{width:t=100,height:e=t,depth:r=t,widthSegments:n=64,heightSegments:o=64,phiStart:a,phiLength:s,thetaStart:l,thetaLength:c}=i.parameters,d;return c===0?(d=new Fa.BufferGeometry,d.setAttribute("position",new Fa.Float32BufferAttribute([],3))):d=new Fa.SphereGeometry(.5*t,n,o,a,s,l,c*Fa.MathUtils.DEG2RAD),d.scale(1,e/t,r/t),Object.assign(d,{userData:{...i,type:"SphereGeometry"}})}};var L2=require("three"),_2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:0})}}static build(i){let{width:t=100,height:e=t,widthSegments:r=8,heightSegments:n=8}=i.parameters,o=new L2.PlaneGeometry(t,e,r,n);return o.scale(1,1,1),Object.assign(o,{userData:{...i,type:"PlaneGeometry"}})}};var Ps=require("three"),k2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},i.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(i){let{width:t,height:e,depth:r,angle:n,cornerRadius:o,cornerSegments:a}=i.parameters,s=new JS(t,e,r,n,o,a);return Object.assign(s,{userData:{...i,type:"BackdropGeometry"}})}},JS=class extends Ps.BufferGeometry{constructor(t=1,e=1,r=1,n=90,o=10,a=24){super(),this.type="BackdropGeometry";let s=[],l=[],c=[],d=.001;o==0&&(a=1),a=Math.max(1,Math.floor(a)),o=Math.min(o,100),n=Math.min(180-d,n),n*=Math.PI/180;let u=[],p=Math.PI/2,h=(le=0,ce=0,de=0)=>new Ps.Vector3(le,ce,de),f=h(),m=h(),[y,g,v]=[e/2,t/2,r/2],b=-g,S=+g,[x,A,w]=[h(b,-y,+v),h(b,-y,-v),h(b,+y,-v)],C=(le,ce=!1)=>Math.sin(le-Math.PI/(1+ +ce)),T=(le,ce=!1)=>Math.cos(le-Math.PI/(1+ +ce));w.y=Math.sin(n)*e-y;let M=Math.cos(n)*e-v,D=x.z-d;n<=p?(w.z=Math.min(M,D),w.z==D&&(w.y-=(M-D)/Math.tan(p-n))):A.z=Math.min(A.z-M-v,x.z-d),f.subVectors(x,A),m.subVectors(w,A);let I=Math.min(f.length(),m.length())*o/100,_=I*Math.tan(n/2),E=I/Math.cos(n/2),B=f.clone().normalize().add(m.normalize()).setLength(E).add(A);f.set(0,C(n,!0),T(n,!0)),u.push([w,f.clone()]);let L=(Math.PI-n)/a;for(let le=0;le<=a;le++){let ce=p+n+le*L;f.set(0,Math.sin(ce)*_,Math.cos(ce)*_),f.add(B),m.set(0,C(ce),T(ce)),u.push([f.clone(),m.clone()])}u.push([x,h(0,1,0)]);let k=Math.sin(L/2)*_*2,F=u.length-1,W=u[0][0].distanceTo(u[1][0]),U=u[F-1][0].distanceTo(u[F][0]),G=W+k*a+U;u[0].push(1);for(let le=0;le<=a;le++)u[le+1].push(1-(W+le*k)/G);u[F].push(0);let[q,X,Y]=u[0],Q,te,ue;for(let le=1;le<u.length;le++)[Q,te,ue]=u[le],s.push(b,q.y,q.z,b,Q.y,Q.z,S,q.y,q.z,S,q.y,q.z,b,Q.y,Q.z,S,Q.y,Q.z),l.push(0,X.y,X.z,0,te.y,te.z,0,X.y,X.z,0,X.y,X.z,0,te.y,te.z,0,te.y,te.z),c.push(0,Y,0,ue,1,Y,1,Y,0,ue,1,ue),[q,X,Y]=[Q,te,ue];this.setAttribute("position",new Ps.Float32BufferAttribute(s,3)),this.setAttribute("normal",new Ps.Float32BufferAttribute(l,3)),this.setAttribute("uv",new Ps.Float32BufferAttribute(c,2))}};var og=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof ht?i.shape:new ht,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,innerRadiusPercent:r,spikes:n,cornerRadius:o,angle:a,depth:s,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:d}=i.parameters,u=i.shape,p=t*.5,h=e*.5,f=0,m=0,y=a*Math.PI/360/n,g=Math.PI/2*3*-1,v=p*r/100,b=h*r/100;if(n===3&&r===50){y=2*Math.PI/n;for(let x=0;x<n;x++){let A=y*x,w=f+Math.sin(A)*p,C=m+Math.cos(A)*h;u.addPoint(u.createPoint(w,C))}}else for(let x=0;x<n;x++){let A=f+Math.cos(g)*p,w=m+Math.sin(g)*h;u.addPoint(u.createPoint(A,w)),g+=y,A=f+Math.cos(g)*v,w=m+Math.sin(g)*b,u.addPoint(u.createPoint(A,w)),g+=y}u.isClosed=!0;for(let x=0,A=u.points.length;x<A;x++)u.points[x].roundness=o;u.roundness=o,u.update();let S=ei.create({shape:u,parameters:{roundness:o,depth:s,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:d}});return Object.assign(S,{userData:{...i,type:"StarGeometry"}})}};var F2=require("three"),V2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0},i.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(i){let{width:t,height:e}=i.parameters,r=new F2.PlaneGeometry(t,e);return Object.assign(r,{userData:{...i,type:"TextFrameGeometry"}})}};var Cd=require("three");var G2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},i.parameters),r=Math.abs(e.width),n=Math.abs(e.height??e.width);e.shapeBlendNode&&(n=r);let o=Math.round(Math.abs(e.depth??e.width*.25));return{parameters:Object.assign(e,{width:r,height:n,depth:o})}}static build(i){let{width:t,height:e,depth:r,radialSegments:n,tubularSegments:o,arc:a,cornerRadius:s,cornerSegments:l}=i.parameters,c=oG(t,e,r,t*.5,a,o,0,0,n,s,l);return c.scale(1,e/t,1),Object.assign(c,{userData:{...i,type:"TorusGeometry"}})}};function oG(i,t,e,r,n,o,a,s,l,c,d){[t,e]=[e,t],a=t/2;let u=Cd.MathUtils.clamp(n/360,0,1);if(u===0){let p=new Cd.BufferGeometry;return p.setAttribute("position",new Cd.Float32BufferAttribute([],3)),p}return u===1&&(c=0),new qp(!0,i,t,e,r,u,o,a,s,l,c,d)}var U2=require("three"),z2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.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(i){let{width:t,tube:e,tubularSegments:r,radialSegments:n,p:o,q:a}=i.parameters,s=t*.5;s!==e&&(s-=e);let l=new U2.TorusKnotGeometry(s,e,r,n,o,a);return Object.assign(l,{userData:{...i,type:"TorusKnotGeometry"}})}};var j2=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof ht?i.shape:new ht,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(i){let{width:t=100,height:e,cornerRadius:r,depth:n,extrudeBevelSize:o,extrudeBevelSegments:a,isRect:s,extrusionVersion:l}=i.parameters,c=i.shape,d=t*.5,u=e*.5;s?(c.addPoint(c.createPoint(-d,u)),c.addPoint(c.createPoint(d,-u)),c.addPoint(c.createPoint(-d,-u))):(c.addPoint(c.createPoint(0,u)),c.addPoint(c.createPoint(d,-u)),c.addPoint(c.createPoint(-d,-u))),c.isClosed=!0;for(let h=0,f=c.points.length;h<f;h++)c.points[h].roundness=r;c.roundness=r,c.update();let p=ei.create({shape:c,parameters:{roundness:r,depth:n,extrudeBevelSize:o,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(p,{userData:{...i,type:"TriangleGeometry"}})}};gr();var Ul=require("three"),H2=require("three/examples/jsm/utils/BufferGeometryUtils.js");function W2(){let i=new Ul.BufferGeometry;return i.setAttribute("position",new Ul.BufferAttribute(new Float32Array([]),3)),i.setIndex(new Ul.BufferAttribute(new Uint16Array([]),1)),i}var sG=W2().attributes,lG=12,cG=1,Ed=class extends Ul.BufferGeometry{constructor(e,r){super();this.isTextGeometry=!0;this.charWidths=[];this.charCoords=[];this.wrappedText=[];this.isLowResolution=!1;this.vectorShapes=[];this._nearSide=new Uint8Array(0);this._depth=0;this._effectiveBevel=0;this._vScale=0;Object.assign(this.attributes,sG),this.userData={parameters:e,type:"TextGeometry"};let n=r.getFont(e.font);n?.isLoaded?(this.font=n,this.update(e,r)):this.updateFont(e.font,r).then(()=>{this.update(e,r),r?.requestRender()})}async updateFont(e,r){let n=r.getFont(e);n&&(this.font=n,await n.loadingPromise)}update(e,r){let n=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!n?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:o,height:a,depth:s,extrudeBevelSize:l,extrudeBevelSegments:c,text:d,textTransform:u,fontSize:p,extrusionVersion:h}=e,f=Dr.getDisplayedValue(d),m=u===2?f.toUpperCase():u===3?f.toLowerCase():f,y=dG(e,n,m,r),{shapes:g,charWidths:v,charCoords:b}=n.generateShapes(y,e,r),S=(typeof o=="number"?o:Number(r.getVariable(o)))*.5,x=(typeof a=="number"?a:Number(r.getVariable(a)))*.5,A=g.map(T=>new ht().fromShape(T,!0));this.vectorShapes=A;let w=A.map(T=>ei.create({shape:T,parameters:{depth:s,extrudeBevelSegments:c,extrudeBevelSize:l,uvPitch:h===1?void 0:p,extrusionVersion:h,windingRule:s<=0?Ct.NONZERO:Ct.ODD,subdivisions:this.isLowResolution&&s>0?cG:lG}})),C=w.length?(0,H2.mergeGeometries)(w):W2();C.translate(-S,x,0),this.dispose(),this.wrappedText=y,this.charCoords=b,this.charWidths=v,this.deleteAttribute("extrudeNormal"),Object.entries(C.attributes).forEach(([T,M])=>{this.setAttribute(T,M)}),this.setIndex(C.index),this.adoptNearSide(w,s),this.computeBoundingSphere()}adoptNearSide(e,r){this._depth=r;let n=0,o=0,a=0;for(let c of e){let d=c,u=d._nearSide;if(u===void 0||u.length===0){this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0;return}n+=u.length,o=Math.max(o,d._effectiveBevel??0),a=d._vScale??a}this._effectiveBevel=o,this._vScale=a;let s=new Uint8Array(n),l=0;for(let c of e){let d=c._nearSide;s.set(d,l),l+=d.length}this._nearSide=s}takeDepthStateFrom(e){let r=e;r._nearSide!==void 0&&(this._depth=r._depth??this._depth,this._nearSide=r._nearSide,this._vScale=r._vScale??this._vScale,this._effectiveBevel=r._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length!==this.getAttribute("position")?.count?!1:Vl(this._effectiveBevel,e)&&Vl(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let r=e-this._depth;if(this._depth=e,r===0)return!0;let n=this.getAttribute("position"),o=n.array,a=this.getAttribute("uv"),s=a?.array,l=this._vScale>0?r/this._vScale:0,c=this._nearSide;for(let d=0;d<c.length;d++){let u=c[d];u!==0&&(o[d*3+2]+=r,u===2&&s!==void 0&&(s[d*2+1]+=l))}return n.needsUpdate=!0,a!==void 0&&l!==0&&(a.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let r=this.boundingBox;r.min.z=Math.min(0,e),r.max.z=Math.max(0,e),this.boundingSphere!==null&&r.getBoundingSphere(this.boundingSphere)}clone(){let e=Mr(new Ul.BufferGeometry,Ed.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([r,n])=>{this.setAttribute(r,n)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,r){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},r)}get text(){return this.userData.parameters.text??""}};function dG(i,t,e,r){let n=typeof i.width=="string"?Number(r.getVariable(i.width)):i.width,o=[""],a="";for(let s of e)a+=s,s===" "||s===`
727
727
  `?(o[o.length-1]+=a,a="",s===`
728
- `&&o.push("")):t.getTextWidth(o[o.length-1]+a,i)>n&&(o[o.length-1].length&&o.push(""),t.getTextWidth(o[o.length-1]+a,i)>n&&(a.length===1?(o[o.length-1]+=a,a=""):(o[o.length-1]+=a.slice(0,-1),a=a[a.length-1],o.push(""))));return o[o.length-1]+=a,o}var Et=require("three");var X2,sg=new Promise(i=>{X2=i}),q2=!1;var ag;function Y2(i){if(q2)return;if(ag)return ag;async function t(){let r=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.122/build"),o=import("./process.js"),[a,s]=await Promise.all([o,fetch(`${r}/process.wasm`).then(d=>d.arrayBuffer())]),l=a.default,c=await l({wasmBinary:s});X2(c),q2=!0}return ag=t(),ag}var K2=require("three"),uG=new K2.Matrix4;function lg(i,t){if(Object.keys(i.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let e=Object.keys(i.attributes),r=Object.keys(t.attributes);if(e.length!==r.length)return!1;for(let l of r){let c=i.attributes[l],d=t.attributes[l];if(c===void 0||c.isInterleavedBufferAttribute===!0||d.isInterleavedBufferAttribute===!0||c.itemSize!==d.itemSize||c.normalized!==d.normalized||c.array.constructor!==d.array.constructor||c.array.length!==d.array.length)return!1}let n=i.index,o=t.index;if(n===null!=(o===null))return!1;let a=!1;if(n!==null&&o!==null){if(n.array.length!==o.array.length)return!1;let l=n.array.constructor,c=o.array.constructor;if(l!==c){if(l!==Uint32Array||c!==Uint16Array)return!1;a=!0}}if(i.groups.length!==t.groups.length)return!1;for(let l=0;l<t.groups.length;l++){let c=i.groups[l],d=t.groups[l];if(c.start!==d.start||c.count!==d.count||c.materialIndex!==d.materialIndex)return!1}for(let l of r){let c=i.attributes[l],d=t.attributes[l];c.array.set(d.array),c.needsUpdate=!0}let s=i.takeDepthStateFrom;if(typeof s=="function"&&s.call(i,t),n!==null&&o!==null){if(a){let l=n.array,c=o.array;for(let d=0,u=c.length;d<u;d++){let p=c[d];l[d]=p===65535?4294967295:p}}else n.array.set(o.array);n.needsUpdate=!0}return i.drawRange.start=t.drawRange.start,i.drawRange.count=t.drawRange.count,i.userData=t.userData,i.boundingBox=null,i.boundingSphere=null,!0}function ah(i,t,e,r){let n=i.position.array,o=i.normal.array,a=uG.makeScale(t,e,r).invert().elements,s,l,c;for(let d=0,u=n.length;d<u;d+=3)n[d]*=t,n[d+1]*=e,n[d+2]*=r,s=o[d],l=o[d+1],c=o[d+2],o[d]=a[0]*s+a[4]*l+a[8]*c,o[d+1]=a[1]*s+a[5]*l+a[9]*c,o[d+2]=a[2]*s+a[6]*l+a[10]*c;i.position.needsUpdate=!0,i.normal.needsUpdate=!0}var cg=new Et.Box3,Td=new Et.Vector3,Ce;sg.then(i=>{Ce=i});var Q2=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Z2=new Uint32Array([0,1,2,3]),J2=new Uint8Array([4]);function n1(i){let t=Number(i);return Number.isInteger(t)&&t>=0&&String(t)===i?t:-1}function pG(i){let t=Object.keys(i),e=0;for(let n of t){let o=n1(n);o>=e&&(e=o+1)}if(e===0||e>t.length)return;let r=new Array(e);for(let n=0;n<e;n++){let o=i[n];if(typeof o!="number")return;r[n]=o}return r}function dg(i){if(i!=null){if(Array.isArray(i)||ArrayBuffer.isView(i)&&!(i instanceof DataView))return i;if(typeof i=="object")return pG(i)}}function $S(i){if(i==null)return"missing";if(Array.isArray(i))return`Array(${i.length})`;if(ArrayBuffer.isView(i)){let l=i;return`${i.constructor.name}(${l.length})`}if(typeof i!="object")return typeof i;let t=Object.keys(i),e=t.filter(l=>n1(l)===-1),r=0;for(let l of t){let c=n1(l);c>=r&&(r=c+1)}let n=i,o=-1,a=-1;for(let l=0;l<r;l++)l in n?typeof n[l]!="number"&&a===-1&&(a=l):o===-1&&(o=l);let s=[`${t.length} keys`,`max index ${r-1}`];return o!==-1&&s.push(`first missing index ${o}`),a!==-1&&s.push(`non-number at ${a} (${typeof n[a]})`),e.length&&s.push(`stray keys ${e.slice(0,3).join(",")}`),`Object{${s.join(", ")}}`}var Bt=class extends Et.BufferGeometry{constructor(e,r){super();this.data=e;this.flatShading=r;this.subdivPointer=0;this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,r){this.freeSubdivPointer();let n=this.data.scaleBaked.map(l=>typeof l=="number"?l:1),o=Oi.div(r.map(l=>typeof l=="number"?l:0),n);if(o.every(l=>l===1))return;this.subdividedGeometry&&ah(this.subdividedGeometry.attributes,...o),this.originalGeometry&&ah(this.originalGeometry.attributes,...o),this.data=e;let a=this.userData.parameters;this.userData.parameters={width:a.width*o[0],height:a.height*o[1],depth:a.depth*o[2]},this.originalGeometry.boundingSphere.center.multiply(Td.fromArray(o));let s=Td.set(a.width,a.height,a.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let r=e.phongAngle??35;this.flatShading&&(r=-1);let n=null;if(e.subdivisions>0){let a=0;try{a=Bt.allocate(e),n=Bt.buildRefined(a,e.subdivisions,r)}catch(s){console.error(s,e)}finally{a&&Bt.freeSubdivPointer(a)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let o=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=o}rebuild(){let e,r,n;try{({originalGeometry:e,subdividedGeometry:r,subdivPointer:n}=Bt.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Et.BoxGeometry(100,100,100),n=0}this.subdivPointer=n,this.originalGeometry=e,this.subdividedGeometry=r??void 0;let o=this.subdividedGeometry??this.originalGeometry;Object.assign(this,o),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Bt.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new Et.Sphere,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let r=e.attributes.position,n=e.boundingSphere.center;cg.setFromBufferAttribute(r),cg.getCenter(n),e.boundingSphere.radius=n.distanceTo(cg.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),cg.getSize(Td);let o={width:Td.x,height:Td.y,depth:Td.z};return this.userData.parameters=o,o}static build(e,r,n,o){let a,s,l=e?.phongAngle??35;n===!1&&(l=-1),r&&(Ce.free_bvh(r),Ce.free_subdivision_surface(r));try{a=Bt.allocate(e,o)}catch(d){console.error(d,e),a=Bt.allocate({positionWASM:Q2,indexWASM:Z2,verticesPerFaceWASM:J2},o)}Ce.set_destination_refinement_level(a,0);let c=Bt.buildLevel(a,!0,l);return e.subdivisions>0?s=Bt.buildRefined(a,e.subdivisions,l):s=null,{subdivPointer:a,originalGeometry:c,subdividedGeometry:s}}static buildRefined(e,r,n){try{return Ce.set_destination_refinement_level(e,r),Bt.buildLevel(e,!1,n)??null}catch{try{return Ce.set_destination_refinement_level(e,r-1),Bt.buildLevel(e,!1,n)??null}catch{return null}}}static primitiveToQuads(e,r,n){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 o=e.shape!==void 0||e.path!==void 0?r.geometry:Ui(e,n,!1,r),a;Sy(e)?a=o.getClosedTorusIndicesForBooleanOrSubdiv():a=o.getIndex();let{positions:s,triIndices:l,triOriginals:c}=sh(o.getAttribute("position"),a),d;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let f=e.radialSegments*e.heightSegments*3*2,m=f+e.radialSegments*3;d=[f,m]}let{indices:u,verticesPerFace:p,uvs:h}=hG(s,l,o,d,c);return{positions:s,indices:u,verticesPerFace:p,uvs:h}}static allocate(e,r){let n,o,a,s=[],l=[],c=dg(e.positionWASM),d=dg(e.indexWASM),u=dg(e.verticesPerFaceWASM);if(c&&c.length>0){if(!d?.length||!u?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${$S(e.positionWASM)}, indexWASM ${$S(e.indexWASM)}, verticesPerFaceWASM ${$S(e.verticesPerFaceWASM)}`);n=c,o=d,a=u;let T=dg(e.uvWASM);Ce.alloc_subdivision_surface_uvs&&T&&T.length===o.length*2&&(l=T)}else n=Q2,o=Z2,a=J2;let p=n.length,h=o.length,f=a.length,m=n.length+s.length+l.length,y=o.length+a.length,g=m*Float32Array.BYTES_PER_ELEMENT+y*Uint32Array.BYTES_PER_ELEMENT,v=m*Float32Array.BYTES_PER_ELEMENT,b=Ce._malloc(g);if(!b)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${g}) failed`);let S=new Float32Array(Ce.HEAPF32.buffer,b,m),x=new Uint32Array(Ce.HEAPU32.buffer,b+v,y);S.set(n,0),S.set(s,n.length),S.set(l,n.length+s.length),x.set(o,0),x.set(a,o.length);let A;e?.scaleBaked?.some(T=>T!==1)&&(A=new Et.Matrix4().makeScale(...e.scaleBaked.map(T=>typeof T=="number"?T:1))),r&&(A?A.premultiply(r):A=r);let w=b+(n.length+s.length)*Float32Array.BYTES_PER_ELEMENT,C=l.length?A?Ce.alloc_subdivision_surface_uvs2(b,p,b+v,h,b+v+o.length*Uint32Array.BYTES_PER_ELEMENT,f,w,l.length,A.elements):Ce.alloc_subdivision_surface_uvs(b,p,b+v,h,b+v+o.length*Uint32Array.BYTES_PER_ELEMENT,f,w,l.length):A?Ce.alloc_subdivision_surface2(b,p,b+v,h,b+v+o.length*Uint32Array.BYTES_PER_ELEMENT,f,A.elements):Ce.alloc_subdivision_surface(b,p,b+v,h,b+v+o.length*Uint32Array.BYTES_PER_ELEMENT,f);return Ce._free(b),C}static buildLevel(e,r,n,o,a,s=!1){let l=a?Ce.get_mesh_data2(e,r?Ce.Level.CONTROL:Ce.Level.REFINED,n,a.elements):Ce.get_mesh_data(e,r?Ce.Level.CONTROL:Ce.Level.REFINED,n),c=10,d=Ce.HEAPU32.subarray(l>>2,(l>>2)+c),u=d.subarray(4,4+4),p=0,h=Ce.HEAPU32[d[p]>>2],f=Ce.HEAPF32.subarray(h>>2,(h>>2)+u[p]);p++;let m=Ce.HEAPU32[d[p]>>2],y=Ce.HEAPF32.subarray(m>>2,(m>>2)+u[p]);p++;let g=Ce.HEAPU32[d[p]>>2],v=Ce.HEAPU32.subarray(g>>2,(g>>2)+u[p]);p++;let b=Ce.HEAPU32[d[p]>>2],S=Ce.HEAPU32.subarray(b>>2,(b>>2)+u[p]);p++;let x;if(Ce.alloc_subdivision_surface_uvs){let w=d[9];if(w>0){let C=Ce.HEAPU32[d[8]>>2];x=Ce.HEAPF32.subarray(C>>2,(C>>2)+w)}}if(o===void 0){let w=new Et.BufferGeometry;if(w.setIndex(new Et.Uint32BufferAttribute(S,1)),w.setAttribute("position",new Et.Float32BufferAttribute(f,3)),w.setAttribute("normal",new Et.Float32BufferAttribute(y,3)),x&&w.setAttribute("uv",new Et.Float32BufferAttribute(x,2)),r){w.setAttribute("faceMap",new Et.Uint32BufferAttribute(v,1));let C=new Float32Array(y.length/3*4).fill(0);w.setAttribute("color",new Et.BufferAttribute(C,4))}return Ce.free_mesh_data(l),w.userData.type="SubdivGeometry",w}if(o.getAttribute("position").copyArray(f),o.getAttribute("normal").copyArray(y),o.attributes.position.needsUpdate=!0,o.attributes.normal.needsUpdate=!0,s){let w=o.getIndex();w!==null&&w.array.length===S.length&&(w.copyArray(S),w.needsUpdate=!0)}let A=o.getAttribute("uv");x&&A&&A.array.length===x.length&&(A.copyArray(x),A.needsUpdate=!0),Ce.free_mesh_data(l)}static freeSubdivPointer(e){Ce.free_bvh(e),Ce.free_subdivision_surface(e)}static buildControlCageWireframe(e,r,n){let o=Ce.get_wireframe_data_for_base_level(e),a=4,s=Ce.HEAPU32.subarray(o>>2,(o>>2)+a),l=s.subarray(2,2+2),c=0,d=Ce.HEAPU32[s[c]>>2],u=Ce.HEAPF32.subarray(d>>2,(d>>2)+l[c]);c++;let p=Ce.HEAPU32[s[c]>>2],h=Ce.HEAPU32.subarray(p>>2,(p>>2)+l[c]);if(r===void 0){let f=new Et.BufferGeometry;f.setAttribute("position",new Et.Float32BufferAttribute(u,3));let m=new Float32Array(u.length);for(let y=0,g=u.length;y<g;)m[y++]=n.r,m[y++]=n.g,m[y++]=n.b;return f.setAttribute("color",new Et.BufferAttribute(m,3)),f.setIndex(new Et.Uint32BufferAttribute(h,1)),Ce.free_wireframe_data_for_base_level(o),f}r.getAttribute("position").copyArray(u),r.attributes.position.needsUpdate=!0,Ce.free_wireframe_data_for_base_level(o)}static updateCollabMesh(e,r,n){let o=r===0;o||Ce.set_destination_refinement_level(e,r);let a=n?Ce.get_topological_data2(e,o?Ce.Level.CONTROL:Ce.Level.REFINED,n.elements):Ce.get_topological_data(e,o?Ce.Level.CONTROL:Ce.Level.REFINED),s=8,l=Ce.HEAPU32.subarray(a>>2,(a>>2)+s),c=l.subarray(3,3+3),d=0,u=Ce.HEAPU32[l[d]>>2],p=new Float32Array(Ce.HEAPF32.subarray(u>>2,(u>>2)+c[d]));d++;let h=Ce.HEAPU32[l[d]>>2],f=new Uint32Array(Ce.HEAPU32.subarray(h>>2,(h>>2)+c[d]));d++;let m=Ce.HEAPU32[l[d]>>2],y=new Uint8Array(Ce.HEAPU32.subarray(m>>2,(m>>2)+c[d])),g;if(Ce.alloc_subdivision_surface_uvs){let v=l[7];if(v>0){let b=Ce.HEAPU32[l[6]>>2];g=new Float32Array(Ce.HEAPF32.subarray(b>>2,(b>>2)+v))}}return Ce.free_topological_data(a),{positions:p,indices:f,verticesPerFace:y,uvs:g}}};function pg(i){let t=Object.keys(i);return t.length===1&&t[0]==="subdivisions"}function sh(i,t){let e=t?t.count:i.count,r=0,n=1e4,o=new Map,a=new Uint32Array(e),s=[];for(let d=0;d<e;d++){let u=t?t.getX(d):d,p=i.getX(u),h=i.getY(u),f=i.getZ(u),m=Math.round(p*n),y=Math.round(h*n),g=Math.round(f*n),v=o.get(m);v===void 0&&(v=new Map,o.set(m,v));let b=v.get(y);b===void 0&&(b=new Map,v.set(y,b));let S=b.get(g);S===void 0&&(S=r++,b.set(g,S),s.push(p,h,f)),a[d]=S}let l=[],c=[];for(let d=0;d<a.length;d+=3)a[d]===a[d+1]||a[d]===a[d+2]||a[d+1]===a[d+2]||(l.push(a[d],a[d+1],a[d+2]),c.push(t?t.getX(d):d,t?t.getX(d+1):d+1,t?t.getX(d+2):d+2));return{positions:s,triIndices:l,triOriginals:c}}var ug=new Et.Vector3,e1=new Et.Vector3,t1=new Et.Vector3,r1=new Et.Vector3;function hG(i,t,e,r,n){let o=[],a=[],s=n?e.getAttribute("uv"):void 0,l=s&&s.itemSize===2?[]:void 0,c=p=>{if(l){let h=n[p];l.push(s.getX(h),s.getY(h))}};if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let p=e.userData.shape.extractShapePointsToFlatArray([]),h=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&h<=24&&h%4===0&&e.userData.parameters.angle>=360){let y=p.length/2/h;p=p.filter((g,v)=>Math.floor(v/2)%y===0)}let f=0;for(let y=0;y<p.length;y+=2)f+=(p[y]-p[(y===0?p.length:y)-2])*(p[y+1]+p[(y===0?p.length:y)-1]);i.length=0;let m=0;if(f<0)for(let y=0;y<p.length;y+=2)i.push(p[y],p[y+1],0),o.push(m++);else for(let y=p.length-2;y>=0;y-=2)i.push(p[y],p[y+1],0),o.push(m++);return a.push(m),{indices:o,verticesPerFace:a}}let d=new Float32Array([e.userData.parameters.depth])[0],u=0;for(;u<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let p=0;if((i[t[u]*3+2]===d||i[t[u]*3+2]===0)&&p++,(i[t[u+1]*3+2]===d||i[t[u+1]*3+2]===0)&&p++,(i[t[u+2]*3+2]===d||i[t[u+2]*3+2]===0)&&p++,p===3)break}if(t[u+1]===t[u+3]&&t[u+2]===t[u+5]||t[u+0]===t[u+3]&&t[u+2]===t[u+4]){ug.set(i[t[u]*3],i[t[u]*3+1],i[t[u]*3+2]),e1.set(i[t[u+1]*3],i[t[u+1]*3+1],i[t[u+1]*3+2]),t1.set(i[t[u+4]*3],i[t[u+4]*3+1],i[t[u+4]*3+2]),r1.set(i[t[u+5]*3],i[t[u+5]*3+1],i[t[u+5]*3+2]),e1.sub(ug).normalize(),t1.sub(ug).normalize(),r1.sub(ug).normalize();let p=e1.cross(t1).dot(r1),h=u;Math.abs(p)>.005||r&&r.some((f,m)=>m%2===1?!1:h>=r[m]&&h<r[m+1])?(o.push(t[u],t[u+1],t[u+2]),c(u),c(u+1),c(u+2),a.push(3),u+=3):(o.push(t[u],t[u+1],t[u+4],t[u+5]),c(u),c(u+1),c(u+4),c(u+5),a.push(4),u+=6)}else o.push(t[u],t[u+1],t[u+2]),c(u),c(u+1),c(u+2),a.push(3),u+=3}if(e.useNgonForTopBottomFaceDuringBake){let p=[],h=[],f=0;for(let m=0,y=0;m<i.length;m+=3,y++)i[m+2]===0&&(p.push(y),f++),i[m+2]===d&&h.push(y);if(e.userData.parameters.extrudeBevelSize===0){let m=h[0];h[0]=h[1],h[1]=m}p.reverse(),o.push(...p,...h),a.push(f,f),l=void 0}return{indices:o,verticesPerFace:a,uvs:l}}var fG={ConeGeometry:qM,CubeGeometry:XM,CylinderGeometry:Hy,DodecahedronGeometry:KM,EllipseGeometry:Sd,HelixGeometry:YP,IcosahedronGeometry:I2,LatheGeometry:D2,NonParametricGeometry:R2,PolygonGeometry:ig,PyramidGeometry:B2,RectangleGeometry:wd,SphereGeometry:N2,PlaneGeometry:_2,BackdropGeometry:k2,StarGeometry:og,TextFrameGeometry:V2,TorusGeometry:G2,TorusKnotGeometry:z2,TriangleGeometry:j2,VectorGeometry:ei},hg=i=>{let t=fG[i.type]??yy(i.type);if(t===void 0)throw new Error(`No geometry factory registered for "${i.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(i)};var mG=["font"];function Ui(i,t,e,r){let n,o,a;i.type==="PathGeometry"?(o={...i,extrusion:{...i.extrusion}},a=[[],["extrusion"]]):(o={...i},a=[[]]);for(let c of a){let d=o;for(let u of c)d=d[u];for(n in d){let u=d[n];Ap(u)&&!mG.includes(n)&&(d[n]=t.getVariable(u,[r.uuid,"geometry",...c,n]),Ap(d[n])&&(d[n]=1))}}let s={parameters:o,type:o.type};if(o.type==="PathGeometry"){s.path=o.path;let c=r.profileShape;c!==void 0&&(s.shapeData=c),s.ownerId=r.uuid}else if(o.type==="VectorGeometry"){let c=ht.createFromState(o.shape,o.width,o.height);s.shape=c,s.ownerId=r.uuid}else if(o.type==="NonParametricGeometry"){if(o.data.groups&&o.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),s.geometry=new $2.BufferGeometryLoader().parse(o),s.geometry.groups.length===0){let c=s.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else if(o.type==="SubdivGeometry"){let c=new Bt(o,e);return c.data=i,c}else if(o.type==="TextGeometry"||o.type==="InputGeometry"){let c=yy(o.type);if(c)return c.create(o,t);xr("text",`a ${o.type}`);let d=ht.createFromState(gs.defaultData(),100,100);return hg({...o,shape:d,type:"VectorGeometry"})}else if(o.type==="UIGeometry")return wd.create({parameters:{width:o.width,height:o.height,cornerRadius:o.cornerRadius,cornerType:o.cornerType}});let l;try{l=hg(s)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${s}`);let d=ht.createFromState(gs.defaultData(),100,100);s.shape=d,s.type="VectorGeometry",l=hg(s)}return l}var yG=new Set(["CubeGeometry","SphereGeometry","CylinderGeometry","ConeGeometry","TorusGeometry","TorusKnotGeometry","IcosahedronGeometry","DodecahedronGeometry","PyramidGeometry","PlaneGeometry","BackdropGeometry","HelixGeometry"]);function eO(i,t,e){if(!yG.has(i.type))return;let r=i;if(r.shapeBlendNode!=null||e.isTransientGeometryKey(i))return;let n=t.material;if(n===void 0||Array.isArray(n))return;let o=n;if(typeof o.getLayersOfType!="function"||o.getLayersOfType("outline").length>0||o.getLayersOfType("cavity").length>0)return;let a=i.type;for(let s of Object.keys(r).sort()){let l=r[s];if(l===void 0||s==="type")continue;let c=i1(l);if(c===void 0)return;a+=`|${s}=${c}`}return a}function i1(i){switch(typeof i){case"number":return Number.isFinite(i)?JSON.stringify(i):void 0;case"boolean":return JSON.stringify(i);case"string":return Ap(i)?void 0:JSON.stringify(i);case"object":{if(i===null)return"null";if(Array.isArray(i)){let n="[";for(let o=0;o<i.length;o++){let a=i1(i[o]);if(a===void 0)return;n+=(o>0?",":"")+a}return n+"]"}let t=i,e="{",r=!0;for(let n of Object.keys(t).sort()){if(t[n]===void 0)continue;let o=i1(t[n]);if(o===void 0)return;e+=`${r?"":","}${JSON.stringify(n)}:${o}`,r=!1}return e+"}"}default:return}}var o1=class{constructor(){this.objects=new Map;this.refs=new Map;this.sharedByKey=new WeakSet;this.unreachable=new Set}resolveObject(t,e,r){return this.createObject(t,e,r)}onObjectDisposed(t){}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,r){let n=this.objects.get(t);return n===void 0?(n=this.resolveObject(t,e,r),this.objects.set(t,n),this.retain(n)):(this.sharedByKey.add(n),n.isShared=!0),n}forceDelete(t){let e=this.objects.get(t);e&&(this.objects.delete(t),this.release(e))}adopt(t,e){this.replace(t,e),this.retain(e)}mutateIfUnique(t,e){let r=this.objects.get(t);if(r&&r.isShared!==!0)return this.objects.delete(t),this.replace(e,r),r}replace(t,e){let r=this.objects.get(t);this.objects.set(t,e),r!==void 0&&r!==e&&this.release(r)}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){let r=this.objects.get(t);e===r?this.unreachable.delete(t):!1&&console.warn("Reachable but deleted",t)}endGc(){this.unreachable.forEach(t=>{let e=this.objects.get(t);this.objects.delete(t),this.release(e)}),this.unreachable.clear()}dispose(){new Set(this.objects.values()).forEach(t=>{this.disposeObject(t),this.onObjectDisposed(t)}),this.objects.clear(),this.refs.clear()}retain(t){let e=(this.refs.get(t)??0)+1;this.refs.set(t,e),e>1&&(t.isShared=!0)}release(t){let e=(this.refs.get(t)??1)-1;if(e>0){this.refs.set(t,e),e===1&&!this.sharedByKey.has(t)&&(t.isShared=!1);return}this.refs.delete(t),this.disposeObject(t),this.onObjectDisposed(t)}},lh=class extends o1{constructor(e){super();this.flatShading=e;this.dedupeByValue=!1;this.byValue=new Map;this.valueKeyOf=new Map}disposeObject(e){e.dispose()}createObject(e,r,n){let o=Ui(e,r,this.flatShading,n);return o.computeBoundingSphere(),o}resolveObject(e,r,n){let o=this.dedupeByValue?eO(e,n,r):void 0;if(o!==void 0){let s=this.byValue.get(o);if(s!==void 0)return s}let a=this.createObject(e,r,n);return o!==void 0&&(this.byValue.set(o,a),this.valueKeyOf.set(a,o)),a}mutateIfUnique(e,r){let n=super.mutateIfUnique(e,r);return n!==void 0&&this.forgetValue(n),n}onObjectDisposed(e){this.forgetValue(e)}forgetValue(e){let r=this.valueKeyOf.get(e);r!==void 0&&(this.valueKeyOf.delete(e),this.byValue.get(r)===e&&this.byValue.delete(r))}};var l1="webgl",tO,a1,rO=!1;function c1(){return l1}function iO(i){a1=i}function oO(){if(l1==="webgpu"){if(tO!==void 0)return tO;rO||(rO=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(a1===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return a1}function fg(i,t){return oO().createRootMaterial(i,t)}function d1(i,t,e){return oO().createSharedMaterial(i,t,e)}function u1(i){return i.getLayersOfType===void 0&&Object.assign(i,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),i}var nO,aO;function sO(i){aO=i}function lO(){let i=l1==="webgpu"&&nO!==void 0?nO:aO;return i===void 0?null:u1(i())}var s1;function cO(i){s1=i}function dO(i,t){return s1===void 0?!1:s1(i,t)}var uO={markNeedsUpdateRendererDirty:()=>{}};function pO(i){return i.data.type!=="displace"&&!!i.data.isMask}function zi(i,t){let e=0;if(!i.layers||i.layers.length===0)return!1;let r=i.layers?.find(o=>o.data.type==="light");if(r){let o=r.data,a=Number(t.getVariable(o.alphaOverride));if((typeof o.alphaOverride=="string"?a/100:o.alphaOverride)<1)return!0}let n=i.layers;for(let o=0;o<n.length;o++){let a=n[o];if(!pO(a)){if(o>0&&pO(n[o-1])){if(a.data.type==="light"&&!a.data.visible)return!0;continue}if(a.data.type!=="displace"&&"alpha"in a.data&&a.data.type!=="light"&&a.data.type!=="fresnel"&&a.data.type!=="cavity"&&a.data.type!=="dust"&&a.data.type!=="texture"&&a.data.type!=="matcap"&&a.data.type!=="rainbow"&&a.data.type!=="outline"&&a.data.type!=="pattern"){let s=a.data.visible?a.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&a.data.type==="depth"||a.data.type==="gradient"){for(let l of a.data.colors)if(l[3]<1){s=l[3];break}}else if(s===1&&a.data.type==="noise"){let l=t.color(a.data.colorA).a,c=t.color(a.data.colorB).a,d=t.color(a.data.colorC).a,u=t.color(a.data.colorD).a,p=Math.min(l,Math.min(c,Math.min(d,u)));p<1&&(s=p)}e+=(1-e)*s}}}return e<1}var mg=require("three"),ji=(i,t,e)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof i=="number"?i*100:i,e)??100)/100))??1,he=(i,t,e)=>typeof i=="number"?i:t.getVariable(i,e),ti=(i,t)=>(i||(i=new mg.Vector3),i.x=he(i.x,t)??0,i.y=he(i.y,t)??0,i.z=he(i.z,t)??0,i),vi=(i,t)=>(i||(i=new mg.Vector2),i.x=he(i.x,t)??0,i.y=he(i.y,t)??0,i);function hO(i,t){return i==="displace"?t==="intensity":t==="alpha"}function fO(i,t,e){let r=i==="alpha"?Math.max(0,Math.min(Number(t)/100,1)):Number(t);return e?r:0}function p1(i){let t=typeof i=="string"?i:i.type;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function bo(i){return typeof i=="string"||typeof i=="number"&&i!==0}var Pd={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},mO={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]};var yO=require("three");var h1=class extends nd(yO.Object3D){},gG=i=>i.type==="Mesh",lr=class extends h1{constructor(e){super();this.object=e;this.isClone=!0;this.matrixAutoUpdate=!1}raycast(e,r){}expand(){let e=0,r=this.object.entityChildren(e);for(;r;){let n=this.children[e];(!(n instanceof lr)||n.object!==r)&&(n=new lr(r),this._replaceChildAt(e,n),n.matrixWorldNeedsUpdate=!0,n.matrixAutoUpdate=!1,n.matrix=r.matrix,n.shearMatrix=r.shearMatrix,n.pivotMatrix=r.pivotMatrix),n.expand(),e+=1,r=this.object.entityChildren(e)}for(let n of this.object.children){if(!ed(n)||n.object.parent!==this.object)continue;let o=this.children[e];o?.source!==n&&(o=n.createCopy(),this._replaceChildAt(e,o)),o.expand(),e+=1}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}_replaceChildAt(e,r){let n=this.children[e];n&&this.remove(n),this.add(r),this.children.splice(e,0,this.children.pop())}get visible(){let e=this.parent,r=ed(e)&&e.object===this.object;return r&&(e.instancingActive||e.insideBoolean)?!1:this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||r&&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 gG(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}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}};yt();var bi=require("three");var gO=null,vO=null;function bO(i){gO=i}function f1(){return gO}function xO(i){vO=i}function SO(){return vO}function yg(i){return"variable_"+i}var AO=new bi.Matrix4,wO=new bi.Vector3,CO=new bi.Quaternion,xG=new bi.Vector3,EO=new bi.Euler,m1=class extends zy{constructor(e){super();this.shared=e}create(e){return new hd(e,this.shared)}},TO=new Set;function SG(i,t){let e=`${i}/${t}`;TO.has(e)||(TO.add(e),console.warn(`[spline] updateObject: ignoring a geometry update of ${i} vertices for a mesh that holds ${t}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}var y1=class{constructor(t,e={},r=!0,n=!1){this.data=t;this.needsJitter=r;this.enableLocalStorageForPersistentVariables=n;this.geometryCache=new lh(!0);this.geometryCache2=new lh(!1);this.imageHolderCache=new m1(this);this.thisContext={scene:uO,shared:this};this.deletedImage=new yi(Nc.emptyImage,this);this.deletedVideo=new yi(Lc.defaultVideo,this);this.materials={};this.images={};this.uiBuffers={};this.videos={};this.colors={};this.audios={};this.particles={};this.fonts={};this.variables={};this.userAPIs={};this.userWebhooks={};this.mouseProperty=null;this.raycastProperty=null;this.requestRender=()=>{this._requestRender&&this._requestRender()};this.transientGeometryKeys=new WeakSet;if(e.images)for(let[o,a]of Object.entries(e.images))this.addImage(o,a);if(e.videos)for(let[o,a]of Object.entries(e.videos))this.addVideo(o,a);if(e.audios)for(let[o,a]of Object.entries(e.audios))this.addAudio(o,a);if(e.particles)for(let[o,a]of Object.entries(e.particles))this.addParticle(o,a);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=d1(sr.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,r=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:o}of t.variables)this.addVariableHolder(n,o),e&&this.updateVariableHolder(n,o);for(let[n,o]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,o);for(let[n,o]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,o);if(!r){for(let[n,o]of Object.entries(t.images))this.addImage(n,o);for(let[n,o]of Object.entries(t.videos))this.addVideo(n,o)}for(let[n,o]of Object.entries(t.colors))this.addColor(n,o);for(let[n,o]of Object.entries(t.lib.materials))this.addMaterial(n,o.asset);for(let[n,o]of Object.entries(t.materials))this.addMaterial(n,o);for(let[n,o]of Object.entries(t.audios))this.addAudio(n,o);for(let[n,o]of Object.entries(t.particles))this.addParticle(n,o);for(let[n,o]of Object.entries(t.fonts))this.addFont(n,o)}addMaterial(t,e){if(e=sr.withRepairedLayers(e),this.materials[t]){let r=this.materials[t];r.reset(e,this.thisContext),r.dispose()}else{let r=d1(e,this.thisContext,t);this.materials[t]=r}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):fg(sr.withRepairedLayers(t),this.thisContext)}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new yi(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new yi(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}getEntityTexture(t,e={}){let r=t.material;if(!r)return null;for(let n of Array.isArray(r)?r:[r]){let o=n.root??n;for(let a of o?.data?.layers??[]){let s=a?.data;if(s?.type!=="texture"&&s?.type!=="matcap"||e.layer!==void 0&&a.id!==e.layer&&s.type!==e.layer)continue;let l=s.texture?.image;if(l==null)continue;let c=(typeof l=="string"?this.uiBuffer(l):void 0)??this.image(l);if(!c)continue;let d=c.getTexture(s.texture.wrapping??(s.type==="texture"?1e3:1001),s.texture.minFilter??1008,s.texture.magFilter??1006),u=c.img;return{texture:d,width:u?.width??0,height:u?.height??0,layerId:a.id,layerType:s.type}}}return null}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new yi(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new La(e.r,e.g,e.b,e.a):this.colors[t]=new La(e.r,e.g,e.b,1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let r=this.colors[t];return this.colors[t].r=e.r??r.r,this.colors[t].g=e.g??r.g,this.colors[t].b=e.b??r.b,this.colors[t].a=e.a??r.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t=="string"){let r=this.getColor(t);r?e=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new Vt(0,0,0,0))}else return"a"in t?new Vt(t.r,t.g,t.b,t.a):new Vt(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof ka)return e;{let r=new ka({src:e.data});return this.audios[t]=r,r}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof ka&&e.dispose(),delete this.audios[t])}addFont(t,e){let r=HM();if(r===null){xr("text","a font asset");return}this.fonts[t]=new r(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof ka&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let r=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(yg(t));r=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:r,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(yg(t),JSON.stringify(e));let r=e;for(;typeof r=="string";)r=this.variables[r].value;let n=this.entityOpContext.scene,o=!1;for(let a=this.variables[t].locations.length-1;a>=0;a--){let s=this.variables[t].locations[a];if(s[0]==="material"){let l=s[1],c=r,d={scene:n,shared:this},u=s.slice(2);n.traverseMaterial(h=>{let f=h.root??h;f.uuid===l&&f.onVariableUpdate(u,c,d)});let p=this.materials[l];p&&p.onVariableUpdate(u,c,d)}else{let l=n.find(s[0]);if(l===void 0){this.variables[t].locations.splice(a,1);continue}if(o=!0,s[1]!=="geometry"&&s[1]!=="particles"){for(let c=1;c<s.length-1;c++)l=l[s[c]];s[1]==="rotation"?l[s[s.length-1]]=r*bi.MathUtils.DEG2RAD:l[s[s.length-1]]=r}if(l=n.find(s[0]),l.type==="ParticleEmitter"&&l.updateVariableState(r,s),Ne.is(l))if(s[1]==="position"||s[1]==="rotation"||s[1]==="scale")l.onVariableUpdate();else if(s[1]==="geometry"){let c=l;l.component&&(c=l.component);let d=c.dataPatched;c.chooseGeoemtryCache(this).forceDelete(d.geometry),c.createGeometryDelayed(this.entityOpContext),c.onVariableUpdate(!0),c.invalidateDownstreamBooleanData(),c.instances.forEach(u=>{let p=u.dataPatched;u.chooseGeoemtryCache(this).forceDelete(p.geometry),u.createGeometryDelayed(this.entityOpContext),u.onVariableUpdate(!0),u.invalidateDownstreamBooleanData()})}else s[1]==="morphTargetInfluences"&&l.updateMorphInfluences(s[2],r)}}return o&&n.markShadowsDirty(),this.requestRender(),!0}isTransientGeometryKey(t){return this.transientGeometryKeys.has(t)}updateEntityGeometryParams(t,e){let r=t;if(r.component&&(r=r.component),typeof r.chooseGeoemtryCache!="function")return!1;let n=r.dataPatched,o=n?.geometry;if(!o||typeof o.type!="string"||o.type==="VectorGeometry"||o.type==="PathGeometry")return!1;let a=d=>d.toLowerCase().replace(/[\s_.-]+/g,""),s=new Map;for(let d of Object.keys(o))s.set(a(d),d);let l={};for(let[d,u]of Object.entries(e??{})){let p=s.get(a(d));if(p===void 0||p==="type"||p==="font"||p==="shape"||p==="path"||p==="data")continue;if(p==="text"){(typeof u=="string"||typeof u=="number")&&(l[p]={textValue:String(u)});continue}let h=o[p];typeof u=="number"&&isFinite(u)&&(typeof h=="number"||typeof h=="string")&&(l[p]=u)}if(Object.keys(l).length===0)return!1;let c={...o,...l};return r.dataPatched={...n,geometry:c},this.transientGeometryKeys.has(o)&&r.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(c),r.createGeometryDelayed(this.entityOpContext),r.onVariableUpdate(!0),r.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let n=e.dataPatched?.geometry;return!n||!this.transientGeometryKeys.has(n)?!1:(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(n),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0)}updateEntityGeometryVertices(t,e){let r=t;if(r.component&&(r=r.component),typeof r.chooseGeoemtryCache!="function")return!1;let n=r.dataPatched,o=n?.geometry;if(!o||o.type!=="NonParametricGeometry")return!1;let a=e?.vertices;if(a===void 0||typeof a.length!="number"||a.length<9||a.length%3!==0||a.length/3>y1.MAX_TRANSIENT_VERTICES)return!1;let s=a instanceof Float32Array?a:Float32Array.from(a),l=s.length/3,c;if(e.normals!==void 0){if(e.normals.length!==s.length)return!1;c=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}let d;if(e.uvs!==void 0){if(e.uvs.length!==l*2)return!1;d=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}let u;if(e.indices!==void 0){let A=l>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(A.length===0||A.length%3!==0)return!1;for(let w=0;w<A.length;w++)if(A[w]>=l)return!1;u={array:A,itemSize:1,type:A.constructor.name,normalized:!1}}else{let A=o.data,w=A?.index;if(w?.array?.length){let C=(A?.attributes?.position?.array?.length??0)/3;if(l!==C)return SG(l,C),!1;u=w}}let p=1/0,h=1/0,f=1/0,m=-1/0,y=-1/0,g=-1/0;for(let A=0;A<s.length;A+=3){let w=s[A],C=s[A+1],T=s[A+2];w<p&&(p=w),w>m&&(m=w),C<h&&(h=C),C>y&&(y=C),T<f&&(f=T),T>g&&(g=T)}let v=(A,w)=>({array:A,itemSize:w,type:"Float32Array",normalized:!1}),b={position:v(s,3)};c&&(b.normal=v(c,3)),d&&(b.uv=v(d,2));let S={...o,width:m-p,height:y-h,depth:g-f,data:{attributes:b,...u?{index:u}:{}}},x=this.transientGeometryKeys.has(o);return r.dataPatched={...n,geometry:S},this.transientGeometryKeys.add(S),r.applyTransientGeometryData(this.entityOpContext,x),r.onVariableUpdate(!0),r.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let r=t;r.component&&(r=r.component);let n=r.cloner;if(n===void 0)return-1;let o=n.children,a=Math.PI/180,s=!1;if(e===null)for(let l of o)l.transformOverride!==void 0&&(l.transformOverride=void 0,s=!0);else if(Array.isArray(e)){let l=Math.min(e.length,o.length);for(let c=0;c<l;c++){let d=e[c],u=o[c];if(d==null){u.transformOverride!==void 0&&(u.transformOverride=void 0,s=!0);continue}let p=u.transformOverride??{position:[u.position.x,u.position.y,u.position.z],rotation:[u.rotation.x,u.rotation.y,u.rotation.z],scale:[u.scale.x,u.scale.y,u.scale.z]};d.position&&(typeof d.position.x=="number"&&(p.position[0]=d.position.x),typeof d.position.y=="number"&&(p.position[1]=d.position.y),typeof d.position.z=="number"&&(p.position[2]=d.position.z)),d.rotation&&(typeof d.rotation.x=="number"&&(p.rotation[0]=d.rotation.x*a),typeof d.rotation.y=="number"&&(p.rotation[1]=d.rotation.y*a),typeof d.rotation.z=="number"&&(p.rotation[2]=d.rotation.z*a)),d.scale&&(typeof d.scale.x=="number"&&(p.scale[0]=d.scale.x),typeof d.scale.y=="number"&&(p.scale[1]=d.scale.y),typeof d.scale.z=="number"&&(p.scale[2]=d.scale.z)),u.transformOverride=p,u.position.fromArray(p.position),u.rotation.fromArray(p.rotation),u.scale.fromArray(p.scale),u.updateMatrix(),u.hasNonUniformScale&&(u.updateMatrixWorld(),u.updateMatrixWorldRigid())}}else return o.length;return s?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(r),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),o.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let r=t.parent;if(r===null)return;let n=new lr(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let o=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.shearMatrix.copy(t.shearMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*o),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*o),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*o)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),r.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let r=t.material;if(!r)return!1;let n=[];for(let d of Array.isArray(r)?r:[r]){let u=d.root??d;u&&Array.isArray(u.layers)&&u.data&&!n.includes(u)&&n.push(u)}if(n.length===0)return!1;let o={scene:this.entityOpContext.scene,shared:this},a=d=>d.toLowerCase().replace(/[\s_.-]+/g,""),s=d=>{if(typeof d=="string"){let u=new Vt(1,1,1,1);try{u.set(d)}catch{return null}return{r:u.r,g:u.g,b:u.b,a:void 0}}if(d&&typeof d=="object"&&"r"in d){let u=d;if([u.r,u.g,u.b].some(h=>typeof h!="number"||!isFinite(h)))return null;let p=Math.max(u.r,u.g,u.b)>1?1/255:1;return{r:u.r*p,g:u.g*p,b:u.b*p,a:typeof u.a=="number"?Math.max(0,Math.min(u.a,1)):void 0}}return null},l=(d,u,p)=>{if(!d.hasValue(u))return!1;let h=d.getValue(u);if(!h||typeof h!="object"||!h.isColor)return!1;let f=p.a??(typeof h.a=="number"?h.a:1);return h instanceof La?d.setValue(u,new Vt(p.r,p.g,p.b,f)):typeof h.setRGBA=="function"?h.setRGBA(p.r,p.g,p.b,f):h.setRGB(p.r,p.g,p.b),!0},c=!1;for(let d of n){let u=d.data.layers??[],p=h=>d.layers.find(f=>f.uuid===h);if(e.color!==void 0){let h=s(e.color),f=u.find(y=>y.data.type==="color"),m=f&&p(f.id);if(h&&m&&l(m,"color",h)&&(c=!0,h.a!==void 0)){let y=h.a<1?!0:zi(d.data,this);d.setTransparent?d.setTransparent(y,o.scene):d.transparent=y}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(d.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),o),c=!0);for(let h of e.layers??[]){if(!h||typeof h!="object")continue;let f=typeof h.id=="string"?u.find(v=>v.id===h.id):typeof h.index=="number"?u[h.index]:typeof h.type=="string"?u.find(v=>v.data.type===h.type):void 0,m=f&&p(f.id);if(!f||!m)continue;let y=Pd[f.data.type]??[],g=Object.keys(f.data);for(let[v,b]of Object.entries(h)){if(v==="id"||v==="index"||v==="type")continue;let S=g.find(A=>A===v)??g.find(A=>a(A)===a(v))??v;if(y.includes(S))continue;let x=s(b);if(x&&l(m,S,x)){c=!0;continue}if(typeof b=="number"&&isFinite(b))d.onVariableUpdate?.(["layer",f.id,S],b,o),c=!0;else if(Array.isArray(b)&&b.length<=3&&b.every(A=>typeof A=="number"&&isFinite(A))){let A=["x","y","z"];b.forEach((w,C)=>{d.onVariableUpdate?.(["layer",f.id,S,A[C]],w,o)}),c=!0}}}}return c&&this.requestRender(),c}deleteVariable(t){this.variables[t]&&delete this.variables[t]}referencesMissingObject(t){return Array.isArray(t)&&t[0]!=="mouse"&&t[0]!=="raycast"&&this.entityOpContext.scene.find(t[0])===void 0}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let r=this.entityOpContext.scene.find(t[0]);if(r===void 0)return;if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return r.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&r?.getPhysicsLocalMatrix?.(AO))return AO.decompose(wO,CO,xG),t[1]==="position"?wO[t[2]]:(EO.setFromQuaternion(CO,r.rotation.order),EO[t[2]]*bi.MathUtils.RAD2DEG);for(let n=1;n<t.length;n++)r=r[t[n]];return t[1]==="rotation"&&(r*=bi.MathUtils.RAD2DEG),r}for(let r in this.variables){if(e===void 0)break;let n=this.variables[r],o=n.locations?.findIndex(a=>jt.equal(a,e));o!==void 0&&o!==-1&&n.locations.splice(o,1)}if(typeof t=="string"){let r=t,n=t;do{if(n=r,this.variables[r]===void 0)break;let o=this.variables[r].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),r=o}while(typeof r=="string");return r}else return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,r]of Object.entries(t.images))this.addImage(e,r.asset);for(let[e,r]of Object.entries(t.audios))this.addAudio(e,r.asset);for(let[e,r]of Object.entries(t.particles))this.addParticle(e,r.asset);for(let[e,r]of Object.entries(t.colors))this.addColor(e,r.asset);for(let[e,r]of Object.entries(t.fonts))this.addFont(e,r.asset);for(let[e,r]of Object.entries(t.videos))this.addVideo(e,r.asset);for(let[e,r]of Object.entries(t.variables))this.addVariableHolder(e,r.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,r){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(or.drop(t,2),e.materials[t.path[1]],{shared:this,scene:r});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,r):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let o=t.type===0&&t.props.debounce===void 0,a=this.getUserAPI(t.path[1]);a!==void 0&&a===this.openAIRealtime?a.update(n):a?.update(n,this,o)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(or.drop(t,1),r)}updateFont(t,e,r){if(e.props.url){let n=this.getFont(t),o={...this.data.fonts[t],url:e.props.url};n.update(o),n.loadingPromise.then(()=>this.requestRender()),r.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let r=SO();return r===null?(xr("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=r(e,t,this),!1)}else{let r=f1();return r===null?(xr("api-services","a user API integration"),!1):(this.userAPIs[t]=r.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let r=f1();return r===null?(xr("api-services","a user webhook"),!1):(this.userWebhooks[t]=r.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}},Ms=y1;Ms.MAX_TRANSIENT_VERTICES=6e4;var MO=new Ms(kn.emptyData());function gg(i){return i?.isClassicNodeMaterial===!0}function OO(i){return i?.isClassicSharedMaterial===!0}function zl(i){return gg(i)||i?.isTSLNodeMaterial===!0}function IO(i){return OO(i)||i?.isTSLSharedMaterial===!0}yt();gr();var Gn=5,Md=3;var DO=.98;var Ar=class extends it{setMaterialOverride(e,r){this.materialOverride=u1(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),r.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,r,n){if(super.updateByPatchedOp(e,r,n),Ye(e.path,["geometry"])&&this.syncShadowCatcher(n),XC(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[o,a]of Object.entries(e.props)){let s=this.material[Number(o)],l=n.shared.material(a);l!==s&&Ar.disposeOneMaterial(s),this.material[Number(o)]=l}else if(Ye(e.path,["material"])){let o=this.material;!Array.isArray(o)&&typeof o?.updateByOp=="function"&&"material"in r&&typeof r.material!="string"&&o.updateByOp(or.drop(e,1),r.material,n)}else if(Ye(e.path,["materials","*"])&&Array.isArray(this.material)){let o=e.path[1];if("materials"in r&&o<this.material.length){let a=r.materials[o];typeof a!="string"&&this.material[o].updateByOp(or.drop(e,2),a,n)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&!!this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):(this.layers.mask&1<<9)!==0&&this.layers.set(0)}updateState(e,r){super.updateState(e,r),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let n=this.dataPatched;this.syncShapeBlendNodeLayer();let o;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(o={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let a=this.materialOverride!==void 0;!a&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=r.shared.material(e.material).getFlavor(n.flatShading,n.side,n.wireframe,o),r.scene.markNeedsUpdateRendererDirty()),!a&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(l=>r.shared.material(l).getFlavor(n.flatShading,n.side,n.wireframe)),r.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[r.shared.material(e.material).getFlavor(n.flatShading,n.side,n.wireframe)],r.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!a&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=r.shared.material(s.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!a&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let l=0;l<this.material.length;l++)this.material[l]=this.material[l].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,o);this.syncShadowCatcher(r)}shadowCatcherActive(){let e=this.dataPatched,r=e.geometry?.type;return e.shadowCatcher===!0&&(r==="RectangleGeometry"||r==="PlaneGeometry")}syncShadowCatcher(e){let r=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let n=lO();if(n===null)return;this.shadowCatcherMaterial=n}this.shadowCatcherMaterial.side=r.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,e.scene.markNeedsUpdateRendererDirty()):"material"in r&&r.material!==void 0&&(this.material=e.shared.material(r.material).getFlavor(r.flatShading,r.side,r.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow)}static disposeOneMaterial(e){zl(e)&&!IO(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&Wf(this.material).forEach(e=>{Ar.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}};var wr=require("three");var RO=new wr.Vector3,BO=new wr.Vector4,NO=new wr.Vector4,AG=new wr.Vector3,LO=new wr.Matrix4,Os=new wr.Mesh,wG=Os.geometry,CG=Os.material,vg=new wr.Vector3,tt=class extends Ar{constructor(e,r,n){super(e,r);this.data=r;this.isSkinnedMesh=!1;this.localGeometry=void 0,r.bindMode&&r.bindMatrix&&(this.bindMode=r.bindMode,this.bindMatrix=new wr.Matrix4().fromArray(r.bindMatrix),this.bindMatrixInverse=new wr.Matrix4)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof wr.BufferGeometry&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof wr.BufferGeometry?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Ms){let e=this.geometryCreateDeleyed,r=this.chooseGeoemtryCache(e),n=this.dataPatched.geometry;this.geometryCreateDeleyed=r.get(n,e,this),this._geometryCacheKey=n}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return Tp.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return Tp.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,r,n){super.updateByPatchedOp(e,r,n),Ye(e.path,["geometry"])&&this.updateByPatchedOpGeometry(or.drop(e,1),r.geometry,n)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){super.dispose(),A2(this.uuid),this._posed=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(!(e===void 0||e.sxPrev===void 0))return[e.sxPrev,e.syPrev,e.szPrev]}updateGeometryInteractions(e,r){this.invalidateDownstreamBooleanData();let n=this.data.geometry.type;if(n==="NonParametricGeometry"||n==="SubdivGeometry"){let o=e;if(this.localGeometry===void 0){let h={...this.data.geometry,...o};this.localGeometry=Ui(h,r,this.data.flatShading,this)}let a,s,l;o.scaleBaked?[a,s,l]=o.scaleBaked:{width:a,height:s,depth:l}=o;let c=this.localGeometry.userData,d=typeof a=="number"?a:1,u=typeof s=="number"?s:1,p=typeof l=="number"?l:1;c.sxPrev!==void 0&&ah(this.localGeometry.attributes,d/c.sxPrev,u/c.syPrev,p/c.szPrev),c.sxPrev=d,c.syPrev=u,c.szPrev=p}else if(!this.absorbDepthInteraction(e)){let o=n==="VectorGeometry"?kc.merge(this.data.geometry,e):{...this.data.geometry,...e},a=Ui(o,r,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&lg(this.localGeometry,a)?a.dispose():(this.localGeometry?.dispose(),this.localGeometry=a)}}absorbDepthInteraction(e){let r=this.localGeometry;if(r?.shiftDepthTo===void 0)return!1;let n=e;if(typeof n.depth!="number")return!1;let o=r.userData?.parameters;if(o===void 0)return!1;for(let a of Object.keys(n))if(a!=="depth"&&n[a]!==o[a])return!1;return r.shiftDepthTo(n.depth)?(o.depth=n.depth,!0):!1}refreshAttachedClonersInteractions(e){for(let r of this.attachedSurfaceCloners)r.update(e)}refreshAttachedCloners(e){for(let r of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(r.object)}refreshAttachedPaths(e){for(let r of this.attachedPaths)e.scene.addPendingCommand(()=>r.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,r,n){let o=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Bt&&this.chooseGeoemtryCache(n.shared).mutateIfUnique(this.geometryCreateDeleyed.data,r)===this.geometryCreateDeleyed&&(o=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(r,e.props.scaleBaked),this.refreshAttachedCloners(n),this.refreshAttachedPaths(n)),!o&&e.type===0&&e.path.length===0&&pg(e.props)&&this.geometryCreateDeleyed instanceof Bt&&this.chooseGeoemtryCache(n.shared).mutateIfUnique(this.geometryCreateDeleyed.data,r)===this.geometryCreateDeleyed&&(o=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(r),this.refreshAttachedCloners(n),this.refreshAttachedPaths(n)),!o&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof wr.BufferGeometry&&!(this.geometryCreateDeleyed instanceof Bt)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let a=n.shared,s=this.chooseGeoemtryCache(a),l=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===l&&l.isShared!==!0){let d=this.dataPatched.geometry,u=Ui(d,a,this.data.flatShading,this);lg(l,u)?(u.dispose(),l.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,d)):(u.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(d,u),this.geometryCreateDeleyed=u),this._geometryCacheKey=d,o=!0,this.refreshAttachedCloners(n),this.refreshAttachedPaths(n)}}o||(n.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(n)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,r){this.createGeometryDelayed(r)}applyTransientGeometryData(e,r){let n=e.shared,o=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof wr.BufferGeometry&&!(this.geometryCreateDeleyed instanceof Bt)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let a=this.chooseGeoemtryCache(n),s=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let c=Ui(o,n,this.data.flatShading,this);lg(s,c)?(c.dispose(),s.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,o)):(c.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(o,c),this.geometryCreateDeleyed=c),this._geometryCacheKey=o,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e);return}}r&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(n).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,r){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,r);let n=e.morphTargetInfluences;if(n){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:o,value:a}}of n)this.updateMorphInfluences(o,r.shared.getVariable(a,[this.uuid,"morphTargetInfluences",o]))}super.updateState(e,r)}updateMorphInfluences(e,r){if(this.morphTargetDictionary===void 0)return;let n=this.morphTargetDictionary[e];n!==void 0&&(this.morphTargetInfluences[n]=r)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,r){let n=this.posedGeometry()?.boundingBox;if(n){n.getCenter(e),n.getSize(r).multiplyScalar(.5);return}let o=this.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,o.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),r.set(o.width,o.height,o.depth??0).multiplyScalar(.5)):o.centerOffset?e.fromArray(o.centerOffset):e.setScalar(0),r.set(o.width,o.height,o.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,r){this.skeleton=e,this.isSkinnedMesh=!0,r===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),r=this.matrixWorld),this.bindMatrix.copy(r),this.bindMatrixInverse.copy(r).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let r=new wr.Vector4,n=this.geometry.attributes.skinWeight;for(let o=0,a=n.count;o<a;o++){r.fromBufferAttribute(n,o);let s=1/r.manhattanLength();s!==1/0?r.multiplyScalar(s):r.set(1,0,0,0),n.setXYZW(o,r.x,r.y,r.z,r.w)}}boneTransform(e,r){let n=this.skeleton;if(n===void 0)return;let o=this.geometry;BO.fromBufferAttribute(o.attributes.skinIndex,e),NO.fromBufferAttribute(o.attributes.skinWeight,e),RO.copy(r).applyMatrix4(this.bindMatrix),r.set(0,0,0);for(let a=0;a<4;a++){let s=NO.getComponent(a);if(s!==0){let l=BO.getComponent(a);LO.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),r.addScaledVector(AG.copy(RO).applyMatrix4(LO),s)}}return r.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(e,r){let n=this.posedGeometry();if(n===void 0)return!1;Os.geometry=n,Os.material=this.material,Os.matrixWorld.copy(this.matrixWorld);let o=r.length;Os.raycast(e,r);for(let a=o;a<r.length;a++)r[a].object=this;return Os.geometry=wG,Os.material=CG,!0}posedGeometry(){let e=this.skeleton;if(!this.isSkinnedMesh||e===void 0)return;let r=this.geometry,{position:n,skinIndex:o,skinWeight:a}=r.attributes;if(!n||!o||!a)return;let s=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let h=0;h<e.bones.length;h++){let f=e.bones[h];if(!f||!e.boneInverses[h])return;s.push(...f.matrixWorld.elements)}let l=this._posed;if(l?.source===r&&l.version===n.version&&l.pose.length===s.length&&l.pose.every((h,f)=>h===s[f]))return l.geometry;let c=n.count,d=l?.geometry.attributes.position,u=d?.count===c?d:new wr.BufferAttribute(new Float32Array(c*3),3);for(let h=0;h<c;h++)this.boneTransform(h,this.getVertexPosition(h,vg)),u.setXYZ(h,vg.x,vg.y,vg.z);let p=new wr.BufferGeometry;p.setAttribute("position",u);for(let h of["normal","uv","uv1"]){let f=r.attributes[h];f&&p.setAttribute(h,f)}return p.setIndex(r.index),p.groups=r.groups,p.drawRange=r.drawRange,p.computeBoundingSphere(),p.computeBoundingBox(),this._posed={source:r,version:n.version,pose:s,geometry:p},p}};var GO=require("three");var Jo=require("three");var _O=require("three"),Qo=i=>{var t;return t=class extends i{},t.geometryHelper=new _O.BoxGeometry(30,30,30),t};var En=require("three"),bg=new En.Ray,v1=new En.Sphere,kO=new En.Matrix4,Zo=(i,t,e,r,n=!1,o=i)=>{let a=t,s=o.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),v1.copy(a.boundingSphere),v1.applyMatrix4(s),e.ray.intersectsSphere(v1)===!1||(kO.copy(s).invert(),bg.copy(e.ray).applyMatrix4(kO),a.boundingBox!==null&&bg.intersectsBox(a.boundingBox)===!1))return;let l,c,d,u,p=a.index,h=a.attributes.position,f=a.drawRange,m,y;if(n===!1){let v=Math.max(0,f.start),b=Math.min(p.count,f.start+f.count);for(m=v,y=b;m<y;m+=3)if(c=p.getX(m),d=p.getX(m+1),u=p.getX(m+2),l=g(i,e,bg,h,c,d,u),l){l.faceIndex=Math.floor(m/3),r.push(l);return}}else{let b=a.attributes.position,S=new En.Vector3,x=new En.Vector3,A=new En.Vector3,w=new En.Vector3,C=2,M=1/((o.scale.x+o.scale.y+o.scale.z)/3),D=M*M,I=Math.max(0,f.start),_=Math.min(b.count,f.start+f.count);for(let E=I,B=_-1;E<B;E+=C){if(S.fromBufferAttribute(b,E),x.fromBufferAttribute(b,E+1),bg.distanceSqToSegment(S,x,w,A)>D)continue;w.applyMatrix4(o.matrixWorld);let k=e.ray.origin.distanceTo(w);k<e.near||k>e.far||r.push({distance:k,point:A.clone().applyMatrix4(o.matrixWorld),object:i})}}function g(v,b,S,x,A,w,C){let T=new En.Vector3,M=new En.Vector3,D=new En.Vector3,I=new En.Vector3,_=new En.Vector3;if(T.fromBufferAttribute(x,A),M.fromBufferAttribute(x,w),D.fromBufferAttribute(x,C),S.intersectTriangle(T,M,D,!1,I)===null)return null;_.copy(I),_.applyMatrix4(v.matrixWorld);let B=b.ray.origin.distanceTo(_);return B<b.near||B>b.far?null:{faceIndex:1,distance:B,point:_.clone(),object:v}}};var EG=new Jo.Vector3(1,1,1),FO=new Jo.Vector3,TG=new Jo.Vector3,VO=new Jo.Quaternion,Hi=class extends Qo(Jo.AxesHelper){constructor(e,r=15){super(r);this.object=e;this.dummy=new Jo.Group;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,r){Zo(this.object,Hi.geometryHelper,e,r,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(FO,VO,TG),this.matrix.compose(FO,VO,EG),super.updateMatrixWorld(e)}updateWorldMatrix(e,r){}};var ch=require("three");var xg;(t=>t.is=e=>"objectHelper"in e)(xg||(xg={}));var Wi=(i,t)=>class extends ad(i){constructor(){super(...arguments);this.objectHelper=new t(this);this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(n,o){this.objectHelper.raycast(n,o)}showGizmos(){for(let n in this.gizmos){let o=this.gizmos[n];o instanceof ch.Box3Helper&&(o.visible=!0)}}updateEntityBoxSize(n,o){this.objectHelper.visible&&this.geometryHelper instanceof ch.BoxGeometry?(n.setScalar(0),o.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(n,o)}hideGizmos(){for(let n in this.gizmos){let o=this.gizmos[n];o instanceof ch.Box3Helper&&(o.visible=!1)}}};var Id=class extends Wi(GO.Group,Hi){constructor(e,r,n){super();this.super_Entity(e,r),this.context=n,this.objectHelper.update()}updateState(e,r){this.updateState_Entity(e,r)}};var PG=null;function UO(){return PG}var $e=require("three"),Ig=Ec(jO());var MG=.5*(Math.sqrt(3)-1),dh=(3-Math.sqrt(3))/6,OG=1/3,$o=1/6,Yre=(Math.sqrt(5)-1)/4,Kre=(5-Math.sqrt(5))/20,uh=i=>Math.floor(i)|0,HO=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]),x1=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 WO(i=Math.random){let t=XO(i),e=new Float64Array(t).map(n=>HO[n%12*2]),r=new Float64Array(t).map(n=>HO[n%12*2+1]);return function(o,a){let s=0,l=0,c=0,d=(o+a)*MG,u=uh(o+d),p=uh(a+d),h=(u+p)*dh,f=u-h,m=p-h,y=o-f,g=a-m,v,b;y>g?(v=1,b=0):(v=0,b=1);let S=y-v+dh,x=g-b+dh,A=y-1+2*dh,w=g-1+2*dh,C=u&255,T=p&255,M=.5-y*y-g*g;if(M>=0){let _=C+t[T],E=e[_],B=r[_];M*=M,s=M*M*(E*y+B*g)}let D=.5-S*S-x*x;if(D>=0){let _=C+v+t[T+b],E=e[_],B=r[_];D*=D,l=D*D*(E*S+B*x)}let I=.5-A*A-w*w;if(I>=0){let _=C+1+t[T+1],E=e[_],B=r[_];I*=I,c=I*I*(E*A+B*w)}return 70*(s+l+c)}}function qO(i=Math.random){let t=XO(i),e=new Float64Array(t).map(o=>x1[o%12*3]),r=new Float64Array(t).map(o=>x1[o%12*3+1]),n=new Float64Array(t).map(o=>x1[o%12*3+2]);return function(a,s,l){let c,d,u,p,h=(a+s+l)*OG,f=uh(a+h),m=uh(s+h),y=uh(l+h),g=(f+m+y)*$o,v=f-g,b=m-g,S=y-g,x=a-v,A=s-b,w=l-S,C,T,M,D,I,_;x>=A?A>=w?(C=1,T=0,M=0,D=1,I=1,_=0):x>=w?(C=1,T=0,M=0,D=1,I=0,_=1):(C=0,T=0,M=1,D=1,I=0,_=1):A<w?(C=0,T=0,M=1,D=0,I=1,_=1):x<w?(C=0,T=1,M=0,D=0,I=1,_=1):(C=0,T=1,M=0,D=1,I=1,_=0);let E=x-C+$o,B=A-T+$o,L=w-M+$o,k=x-D+2*$o,F=A-I+2*$o,W=w-_+2*$o,U=x-1+3*$o,G=A-1+3*$o,q=w-1+3*$o,X=f&255,Y=m&255,Q=y&255,te=.6-x*x-A*A-w*w;if(te<0)c=0;else{let de=X+t[Y+t[Q]];te*=te,c=te*te*(e[de]*x+r[de]*A+n[de]*w)}let ue=.6-E*E-B*B-L*L;if(ue<0)d=0;else{let de=X+C+t[Y+T+t[Q+M]];ue*=ue,d=ue*ue*(e[de]*E+r[de]*B+n[de]*L)}let le=.6-k*k-F*F-W*W;if(le<0)u=0;else{let de=X+D+t[Y+I+t[Q+_]];le*=le,u=le*le*(e[de]*k+r[de]*F+n[de]*W)}let ce=.6-U*U-G*G-q*q;if(ce<0)p=0;else{let de=X+1+t[Y+1+t[Q+1]];ce*=ce,p=ce*ce*(e[de]*U+r[de]*G+n[de]*q)}return 32*(c+d+u+p)}}function XO(i){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 n=r+~~(i()*(256-r)),o=e[r];e[r]=e[n],e[n]=o}for(let r=256;r<512;r++)e[r]=e[r-256];return e}var YO=require("three"),xo=new YO.Triangle,Sg=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 n=0;n<t.count;n+=3){let o=1;xo.a.fromBufferAttribute(t,n),xo.b.fromBufferAttribute(t,n+1),xo.c.fromBufferAttribute(t,n+2),o*=xo.getArea(),e[n/3]=o}this.distribution=new Float32Array(t.count/3);let r=0;for(let n=0;n<e.length;n++)r+=e[n],this.distribution[n]=r;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let r=this.distribution[this.distribution.length-1],n=this.binarySearch(this.randomFunction()*r);return this.sampleFace(n,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,r=0,n=e.length-1,o=-1;for(;r<=n;){let a=Math.ceil((r+n)/2);if(a===0||e[a-1]<=t&&e[a]>t){o=a;break}else t<e[a]?n=a-1:r=a+1}return o}sampleFace(t,e,r){let n=this.randomFunction(),o=this.randomFunction();return n+o>1&&(n=1-n,o=1-o),xo.a.fromBufferAttribute(this.positionAttribute,t*3),xo.b.fromBufferAttribute(this.positionAttribute,t*3+1),xo.c.fromBufferAttribute(this.positionAttribute,t*3+2),e.set(0,0,0).addScaledVector(xo.a,n).addScaledVector(xo.b,o).addScaledVector(xo.c,1-(n+o)),xo.getNormal(r),this}};var jl=require("three");var xi=require("three");function IG(i){if(i.geometry.attributes.extrudeNormal||!i.geometry.attributes.position||!i.geometry.attributes.normal)return;let t=new Map,e=i.geometry.attributes,r=e.position.array,n=e.normal.array,o=new Float32Array(r.length);for(let a=0;a<r.length;a+=3){let s=`${r[a]}_${r[a+1]}_${r[a+2]}`,l=new xi.Vector3(n[a],n[a+1],n[a+2]);t.has(s)?t.get(s)?.normals.push(l):t.set(s,{normals:[l],result:new xi.Vector3})}t.forEach((a,s)=>{for(let l of a.normals)a.result.add(l);a.result.divideScalar(a.normals.length)});for(let a=0;a<r.length;a+=3){let s=`${r[a]}_${r[a+1]}_${r[a+2]}`,l=t.get(s)?.result;l&&(o[a]=l.x,o[a+1]=l.y,o[a+2]=l.z)}i.geometry.setAttribute("extrudeNormal",new xi.Float32BufferAttribute(o,3))}function DG(i){if(i.geometry.attributes.extrudeNormals||!i.geometry.attributes.position)return;let e=i.geometry.attributes.position.array,r=new Float32Array(e.length),n=new xi.Vector3;for(let o=0;o<e.length;o+=3)n.set(e[o],e[o+1],e[o+2]).normalize(),r[o]=n.x,r[o+1]=n.y,r[o+2]=n.z;i.geometry.setAttribute("extrudeNormal",new xi.Float32BufferAttribute(r,3))}function ea(i){if(Array.isArray(i.material)){for(let t of i.material)if(t.getLayersOfType("outline").length===0)return}else if(!gg(i.material)||i.material.getLayersOfType("outline").length===0)return;i instanceof tt&&i.is2DAndNoDepth?DG(i):IG(i)}function S1(i){return Math.min(2047,Math.max(1,Math.round(i*2048)))/2048}function ta(i){if(!i.geometry.attributes.position)return;let t=i.geometry.attributes,e=t.position.array,r=t.randomColor;if(r!==void 0&&r.count*3===e.length)return;let n=new Float32Array(e.length),o=parseInt(i.uuid.replace(/\D/g,"")),a=[S1(xi.MathUtils.seededRandom(o)),S1(xi.MathUtils.seededRandom(o+1e4)),S1(xi.MathUtils.seededRandom(o+2e4))];for(let s=0;s<e.length;s++)n[s]=a[s%3];i.geometry.setAttribute("randomColor",new xi.BufferAttribute(n,3))}var ra=new jl.Box3,ph=new jl.Vector3;function KO(i){let t=!1;return i.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&r.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var Va=class extends tt{constructor(e,r,n){super(e,r,n);this.data=r;this.smoothShading=!0;this.skipReactionUpdate=!1;this.shearCompensationIsActive=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,r){let n=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),r.set(n.width,n.height,n.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let r=this.localGeometry?.uuid,{originalGeometry:n,subdividedGeometry:o,subdivPointer:a}=Bt.build(e,this.subdivPointer,this.smoothShading,this.shearScale);this.subdivPointer=a,n!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=n),o!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=o??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ea(this),ta(this),this.calcBoundingBox(),r&&(this.localGeometry.uuid=r)}updateState(e,r){if(super.updateState(e,r),e.flatShading!==void 0){let n=this.material;this.material=Array.isArray(n)?n.map(o=>o.getFlavor(!1,o.side,o.wireframe)):n.getFlavor(!1,n.side,n.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(r)}}updateMesh(e=!1,r=!1,n=!1){r&&this.subdividedGeometry||Bt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0,n),this.subdividedGeometry&&Bt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){let e=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Bt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Bt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ea(this),ta(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}raycast(e,r){let n=this.localGeometry;this.localGeometry=this.originalGeometryNew,it.prototype.raycast.call(this,e,r),this.localGeometry=n}activateShearCompensation(){this.shearCompensationIsActive=!0,this.matrixWorld.copy(this.matrixWorldRigid)}deactivateShearCompensation(){this.shearCompensationIsActive=!1,this.updateMatrixWorld(!0)}updateMatrixWorld(e){this.shearCompensationIsActive!==!0&&super.updateMatrixWorld(e)}updateWorldMatrix(e,r){this.shearCompensationIsActive!==!0&&super.updateWorldMatrix(e,r)}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new jl.Sphere,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let r=e.attributes.position,n=e.boundingSphere.center;ra.setFromBufferAttribute(r),ra.getCenter(n),e.boundingSphere.radius=n.distanceTo(ra.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ra.getSize(ph),ph.divide(this.scale);let o={width:ph.x,height:ph.y,depth:ph.z};return this.geometry.userData.parameters=o,o}updateBoundingSphere(e){let r=this.originalGeometry;ra.min.set(e[0],e[2],e[4]),ra.max.set(e[1],e[3],e[5]),ra.min.applyMatrix4(this.shearScaleInv),ra.max.applyMatrix4(this.shearScaleInv),r.boundingSphere===null&&(r.boundingSphere=new jl.Sphere);let n=r.boundingSphere.center;ra.getCenter(n),r.boundingSphere.radius=n.distanceTo(ra.max)}freeSubdivPointer(){this.subdivPointer&&(Bt.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(e){if(this.skipReactionUpdate===!0)return;let r=this.localGeometry,n=r?.uuid,o=r?.userData.parameters,a=e.subdivisions>0?Bt.buildRefined(this.subdivPointer,e.subdivisions,this.smoothShading?e.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=a??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ea(this),ta(this),o!==void 0&&(this.localGeometry.userData.parameters=o),n&&(this.localGeometry.uuid=n)}updateByPatchedOpGeometry(e,r,n){super.updateByPatchedOpGeometry(e,r,n),this.localGeometry&&(e.type===0&&e.path.length===0&&pg(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(r):this.createGeometryByControls(r))}};var na=require("three"),QO=-1,RG=1,ZO={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},JO={polygon_center:0,edge:1,vertex:2},hh=(i,t)=>(e,r)=>!t||e===0||i===0?0:i*r/100,ze=(i,t)=>{let e=Math.abs(t),r=e*-1;return(i-QO)*(e-r)/(RG-QO)+r},BG=new na.Vector3,Ag=new na.Vector3,NG=new na.Vector3,LG=new na.Vector3;function Dd(i,t){let e=NG.fromArray(i),r=LG.fromArray(t);Ag.copy(r).sub(e);let n=Ag.length();return Ag.normalize().multiplyScalar(n*.5),BG.copy(e).add(Ag).toArray()}var qi=new na.Triangle,wg=new na.Vector3,Cg=new na.Vector3,Hl=new na.Vector3;function $O(i){let t=[],e=Math.floor(i.index.count/3);for(let r=0;r<e;r++)if(wg.fromArray(i.index.array,r*3),qi.setFromAttributeAndIndices(i.attributes.position,wg.x,wg.y,wg.z),qi.getNormal(Cg),qi.getMidpoint(Hl),!(isNaN(Hl.x)||isNaN(Hl.y)||isNaN(Hl.z))){let{a:n,b:o,c:a}=qi,s=n.toArray(),l=o.toArray(),c=a.toArray(),d=n.distanceTo(o),u=o.distanceTo(a),p=a.distanceTo(n),h=Dd(s,l),f=Dd(l,c),m=Dd(c,s),y=[d,u,p],g=Math.max(...y),v=y.filter(x=>Math.round(x)===Math.round(g)).length>1,b=[],S=qi.getMidpoint(Hl).toArray();g===d&&!v&&(b=[f,m,m],S=h),g===u&&!v&&(b=[h,m,m],S=f),g===p&&!v&&(b=[h,f,f],S=m),v&&(b=[h,f,m]),t.push({vertices:[s,l,c],faceCenters:b,midpoint:S,norm:qi.getNormal(Cg).toArray()})}return t}function eI(i){let t=[],{position:e}=i.attributes;for(let r=0;r<e.count;r++){qi.setFromAttributeAndIndices(e,r*3,r*3+1,r*3+2),qi.getNormal(Cg),qi.getMidpoint(Hl);let n=qi.a.toArray(),o=qi.b.toArray(),a=qi.c.toArray();t.push({vertices:[n,o,a],faceCenters:[Dd(n,o),Dd(o,a),Dd(a,n)],midpoint:Hl.toArray(),norm:Cg.toArray()})}return t}var fh=require("three"),A1=class extends fh.InstancedMesh{},Eg=class extends A1{constructor(e,r){super(void 0,void 0,r);this.source=e;this.isClonerInstancedMesh=!0;this.pivotMatrix=new fh.Matrix4;this.previousModelViewMatrix=new fh.Matrix4;this.copyPreviousMatrix=!0;this.capacity=r,this.count=0,this.matrixAutoUpdate=!1}raycast(e,r){}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let r of this.children)r.updateMatrixWorld(e)}updateWorldMatrix(e,r){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),r)for(let o of this.children)o.updateWorldMatrix(!1,!0)}onAfterRender(e,r,n,o,a,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}get visible(){return this.source.cloner?.insideBoolean===!0?!1:this.source.visible||this.source.dataPatched.visible&&this.source.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.source.castShadow}set castShadow(e){}get receiveShadow(){return this.source.receiveShadow}set receiveShadow(e){}get layers(){return this.source.layers}set layers(e){}get geometry(){return this.source.geometry}set geometry(e){}get material(){return this.source.material}set material(e){}get morphTargetInfluences(){return this.source.morphTargetInfluences}set morphTargetInfluences(e){}};var w1=i=>.5*(1-Math.cos(i*Math.PI)),C1=class{constructor(){this.perlin=new Array(4095+1)}noise(t,e=0,r=0){if(this.perlin==null){this.perlin=new Array(4095+1);for(let g=0;g<4095+1;g++)this.perlin[g]=Math.random()}t<0&&(t=-t),e<0&&(e=-e),r<0&&(r=-r);let n=Math.floor(t),o=Math.floor(e),a=Math.floor(r),s=t-n,l=e-o,c=r-a,d,u,p=0,h=.5,f,m,y;for(let g=0;g<4;g++){let v=n+(o<<4)+(a<<8);d=w1(s),u=w1(l),f=this.perlin[v&4095],f+=d*(this.perlin[v+1&4095]-f),m=this.perlin[v+16&4095],m+=d*(this.perlin[v+16+1&4095]-m),f+=u*(m-f),v+=256,m=this.perlin[v&4095],m+=d*(this.perlin[v+1&4095]-m),y=this.perlin[v+16&4095],y+=d*(this.perlin[v+16+1&4095]-y),m+=u*(y-m),f+=w1(c)*(m-f),p+=f*h,h*=.5,n<<=1,s*=2,o<<=1,l*=2,a<<=1,c*=2,s>=1&&(n++,s--),l>=1&&(o++,l--),c>=1&&(a++,c--)}return p}noiseSeed(t){let e=(()=>{let a,s;return{setSeed(l){s=a=(l??Math.random()*4294967296)>>>0},getSeed(){return a},rand(){return s=(1664525*s+1013904223)%4294967296,s/4294967296}}})();e.setSeed(t),this.perlin=new Array(4095+1);for(let r=0;r<4095+1;r++)this.perlin[r]=e.rand()}},tI=C1;var Rd=require("three");var rI=new Rd.Vector3,nI=new Rd.Matrix4,iI=new Rd.Ray,Is=class extends tt{constructor(e,r,n){super(e,r,n);this.data=r}get textGeometry(){return this.geometry}get charWidths(){return this.textGeometry.charWidths}get charCoords(){return this.textGeometry.charCoords}get wrappedText(){return this.textGeometry.wrappedText}get font(){return this.textGeometry.font}get initialOffsetY(){let e=this.dataPatched;return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,typeof e.geometry.height=="number"?e.geometry.height:1,this.fontScale,e.geometry.verticalAlign)??0}get fontScale(){let e=this.dataPatched;return this.font?e.geometry.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){let e=this.dataPatched;return e.geometry.fontSize*e.geometry.lineHeight}raycast(e,r){let{matrixWorld:n}=this;if(!(isNaN(e.ray.origin.x)||this.scale.x===0||this.scale.y===0||this.scale.z===0)&&(nI.copy(n).invert(),iI.copy(e.ray).applyMatrix4(nI),iI.intersectBox(this.singleBBox,rI))){let o=rI.applyMatrix4(n),a=e.ray.origin.distanceTo(o);r.push({distance:a,point:o.clone(),object:this})}}};var Un=1e-4,ia,mI,yI,gI,oI=new $e.Vector3,aI=new $e.Vector3;sg.then(i=>{ia=i,mI=[ia.get_face_center,ia.get_edge_midpoint,ia.get_vertex_position],yI=[ia.get_face_normal,ia.get_edge_normal,ia.get_vertex_normal],gI=[ia.face_count,ia.edge_count,ia.vertex_count]});var tie=new $e.Matrix4,_G=new $e.Matrix4,sI=new $e.Matrix4,lI=new $e.Matrix4,cI=new $e.Matrix4,dI=new $e.Matrix4,uI=new $e.Matrix4,Ds=new $e.Vector3,Tg=new $e.Vector3,Pg=new $e.Vector3,E1=new $e.Vector3,kG=new $e.Vector3,pI=new $e.Vector3,Mg=new $e.Vector3,T1=new $e.Vector3,hI=new $e.Vector3,P1=new $e.Vector3,fI=new $e.Vector3,So=new $e.Euler,FG=new $e.Quaternion;function Og(i){return i?i.version??i.data?.version??0:-1}function cr(i,t){return[typeof i?.[0]=="number"?i[0]:typeof i?.[0]=="string"&&t?parseFloat(String(t.shared.getVariable(i[0])??"0")):0,typeof i?.[1]=="number"?i[1]:typeof i?.[1]=="string"&&t?parseFloat(String(t.shared.getVariable(i[1])??"0")):0,typeof i?.[2]=="number"?i[2]:typeof i?.[2]=="string"&&t?parseFloat(String(t.shared.getVariable(i[2])??"0")):0]}var M1=class{constructor(t,e){this.data=t;this.is3D=e;this.perlin=new tI;t.noiseType==="perlin"?(this.perlin.noiseSeed(t.seed),e?this.noise=(n,o,a)=>this.perlin.noise(n,o,a):this.noise=n=>this.perlin.noise(n)):e?this.noise=qO((0,Ig.default)(t.seed)):this.noise=WO((0,Ig.default)(t.seed??""))}},Tn=class extends nd($e.Object3D){constructor(e,r){super();this.parameters=r;this.isCloner=!0;this.objectForSample=void 0;this._pendingMediaLoad=!1;this.random=null;this.surfaceSamplerCache=null;this.surfacePointsCache=null;this.object=e}resetOnMove(){this.removeFromParent(),this.parent=null}removeFromParent(){return super.removeFromParent(),this.instancedMesh?.removeFromParent(),this}dispose(){this.removeFromParent(),this._disposeInstancedMesh(),this._invalidateBoolean(),this._syncEnclosingCopies(!0)}createCopy(){return new mh(this)}_syncEnclosingCopies(e){!e&&this.parent!==this.object.parent||this.object.traverseEntityAncestors(r=>{let n=r.cloner;n===void 0||n.parent===null||(e&&n.expandCopies(),n.invalidateTransform(this.object))})}_invalidateBoolean(){this.object instanceof it&&this.object.onClonerLayoutUpdated()}expandClones(e){this.parent===null?this.updateState(this.parameters,e):this.expandCopies()}expandCopies(){for(let e of this.children)e instanceof lr&&e.expand();this._syncInstancedMesh()}invalidateTransform(e){this.matrixWorldNeedsUpdate=!0}onObjUpdateMatrix(){this.parameters.type!=="toObject"&&(this.matrixWorldNeedsUpdate=!0)}update(e){this._syncEnclosingCopies(this._layout(e))}_layout(e){let r=this.children.length;switch(this._updateCount(e),this.parameters.type){case"radial":this._updateRadial(this.parameters,e);break;case"linear":this._updateLinear(this.parameters,e);break;case"grid":this._updateGrid(this.parameters,e);break;case"toObject":this._updateToObject(this.parameters,e)}for(let n of this.children){let o=n.transformOverride;o!==void 0&&(n.position.fromArray(o.position),n.rotation.fromArray(o.rotation),n.scale.fromArray(o.scale)),n.updateMatrix(),n.hasNonUniformScale&&(n.updateMatrixWorld(),n.updateMatrixWorldRigid())}return this._syncInstancedMesh(),this._invalidateBoolean(),this.children.length!==r}get instancingActive(){return this.instancedMesh!==void 0}get insideBoolean(){return this.parent!==null&&"booleanOp"in this.parent}_instancingEligible(){if(this.parameters.instanced!==!0)return!1;let e=this.object;return!(e.entityChildrenCount()>0||e.isMesh!==!0||fi(e)||e.isDecalObject===!0)}_syncInstancedMesh(){if(!this._instancingEligible()){this._disposeInstancedMesh();return}let e=this.instancedMesh;if(e!==void 0&&e.capacity<this.children.length&&(this._disposeInstancedMesh(),e=void 0),e===void 0){let r=Math.max(8,Math.ceil(this.children.length*1.5));e=this.instancedMesh=new Eg(this.object,r)}e.matrix=this.matrix,e.matrixWorldNeedsUpdate=!0,e.parent!==this.parent&&(e.removeFromParent(),this.parent?.add(e)),this.syncInstanceMatrices()}syncInstanceMatrices(){this._invalidateBoolean();let e=this.instancedMesh;if(e===void 0)return;let r=0;for(let n of this.children)n.playModeVisible!==!1&&(sI.copy(n.matrix).multiply(n.pivotMatrix),e.setMatrixAt(r++,sI));e.count=r,e.instanceMatrix.needsUpdate=!0,e.boundingSphere=null}_disposeInstancedMesh(){let e=this.instancedMesh;e!==void 0&&(this.instancedMesh=void 0,e.removeFromParent(),e.dispose())}_updateCount(e,r){let n;if(r!==void 0)n=r;else{let o=cr(this.parameters.grid.count,e);n=this.parameters.type==="grid"?Math.round(o[0])*Math.round(o[1])*Math.round(o[2]):this.parameters.count}if(this.parameters.type==="toObject"){if(!this.parameters.toObject.object)n=0;else if(r===void 0&&this.parameters.toObject.spreadType!=="random")return}if(this.children.length!==n)if(this.children.length<n)for(let o=0,a=n-this.children.length;o<a;++o){let s=new lr(this.object);s.expand(),this.add(s)}else for(;this.children.length>n;){let o=this.children.pop();o.parent=null,o.dispatchEvent({type:"removed"}),this.dispatchEvent({type:"childremoved",child:o})}}getRandom(e,r=!1){return(this.random===null||this.random.data.seed!==e.seed||this.random.data.noiseType!==e.noiseType||this.random.is3D!==r)&&(this.random=new M1(e,r)),this.random}_updateRadial(e,r){let n=e.radial,o=n.start*$e.MathUtils.DEG2RAD,a=n.end*$e.MathUtils.DEG2RAD,s=o-a,l=cr(n.rotation,r),c=new $e.Euler(l[0],l[1],l[2]),d;switch(n.axis){case"z":d=new $e.Vector3(0,0,1);break;case"y":d=new $e.Vector3(0,1,0);break;default:case"x":d=new $e.Vector3(1,0,0);break}let u=e.randomnessObject??Fo.defaultData([1,1,1]).randomnessObject,h=this.parameters.randomness===!0&&u.strength!==0?this.getRandom(u):null,f=cr(n.scale,r),m=cr(n.position,r),y=cr(u.scale,r),g=cr(u.position,r),v=cr(u.rotation,r),b=s/e.count,S=hh(u.strength,this.parameters.randomness);for(let[x,A]of this.children.entries()){let w=x*(u.freqScale/10)+u.movement,C=h===null?0:h.noise(w,w,w),T=x+1;A.scale.x=f[0]+S(T,ze(C,y[0]))||Un,A.scale.y=f[1]+S(T,ze(C,y[1]))||Un,A.scale.z=f[2]+S(T,ze(C,y[2]))||Un;let M=b*x-o;switch(n.axis){default:case"x":So.set(0,M,0);break;case"y":So.set(0,0,M);break;case"z":So.set(M,0,0);break}Mg.copy(d).applyQuaternion(FG.setFromEuler(So)).multiplyScalar(n.radius),A.position.set(Mg.x+(m[0]+S(T,ze(C,g[0]))),Mg.y+(m[1]+S(T,ze(C,g[1]))),Mg.z+(m[2]+S(T,ze(C,g[2]))));let D=S(T,ze(C,v[0])),I=S(T,ze(C,v[1])),_=S(T,ze(C,v[2]));n.alignment===!0?A.rotation.set(So.x+(c.x+D),So.y+(c.y+I),So.z+(c.z+_)):A.rotation.set(c.x+D,c.y+I,c.z+_)}}_updateLinear(e,r){if(e.type!=="linear")throw new Error;let n=e.linear,o=cr(n.rotation,r),a=cr(n.scale,r),s=cr(n.position,r),l=new $e.Euler(o[0]??0,o[1]??0,o[2]??0),c=e.randomnessObject??Fo.defaultData([1,1,1]).randomnessObject,d=cr(c.rotation,r),u=cr(c.scale,r),p=cr(c.position,r),f=this.parameters.randomness===!0&&c.strength!==0?this.getRandom(c):null,m=hh(c.strength,this.parameters.randomness);for(let[y,g]of this.children.entries()){let v=y*(c.freqScale/10)+c.movement,b=f===null?0:f.noise(v,v,v),S=y+1,x=m(S,ze(b,d[0])),A=m(S,ze(b,d[1])),w=m(S,ze(b,d[2]));g.scale.x=1+(a[0]-1)*y+m(S,ze(b,u[0]))||Un,g.scale.y=1+(a[1]-1)*y+m(S,ze(b,u[1]))||Un,g.scale.z=1+(a[2]-1)*y+m(S,ze(b,u[2]))||Un,g.rotation.set(l.x*y+x,l.y*y+A,l.z*y+w),g.position.x=s[0]*y+m(S,ze(b,p[0])),g.position.y=s[1]*y+m(S,ze(b,p[1])),g.position.z=s[2]*y+m(S,ze(b,p[2]))}}_updateGrid(e,r){let n=0,o=e.grid,a=e.randomnessObject??Fo.defaultData([1,1,1]).randomnessObject,s=cr(a.scale,r),l=cr(a.rotation,r),c=cr(a.position,r),u=this.parameters.randomness===!0&&a.strength!==0?this.getRandom(a,!0):null,p=hh(a.strength,this.parameters.randomness),h=cr(o.count,r),f=cr(o.size,r);if(o.useCenter===!0){let m={x:h[0]%2===0?2:1,y:h[1]%2===0?2:1,z:h[2]%2===0?2:1},y=new $e.Vector3(f[0]*(h[0]-m.x)*.5,f[1]*(h[1]-m.y)*.5,f[2]*(h[2]-m.z)*.5);for(let g=0;g<h[0];g++)for(let v=0;v<h[1];v++)for(let b=0;b<h[2];b++){let S=this.children[n++];if(!S)continue;let x=u===null?0:u.noise((g+1)*(a.freqScale/10)+a.movement,(v+1)*(a.freqScale/10)+a.movement,(b+1)*(a.freqScale/10)+a.movement);S.scale.x=1+p(n,ze(x,s[0]))||Un,S.scale.y=1+p(n,ze(x,s[1]))||Un,S.scale.z=1+p(n,ze(x,s[2]))||Un;let A=p(n,ze(x,l[0])),w=p(n,ze(x,l[1])),C=p(n,ze(x,l[2]));S.rotation.set(A,w,C),S.position.x=f[0]*g-y.x+p(n,ze(x,c[0])),S.position.y=f[1]*v-y.y+p(n,ze(x,c[1])),S.position.z=f[2]*b-y.z+p(n,ze(x,c[2]))}}else for(let m=0;m<h[0];m++)for(let y=0;y<h[1];y++)for(let g=0;g<h[2];g++){let v=this.children[n++];if(!v)continue;let b=u===null?0:u.noise((m+1)*(a.freqScale/10)+a.movement,(y+1)*(a.freqScale/10)+a.movement,(g+1)*(a.freqScale/10)+a.movement);v.scale.x=1+p(n,ze(b,s[0]))||Un,v.scale.y=1+p(n,ze(b,s[1]))||Un,v.scale.z=1+p(n,ze(b,s[2]))||Un;let S=p(n,ze(b,l[0])),x=p(n,ze(b,l[1])),A=p(n,ze(b,l[2]));v.rotation.set(S,x,A),v.position.x=f[0]*m+p(n,ze(b,c[0])),v.position.y=-f[1]*y+p(n,ze(b,c[1])),v.position.z=-f[2]*g+p(n,ze(b,c[2]))}}_updateToObject(e,r){if(e.type!=="toObject")throw new Error;let{toObject:n}=e,o=cr(n.rotation,r),a=cr(n.position,r),s=cr(n.scale,r),l=new $e.Euler(o[0],o[1],o[2]),c=e.randomnessObject??Fo.defaultData([1,1,1]).randomnessObject,d=cr(c.rotation,r),u=cr(c.position,r),p=cr(c.scale,r),f=this.parameters.randomness===!0&&c.strength!==0?this.getRandom(c):null,m=hh(c.strength,this.parameters.randomness);if(!n.object){for(let[,A]of this.children.entries())A.position.set(0,0,0),A.scale.setScalar(1),A.rotation.set(0,0,0);this.objectForSample=void 0,this.invalidateSurfaceCaches();return}if(!this.objectForSample)return;if(this.objectForSample instanceof Is)if(!this.objectForSample.font?.isLoaded||this.objectForSample.geometry.attributes.position===void 0){this._pendingMediaLoad=!0;return}else this._pendingMediaLoad=!1;if(this.objectForSample.geometry===void 0&&this.objectForSample.isAncestorOf(this.object.uuid)){console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);return}let y=this.getSubdivData();if(y.length>0){let A=Math.round(y.length*n.count/100);this._updateCount(r,A)}else{let A=this.objectForSample.geometry.getAttribute("position");if(!A||isNaN(A.count)||A.count===0){console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`);return}}this.objectForSample.updateMatrixWorld();let g=n.spreadType==="random",v=null;g&&(v=this.getSurfaceSampler(),v.setRandomGenerator((0,Ig.default)(this.object.uuid+n.seed)));let b=ZO[n.axis],S=this.children;Ds.fromArray(b);let x=this.objectForSample instanceof Va;x&&lI.copy(this.objectForSample.matrixWorld).invert(),n.align!=="normal"&&this.object.getWorldDirection(pI),P1.set(Ds.y,Ds.z,Ds.x).normalize(),fI.copy(P1).cross(Ds).normalize(),dI.makeBasis(P1,Ds,fI).invert();for(let[A,w]of S.entries()){let C=A*(c.freqScale/10)+c.movement,T=f===null?0:f.noise(C,C,C),M=A+1,D=m(M,ze(T,d[0])),I=m(M,ze(T,d[1])),_=m(M,ze(T,d[2]));g?v.sample(Pg,E1):(y.length&&(Pg.fromArray(y[A].pos),E1.fromArray(y[A].norm)),x&&Pg.applyMatrix4(lI)),w.position.copy(Pg);let E=n.align==="normal"?E1:pI,B=Tg.fromArray(a);Tg.x+=m(M,ze(T,u[0])),Tg.y+=m(M,ze(T,u[1])),Tg.z+=m(M,ze(T,u[2]));let L=Math.acos(E.dot(Ds)),k=kG.crossVectors(Ds,E).normalize(),F=_G.makeRotationAxis(k,L);T1.copy(E).cross(this.object.up).normalize(),hI.copy(T1).cross(E).normalize(),cI.makeBasis(T1,E,hI),uI.multiplyMatrices(cI,dI),So.setFromRotationMatrix(uI),B.applyMatrix4(F),w.position.add(B),w.rotation.set(So.x+l.x+D,So.y+l.y+I,So.z+l.z+_),w.scale.set(1+s[0]+m(M,ze(T,p[0]))||Un,1+s[1]+m(M,ze(T,p[1]))||Un,1+s[2]+m(M,ze(T,p[2]))||Un),w.scale.multiply(this.object.scale)}}getSurfaceSampler(){let e=this.objectForSample,r=e.geometry,n=r.getAttribute("position"),o=r.index,a=this.surfaceSamplerCache;if(a!==null&&a.geometry===r&&a.position===n&&a.positionVersion===Og(n)&&a.index===o&&a.indexVersion===(o===null?-1:o.version))return a.sampler;let s=new Sg(e).build();return this.surfaceSamplerCache={geometry:r,position:n,positionVersion:Og(n),index:o,indexVersion:o===null?-1:o.version,sampler:s},s}invalidateSurfaceCaches(){this.surfaceSamplerCache=null,this.surfacePointsCache=null}getSubdivData(){if(!this.objectForSample)return[];let e=this.parameters.toObject.spreadType;if(e==="random")return[];let r=this.objectForSample instanceof Va,n=this.objectForSample.geometry;if(!r&&n){let l=this.surfacePointsCache,c=n.getAttribute("position");if(l!==null&&l.spreadType===e&&l.geometry===n&&l.position===c&&l.positionVersion===Og(c)&&l.index===n.index&&l.indexVersion===(n.index===null?-1:n.index.version))return l.points}let o=new Map,a=(l,c)=>{let d=Math.round(l[0]*1e4)+"_"+Math.round(l[1]*1e4)+"_"+Math.round(l[2]*1e4),u=o.get(d);u?(u.pos[0]+=l[0],u.pos[1]+=l[1],u.pos[2]+=l[2],u.norm[0]+=c[0],u.norm[1]+=c[1],u.norm[2]+=c[2],u.count+=1):o.set(d,{pos:[...l],norm:[...c],count:1})};if(r){let l=this.objectForSample,c=JO[e],d=gI[c],u=mI[c],p=yI[c],h=d(l.subdivPointerNew);for(let f=0;f<=h-1;f++){let m=u(l.subdivPointerNew,f),y=p(l.subdivPointerNew,f);oI.fromArray(m).applyMatrix4(l.matrixWorld),aI.fromArray(y),a(oI.toArray(),aI.toArray())}}else(n.index?$O(n):eI(n)).forEach((c,d)=>{e==="polygon_center"&&a(c.midpoint,c.norm),e==="vertex"&&(a(c.vertices[0],c.norm),a(c.vertices[1],c.norm),a(c.vertices[2],c.norm)),e==="edge"&&(a(c.faceCenters[0],c.norm),a(c.faceCenters[1],c.norm),a(c.faceCenters[2],c.norm))});let s=Array.from(o.values());for(let l of s)l.pos[0]/=l.count,l.pos[1]/=l.count,l.pos[2]/=l.count,l.norm[0]/=l.count,l.norm[1]/=l.count,l.norm[2]/=l.count;if(!r&&n){let l=n.getAttribute("position");this.surfacePointsCache={spreadType:e,geometry:n,position:l,positionVersion:Og(l),index:n.index,indexVersion:n.index===null?-1:n.index.version,points:s}}return s}updateState(e,r){this.parameters=Ss(e);let{parent:n,matrix:o}=this;if(this.parameters.type!=="toObject")this.invalidateSurfaceCaches(),(this.parent===null||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(this.parent===null||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent(),this.invalidateSurfaceCaches();let s=r.scene.find(this.parameters.toObject.object);s instanceof it?this.objectForSample=s:this.objectForSample=void 0,this.matrix=new $e.Matrix4,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,s&&s.add(this)}let a=this._layout(r);this._syncEnclosingCopies(a||this.parent!==n||this.matrix!==o)}get pendingMediaLoad(){return this._pendingMediaLoad}},mh=class extends Tn{constructor(e){super(e.object,e.parameters);this.source=e;this.matrixAutoUpdate=!1}get insideBoolean(){return this.source.insideBoolean}expand(){this.matrix=this.source.matrix,this.matrixWorldNeedsUpdate=!0;let e=0;for(let r of this.source.children){if(!(r instanceof lr))continue;let n=this.children[e];n===void 0&&(n=new lr(this.object),this.add(n)),n.matrix=r.matrix,n.matrixWorldNeedsUpdate=!0,n.expand(),e+=1}for(;this.children.length>e;)this.remove(this.children[e])}};var Ao=24,Nr=96,oa=RM(),Ga=2;var O1=!1,vI=!0;try{let i=new URLSearchParams(window.location.search);O1=i.get("dbgsbstatic")==="0",vI=i.get("sb512")!=="0"}catch{}function VG(i){let t=i.getAttribute("position");return t===void 0?-1:(t.version??t.data?.version??0)*1048576+(t.count??0)%1048576}var I1=class extends tt{constructor(e,r,n){super(e,r,n);this.data=r;this.isShapeBlendEntity=!0;this.needsRebuild=!0;this.customDepthMaterialNeedsUpdate=!1;this._prevShapeData=null;this._prevSpan=-1;this._reach=new Float32Array(Nr);this._prevReach=new Float32Array(Nr);this._fieldDirtyFull=!0;this._fieldDirtyMin=new me.Vector3;this._fieldDirtyMax=new me.Vector3;this._maxBlendK=0;this._meshSdfBaked=new Map;this._meshSdfWanted=new Map;this._passesRenderer=null;this._npart=-1;this.spatialn=1;this.drawRangeNeedsForceUpdate=!0;this._resolutionLevel=-1;this._authoredResolutionLevel=-1;this.ultraFieldResolution=0;this.resolution=64;this.spatialDivisions=25;this.zLayersPerRow=8;this.basePyramidSize=512;this.pyramidTexture1Width=341;this.pyramidTexture1Height=256;this.pyramidTexture2Width=170;this.pyramidTexture2Height=128;this.numLevels=9;this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512];this.bboxSize=0;this.bboxOffset=0;this.shapesDataTexture={value:void 0};this.spatialscene=new me.Scene;this.potentialPassScene=new me.Scene;this.voxelPassScene=new me.Scene;this._spatialPassRenderTargets=[];this._potentialPassRenderTargets=[];this._voxelPassRenderTargets=[];this._pyramidRenderTargets=[];this.geometry=new me.BufferGeometry,this.geometry.drawRange.count=0,this.spatialPassUniforms={span:{value:-1},shapesDataTexture:this.shapesDataTexture,npart:{value:this.npart},spatialn:{value:this.spatialn}},this.spatialMesh=new me.Mesh(pd,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let o=new me.DataTexture(oa.triTable,16,256,me.RedFormat,me.FloatType);o.needsUpdate=!0;let a=new me.DataTexture(oa.numTrisTable,256,1,me.RedFormat,me.FloatType);a.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:a}},this.voxelMesh=new me.Mesh(pd,this.voxelPassMaterial()),this.voxelMesh.frustumCulled=!1,this.voxelPassScene.add(this.voxelMesh),this.potentialPassUniforms={shapesDataTexture:this.shapesDataTexture,spatialPassTexture:{value:void 0},npart:{value:this.npart},spatialn:{value:this.spatialn}},this.potentialMesh=new me.Mesh(pd,this.potentialPassMaterial()),this.potentialMesh.frustumCulled=!1,this.potentialPassScene.add(this.potentialMesh),this.marchPassUniforms={triTable:{value:o},potentialPassTexture:{value:void 0},voxelPassTexture:{value:void 0},pyramidTexture1:{value:void 0},pyramidTexture1Size:{value:void 0},pyramidTexture2:{value:void 0},pyramidTexture2Size:{value:void 0}},this.frustumCulled=!1,this.onBeforeShadowPass=s=>{let l=HG.call(this);if(this.npart===0){this.geometry.drawRange.count=0;return}let c=this.material.root;if(!c.shadersPatchedForShapeBlend)this.patchVertexShaderForShapeBlend(c),c.shadersPatchedForShapeBlend=!0,this.customDepthMaterialNeedsUpdate=!0;else if(this.customDepthMaterialNeedsUpdate){this.customDepthMaterialNeedsUpdate=!1,this.customDepthMaterial=new me.ShaderMaterial({vertexShader:c.vertexShader,fragmentShader:`
728
+ `&&o.push("")):t.getTextWidth(o[o.length-1]+a,i)>n&&(o[o.length-1].length&&o.push(""),t.getTextWidth(o[o.length-1]+a,i)>n&&(a.length===1?(o[o.length-1]+=a,a=""):(o[o.length-1]+=a.slice(0,-1),a=a[a.length-1],o.push(""))));return o[o.length-1]+=a,o}var Et=require("three");var X2,sg=new Promise(i=>{X2=i}),q2=!1;var ag;function Y2(i){if(q2)return;if(ag)return ag;async function t(){let r=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.124/build"),o=import("./process.js"),[a,s]=await Promise.all([o,fetch(`${r}/process.wasm`).then(d=>d.arrayBuffer())]),l=a.default,c=await l({wasmBinary:s});X2(c),q2=!0}return ag=t(),ag}var K2=require("three"),uG=new K2.Matrix4;function lg(i,t){if(Object.keys(i.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let e=Object.keys(i.attributes),r=Object.keys(t.attributes);if(e.length!==r.length)return!1;for(let l of r){let c=i.attributes[l],d=t.attributes[l];if(c===void 0||c.isInterleavedBufferAttribute===!0||d.isInterleavedBufferAttribute===!0||c.itemSize!==d.itemSize||c.normalized!==d.normalized||c.array.constructor!==d.array.constructor||c.array.length!==d.array.length)return!1}let n=i.index,o=t.index;if(n===null!=(o===null))return!1;let a=!1;if(n!==null&&o!==null){if(n.array.length!==o.array.length)return!1;let l=n.array.constructor,c=o.array.constructor;if(l!==c){if(l!==Uint32Array||c!==Uint16Array)return!1;a=!0}}if(i.groups.length!==t.groups.length)return!1;for(let l=0;l<t.groups.length;l++){let c=i.groups[l],d=t.groups[l];if(c.start!==d.start||c.count!==d.count||c.materialIndex!==d.materialIndex)return!1}for(let l of r){let c=i.attributes[l],d=t.attributes[l];c.array.set(d.array),c.needsUpdate=!0}let s=i.takeDepthStateFrom;if(typeof s=="function"&&s.call(i,t),n!==null&&o!==null){if(a){let l=n.array,c=o.array;for(let d=0,u=c.length;d<u;d++){let p=c[d];l[d]=p===65535?4294967295:p}}else n.array.set(o.array);n.needsUpdate=!0}return i.drawRange.start=t.drawRange.start,i.drawRange.count=t.drawRange.count,i.userData=t.userData,i.boundingBox=null,i.boundingSphere=null,!0}function ah(i,t,e,r){let n=i.position.array,o=i.normal.array,a=uG.makeScale(t,e,r).invert().elements,s,l,c;for(let d=0,u=n.length;d<u;d+=3)n[d]*=t,n[d+1]*=e,n[d+2]*=r,s=o[d],l=o[d+1],c=o[d+2],o[d]=a[0]*s+a[4]*l+a[8]*c,o[d+1]=a[1]*s+a[5]*l+a[9]*c,o[d+2]=a[2]*s+a[6]*l+a[10]*c;i.position.needsUpdate=!0,i.normal.needsUpdate=!0}var cg=new Et.Box3,Td=new Et.Vector3,Ce;sg.then(i=>{Ce=i});var Q2=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Z2=new Uint32Array([0,1,2,3]),J2=new Uint8Array([4]);function n1(i){let t=Number(i);return Number.isInteger(t)&&t>=0&&String(t)===i?t:-1}function pG(i){let t=Object.keys(i),e=0;for(let n of t){let o=n1(n);o>=e&&(e=o+1)}if(e===0||e>t.length)return;let r=new Array(e);for(let n=0;n<e;n++){let o=i[n];if(typeof o!="number")return;r[n]=o}return r}function dg(i){if(i!=null){if(Array.isArray(i)||ArrayBuffer.isView(i)&&!(i instanceof DataView))return i;if(typeof i=="object")return pG(i)}}function $S(i){if(i==null)return"missing";if(Array.isArray(i))return`Array(${i.length})`;if(ArrayBuffer.isView(i)){let l=i;return`${i.constructor.name}(${l.length})`}if(typeof i!="object")return typeof i;let t=Object.keys(i),e=t.filter(l=>n1(l)===-1),r=0;for(let l of t){let c=n1(l);c>=r&&(r=c+1)}let n=i,o=-1,a=-1;for(let l=0;l<r;l++)l in n?typeof n[l]!="number"&&a===-1&&(a=l):o===-1&&(o=l);let s=[`${t.length} keys`,`max index ${r-1}`];return o!==-1&&s.push(`first missing index ${o}`),a!==-1&&s.push(`non-number at ${a} (${typeof n[a]})`),e.length&&s.push(`stray keys ${e.slice(0,3).join(",")}`),`Object{${s.join(", ")}}`}var Bt=class extends Et.BufferGeometry{constructor(e,r){super();this.data=e;this.flatShading=r;this.subdivPointer=0;this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,r){this.freeSubdivPointer();let n=this.data.scaleBaked.map(l=>typeof l=="number"?l:1),o=Oi.div(r.map(l=>typeof l=="number"?l:0),n);if(o.every(l=>l===1))return;this.subdividedGeometry&&ah(this.subdividedGeometry.attributes,...o),this.originalGeometry&&ah(this.originalGeometry.attributes,...o),this.data=e;let a=this.userData.parameters;this.userData.parameters={width:a.width*o[0],height:a.height*o[1],depth:a.depth*o[2]},this.originalGeometry.boundingSphere.center.multiply(Td.fromArray(o));let s=Td.set(a.width,a.height,a.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let r=e.phongAngle??35;this.flatShading&&(r=-1);let n=null;if(e.subdivisions>0){let a=0;try{a=Bt.allocate(e),n=Bt.buildRefined(a,e.subdivisions,r)}catch(s){console.error(s,e)}finally{a&&Bt.freeSubdivPointer(a)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let o=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=o}rebuild(){let e,r,n;try{({originalGeometry:e,subdividedGeometry:r,subdivPointer:n}=Bt.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Et.BoxGeometry(100,100,100),n=0}this.subdivPointer=n,this.originalGeometry=e,this.subdividedGeometry=r??void 0;let o=this.subdividedGeometry??this.originalGeometry;Object.assign(this,o),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Bt.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new Et.Sphere,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let r=e.attributes.position,n=e.boundingSphere.center;cg.setFromBufferAttribute(r),cg.getCenter(n),e.boundingSphere.radius=n.distanceTo(cg.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),cg.getSize(Td);let o={width:Td.x,height:Td.y,depth:Td.z};return this.userData.parameters=o,o}static build(e,r,n,o){let a,s,l=e?.phongAngle??35;n===!1&&(l=-1),r&&(Ce.free_bvh(r),Ce.free_subdivision_surface(r));try{a=Bt.allocate(e,o)}catch(d){console.error(d,e),a=Bt.allocate({positionWASM:Q2,indexWASM:Z2,verticesPerFaceWASM:J2},o)}Ce.set_destination_refinement_level(a,0);let c=Bt.buildLevel(a,!0,l);return e.subdivisions>0?s=Bt.buildRefined(a,e.subdivisions,l):s=null,{subdivPointer:a,originalGeometry:c,subdividedGeometry:s}}static buildRefined(e,r,n){try{return Ce.set_destination_refinement_level(e,r),Bt.buildLevel(e,!1,n)??null}catch{try{return Ce.set_destination_refinement_level(e,r-1),Bt.buildLevel(e,!1,n)??null}catch{return null}}}static primitiveToQuads(e,r,n){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 o=e.shape!==void 0||e.path!==void 0?r.geometry:Ui(e,n,!1,r),a;Sy(e)?a=o.getClosedTorusIndicesForBooleanOrSubdiv():a=o.getIndex();let{positions:s,triIndices:l,triOriginals:c}=sh(o.getAttribute("position"),a),d;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let f=e.radialSegments*e.heightSegments*3*2,m=f+e.radialSegments*3;d=[f,m]}let{indices:u,verticesPerFace:p,uvs:h}=hG(s,l,o,d,c);return{positions:s,indices:u,verticesPerFace:p,uvs:h}}static allocate(e,r){let n,o,a,s=[],l=[],c=dg(e.positionWASM),d=dg(e.indexWASM),u=dg(e.verticesPerFaceWASM);if(c&&c.length>0){if(!d?.length||!u?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${$S(e.positionWASM)}, indexWASM ${$S(e.indexWASM)}, verticesPerFaceWASM ${$S(e.verticesPerFaceWASM)}`);n=c,o=d,a=u;let T=dg(e.uvWASM);Ce.alloc_subdivision_surface_uvs&&T&&T.length===o.length*2&&(l=T)}else n=Q2,o=Z2,a=J2;let p=n.length,h=o.length,f=a.length,m=n.length+s.length+l.length,y=o.length+a.length,g=m*Float32Array.BYTES_PER_ELEMENT+y*Uint32Array.BYTES_PER_ELEMENT,v=m*Float32Array.BYTES_PER_ELEMENT,b=Ce._malloc(g);if(!b)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${g}) failed`);let S=new Float32Array(Ce.HEAPF32.buffer,b,m),x=new Uint32Array(Ce.HEAPU32.buffer,b+v,y);S.set(n,0),S.set(s,n.length),S.set(l,n.length+s.length),x.set(o,0),x.set(a,o.length);let A;e?.scaleBaked?.some(T=>T!==1)&&(A=new Et.Matrix4().makeScale(...e.scaleBaked.map(T=>typeof T=="number"?T:1))),r&&(A?A.premultiply(r):A=r);let w=b+(n.length+s.length)*Float32Array.BYTES_PER_ELEMENT,C=l.length?A?Ce.alloc_subdivision_surface_uvs2(b,p,b+v,h,b+v+o.length*Uint32Array.BYTES_PER_ELEMENT,f,w,l.length,A.elements):Ce.alloc_subdivision_surface_uvs(b,p,b+v,h,b+v+o.length*Uint32Array.BYTES_PER_ELEMENT,f,w,l.length):A?Ce.alloc_subdivision_surface2(b,p,b+v,h,b+v+o.length*Uint32Array.BYTES_PER_ELEMENT,f,A.elements):Ce.alloc_subdivision_surface(b,p,b+v,h,b+v+o.length*Uint32Array.BYTES_PER_ELEMENT,f);return Ce._free(b),C}static buildLevel(e,r,n,o,a,s=!1){let l=a?Ce.get_mesh_data2(e,r?Ce.Level.CONTROL:Ce.Level.REFINED,n,a.elements):Ce.get_mesh_data(e,r?Ce.Level.CONTROL:Ce.Level.REFINED,n),c=10,d=Ce.HEAPU32.subarray(l>>2,(l>>2)+c),u=d.subarray(4,4+4),p=0,h=Ce.HEAPU32[d[p]>>2],f=Ce.HEAPF32.subarray(h>>2,(h>>2)+u[p]);p++;let m=Ce.HEAPU32[d[p]>>2],y=Ce.HEAPF32.subarray(m>>2,(m>>2)+u[p]);p++;let g=Ce.HEAPU32[d[p]>>2],v=Ce.HEAPU32.subarray(g>>2,(g>>2)+u[p]);p++;let b=Ce.HEAPU32[d[p]>>2],S=Ce.HEAPU32.subarray(b>>2,(b>>2)+u[p]);p++;let x;if(Ce.alloc_subdivision_surface_uvs){let w=d[9];if(w>0){let C=Ce.HEAPU32[d[8]>>2];x=Ce.HEAPF32.subarray(C>>2,(C>>2)+w)}}if(o===void 0){let w=new Et.BufferGeometry;if(w.setIndex(new Et.Uint32BufferAttribute(S,1)),w.setAttribute("position",new Et.Float32BufferAttribute(f,3)),w.setAttribute("normal",new Et.Float32BufferAttribute(y,3)),x&&w.setAttribute("uv",new Et.Float32BufferAttribute(x,2)),r){w.setAttribute("faceMap",new Et.Uint32BufferAttribute(v,1));let C=new Float32Array(y.length/3*4).fill(0);w.setAttribute("color",new Et.BufferAttribute(C,4))}return Ce.free_mesh_data(l),w.userData.type="SubdivGeometry",w}if(o.getAttribute("position").copyArray(f),o.getAttribute("normal").copyArray(y),o.attributes.position.needsUpdate=!0,o.attributes.normal.needsUpdate=!0,s){let w=o.getIndex();w!==null&&w.array.length===S.length&&(w.copyArray(S),w.needsUpdate=!0)}let A=o.getAttribute("uv");x&&A&&A.array.length===x.length&&(A.copyArray(x),A.needsUpdate=!0),Ce.free_mesh_data(l)}static freeSubdivPointer(e){Ce.free_bvh(e),Ce.free_subdivision_surface(e)}static buildControlCageWireframe(e,r,n){let o=Ce.get_wireframe_data_for_base_level(e),a=4,s=Ce.HEAPU32.subarray(o>>2,(o>>2)+a),l=s.subarray(2,2+2),c=0,d=Ce.HEAPU32[s[c]>>2],u=Ce.HEAPF32.subarray(d>>2,(d>>2)+l[c]);c++;let p=Ce.HEAPU32[s[c]>>2],h=Ce.HEAPU32.subarray(p>>2,(p>>2)+l[c]);if(r===void 0){let f=new Et.BufferGeometry;f.setAttribute("position",new Et.Float32BufferAttribute(u,3));let m=new Float32Array(u.length);for(let y=0,g=u.length;y<g;)m[y++]=n.r,m[y++]=n.g,m[y++]=n.b;return f.setAttribute("color",new Et.BufferAttribute(m,3)),f.setIndex(new Et.Uint32BufferAttribute(h,1)),Ce.free_wireframe_data_for_base_level(o),f}r.getAttribute("position").copyArray(u),r.attributes.position.needsUpdate=!0,Ce.free_wireframe_data_for_base_level(o)}static updateCollabMesh(e,r,n){let o=r===0;o||Ce.set_destination_refinement_level(e,r);let a=n?Ce.get_topological_data2(e,o?Ce.Level.CONTROL:Ce.Level.REFINED,n.elements):Ce.get_topological_data(e,o?Ce.Level.CONTROL:Ce.Level.REFINED),s=8,l=Ce.HEAPU32.subarray(a>>2,(a>>2)+s),c=l.subarray(3,3+3),d=0,u=Ce.HEAPU32[l[d]>>2],p=new Float32Array(Ce.HEAPF32.subarray(u>>2,(u>>2)+c[d]));d++;let h=Ce.HEAPU32[l[d]>>2],f=new Uint32Array(Ce.HEAPU32.subarray(h>>2,(h>>2)+c[d]));d++;let m=Ce.HEAPU32[l[d]>>2],y=new Uint8Array(Ce.HEAPU32.subarray(m>>2,(m>>2)+c[d])),g;if(Ce.alloc_subdivision_surface_uvs){let v=l[7];if(v>0){let b=Ce.HEAPU32[l[6]>>2];g=new Float32Array(Ce.HEAPF32.subarray(b>>2,(b>>2)+v))}}return Ce.free_topological_data(a),{positions:p,indices:f,verticesPerFace:y,uvs:g}}};function pg(i){let t=Object.keys(i);return t.length===1&&t[0]==="subdivisions"}function sh(i,t){let e=t?t.count:i.count,r=0,n=1e4,o=new Map,a=new Uint32Array(e),s=[];for(let d=0;d<e;d++){let u=t?t.getX(d):d,p=i.getX(u),h=i.getY(u),f=i.getZ(u),m=Math.round(p*n),y=Math.round(h*n),g=Math.round(f*n),v=o.get(m);v===void 0&&(v=new Map,o.set(m,v));let b=v.get(y);b===void 0&&(b=new Map,v.set(y,b));let S=b.get(g);S===void 0&&(S=r++,b.set(g,S),s.push(p,h,f)),a[d]=S}let l=[],c=[];for(let d=0;d<a.length;d+=3)a[d]===a[d+1]||a[d]===a[d+2]||a[d+1]===a[d+2]||(l.push(a[d],a[d+1],a[d+2]),c.push(t?t.getX(d):d,t?t.getX(d+1):d+1,t?t.getX(d+2):d+2));return{positions:s,triIndices:l,triOriginals:c}}var ug=new Et.Vector3,e1=new Et.Vector3,t1=new Et.Vector3,r1=new Et.Vector3;function hG(i,t,e,r,n){let o=[],a=[],s=n?e.getAttribute("uv"):void 0,l=s&&s.itemSize===2?[]:void 0,c=p=>{if(l){let h=n[p];l.push(s.getX(h),s.getY(h))}};if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let p=e.userData.shape.extractShapePointsToFlatArray([]),h=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&h<=24&&h%4===0&&e.userData.parameters.angle>=360){let y=p.length/2/h;p=p.filter((g,v)=>Math.floor(v/2)%y===0)}let f=0;for(let y=0;y<p.length;y+=2)f+=(p[y]-p[(y===0?p.length:y)-2])*(p[y+1]+p[(y===0?p.length:y)-1]);i.length=0;let m=0;if(f<0)for(let y=0;y<p.length;y+=2)i.push(p[y],p[y+1],0),o.push(m++);else for(let y=p.length-2;y>=0;y-=2)i.push(p[y],p[y+1],0),o.push(m++);return a.push(m),{indices:o,verticesPerFace:a}}let d=new Float32Array([e.userData.parameters.depth])[0],u=0;for(;u<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let p=0;if((i[t[u]*3+2]===d||i[t[u]*3+2]===0)&&p++,(i[t[u+1]*3+2]===d||i[t[u+1]*3+2]===0)&&p++,(i[t[u+2]*3+2]===d||i[t[u+2]*3+2]===0)&&p++,p===3)break}if(t[u+1]===t[u+3]&&t[u+2]===t[u+5]||t[u+0]===t[u+3]&&t[u+2]===t[u+4]){ug.set(i[t[u]*3],i[t[u]*3+1],i[t[u]*3+2]),e1.set(i[t[u+1]*3],i[t[u+1]*3+1],i[t[u+1]*3+2]),t1.set(i[t[u+4]*3],i[t[u+4]*3+1],i[t[u+4]*3+2]),r1.set(i[t[u+5]*3],i[t[u+5]*3+1],i[t[u+5]*3+2]),e1.sub(ug).normalize(),t1.sub(ug).normalize(),r1.sub(ug).normalize();let p=e1.cross(t1).dot(r1),h=u;Math.abs(p)>.005||r&&r.some((f,m)=>m%2===1?!1:h>=r[m]&&h<r[m+1])?(o.push(t[u],t[u+1],t[u+2]),c(u),c(u+1),c(u+2),a.push(3),u+=3):(o.push(t[u],t[u+1],t[u+4],t[u+5]),c(u),c(u+1),c(u+4),c(u+5),a.push(4),u+=6)}else o.push(t[u],t[u+1],t[u+2]),c(u),c(u+1),c(u+2),a.push(3),u+=3}if(e.useNgonForTopBottomFaceDuringBake){let p=[],h=[],f=0;for(let m=0,y=0;m<i.length;m+=3,y++)i[m+2]===0&&(p.push(y),f++),i[m+2]===d&&h.push(y);if(e.userData.parameters.extrudeBevelSize===0){let m=h[0];h[0]=h[1],h[1]=m}p.reverse(),o.push(...p,...h),a.push(f,f),l=void 0}return{indices:o,verticesPerFace:a,uvs:l}}var fG={ConeGeometry:qM,CubeGeometry:XM,CylinderGeometry:Hy,DodecahedronGeometry:KM,EllipseGeometry:Sd,HelixGeometry:YP,IcosahedronGeometry:I2,LatheGeometry:D2,NonParametricGeometry:R2,PolygonGeometry:ig,PyramidGeometry:B2,RectangleGeometry:wd,SphereGeometry:N2,PlaneGeometry:_2,BackdropGeometry:k2,StarGeometry:og,TextFrameGeometry:V2,TorusGeometry:G2,TorusKnotGeometry:z2,TriangleGeometry:j2,VectorGeometry:ei},hg=i=>{let t=fG[i.type]??yy(i.type);if(t===void 0)throw new Error(`No geometry factory registered for "${i.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(i)};var mG=["font"];function Ui(i,t,e,r){let n,o,a;i.type==="PathGeometry"?(o={...i,extrusion:{...i.extrusion}},a=[[],["extrusion"]]):(o={...i},a=[[]]);for(let c of a){let d=o;for(let u of c)d=d[u];for(n in d){let u=d[n];Ap(u)&&!mG.includes(n)&&(d[n]=t.getVariable(u,[r.uuid,"geometry",...c,n]),Ap(d[n])&&(d[n]=1))}}let s={parameters:o,type:o.type};if(o.type==="PathGeometry"){s.path=o.path;let c=r.profileShape;c!==void 0&&(s.shapeData=c),s.ownerId=r.uuid}else if(o.type==="VectorGeometry"){let c=ht.createFromState(o.shape,o.width,o.height);s.shape=c,s.ownerId=r.uuid}else if(o.type==="NonParametricGeometry"){if(o.data.groups&&o.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),s.geometry=new $2.BufferGeometryLoader().parse(o),s.geometry.groups.length===0){let c=s.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else if(o.type==="SubdivGeometry"){let c=new Bt(o,e);return c.data=i,c}else if(o.type==="TextGeometry"||o.type==="InputGeometry"){let c=yy(o.type);if(c)return c.create(o,t);xr("text",`a ${o.type}`);let d=ht.createFromState(gs.defaultData(),100,100);return hg({...o,shape:d,type:"VectorGeometry"})}else if(o.type==="UIGeometry")return wd.create({parameters:{width:o.width,height:o.height,cornerRadius:o.cornerRadius,cornerType:o.cornerType}});let l;try{l=hg(s)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${s}`);let d=ht.createFromState(gs.defaultData(),100,100);s.shape=d,s.type="VectorGeometry",l=hg(s)}return l}var yG=new Set(["CubeGeometry","SphereGeometry","CylinderGeometry","ConeGeometry","TorusGeometry","TorusKnotGeometry","IcosahedronGeometry","DodecahedronGeometry","PyramidGeometry","PlaneGeometry","BackdropGeometry","HelixGeometry"]);function eO(i,t,e){if(!yG.has(i.type))return;let r=i;if(r.shapeBlendNode!=null||e.isTransientGeometryKey(i))return;let n=t.material;if(n===void 0||Array.isArray(n))return;let o=n;if(typeof o.getLayersOfType!="function"||o.getLayersOfType("outline").length>0||o.getLayersOfType("cavity").length>0)return;let a=i.type;for(let s of Object.keys(r).sort()){let l=r[s];if(l===void 0||s==="type")continue;let c=i1(l);if(c===void 0)return;a+=`|${s}=${c}`}return a}function i1(i){switch(typeof i){case"number":return Number.isFinite(i)?JSON.stringify(i):void 0;case"boolean":return JSON.stringify(i);case"string":return Ap(i)?void 0:JSON.stringify(i);case"object":{if(i===null)return"null";if(Array.isArray(i)){let n="[";for(let o=0;o<i.length;o++){let a=i1(i[o]);if(a===void 0)return;n+=(o>0?",":"")+a}return n+"]"}let t=i,e="{",r=!0;for(let n of Object.keys(t).sort()){if(t[n]===void 0)continue;let o=i1(t[n]);if(o===void 0)return;e+=`${r?"":","}${JSON.stringify(n)}:${o}`,r=!1}return e+"}"}default:return}}var o1=class{constructor(){this.objects=new Map;this.refs=new Map;this.sharedByKey=new WeakSet;this.unreachable=new Set}resolveObject(t,e,r){return this.createObject(t,e,r)}onObjectDisposed(t){}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,r){let n=this.objects.get(t);return n===void 0?(n=this.resolveObject(t,e,r),this.objects.set(t,n),this.retain(n)):(this.sharedByKey.add(n),n.isShared=!0),n}forceDelete(t){let e=this.objects.get(t);e&&(this.objects.delete(t),this.release(e))}adopt(t,e){this.replace(t,e),this.retain(e)}mutateIfUnique(t,e){let r=this.objects.get(t);if(r&&r.isShared!==!0)return this.objects.delete(t),this.replace(e,r),r}replace(t,e){let r=this.objects.get(t);this.objects.set(t,e),r!==void 0&&r!==e&&this.release(r)}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){let r=this.objects.get(t);e===r?this.unreachable.delete(t):!1&&console.warn("Reachable but deleted",t)}endGc(){this.unreachable.forEach(t=>{let e=this.objects.get(t);this.objects.delete(t),this.release(e)}),this.unreachable.clear()}dispose(){new Set(this.objects.values()).forEach(t=>{this.disposeObject(t),this.onObjectDisposed(t)}),this.objects.clear(),this.refs.clear()}retain(t){let e=(this.refs.get(t)??0)+1;this.refs.set(t,e),e>1&&(t.isShared=!0)}release(t){let e=(this.refs.get(t)??1)-1;if(e>0){this.refs.set(t,e),e===1&&!this.sharedByKey.has(t)&&(t.isShared=!1);return}this.refs.delete(t),this.disposeObject(t),this.onObjectDisposed(t)}},lh=class extends o1{constructor(e){super();this.flatShading=e;this.dedupeByValue=!1;this.byValue=new Map;this.valueKeyOf=new Map}disposeObject(e){e.dispose()}createObject(e,r,n){let o=Ui(e,r,this.flatShading,n);return o.computeBoundingSphere(),o}resolveObject(e,r,n){let o=this.dedupeByValue?eO(e,n,r):void 0;if(o!==void 0){let s=this.byValue.get(o);if(s!==void 0)return s}let a=this.createObject(e,r,n);return o!==void 0&&(this.byValue.set(o,a),this.valueKeyOf.set(a,o)),a}mutateIfUnique(e,r){let n=super.mutateIfUnique(e,r);return n!==void 0&&this.forgetValue(n),n}onObjectDisposed(e){this.forgetValue(e)}forgetValue(e){let r=this.valueKeyOf.get(e);r!==void 0&&(this.valueKeyOf.delete(e),this.byValue.get(r)===e&&this.byValue.delete(r))}};var l1="webgl",tO,a1,rO=!1;function c1(){return l1}function iO(i){a1=i}function oO(){if(l1==="webgpu"){if(tO!==void 0)return tO;rO||(rO=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(a1===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return a1}function fg(i,t){return oO().createRootMaterial(i,t)}function d1(i,t,e){return oO().createSharedMaterial(i,t,e)}function u1(i){return i.getLayersOfType===void 0&&Object.assign(i,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),i}var nO,aO;function sO(i){aO=i}function lO(){let i=l1==="webgpu"&&nO!==void 0?nO:aO;return i===void 0?null:u1(i())}var s1;function cO(i){s1=i}function dO(i,t){return s1===void 0?!1:s1(i,t)}var uO={markNeedsUpdateRendererDirty:()=>{}};function pO(i){return i.data.type!=="displace"&&!!i.data.isMask}function zi(i,t){let e=0;if(!i.layers||i.layers.length===0)return!1;let r=i.layers?.find(o=>o.data.type==="light");if(r){let o=r.data,a=Number(t.getVariable(o.alphaOverride));if((typeof o.alphaOverride=="string"?a/100:o.alphaOverride)<1)return!0}let n=i.layers;for(let o=0;o<n.length;o++){let a=n[o];if(!pO(a)){if(o>0&&pO(n[o-1])){if(a.data.type==="light"&&!a.data.visible)return!0;continue}if(a.data.type!=="displace"&&"alpha"in a.data&&a.data.type!=="light"&&a.data.type!=="fresnel"&&a.data.type!=="cavity"&&a.data.type!=="dust"&&a.data.type!=="texture"&&a.data.type!=="matcap"&&a.data.type!=="rainbow"&&a.data.type!=="outline"&&a.data.type!=="pattern"){let s=a.data.visible?a.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&a.data.type==="depth"||a.data.type==="gradient"){for(let l of a.data.colors)if(l[3]<1){s=l[3];break}}else if(s===1&&a.data.type==="noise"){let l=t.color(a.data.colorA).a,c=t.color(a.data.colorB).a,d=t.color(a.data.colorC).a,u=t.color(a.data.colorD).a,p=Math.min(l,Math.min(c,Math.min(d,u)));p<1&&(s=p)}e+=(1-e)*s}}}return e<1}var mg=require("three"),ji=(i,t,e)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof i=="number"?i*100:i,e)??100)/100))??1,he=(i,t,e)=>typeof i=="number"?i:t.getVariable(i,e),ti=(i,t)=>(i||(i=new mg.Vector3),i.x=he(i.x,t)??0,i.y=he(i.y,t)??0,i.z=he(i.z,t)??0,i),vi=(i,t)=>(i||(i=new mg.Vector2),i.x=he(i.x,t)??0,i.y=he(i.y,t)??0,i);function hO(i,t){return i==="displace"?t==="intensity":t==="alpha"}function fO(i,t,e){let r=i==="alpha"?Math.max(0,Math.min(Number(t)/100,1)):Number(t);return e?r:0}function p1(i){let t=typeof i=="string"?i:i.type;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function bo(i){return typeof i=="string"||typeof i=="number"&&i!==0}var Pd={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},mO={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]};var yO=require("three");var h1=class extends nd(yO.Object3D){},gG=i=>i.type==="Mesh",lr=class extends h1{constructor(e){super();this.object=e;this.isClone=!0;this.matrixAutoUpdate=!1}raycast(e,r){}expand(){let e=0,r=this.object.entityChildren(e);for(;r;){let n=this.children[e];(!(n instanceof lr)||n.object!==r)&&(n=new lr(r),this._replaceChildAt(e,n),n.matrixWorldNeedsUpdate=!0,n.matrixAutoUpdate=!1,n.matrix=r.matrix,n.shearMatrix=r.shearMatrix,n.pivotMatrix=r.pivotMatrix),n.expand(),e+=1,r=this.object.entityChildren(e)}for(let n of this.object.children){if(!ed(n)||n.object.parent!==this.object)continue;let o=this.children[e];o?.source!==n&&(o=n.createCopy(),this._replaceChildAt(e,o)),o.expand(),e+=1}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}_replaceChildAt(e,r){let n=this.children[e];n&&this.remove(n),this.add(r),this.children.splice(e,0,this.children.pop())}get visible(){let e=this.parent,r=ed(e)&&e.object===this.object;return r&&(e.instancingActive||e.insideBoolean)?!1:this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||r&&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 gG(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}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}};yt();var bi=require("three");var gO=null,vO=null;function bO(i){gO=i}function f1(){return gO}function xO(i){vO=i}function SO(){return vO}function yg(i){return"variable_"+i}var AO=new bi.Matrix4,wO=new bi.Vector3,CO=new bi.Quaternion,xG=new bi.Vector3,EO=new bi.Euler,m1=class extends zy{constructor(e){super();this.shared=e}create(e){return new hd(e,this.shared)}},TO=new Set;function SG(i,t){let e=`${i}/${t}`;TO.has(e)||(TO.add(e),console.warn(`[spline] updateObject: ignoring a geometry update of ${i} vertices for a mesh that holds ${t}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}var y1=class{constructor(t,e={},r=!0,n=!1){this.data=t;this.needsJitter=r;this.enableLocalStorageForPersistentVariables=n;this.geometryCache=new lh(!0);this.geometryCache2=new lh(!1);this.imageHolderCache=new m1(this);this.thisContext={scene:uO,shared:this};this.deletedImage=new yi(Nc.emptyImage,this);this.deletedVideo=new yi(Lc.defaultVideo,this);this.materials={};this.images={};this.uiBuffers={};this.videos={};this.colors={};this.audios={};this.particles={};this.fonts={};this.variables={};this.userAPIs={};this.userWebhooks={};this.mouseProperty=null;this.raycastProperty=null;this.requestRender=()=>{this._requestRender&&this._requestRender()};this.transientGeometryKeys=new WeakSet;if(e.images)for(let[o,a]of Object.entries(e.images))this.addImage(o,a);if(e.videos)for(let[o,a]of Object.entries(e.videos))this.addVideo(o,a);if(e.audios)for(let[o,a]of Object.entries(e.audios))this.addAudio(o,a);if(e.particles)for(let[o,a]of Object.entries(e.particles))this.addParticle(o,a);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=d1(sr.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,r=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:o}of t.variables)this.addVariableHolder(n,o),e&&this.updateVariableHolder(n,o);for(let[n,o]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,o);for(let[n,o]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,o);if(!r){for(let[n,o]of Object.entries(t.images))this.addImage(n,o);for(let[n,o]of Object.entries(t.videos))this.addVideo(n,o)}for(let[n,o]of Object.entries(t.colors))this.addColor(n,o);for(let[n,o]of Object.entries(t.lib.materials))this.addMaterial(n,o.asset);for(let[n,o]of Object.entries(t.materials))this.addMaterial(n,o);for(let[n,o]of Object.entries(t.audios))this.addAudio(n,o);for(let[n,o]of Object.entries(t.particles))this.addParticle(n,o);for(let[n,o]of Object.entries(t.fonts))this.addFont(n,o)}addMaterial(t,e){if(e=sr.withRepairedLayers(e),this.materials[t]){let r=this.materials[t];r.reset(e,this.thisContext),r.dispose()}else{let r=d1(e,this.thisContext,t);this.materials[t]=r}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):fg(sr.withRepairedLayers(t),this.thisContext)}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new yi(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new yi(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}getEntityTexture(t,e={}){let r=t.material;if(!r)return null;for(let n of Array.isArray(r)?r:[r]){let o=n.root??n;for(let a of o?.data?.layers??[]){let s=a?.data;if(s?.type!=="texture"&&s?.type!=="matcap"||e.layer!==void 0&&a.id!==e.layer&&s.type!==e.layer)continue;let l=s.texture?.image;if(l==null)continue;let c=(typeof l=="string"?this.uiBuffer(l):void 0)??this.image(l);if(!c)continue;let d=c.getTexture(s.texture.wrapping??(s.type==="texture"?1e3:1001),s.texture.minFilter??1008,s.texture.magFilter??1006),u=c.img;return{texture:d,width:u?.width??0,height:u?.height??0,layerId:a.id,layerType:s.type}}}return null}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new yi(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new La(e.r,e.g,e.b,e.a):this.colors[t]=new La(e.r,e.g,e.b,1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let r=this.colors[t];return this.colors[t].r=e.r??r.r,this.colors[t].g=e.g??r.g,this.colors[t].b=e.b??r.b,this.colors[t].a=e.a??r.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t=="string"){let r=this.getColor(t);r?e=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new Vt(0,0,0,0))}else return"a"in t?new Vt(t.r,t.g,t.b,t.a):new Vt(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof ka)return e;{let r=new ka({src:e.data});return this.audios[t]=r,r}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof ka&&e.dispose(),delete this.audios[t])}addFont(t,e){let r=HM();if(r===null){xr("text","a font asset");return}this.fonts[t]=new r(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof ka&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let r=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(yg(t));r=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:r,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(yg(t),JSON.stringify(e));let r=e;for(;typeof r=="string";)r=this.variables[r].value;let n=this.entityOpContext.scene,o=!1;for(let a=this.variables[t].locations.length-1;a>=0;a--){let s=this.variables[t].locations[a];if(s[0]==="material"){let l=s[1],c=r,d={scene:n,shared:this},u=s.slice(2);n.traverseMaterial(h=>{let f=h.root??h;f.uuid===l&&f.onVariableUpdate(u,c,d)});let p=this.materials[l];p&&p.onVariableUpdate(u,c,d)}else{let l=n.find(s[0]);if(l===void 0){this.variables[t].locations.splice(a,1);continue}if(o=!0,s[1]!=="geometry"&&s[1]!=="particles"){for(let c=1;c<s.length-1;c++)l=l[s[c]];s[1]==="rotation"?l[s[s.length-1]]=r*bi.MathUtils.DEG2RAD:l[s[s.length-1]]=r}if(l=n.find(s[0]),l.type==="ParticleEmitter"&&l.updateVariableState(r,s),Ne.is(l))if(s[1]==="position"||s[1]==="rotation"||s[1]==="scale")l.onVariableUpdate();else if(s[1]==="geometry"){let c=l;l.component&&(c=l.component);let d=c.dataPatched;c.chooseGeoemtryCache(this).forceDelete(d.geometry),c.createGeometryDelayed(this.entityOpContext),c.onVariableUpdate(!0),c.invalidateDownstreamBooleanData(),c.instances.forEach(u=>{let p=u.dataPatched;u.chooseGeoemtryCache(this).forceDelete(p.geometry),u.createGeometryDelayed(this.entityOpContext),u.onVariableUpdate(!0),u.invalidateDownstreamBooleanData()})}else s[1]==="morphTargetInfluences"&&l.updateMorphInfluences(s[2],r)}}return o&&n.markShadowsDirty(),this.requestRender(),!0}isTransientGeometryKey(t){return this.transientGeometryKeys.has(t)}updateEntityGeometryParams(t,e){let r=t;if(r.component&&(r=r.component),typeof r.chooseGeoemtryCache!="function")return!1;let n=r.dataPatched,o=n?.geometry;if(!o||typeof o.type!="string"||o.type==="VectorGeometry"||o.type==="PathGeometry")return!1;let a=d=>d.toLowerCase().replace(/[\s_.-]+/g,""),s=new Map;for(let d of Object.keys(o))s.set(a(d),d);let l={};for(let[d,u]of Object.entries(e??{})){let p=s.get(a(d));if(p===void 0||p==="type"||p==="font"||p==="shape"||p==="path"||p==="data")continue;if(p==="text"){(typeof u=="string"||typeof u=="number")&&(l[p]={textValue:String(u)});continue}let h=o[p];typeof u=="number"&&isFinite(u)&&(typeof h=="number"||typeof h=="string")&&(l[p]=u)}if(Object.keys(l).length===0)return!1;let c={...o,...l};return r.dataPatched={...n,geometry:c},this.transientGeometryKeys.has(o)&&r.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(c),r.createGeometryDelayed(this.entityOpContext),r.onVariableUpdate(!0),r.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let n=e.dataPatched?.geometry;return!n||!this.transientGeometryKeys.has(n)?!1:(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(n),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0)}updateEntityGeometryVertices(t,e){let r=t;if(r.component&&(r=r.component),typeof r.chooseGeoemtryCache!="function")return!1;let n=r.dataPatched,o=n?.geometry;if(!o||o.type!=="NonParametricGeometry")return!1;let a=e?.vertices;if(a===void 0||typeof a.length!="number"||a.length<9||a.length%3!==0||a.length/3>y1.MAX_TRANSIENT_VERTICES)return!1;let s=a instanceof Float32Array?a:Float32Array.from(a),l=s.length/3,c;if(e.normals!==void 0){if(e.normals.length!==s.length)return!1;c=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}let d;if(e.uvs!==void 0){if(e.uvs.length!==l*2)return!1;d=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}let u;if(e.indices!==void 0){let A=l>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(A.length===0||A.length%3!==0)return!1;for(let w=0;w<A.length;w++)if(A[w]>=l)return!1;u={array:A,itemSize:1,type:A.constructor.name,normalized:!1}}else{let A=o.data,w=A?.index;if(w?.array?.length){let C=(A?.attributes?.position?.array?.length??0)/3;if(l!==C)return SG(l,C),!1;u=w}}let p=1/0,h=1/0,f=1/0,m=-1/0,y=-1/0,g=-1/0;for(let A=0;A<s.length;A+=3){let w=s[A],C=s[A+1],T=s[A+2];w<p&&(p=w),w>m&&(m=w),C<h&&(h=C),C>y&&(y=C),T<f&&(f=T),T>g&&(g=T)}let v=(A,w)=>({array:A,itemSize:w,type:"Float32Array",normalized:!1}),b={position:v(s,3)};c&&(b.normal=v(c,3)),d&&(b.uv=v(d,2));let S={...o,width:m-p,height:y-h,depth:g-f,data:{attributes:b,...u?{index:u}:{}}},x=this.transientGeometryKeys.has(o);return r.dataPatched={...n,geometry:S},this.transientGeometryKeys.add(S),r.applyTransientGeometryData(this.entityOpContext,x),r.onVariableUpdate(!0),r.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let r=t;r.component&&(r=r.component);let n=r.cloner;if(n===void 0)return-1;let o=n.children,a=Math.PI/180,s=!1;if(e===null)for(let l of o)l.transformOverride!==void 0&&(l.transformOverride=void 0,s=!0);else if(Array.isArray(e)){let l=Math.min(e.length,o.length);for(let c=0;c<l;c++){let d=e[c],u=o[c];if(d==null){u.transformOverride!==void 0&&(u.transformOverride=void 0,s=!0);continue}let p=u.transformOverride??{position:[u.position.x,u.position.y,u.position.z],rotation:[u.rotation.x,u.rotation.y,u.rotation.z],scale:[u.scale.x,u.scale.y,u.scale.z]};d.position&&(typeof d.position.x=="number"&&(p.position[0]=d.position.x),typeof d.position.y=="number"&&(p.position[1]=d.position.y),typeof d.position.z=="number"&&(p.position[2]=d.position.z)),d.rotation&&(typeof d.rotation.x=="number"&&(p.rotation[0]=d.rotation.x*a),typeof d.rotation.y=="number"&&(p.rotation[1]=d.rotation.y*a),typeof d.rotation.z=="number"&&(p.rotation[2]=d.rotation.z*a)),d.scale&&(typeof d.scale.x=="number"&&(p.scale[0]=d.scale.x),typeof d.scale.y=="number"&&(p.scale[1]=d.scale.y),typeof d.scale.z=="number"&&(p.scale[2]=d.scale.z)),u.transformOverride=p,u.position.fromArray(p.position),u.rotation.fromArray(p.rotation),u.scale.fromArray(p.scale),u.updateMatrix(),u.hasNonUniformScale&&(u.updateMatrixWorld(),u.updateMatrixWorldRigid())}}else return o.length;return s?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(r),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),o.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let r=t.parent;if(r===null)return;let n=new lr(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let o=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.shearMatrix.copy(t.shearMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*o),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*o),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*o)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),r.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let r=t.material;if(!r)return!1;let n=[];for(let d of Array.isArray(r)?r:[r]){let u=d.root??d;u&&Array.isArray(u.layers)&&u.data&&!n.includes(u)&&n.push(u)}if(n.length===0)return!1;let o={scene:this.entityOpContext.scene,shared:this},a=d=>d.toLowerCase().replace(/[\s_.-]+/g,""),s=d=>{if(typeof d=="string"){let u=new Vt(1,1,1,1);try{u.set(d)}catch{return null}return{r:u.r,g:u.g,b:u.b,a:void 0}}if(d&&typeof d=="object"&&"r"in d){let u=d;if([u.r,u.g,u.b].some(h=>typeof h!="number"||!isFinite(h)))return null;let p=Math.max(u.r,u.g,u.b)>1?1/255:1;return{r:u.r*p,g:u.g*p,b:u.b*p,a:typeof u.a=="number"?Math.max(0,Math.min(u.a,1)):void 0}}return null},l=(d,u,p)=>{if(!d.hasValue(u))return!1;let h=d.getValue(u);if(!h||typeof h!="object"||!h.isColor)return!1;let f=p.a??(typeof h.a=="number"?h.a:1);return h instanceof La?d.setValue(u,new Vt(p.r,p.g,p.b,f)):typeof h.setRGBA=="function"?h.setRGBA(p.r,p.g,p.b,f):h.setRGB(p.r,p.g,p.b),!0},c=!1;for(let d of n){let u=d.data.layers??[],p=h=>d.layers.find(f=>f.uuid===h);if(e.color!==void 0){let h=s(e.color),f=u.find(y=>y.data.type==="color"),m=f&&p(f.id);if(h&&m&&l(m,"color",h)&&(c=!0,h.a!==void 0)){let y=h.a<1?!0:zi(d.data,this);d.setTransparent?d.setTransparent(y,o.scene):d.transparent=y}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(d.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),o),c=!0);for(let h of e.layers??[]){if(!h||typeof h!="object")continue;let f=typeof h.id=="string"?u.find(v=>v.id===h.id):typeof h.index=="number"?u[h.index]:typeof h.type=="string"?u.find(v=>v.data.type===h.type):void 0,m=f&&p(f.id);if(!f||!m)continue;let y=Pd[f.data.type]??[],g=Object.keys(f.data);for(let[v,b]of Object.entries(h)){if(v==="id"||v==="index"||v==="type")continue;let S=g.find(A=>A===v)??g.find(A=>a(A)===a(v))??v;if(y.includes(S))continue;let x=s(b);if(x&&l(m,S,x)){c=!0;continue}if(typeof b=="number"&&isFinite(b))d.onVariableUpdate?.(["layer",f.id,S],b,o),c=!0;else if(Array.isArray(b)&&b.length<=3&&b.every(A=>typeof A=="number"&&isFinite(A))){let A=["x","y","z"];b.forEach((w,C)=>{d.onVariableUpdate?.(["layer",f.id,S,A[C]],w,o)}),c=!0}}}}return c&&this.requestRender(),c}deleteVariable(t){this.variables[t]&&delete this.variables[t]}referencesMissingObject(t){return Array.isArray(t)&&t[0]!=="mouse"&&t[0]!=="raycast"&&this.entityOpContext.scene.find(t[0])===void 0}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let r=this.entityOpContext.scene.find(t[0]);if(r===void 0)return;if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return r.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&r?.getPhysicsLocalMatrix?.(AO))return AO.decompose(wO,CO,xG),t[1]==="position"?wO[t[2]]:(EO.setFromQuaternion(CO,r.rotation.order),EO[t[2]]*bi.MathUtils.RAD2DEG);for(let n=1;n<t.length;n++)r=r[t[n]];return t[1]==="rotation"&&(r*=bi.MathUtils.RAD2DEG),r}for(let r in this.variables){if(e===void 0)break;let n=this.variables[r],o=n.locations?.findIndex(a=>jt.equal(a,e));o!==void 0&&o!==-1&&n.locations.splice(o,1)}if(typeof t=="string"){let r=t,n=t;do{if(n=r,this.variables[r]===void 0)break;let o=this.variables[r].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),r=o}while(typeof r=="string");return r}else return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,r]of Object.entries(t.images))this.addImage(e,r.asset);for(let[e,r]of Object.entries(t.audios))this.addAudio(e,r.asset);for(let[e,r]of Object.entries(t.particles))this.addParticle(e,r.asset);for(let[e,r]of Object.entries(t.colors))this.addColor(e,r.asset);for(let[e,r]of Object.entries(t.fonts))this.addFont(e,r.asset);for(let[e,r]of Object.entries(t.videos))this.addVideo(e,r.asset);for(let[e,r]of Object.entries(t.variables))this.addVariableHolder(e,r.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,r){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(or.drop(t,2),e.materials[t.path[1]],{shared:this,scene:r});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,r):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let o=t.type===0&&t.props.debounce===void 0,a=this.getUserAPI(t.path[1]);a!==void 0&&a===this.openAIRealtime?a.update(n):a?.update(n,this,o)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(or.drop(t,1),r)}updateFont(t,e,r){if(e.props.url){let n=this.getFont(t),o={...this.data.fonts[t],url:e.props.url};n.update(o),n.loadingPromise.then(()=>this.requestRender()),r.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let r=SO();return r===null?(xr("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=r(e,t,this),!1)}else{let r=f1();return r===null?(xr("api-services","a user API integration"),!1):(this.userAPIs[t]=r.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let r=f1();return r===null?(xr("api-services","a user webhook"),!1):(this.userWebhooks[t]=r.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}},Ms=y1;Ms.MAX_TRANSIENT_VERTICES=6e4;var MO=new Ms(kn.emptyData());function gg(i){return i?.isClassicNodeMaterial===!0}function OO(i){return i?.isClassicSharedMaterial===!0}function zl(i){return gg(i)||i?.isTSLNodeMaterial===!0}function IO(i){return OO(i)||i?.isTSLSharedMaterial===!0}yt();gr();var Gn=5,Md=3;var DO=.98;var Ar=class extends it{setMaterialOverride(e,r){this.materialOverride=u1(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),r.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,r,n){if(super.updateByPatchedOp(e,r,n),Ye(e.path,["geometry"])&&this.syncShadowCatcher(n),XC(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[o,a]of Object.entries(e.props)){let s=this.material[Number(o)],l=n.shared.material(a);l!==s&&Ar.disposeOneMaterial(s),this.material[Number(o)]=l}else if(Ye(e.path,["material"])){let o=this.material;!Array.isArray(o)&&typeof o?.updateByOp=="function"&&"material"in r&&typeof r.material!="string"&&o.updateByOp(or.drop(e,1),r.material,n)}else if(Ye(e.path,["materials","*"])&&Array.isArray(this.material)){let o=e.path[1];if("materials"in r&&o<this.material.length){let a=r.materials[o];typeof a!="string"&&this.material[o].updateByOp(or.drop(e,2),a,n)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&!!this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):(this.layers.mask&1<<9)!==0&&this.layers.set(0)}updateState(e,r){super.updateState(e,r),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let n=this.dataPatched;this.syncShapeBlendNodeLayer();let o;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(o={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let a=this.materialOverride!==void 0;!a&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=r.shared.material(e.material).getFlavor(n.flatShading,n.side,n.wireframe,o),r.scene.markNeedsUpdateRendererDirty()),!a&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(l=>r.shared.material(l).getFlavor(n.flatShading,n.side,n.wireframe)),r.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[r.shared.material(e.material).getFlavor(n.flatShading,n.side,n.wireframe)],r.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!a&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=r.shared.material(s.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!a&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let l=0;l<this.material.length;l++)this.material[l]=this.material[l].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,o);this.syncShadowCatcher(r)}shadowCatcherActive(){let e=this.dataPatched,r=e.geometry?.type;return e.shadowCatcher===!0&&(r==="RectangleGeometry"||r==="PlaneGeometry")}syncShadowCatcher(e){let r=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let n=lO();if(n===null)return;this.shadowCatcherMaterial=n}this.shadowCatcherMaterial.side=r.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,e.scene.markNeedsUpdateRendererDirty()):"material"in r&&r.material!==void 0&&(this.material=e.shared.material(r.material).getFlavor(r.flatShading,r.side,r.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow)}static disposeOneMaterial(e){zl(e)&&!IO(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&Wf(this.material).forEach(e=>{Ar.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}};var wr=require("three");var RO=new wr.Vector3,BO=new wr.Vector4,NO=new wr.Vector4,AG=new wr.Vector3,LO=new wr.Matrix4,Os=new wr.Mesh,wG=Os.geometry,CG=Os.material,vg=new wr.Vector3,tt=class extends Ar{constructor(e,r,n){super(e,r);this.data=r;this.isSkinnedMesh=!1;this.localGeometry=void 0,r.bindMode&&r.bindMatrix&&(this.bindMode=r.bindMode,this.bindMatrix=new wr.Matrix4().fromArray(r.bindMatrix),this.bindMatrixInverse=new wr.Matrix4)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof wr.BufferGeometry&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof wr.BufferGeometry?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Ms){let e=this.geometryCreateDeleyed,r=this.chooseGeoemtryCache(e),n=this.dataPatched.geometry;this.geometryCreateDeleyed=r.get(n,e,this),this._geometryCacheKey=n}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return Tp.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return Tp.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,r,n){super.updateByPatchedOp(e,r,n),Ye(e.path,["geometry"])&&this.updateByPatchedOpGeometry(or.drop(e,1),r.geometry,n)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){super.dispose(),A2(this.uuid),this._posed=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(!(e===void 0||e.sxPrev===void 0))return[e.sxPrev,e.syPrev,e.szPrev]}updateGeometryInteractions(e,r){this.invalidateDownstreamBooleanData();let n=this.data.geometry.type;if(n==="NonParametricGeometry"||n==="SubdivGeometry"){let o=e;if(this.localGeometry===void 0){let h={...this.data.geometry,...o};this.localGeometry=Ui(h,r,this.data.flatShading,this)}let a,s,l;o.scaleBaked?[a,s,l]=o.scaleBaked:{width:a,height:s,depth:l}=o;let c=this.localGeometry.userData,d=typeof a=="number"?a:1,u=typeof s=="number"?s:1,p=typeof l=="number"?l:1;c.sxPrev!==void 0&&ah(this.localGeometry.attributes,d/c.sxPrev,u/c.syPrev,p/c.szPrev),c.sxPrev=d,c.syPrev=u,c.szPrev=p}else if(!this.absorbDepthInteraction(e)){let o=n==="VectorGeometry"?kc.merge(this.data.geometry,e):{...this.data.geometry,...e},a=Ui(o,r,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&lg(this.localGeometry,a)?a.dispose():(this.localGeometry?.dispose(),this.localGeometry=a)}}absorbDepthInteraction(e){let r=this.localGeometry;if(r?.shiftDepthTo===void 0)return!1;let n=e;if(typeof n.depth!="number")return!1;let o=r.userData?.parameters;if(o===void 0)return!1;for(let a of Object.keys(n))if(a!=="depth"&&n[a]!==o[a])return!1;return r.shiftDepthTo(n.depth)?(o.depth=n.depth,!0):!1}refreshAttachedClonersInteractions(e){for(let r of this.attachedSurfaceCloners)r.update(e)}refreshAttachedCloners(e){for(let r of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(r.object)}refreshAttachedPaths(e){for(let r of this.attachedPaths)e.scene.addPendingCommand(()=>r.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,r,n){let o=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Bt&&this.chooseGeoemtryCache(n.shared).mutateIfUnique(this.geometryCreateDeleyed.data,r)===this.geometryCreateDeleyed&&(o=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(r,e.props.scaleBaked),this.refreshAttachedCloners(n),this.refreshAttachedPaths(n)),!o&&e.type===0&&e.path.length===0&&pg(e.props)&&this.geometryCreateDeleyed instanceof Bt&&this.chooseGeoemtryCache(n.shared).mutateIfUnique(this.geometryCreateDeleyed.data,r)===this.geometryCreateDeleyed&&(o=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(r),this.refreshAttachedCloners(n),this.refreshAttachedPaths(n)),!o&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof wr.BufferGeometry&&!(this.geometryCreateDeleyed instanceof Bt)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let a=n.shared,s=this.chooseGeoemtryCache(a),l=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===l&&l.isShared!==!0){let d=this.dataPatched.geometry,u=Ui(d,a,this.data.flatShading,this);lg(l,u)?(u.dispose(),l.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,d)):(u.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(d,u),this.geometryCreateDeleyed=u),this._geometryCacheKey=d,o=!0,this.refreshAttachedCloners(n),this.refreshAttachedPaths(n)}}o||(n.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(n)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,r){this.createGeometryDelayed(r)}applyTransientGeometryData(e,r){let n=e.shared,o=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof wr.BufferGeometry&&!(this.geometryCreateDeleyed instanceof Bt)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let a=this.chooseGeoemtryCache(n),s=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let c=Ui(o,n,this.data.flatShading,this);lg(s,c)?(c.dispose(),s.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,o)):(c.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(o,c),this.geometryCreateDeleyed=c),this._geometryCacheKey=o,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e);return}}r&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(n).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,r){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,r);let n=e.morphTargetInfluences;if(n){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:o,value:a}}of n)this.updateMorphInfluences(o,r.shared.getVariable(a,[this.uuid,"morphTargetInfluences",o]))}super.updateState(e,r)}updateMorphInfluences(e,r){if(this.morphTargetDictionary===void 0)return;let n=this.morphTargetDictionary[e];n!==void 0&&(this.morphTargetInfluences[n]=r)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,r){let n=this.posedGeometry()?.boundingBox;if(n){n.getCenter(e),n.getSize(r).multiplyScalar(.5);return}let o=this.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,o.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),r.set(o.width,o.height,o.depth??0).multiplyScalar(.5)):o.centerOffset?e.fromArray(o.centerOffset):e.setScalar(0),r.set(o.width,o.height,o.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,r){this.skeleton=e,this.isSkinnedMesh=!0,r===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),r=this.matrixWorld),this.bindMatrix.copy(r),this.bindMatrixInverse.copy(r).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let r=new wr.Vector4,n=this.geometry.attributes.skinWeight;for(let o=0,a=n.count;o<a;o++){r.fromBufferAttribute(n,o);let s=1/r.manhattanLength();s!==1/0?r.multiplyScalar(s):r.set(1,0,0,0),n.setXYZW(o,r.x,r.y,r.z,r.w)}}boneTransform(e,r){let n=this.skeleton;if(n===void 0)return;let o=this.geometry;BO.fromBufferAttribute(o.attributes.skinIndex,e),NO.fromBufferAttribute(o.attributes.skinWeight,e),RO.copy(r).applyMatrix4(this.bindMatrix),r.set(0,0,0);for(let a=0;a<4;a++){let s=NO.getComponent(a);if(s!==0){let l=BO.getComponent(a);LO.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),r.addScaledVector(AG.copy(RO).applyMatrix4(LO),s)}}return r.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(e,r){let n=this.posedGeometry();if(n===void 0)return!1;Os.geometry=n,Os.material=this.material,Os.matrixWorld.copy(this.matrixWorld);let o=r.length;Os.raycast(e,r);for(let a=o;a<r.length;a++)r[a].object=this;return Os.geometry=wG,Os.material=CG,!0}posedGeometry(){let e=this.skeleton;if(!this.isSkinnedMesh||e===void 0)return;let r=this.geometry,{position:n,skinIndex:o,skinWeight:a}=r.attributes;if(!n||!o||!a)return;let s=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let h=0;h<e.bones.length;h++){let f=e.bones[h];if(!f||!e.boneInverses[h])return;s.push(...f.matrixWorld.elements)}let l=this._posed;if(l?.source===r&&l.version===n.version&&l.pose.length===s.length&&l.pose.every((h,f)=>h===s[f]))return l.geometry;let c=n.count,d=l?.geometry.attributes.position,u=d?.count===c?d:new wr.BufferAttribute(new Float32Array(c*3),3);for(let h=0;h<c;h++)this.boneTransform(h,this.getVertexPosition(h,vg)),u.setXYZ(h,vg.x,vg.y,vg.z);let p=new wr.BufferGeometry;p.setAttribute("position",u);for(let h of["normal","uv","uv1"]){let f=r.attributes[h];f&&p.setAttribute(h,f)}return p.setIndex(r.index),p.groups=r.groups,p.drawRange=r.drawRange,p.computeBoundingSphere(),p.computeBoundingBox(),this._posed={source:r,version:n.version,pose:s,geometry:p},p}};var GO=require("three");var Jo=require("three");var _O=require("three"),Qo=i=>{var t;return t=class extends i{},t.geometryHelper=new _O.BoxGeometry(30,30,30),t};var En=require("three"),bg=new En.Ray,v1=new En.Sphere,kO=new En.Matrix4,Zo=(i,t,e,r,n=!1,o=i)=>{let a=t,s=o.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),v1.copy(a.boundingSphere),v1.applyMatrix4(s),e.ray.intersectsSphere(v1)===!1||(kO.copy(s).invert(),bg.copy(e.ray).applyMatrix4(kO),a.boundingBox!==null&&bg.intersectsBox(a.boundingBox)===!1))return;let l,c,d,u,p=a.index,h=a.attributes.position,f=a.drawRange,m,y;if(n===!1){let v=Math.max(0,f.start),b=Math.min(p.count,f.start+f.count);for(m=v,y=b;m<y;m+=3)if(c=p.getX(m),d=p.getX(m+1),u=p.getX(m+2),l=g(i,e,bg,h,c,d,u),l){l.faceIndex=Math.floor(m/3),r.push(l);return}}else{let b=a.attributes.position,S=new En.Vector3,x=new En.Vector3,A=new En.Vector3,w=new En.Vector3,C=2,M=1/((o.scale.x+o.scale.y+o.scale.z)/3),D=M*M,I=Math.max(0,f.start),_=Math.min(b.count,f.start+f.count);for(let E=I,B=_-1;E<B;E+=C){if(S.fromBufferAttribute(b,E),x.fromBufferAttribute(b,E+1),bg.distanceSqToSegment(S,x,w,A)>D)continue;w.applyMatrix4(o.matrixWorld);let k=e.ray.origin.distanceTo(w);k<e.near||k>e.far||r.push({distance:k,point:A.clone().applyMatrix4(o.matrixWorld),object:i})}}function g(v,b,S,x,A,w,C){let T=new En.Vector3,M=new En.Vector3,D=new En.Vector3,I=new En.Vector3,_=new En.Vector3;if(T.fromBufferAttribute(x,A),M.fromBufferAttribute(x,w),D.fromBufferAttribute(x,C),S.intersectTriangle(T,M,D,!1,I)===null)return null;_.copy(I),_.applyMatrix4(v.matrixWorld);let B=b.ray.origin.distanceTo(_);return B<b.near||B>b.far?null:{faceIndex:1,distance:B,point:_.clone(),object:v}}};var EG=new Jo.Vector3(1,1,1),FO=new Jo.Vector3,TG=new Jo.Vector3,VO=new Jo.Quaternion,Hi=class extends Qo(Jo.AxesHelper){constructor(e,r=15){super(r);this.object=e;this.dummy=new Jo.Group;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,r){Zo(this.object,Hi.geometryHelper,e,r,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(FO,VO,TG),this.matrix.compose(FO,VO,EG),super.updateMatrixWorld(e)}updateWorldMatrix(e,r){}};var ch=require("three");var xg;(t=>t.is=e=>"objectHelper"in e)(xg||(xg={}));var Wi=(i,t)=>class extends ad(i){constructor(){super(...arguments);this.objectHelper=new t(this);this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(n,o){this.objectHelper.raycast(n,o)}showGizmos(){for(let n in this.gizmos){let o=this.gizmos[n];o instanceof ch.Box3Helper&&(o.visible=!0)}}updateEntityBoxSize(n,o){this.objectHelper.visible&&this.geometryHelper instanceof ch.BoxGeometry?(n.setScalar(0),o.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(n,o)}hideGizmos(){for(let n in this.gizmos){let o=this.gizmos[n];o instanceof ch.Box3Helper&&(o.visible=!1)}}};var Id=class extends Wi(GO.Group,Hi){constructor(e,r,n){super();this.super_Entity(e,r),this.context=n,this.objectHelper.update()}updateState(e,r){this.updateState_Entity(e,r)}};var PG=null;function UO(){return PG}var $e=require("three"),Ig=Ec(jO());var MG=.5*(Math.sqrt(3)-1),dh=(3-Math.sqrt(3))/6,OG=1/3,$o=1/6,Yre=(Math.sqrt(5)-1)/4,Kre=(5-Math.sqrt(5))/20,uh=i=>Math.floor(i)|0,HO=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]),x1=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 WO(i=Math.random){let t=XO(i),e=new Float64Array(t).map(n=>HO[n%12*2]),r=new Float64Array(t).map(n=>HO[n%12*2+1]);return function(o,a){let s=0,l=0,c=0,d=(o+a)*MG,u=uh(o+d),p=uh(a+d),h=(u+p)*dh,f=u-h,m=p-h,y=o-f,g=a-m,v,b;y>g?(v=1,b=0):(v=0,b=1);let S=y-v+dh,x=g-b+dh,A=y-1+2*dh,w=g-1+2*dh,C=u&255,T=p&255,M=.5-y*y-g*g;if(M>=0){let _=C+t[T],E=e[_],B=r[_];M*=M,s=M*M*(E*y+B*g)}let D=.5-S*S-x*x;if(D>=0){let _=C+v+t[T+b],E=e[_],B=r[_];D*=D,l=D*D*(E*S+B*x)}let I=.5-A*A-w*w;if(I>=0){let _=C+1+t[T+1],E=e[_],B=r[_];I*=I,c=I*I*(E*A+B*w)}return 70*(s+l+c)}}function qO(i=Math.random){let t=XO(i),e=new Float64Array(t).map(o=>x1[o%12*3]),r=new Float64Array(t).map(o=>x1[o%12*3+1]),n=new Float64Array(t).map(o=>x1[o%12*3+2]);return function(a,s,l){let c,d,u,p,h=(a+s+l)*OG,f=uh(a+h),m=uh(s+h),y=uh(l+h),g=(f+m+y)*$o,v=f-g,b=m-g,S=y-g,x=a-v,A=s-b,w=l-S,C,T,M,D,I,_;x>=A?A>=w?(C=1,T=0,M=0,D=1,I=1,_=0):x>=w?(C=1,T=0,M=0,D=1,I=0,_=1):(C=0,T=0,M=1,D=1,I=0,_=1):A<w?(C=0,T=0,M=1,D=0,I=1,_=1):x<w?(C=0,T=1,M=0,D=0,I=1,_=1):(C=0,T=1,M=0,D=1,I=1,_=0);let E=x-C+$o,B=A-T+$o,L=w-M+$o,k=x-D+2*$o,F=A-I+2*$o,W=w-_+2*$o,U=x-1+3*$o,G=A-1+3*$o,q=w-1+3*$o,X=f&255,Y=m&255,Q=y&255,te=.6-x*x-A*A-w*w;if(te<0)c=0;else{let de=X+t[Y+t[Q]];te*=te,c=te*te*(e[de]*x+r[de]*A+n[de]*w)}let ue=.6-E*E-B*B-L*L;if(ue<0)d=0;else{let de=X+C+t[Y+T+t[Q+M]];ue*=ue,d=ue*ue*(e[de]*E+r[de]*B+n[de]*L)}let le=.6-k*k-F*F-W*W;if(le<0)u=0;else{let de=X+D+t[Y+I+t[Q+_]];le*=le,u=le*le*(e[de]*k+r[de]*F+n[de]*W)}let ce=.6-U*U-G*G-q*q;if(ce<0)p=0;else{let de=X+1+t[Y+1+t[Q+1]];ce*=ce,p=ce*ce*(e[de]*U+r[de]*G+n[de]*q)}return 32*(c+d+u+p)}}function XO(i){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 n=r+~~(i()*(256-r)),o=e[r];e[r]=e[n],e[n]=o}for(let r=256;r<512;r++)e[r]=e[r-256];return e}var YO=require("three"),xo=new YO.Triangle,Sg=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 n=0;n<t.count;n+=3){let o=1;xo.a.fromBufferAttribute(t,n),xo.b.fromBufferAttribute(t,n+1),xo.c.fromBufferAttribute(t,n+2),o*=xo.getArea(),e[n/3]=o}this.distribution=new Float32Array(t.count/3);let r=0;for(let n=0;n<e.length;n++)r+=e[n],this.distribution[n]=r;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let r=this.distribution[this.distribution.length-1],n=this.binarySearch(this.randomFunction()*r);return this.sampleFace(n,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,r=0,n=e.length-1,o=-1;for(;r<=n;){let a=Math.ceil((r+n)/2);if(a===0||e[a-1]<=t&&e[a]>t){o=a;break}else t<e[a]?n=a-1:r=a+1}return o}sampleFace(t,e,r){let n=this.randomFunction(),o=this.randomFunction();return n+o>1&&(n=1-n,o=1-o),xo.a.fromBufferAttribute(this.positionAttribute,t*3),xo.b.fromBufferAttribute(this.positionAttribute,t*3+1),xo.c.fromBufferAttribute(this.positionAttribute,t*3+2),e.set(0,0,0).addScaledVector(xo.a,n).addScaledVector(xo.b,o).addScaledVector(xo.c,1-(n+o)),xo.getNormal(r),this}};var jl=require("three");var xi=require("three");function IG(i){if(i.geometry.attributes.extrudeNormal||!i.geometry.attributes.position||!i.geometry.attributes.normal)return;let t=new Map,e=i.geometry.attributes,r=e.position.array,n=e.normal.array,o=new Float32Array(r.length);for(let a=0;a<r.length;a+=3){let s=`${r[a]}_${r[a+1]}_${r[a+2]}`,l=new xi.Vector3(n[a],n[a+1],n[a+2]);t.has(s)?t.get(s)?.normals.push(l):t.set(s,{normals:[l],result:new xi.Vector3})}t.forEach((a,s)=>{for(let l of a.normals)a.result.add(l);a.result.divideScalar(a.normals.length)});for(let a=0;a<r.length;a+=3){let s=`${r[a]}_${r[a+1]}_${r[a+2]}`,l=t.get(s)?.result;l&&(o[a]=l.x,o[a+1]=l.y,o[a+2]=l.z)}i.geometry.setAttribute("extrudeNormal",new xi.Float32BufferAttribute(o,3))}function DG(i){if(i.geometry.attributes.extrudeNormals||!i.geometry.attributes.position)return;let e=i.geometry.attributes.position.array,r=new Float32Array(e.length),n=new xi.Vector3;for(let o=0;o<e.length;o+=3)n.set(e[o],e[o+1],e[o+2]).normalize(),r[o]=n.x,r[o+1]=n.y,r[o+2]=n.z;i.geometry.setAttribute("extrudeNormal",new xi.Float32BufferAttribute(r,3))}function ea(i){if(Array.isArray(i.material)){for(let t of i.material)if(t.getLayersOfType("outline").length===0)return}else if(!gg(i.material)||i.material.getLayersOfType("outline").length===0)return;i instanceof tt&&i.is2DAndNoDepth?DG(i):IG(i)}function S1(i){return Math.min(2047,Math.max(1,Math.round(i*2048)))/2048}function ta(i){if(!i.geometry.attributes.position)return;let t=i.geometry.attributes,e=t.position.array,r=t.randomColor;if(r!==void 0&&r.count*3===e.length)return;let n=new Float32Array(e.length),o=parseInt(i.uuid.replace(/\D/g,"")),a=[S1(xi.MathUtils.seededRandom(o)),S1(xi.MathUtils.seededRandom(o+1e4)),S1(xi.MathUtils.seededRandom(o+2e4))];for(let s=0;s<e.length;s++)n[s]=a[s%3];i.geometry.setAttribute("randomColor",new xi.BufferAttribute(n,3))}var ra=new jl.Box3,ph=new jl.Vector3;function KO(i){let t=!1;return i.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&r.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var Va=class extends tt{constructor(e,r,n){super(e,r,n);this.data=r;this.smoothShading=!0;this.skipReactionUpdate=!1;this.shearCompensationIsActive=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,r){let n=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),r.set(n.width,n.height,n.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let r=this.localGeometry?.uuid,{originalGeometry:n,subdividedGeometry:o,subdivPointer:a}=Bt.build(e,this.subdivPointer,this.smoothShading,this.shearScale);this.subdivPointer=a,n!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=n),o!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=o??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ea(this),ta(this),this.calcBoundingBox(),r&&(this.localGeometry.uuid=r)}updateState(e,r){if(super.updateState(e,r),e.flatShading!==void 0){let n=this.material;this.material=Array.isArray(n)?n.map(o=>o.getFlavor(!1,o.side,o.wireframe)):n.getFlavor(!1,n.side,n.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(r)}}updateMesh(e=!1,r=!1,n=!1){r&&this.subdividedGeometry||Bt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0,n),this.subdividedGeometry&&Bt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){let e=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Bt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Bt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ea(this),ta(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}raycast(e,r){let n=this.localGeometry;this.localGeometry=this.originalGeometryNew,it.prototype.raycast.call(this,e,r),this.localGeometry=n}activateShearCompensation(){this.shearCompensationIsActive=!0,this.matrixWorld.copy(this.matrixWorldRigid)}deactivateShearCompensation(){this.shearCompensationIsActive=!1,this.updateMatrixWorld(!0)}updateMatrixWorld(e){this.shearCompensationIsActive!==!0&&super.updateMatrixWorld(e)}updateWorldMatrix(e,r){this.shearCompensationIsActive!==!0&&super.updateWorldMatrix(e,r)}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new jl.Sphere,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let r=e.attributes.position,n=e.boundingSphere.center;ra.setFromBufferAttribute(r),ra.getCenter(n),e.boundingSphere.radius=n.distanceTo(ra.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ra.getSize(ph),ph.divide(this.scale);let o={width:ph.x,height:ph.y,depth:ph.z};return this.geometry.userData.parameters=o,o}updateBoundingSphere(e){let r=this.originalGeometry;ra.min.set(e[0],e[2],e[4]),ra.max.set(e[1],e[3],e[5]),ra.min.applyMatrix4(this.shearScaleInv),ra.max.applyMatrix4(this.shearScaleInv),r.boundingSphere===null&&(r.boundingSphere=new jl.Sphere);let n=r.boundingSphere.center;ra.getCenter(n),r.boundingSphere.radius=n.distanceTo(ra.max)}freeSubdivPointer(){this.subdivPointer&&(Bt.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(e){if(this.skipReactionUpdate===!0)return;let r=this.localGeometry,n=r?.uuid,o=r?.userData.parameters,a=e.subdivisions>0?Bt.buildRefined(this.subdivPointer,e.subdivisions,this.smoothShading?e.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=a??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ea(this),ta(this),o!==void 0&&(this.localGeometry.userData.parameters=o),n&&(this.localGeometry.uuid=n)}updateByPatchedOpGeometry(e,r,n){super.updateByPatchedOpGeometry(e,r,n),this.localGeometry&&(e.type===0&&e.path.length===0&&pg(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(r):this.createGeometryByControls(r))}};var na=require("three"),QO=-1,RG=1,ZO={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},JO={polygon_center:0,edge:1,vertex:2},hh=(i,t)=>(e,r)=>!t||e===0||i===0?0:i*r/100,ze=(i,t)=>{let e=Math.abs(t),r=e*-1;return(i-QO)*(e-r)/(RG-QO)+r},BG=new na.Vector3,Ag=new na.Vector3,NG=new na.Vector3,LG=new na.Vector3;function Dd(i,t){let e=NG.fromArray(i),r=LG.fromArray(t);Ag.copy(r).sub(e);let n=Ag.length();return Ag.normalize().multiplyScalar(n*.5),BG.copy(e).add(Ag).toArray()}var qi=new na.Triangle,wg=new na.Vector3,Cg=new na.Vector3,Hl=new na.Vector3;function $O(i){let t=[],e=Math.floor(i.index.count/3);for(let r=0;r<e;r++)if(wg.fromArray(i.index.array,r*3),qi.setFromAttributeAndIndices(i.attributes.position,wg.x,wg.y,wg.z),qi.getNormal(Cg),qi.getMidpoint(Hl),!(isNaN(Hl.x)||isNaN(Hl.y)||isNaN(Hl.z))){let{a:n,b:o,c:a}=qi,s=n.toArray(),l=o.toArray(),c=a.toArray(),d=n.distanceTo(o),u=o.distanceTo(a),p=a.distanceTo(n),h=Dd(s,l),f=Dd(l,c),m=Dd(c,s),y=[d,u,p],g=Math.max(...y),v=y.filter(x=>Math.round(x)===Math.round(g)).length>1,b=[],S=qi.getMidpoint(Hl).toArray();g===d&&!v&&(b=[f,m,m],S=h),g===u&&!v&&(b=[h,m,m],S=f),g===p&&!v&&(b=[h,f,f],S=m),v&&(b=[h,f,m]),t.push({vertices:[s,l,c],faceCenters:b,midpoint:S,norm:qi.getNormal(Cg).toArray()})}return t}function eI(i){let t=[],{position:e}=i.attributes;for(let r=0;r<e.count;r++){qi.setFromAttributeAndIndices(e,r*3,r*3+1,r*3+2),qi.getNormal(Cg),qi.getMidpoint(Hl);let n=qi.a.toArray(),o=qi.b.toArray(),a=qi.c.toArray();t.push({vertices:[n,o,a],faceCenters:[Dd(n,o),Dd(o,a),Dd(a,n)],midpoint:Hl.toArray(),norm:Cg.toArray()})}return t}var fh=require("three"),A1=class extends fh.InstancedMesh{},Eg=class extends A1{constructor(e,r){super(void 0,void 0,r);this.source=e;this.isClonerInstancedMesh=!0;this.pivotMatrix=new fh.Matrix4;this.previousModelViewMatrix=new fh.Matrix4;this.copyPreviousMatrix=!0;this.capacity=r,this.count=0,this.matrixAutoUpdate=!1}raycast(e,r){}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let r of this.children)r.updateMatrixWorld(e)}updateWorldMatrix(e,r){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),r)for(let o of this.children)o.updateWorldMatrix(!1,!0)}onAfterRender(e,r,n,o,a,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}get visible(){return this.source.cloner?.insideBoolean===!0?!1:this.source.visible||this.source.dataPatched.visible&&this.source.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.source.castShadow}set castShadow(e){}get receiveShadow(){return this.source.receiveShadow}set receiveShadow(e){}get layers(){return this.source.layers}set layers(e){}get geometry(){return this.source.geometry}set geometry(e){}get material(){return this.source.material}set material(e){}get morphTargetInfluences(){return this.source.morphTargetInfluences}set morphTargetInfluences(e){}};var w1=i=>.5*(1-Math.cos(i*Math.PI)),C1=class{constructor(){this.perlin=new Array(4095+1)}noise(t,e=0,r=0){if(this.perlin==null){this.perlin=new Array(4095+1);for(let g=0;g<4095+1;g++)this.perlin[g]=Math.random()}t<0&&(t=-t),e<0&&(e=-e),r<0&&(r=-r);let n=Math.floor(t),o=Math.floor(e),a=Math.floor(r),s=t-n,l=e-o,c=r-a,d,u,p=0,h=.5,f,m,y;for(let g=0;g<4;g++){let v=n+(o<<4)+(a<<8);d=w1(s),u=w1(l),f=this.perlin[v&4095],f+=d*(this.perlin[v+1&4095]-f),m=this.perlin[v+16&4095],m+=d*(this.perlin[v+16+1&4095]-m),f+=u*(m-f),v+=256,m=this.perlin[v&4095],m+=d*(this.perlin[v+1&4095]-m),y=this.perlin[v+16&4095],y+=d*(this.perlin[v+16+1&4095]-y),m+=u*(y-m),f+=w1(c)*(m-f),p+=f*h,h*=.5,n<<=1,s*=2,o<<=1,l*=2,a<<=1,c*=2,s>=1&&(n++,s--),l>=1&&(o++,l--),c>=1&&(a++,c--)}return p}noiseSeed(t){let e=(()=>{let a,s;return{setSeed(l){s=a=(l??Math.random()*4294967296)>>>0},getSeed(){return a},rand(){return s=(1664525*s+1013904223)%4294967296,s/4294967296}}})();e.setSeed(t),this.perlin=new Array(4095+1);for(let r=0;r<4095+1;r++)this.perlin[r]=e.rand()}},tI=C1;var Rd=require("three");var rI=new Rd.Vector3,nI=new Rd.Matrix4,iI=new Rd.Ray,Is=class extends tt{constructor(e,r,n){super(e,r,n);this.data=r}get textGeometry(){return this.geometry}get charWidths(){return this.textGeometry.charWidths}get charCoords(){return this.textGeometry.charCoords}get wrappedText(){return this.textGeometry.wrappedText}get font(){return this.textGeometry.font}get initialOffsetY(){let e=this.dataPatched;return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,typeof e.geometry.height=="number"?e.geometry.height:1,this.fontScale,e.geometry.verticalAlign)??0}get fontScale(){let e=this.dataPatched;return this.font?e.geometry.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){let e=this.dataPatched;return e.geometry.fontSize*e.geometry.lineHeight}raycast(e,r){let{matrixWorld:n}=this;if(!(isNaN(e.ray.origin.x)||this.scale.x===0||this.scale.y===0||this.scale.z===0)&&(nI.copy(n).invert(),iI.copy(e.ray).applyMatrix4(nI),iI.intersectBox(this.singleBBox,rI))){let o=rI.applyMatrix4(n),a=e.ray.origin.distanceTo(o);r.push({distance:a,point:o.clone(),object:this})}}};var Un=1e-4,ia,mI,yI,gI,oI=new $e.Vector3,aI=new $e.Vector3;sg.then(i=>{ia=i,mI=[ia.get_face_center,ia.get_edge_midpoint,ia.get_vertex_position],yI=[ia.get_face_normal,ia.get_edge_normal,ia.get_vertex_normal],gI=[ia.face_count,ia.edge_count,ia.vertex_count]});var tie=new $e.Matrix4,_G=new $e.Matrix4,sI=new $e.Matrix4,lI=new $e.Matrix4,cI=new $e.Matrix4,dI=new $e.Matrix4,uI=new $e.Matrix4,Ds=new $e.Vector3,Tg=new $e.Vector3,Pg=new $e.Vector3,E1=new $e.Vector3,kG=new $e.Vector3,pI=new $e.Vector3,Mg=new $e.Vector3,T1=new $e.Vector3,hI=new $e.Vector3,P1=new $e.Vector3,fI=new $e.Vector3,So=new $e.Euler,FG=new $e.Quaternion;function Og(i){return i?i.version??i.data?.version??0:-1}function cr(i,t){return[typeof i?.[0]=="number"?i[0]:typeof i?.[0]=="string"&&t?parseFloat(String(t.shared.getVariable(i[0])??"0")):0,typeof i?.[1]=="number"?i[1]:typeof i?.[1]=="string"&&t?parseFloat(String(t.shared.getVariable(i[1])??"0")):0,typeof i?.[2]=="number"?i[2]:typeof i?.[2]=="string"&&t?parseFloat(String(t.shared.getVariable(i[2])??"0")):0]}var M1=class{constructor(t,e){this.data=t;this.is3D=e;this.perlin=new tI;t.noiseType==="perlin"?(this.perlin.noiseSeed(t.seed),e?this.noise=(n,o,a)=>this.perlin.noise(n,o,a):this.noise=n=>this.perlin.noise(n)):e?this.noise=qO((0,Ig.default)(t.seed)):this.noise=WO((0,Ig.default)(t.seed??""))}},Tn=class extends nd($e.Object3D){constructor(e,r){super();this.parameters=r;this.isCloner=!0;this.objectForSample=void 0;this._pendingMediaLoad=!1;this.random=null;this.surfaceSamplerCache=null;this.surfacePointsCache=null;this.object=e}resetOnMove(){this.removeFromParent(),this.parent=null}removeFromParent(){return super.removeFromParent(),this.instancedMesh?.removeFromParent(),this}dispose(){this.removeFromParent(),this._disposeInstancedMesh(),this._invalidateBoolean(),this._syncEnclosingCopies(!0)}createCopy(){return new mh(this)}_syncEnclosingCopies(e){!e&&this.parent!==this.object.parent||this.object.traverseEntityAncestors(r=>{let n=r.cloner;n===void 0||n.parent===null||(e&&n.expandCopies(),n.invalidateTransform(this.object))})}_invalidateBoolean(){this.object instanceof it&&this.object.onClonerLayoutUpdated()}expandClones(e){this.parent===null?this.updateState(this.parameters,e):this.expandCopies()}expandCopies(){for(let e of this.children)e instanceof lr&&e.expand();this._syncInstancedMesh()}invalidateTransform(e){this.matrixWorldNeedsUpdate=!0}onObjUpdateMatrix(){this.parameters.type!=="toObject"&&(this.matrixWorldNeedsUpdate=!0)}update(e){this._syncEnclosingCopies(this._layout(e))}_layout(e){let r=this.children.length;switch(this._updateCount(e),this.parameters.type){case"radial":this._updateRadial(this.parameters,e);break;case"linear":this._updateLinear(this.parameters,e);break;case"grid":this._updateGrid(this.parameters,e);break;case"toObject":this._updateToObject(this.parameters,e)}for(let n of this.children){let o=n.transformOverride;o!==void 0&&(n.position.fromArray(o.position),n.rotation.fromArray(o.rotation),n.scale.fromArray(o.scale)),n.updateMatrix(),n.hasNonUniformScale&&(n.updateMatrixWorld(),n.updateMatrixWorldRigid())}return this._syncInstancedMesh(),this._invalidateBoolean(),this.children.length!==r}get instancingActive(){return this.instancedMesh!==void 0}get insideBoolean(){return this.parent!==null&&"booleanOp"in this.parent}_instancingEligible(){if(this.parameters.instanced!==!0)return!1;let e=this.object;return!(e.entityChildrenCount()>0||e.isMesh!==!0||fi(e)||e.isDecalObject===!0)}_syncInstancedMesh(){if(!this._instancingEligible()){this._disposeInstancedMesh();return}let e=this.instancedMesh;if(e!==void 0&&e.capacity<this.children.length&&(this._disposeInstancedMesh(),e=void 0),e===void 0){let r=Math.max(8,Math.ceil(this.children.length*1.5));e=this.instancedMesh=new Eg(this.object,r)}e.matrix=this.matrix,e.matrixWorldNeedsUpdate=!0,e.parent!==this.parent&&(e.removeFromParent(),this.parent?.add(e)),this.syncInstanceMatrices()}syncInstanceMatrices(){this._invalidateBoolean();let e=this.instancedMesh;if(e===void 0)return;let r=0;for(let n of this.children)n.playModeVisible!==!1&&(sI.copy(n.matrix).multiply(n.pivotMatrix),e.setMatrixAt(r++,sI));e.count=r,e.instanceMatrix.needsUpdate=!0,e.boundingSphere=null}_disposeInstancedMesh(){let e=this.instancedMesh;e!==void 0&&(this.instancedMesh=void 0,e.removeFromParent(),e.dispose())}_updateCount(e,r){let n;if(r!==void 0)n=r;else{let o=cr(this.parameters.grid.count,e);n=this.parameters.type==="grid"?Math.round(o[0])*Math.round(o[1])*Math.round(o[2]):this.parameters.count}if(this.parameters.type==="toObject"){if(!this.parameters.toObject.object)n=0;else if(r===void 0&&this.parameters.toObject.spreadType!=="random")return}if(this.children.length!==n)if(this.children.length<n)for(let o=0,a=n-this.children.length;o<a;++o){let s=new lr(this.object);s.expand(),this.add(s)}else for(;this.children.length>n;){let o=this.children.pop();o.parent=null,o.dispatchEvent({type:"removed"}),this.dispatchEvent({type:"childremoved",child:o})}}getRandom(e,r=!1){return(this.random===null||this.random.data.seed!==e.seed||this.random.data.noiseType!==e.noiseType||this.random.is3D!==r)&&(this.random=new M1(e,r)),this.random}_updateRadial(e,r){let n=e.radial,o=n.start*$e.MathUtils.DEG2RAD,a=n.end*$e.MathUtils.DEG2RAD,s=o-a,l=cr(n.rotation,r),c=new $e.Euler(l[0],l[1],l[2]),d;switch(n.axis){case"z":d=new $e.Vector3(0,0,1);break;case"y":d=new $e.Vector3(0,1,0);break;default:case"x":d=new $e.Vector3(1,0,0);break}let u=e.randomnessObject??Fo.defaultData([1,1,1]).randomnessObject,h=this.parameters.randomness===!0&&u.strength!==0?this.getRandom(u):null,f=cr(n.scale,r),m=cr(n.position,r),y=cr(u.scale,r),g=cr(u.position,r),v=cr(u.rotation,r),b=s/e.count,S=hh(u.strength,this.parameters.randomness);for(let[x,A]of this.children.entries()){let w=x*(u.freqScale/10)+u.movement,C=h===null?0:h.noise(w,w,w),T=x+1;A.scale.x=f[0]+S(T,ze(C,y[0]))||Un,A.scale.y=f[1]+S(T,ze(C,y[1]))||Un,A.scale.z=f[2]+S(T,ze(C,y[2]))||Un;let M=b*x-o;switch(n.axis){default:case"x":So.set(0,M,0);break;case"y":So.set(0,0,M);break;case"z":So.set(M,0,0);break}Mg.copy(d).applyQuaternion(FG.setFromEuler(So)).multiplyScalar(n.radius),A.position.set(Mg.x+(m[0]+S(T,ze(C,g[0]))),Mg.y+(m[1]+S(T,ze(C,g[1]))),Mg.z+(m[2]+S(T,ze(C,g[2]))));let D=S(T,ze(C,v[0])),I=S(T,ze(C,v[1])),_=S(T,ze(C,v[2]));n.alignment===!0?A.rotation.set(So.x+(c.x+D),So.y+(c.y+I),So.z+(c.z+_)):A.rotation.set(c.x+D,c.y+I,c.z+_)}}_updateLinear(e,r){if(e.type!=="linear")throw new Error;let n=e.linear,o=cr(n.rotation,r),a=cr(n.scale,r),s=cr(n.position,r),l=new $e.Euler(o[0]??0,o[1]??0,o[2]??0),c=e.randomnessObject??Fo.defaultData([1,1,1]).randomnessObject,d=cr(c.rotation,r),u=cr(c.scale,r),p=cr(c.position,r),f=this.parameters.randomness===!0&&c.strength!==0?this.getRandom(c):null,m=hh(c.strength,this.parameters.randomness);for(let[y,g]of this.children.entries()){let v=y*(c.freqScale/10)+c.movement,b=f===null?0:f.noise(v,v,v),S=y+1,x=m(S,ze(b,d[0])),A=m(S,ze(b,d[1])),w=m(S,ze(b,d[2]));g.scale.x=1+(a[0]-1)*y+m(S,ze(b,u[0]))||Un,g.scale.y=1+(a[1]-1)*y+m(S,ze(b,u[1]))||Un,g.scale.z=1+(a[2]-1)*y+m(S,ze(b,u[2]))||Un,g.rotation.set(l.x*y+x,l.y*y+A,l.z*y+w),g.position.x=s[0]*y+m(S,ze(b,p[0])),g.position.y=s[1]*y+m(S,ze(b,p[1])),g.position.z=s[2]*y+m(S,ze(b,p[2]))}}_updateGrid(e,r){let n=0,o=e.grid,a=e.randomnessObject??Fo.defaultData([1,1,1]).randomnessObject,s=cr(a.scale,r),l=cr(a.rotation,r),c=cr(a.position,r),u=this.parameters.randomness===!0&&a.strength!==0?this.getRandom(a,!0):null,p=hh(a.strength,this.parameters.randomness),h=cr(o.count,r),f=cr(o.size,r);if(o.useCenter===!0){let m={x:h[0]%2===0?2:1,y:h[1]%2===0?2:1,z:h[2]%2===0?2:1},y=new $e.Vector3(f[0]*(h[0]-m.x)*.5,f[1]*(h[1]-m.y)*.5,f[2]*(h[2]-m.z)*.5);for(let g=0;g<h[0];g++)for(let v=0;v<h[1];v++)for(let b=0;b<h[2];b++){let S=this.children[n++];if(!S)continue;let x=u===null?0:u.noise((g+1)*(a.freqScale/10)+a.movement,(v+1)*(a.freqScale/10)+a.movement,(b+1)*(a.freqScale/10)+a.movement);S.scale.x=1+p(n,ze(x,s[0]))||Un,S.scale.y=1+p(n,ze(x,s[1]))||Un,S.scale.z=1+p(n,ze(x,s[2]))||Un;let A=p(n,ze(x,l[0])),w=p(n,ze(x,l[1])),C=p(n,ze(x,l[2]));S.rotation.set(A,w,C),S.position.x=f[0]*g-y.x+p(n,ze(x,c[0])),S.position.y=f[1]*v-y.y+p(n,ze(x,c[1])),S.position.z=f[2]*b-y.z+p(n,ze(x,c[2]))}}else for(let m=0;m<h[0];m++)for(let y=0;y<h[1];y++)for(let g=0;g<h[2];g++){let v=this.children[n++];if(!v)continue;let b=u===null?0:u.noise((m+1)*(a.freqScale/10)+a.movement,(y+1)*(a.freqScale/10)+a.movement,(g+1)*(a.freqScale/10)+a.movement);v.scale.x=1+p(n,ze(b,s[0]))||Un,v.scale.y=1+p(n,ze(b,s[1]))||Un,v.scale.z=1+p(n,ze(b,s[2]))||Un;let S=p(n,ze(b,l[0])),x=p(n,ze(b,l[1])),A=p(n,ze(b,l[2]));v.rotation.set(S,x,A),v.position.x=f[0]*m+p(n,ze(b,c[0])),v.position.y=-f[1]*y+p(n,ze(b,c[1])),v.position.z=-f[2]*g+p(n,ze(b,c[2]))}}_updateToObject(e,r){if(e.type!=="toObject")throw new Error;let{toObject:n}=e,o=cr(n.rotation,r),a=cr(n.position,r),s=cr(n.scale,r),l=new $e.Euler(o[0],o[1],o[2]),c=e.randomnessObject??Fo.defaultData([1,1,1]).randomnessObject,d=cr(c.rotation,r),u=cr(c.position,r),p=cr(c.scale,r),f=this.parameters.randomness===!0&&c.strength!==0?this.getRandom(c):null,m=hh(c.strength,this.parameters.randomness);if(!n.object){for(let[,A]of this.children.entries())A.position.set(0,0,0),A.scale.setScalar(1),A.rotation.set(0,0,0);this.objectForSample=void 0,this.invalidateSurfaceCaches();return}if(!this.objectForSample)return;if(this.objectForSample instanceof Is)if(!this.objectForSample.font?.isLoaded||this.objectForSample.geometry.attributes.position===void 0){this._pendingMediaLoad=!0;return}else this._pendingMediaLoad=!1;if(this.objectForSample.geometry===void 0&&this.objectForSample.isAncestorOf(this.object.uuid)){console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);return}let y=this.getSubdivData();if(y.length>0){let A=Math.round(y.length*n.count/100);this._updateCount(r,A)}else{let A=this.objectForSample.geometry.getAttribute("position");if(!A||isNaN(A.count)||A.count===0){console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`);return}}this.objectForSample.updateMatrixWorld();let g=n.spreadType==="random",v=null;g&&(v=this.getSurfaceSampler(),v.setRandomGenerator((0,Ig.default)(this.object.uuid+n.seed)));let b=ZO[n.axis],S=this.children;Ds.fromArray(b);let x=this.objectForSample instanceof Va;x&&lI.copy(this.objectForSample.matrixWorld).invert(),n.align!=="normal"&&this.object.getWorldDirection(pI),P1.set(Ds.y,Ds.z,Ds.x).normalize(),fI.copy(P1).cross(Ds).normalize(),dI.makeBasis(P1,Ds,fI).invert();for(let[A,w]of S.entries()){let C=A*(c.freqScale/10)+c.movement,T=f===null?0:f.noise(C,C,C),M=A+1,D=m(M,ze(T,d[0])),I=m(M,ze(T,d[1])),_=m(M,ze(T,d[2]));g?v.sample(Pg,E1):(y.length&&(Pg.fromArray(y[A].pos),E1.fromArray(y[A].norm)),x&&Pg.applyMatrix4(lI)),w.position.copy(Pg);let E=n.align==="normal"?E1:pI,B=Tg.fromArray(a);Tg.x+=m(M,ze(T,u[0])),Tg.y+=m(M,ze(T,u[1])),Tg.z+=m(M,ze(T,u[2]));let L=Math.acos(E.dot(Ds)),k=kG.crossVectors(Ds,E).normalize(),F=_G.makeRotationAxis(k,L);T1.copy(E).cross(this.object.up).normalize(),hI.copy(T1).cross(E).normalize(),cI.makeBasis(T1,E,hI),uI.multiplyMatrices(cI,dI),So.setFromRotationMatrix(uI),B.applyMatrix4(F),w.position.add(B),w.rotation.set(So.x+l.x+D,So.y+l.y+I,So.z+l.z+_),w.scale.set(1+s[0]+m(M,ze(T,p[0]))||Un,1+s[1]+m(M,ze(T,p[1]))||Un,1+s[2]+m(M,ze(T,p[2]))||Un),w.scale.multiply(this.object.scale)}}getSurfaceSampler(){let e=this.objectForSample,r=e.geometry,n=r.getAttribute("position"),o=r.index,a=this.surfaceSamplerCache;if(a!==null&&a.geometry===r&&a.position===n&&a.positionVersion===Og(n)&&a.index===o&&a.indexVersion===(o===null?-1:o.version))return a.sampler;let s=new Sg(e).build();return this.surfaceSamplerCache={geometry:r,position:n,positionVersion:Og(n),index:o,indexVersion:o===null?-1:o.version,sampler:s},s}invalidateSurfaceCaches(){this.surfaceSamplerCache=null,this.surfacePointsCache=null}getSubdivData(){if(!this.objectForSample)return[];let e=this.parameters.toObject.spreadType;if(e==="random")return[];let r=this.objectForSample instanceof Va,n=this.objectForSample.geometry;if(!r&&n){let l=this.surfacePointsCache,c=n.getAttribute("position");if(l!==null&&l.spreadType===e&&l.geometry===n&&l.position===c&&l.positionVersion===Og(c)&&l.index===n.index&&l.indexVersion===(n.index===null?-1:n.index.version))return l.points}let o=new Map,a=(l,c)=>{let d=Math.round(l[0]*1e4)+"_"+Math.round(l[1]*1e4)+"_"+Math.round(l[2]*1e4),u=o.get(d);u?(u.pos[0]+=l[0],u.pos[1]+=l[1],u.pos[2]+=l[2],u.norm[0]+=c[0],u.norm[1]+=c[1],u.norm[2]+=c[2],u.count+=1):o.set(d,{pos:[...l],norm:[...c],count:1})};if(r){let l=this.objectForSample,c=JO[e],d=gI[c],u=mI[c],p=yI[c],h=d(l.subdivPointerNew);for(let f=0;f<=h-1;f++){let m=u(l.subdivPointerNew,f),y=p(l.subdivPointerNew,f);oI.fromArray(m).applyMatrix4(l.matrixWorld),aI.fromArray(y),a(oI.toArray(),aI.toArray())}}else(n.index?$O(n):eI(n)).forEach((c,d)=>{e==="polygon_center"&&a(c.midpoint,c.norm),e==="vertex"&&(a(c.vertices[0],c.norm),a(c.vertices[1],c.norm),a(c.vertices[2],c.norm)),e==="edge"&&(a(c.faceCenters[0],c.norm),a(c.faceCenters[1],c.norm),a(c.faceCenters[2],c.norm))});let s=Array.from(o.values());for(let l of s)l.pos[0]/=l.count,l.pos[1]/=l.count,l.pos[2]/=l.count,l.norm[0]/=l.count,l.norm[1]/=l.count,l.norm[2]/=l.count;if(!r&&n){let l=n.getAttribute("position");this.surfacePointsCache={spreadType:e,geometry:n,position:l,positionVersion:Og(l),index:n.index,indexVersion:n.index===null?-1:n.index.version,points:s}}return s}updateState(e,r){this.parameters=Ss(e);let{parent:n,matrix:o}=this;if(this.parameters.type!=="toObject")this.invalidateSurfaceCaches(),(this.parent===null||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(this.parent===null||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent(),this.invalidateSurfaceCaches();let s=r.scene.find(this.parameters.toObject.object);s instanceof it?this.objectForSample=s:this.objectForSample=void 0,this.matrix=new $e.Matrix4,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,s&&s.add(this)}let a=this._layout(r);this._syncEnclosingCopies(a||this.parent!==n||this.matrix!==o)}get pendingMediaLoad(){return this._pendingMediaLoad}},mh=class extends Tn{constructor(e){super(e.object,e.parameters);this.source=e;this.matrixAutoUpdate=!1}get insideBoolean(){return this.source.insideBoolean}expand(){this.matrix=this.source.matrix,this.matrixWorldNeedsUpdate=!0;let e=0;for(let r of this.source.children){if(!(r instanceof lr))continue;let n=this.children[e];n===void 0&&(n=new lr(this.object),this.add(n)),n.matrix=r.matrix,n.matrixWorldNeedsUpdate=!0,n.expand(),e+=1}for(;this.children.length>e;)this.remove(this.children[e])}};var Ao=24,Nr=96,oa=RM(),Ga=2;var O1=!1,vI=!0;try{let i=new URLSearchParams(window.location.search);O1=i.get("dbgsbstatic")==="0",vI=i.get("sb512")!=="0"}catch{}function VG(i){let t=i.getAttribute("position");return t===void 0?-1:(t.version??t.data?.version??0)*1048576+(t.count??0)%1048576}var I1=class extends tt{constructor(e,r,n){super(e,r,n);this.data=r;this.isShapeBlendEntity=!0;this.needsRebuild=!0;this.customDepthMaterialNeedsUpdate=!1;this._prevShapeData=null;this._prevSpan=-1;this._reach=new Float32Array(Nr);this._prevReach=new Float32Array(Nr);this._fieldDirtyFull=!0;this._fieldDirtyMin=new me.Vector3;this._fieldDirtyMax=new me.Vector3;this._maxBlendK=0;this._meshSdfBaked=new Map;this._meshSdfWanted=new Map;this._passesRenderer=null;this._npart=-1;this.spatialn=1;this.drawRangeNeedsForceUpdate=!0;this._resolutionLevel=-1;this._authoredResolutionLevel=-1;this.ultraFieldResolution=0;this.resolution=64;this.spatialDivisions=25;this.zLayersPerRow=8;this.basePyramidSize=512;this.pyramidTexture1Width=341;this.pyramidTexture1Height=256;this.pyramidTexture2Width=170;this.pyramidTexture2Height=128;this.numLevels=9;this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512];this.bboxSize=0;this.bboxOffset=0;this.shapesDataTexture={value:void 0};this.spatialscene=new me.Scene;this.potentialPassScene=new me.Scene;this.voxelPassScene=new me.Scene;this._spatialPassRenderTargets=[];this._potentialPassRenderTargets=[];this._voxelPassRenderTargets=[];this._pyramidRenderTargets=[];this.geometry=new me.BufferGeometry,this.geometry.drawRange.count=0,this.spatialPassUniforms={span:{value:-1},shapesDataTexture:this.shapesDataTexture,npart:{value:this.npart},spatialn:{value:this.spatialn}},this.spatialMesh=new me.Mesh(pd,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let o=new me.DataTexture(oa.triTable,16,256,me.RedFormat,me.FloatType);o.needsUpdate=!0;let a=new me.DataTexture(oa.numTrisTable,256,1,me.RedFormat,me.FloatType);a.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:a}},this.voxelMesh=new me.Mesh(pd,this.voxelPassMaterial()),this.voxelMesh.frustumCulled=!1,this.voxelPassScene.add(this.voxelMesh),this.potentialPassUniforms={shapesDataTexture:this.shapesDataTexture,spatialPassTexture:{value:void 0},npart:{value:this.npart},spatialn:{value:this.spatialn}},this.potentialMesh=new me.Mesh(pd,this.potentialPassMaterial()),this.potentialMesh.frustumCulled=!1,this.potentialPassScene.add(this.potentialMesh),this.marchPassUniforms={triTable:{value:o},potentialPassTexture:{value:void 0},voxelPassTexture:{value:void 0},pyramidTexture1:{value:void 0},pyramidTexture1Size:{value:void 0},pyramidTexture2:{value:void 0},pyramidTexture2Size:{value:void 0}},this.frustumCulled=!1,this.onBeforeShadowPass=s=>{let l=HG.call(this);if(this.npart===0){this.geometry.drawRange.count=0;return}let c=this.material.root;if(!c.shadersPatchedForShapeBlend)this.patchVertexShaderForShapeBlend(c),c.shadersPatchedForShapeBlend=!0,this.customDepthMaterialNeedsUpdate=!0;else if(this.customDepthMaterialNeedsUpdate){this.customDepthMaterialNeedsUpdate=!1,this.customDepthMaterial=new me.ShaderMaterial({vertexShader:c.vertexShader,fragmentShader:`
729
729
  #include <packing>
730
730
  void main()
731
731
  {
@@ -1308,7 +1308,7 @@ void main() {
1308
1308
  gl_FragColor = texture(inputTexture, vUv);
1309
1309
  gVelocity = vec4(0.0);
1310
1310
  }
1311
- `,r.pyramidTextureSize.value=new me.Vector2(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(o.uniforms,r)};this.material.shapeBlendhack=n,this.material.root.shapeBlendhack=n}dispose(){super.dispose(),UO()?.release(this)}},yh=I1;yh.streamCompaction=new Vy;var GG=new me.Matrix4,UG=new me.Matrix4,Bd=new me.Quaternion,Wl=new me.Vector3,Dg=new me.Vector3,zG=new me.Quaternion;function jG(i,t=0){let e=this.children.length;for(;e--;){let r=this.children[e];Ba.is(r)&&bI.call(r,i,t+1)}}function bI(i,t=0){if(i(this,t)!==!0){let r=this.children.length;for(;r--;){let n=this.children[r];Ba.is(n)&&bI.call(n,i,t+1)}}}function HG(){if(this.shapesDataTexture.value===void 0){let y=new me.DataTexture(new Float32Array(4*Nr*Na),Nr,Na,me.RGBAFormat,me.FloatType);this.shapesDataTexture.value=y}let i=this.shapesDataTexture.value,t=i.image.data,e=0,r=0,n=this.data.geometry.blendRange,o=GG.copy(this.matrixWorld).invert(),a=this._npart,s=0;this._meshSdfWanted.clear();let l=null;if(jG.call(this,y=>{if(y.visible===!1)return!0;let g;if(y instanceof Tn)return;if(y instanceof Id||Up(y))return;y instanceof lr?g=y.object:g=y;let v=y.data?.cloner;if(Ne.is(y)&&v&&!v.hideBase&&v.type!=="radial"&&v.disabled!==!0||!(g instanceof tt))return;let b=g.geometry.userData.parameters,S=b?.shapeBlendNode??g.dataPatched?.geometry?.shapeBlendNode;if(S===void 0)return;if(UG.multiplyMatrices(o,y.matrixWorld).decompose(Dg,Bd,Wl),b?.type==="TorusGeometry"&&b.arc!==360){let E=b.arc*Math.PI/180;E=E/4,Bd.multiply(zG.set(0,0,Math.sin(E),Math.cos(E)))}let A=S.overrideGlobalBlend?S.blendRange:n;A=A/this.bboxSize*2,t[s*4]=(Dg.x-this.bboxOffset)/this.bboxSize*2,t[s*4+1]=(Dg.y-this.bboxOffset)/this.bboxSize*2,t[s*4+2]=(Dg.z-this.bboxOffset)/this.bboxSize*2,t[s*4+3]=S.operation===0?1:S.operation===2?-1:-2,t[Nr*4+s*4]=-Bd.x,t[Nr*4+s*4+1]=-Bd.y,t[Nr*4+s*4+2]=-Bd.z,t[Nr*4+s*4+3]=Bd.w;let w=new Float32Array(4),C=0,T=A;if(b?.type==="SphereGeometry")b.width===b.height&&b.width===b.depth?w[0]=0:w[0]=1,w[1]=b.width/this.bboxSize,w[2]=b.height/this.bboxSize,w[3]=b.depth/this.bboxSize,T=Math.max(w[1],w[2],w[3])*Wl.x+A;else if(b?.type==="CubeGeometry"){C=b.cornerRadius;let E=b.width,B=b.height,L=b.depth;w[0]=2,w[1]=(E-2*C)/this.bboxSize,w[2]=(B-2*C)/this.bboxSize,w[3]=(L-2*C)/this.bboxSize,T=Math.sqrt(E**2+B**2+L**2)/this.bboxSize*Wl.x+A}else if(b?.type==="CylinderGeometry"){C=b.cornerRadius;let E=b.height,B=b.radiusBottom,L=b.radiusTop;if(L>=B){let k=Math.atan2(L-B,E),F=(Math.PI/2-k)/2;L-=C/Math.tan(F),B-=C*Math.tan(F)}else if(B>L){let k=Math.atan2(B-L,E),F=(Math.PI/2-k)/2;L-=C*Math.tan(F),B-=C/Math.tan(F)}w[1]=(b.height-2*C)/this.bboxSize,B===L?(w[0]=3,w[2]=B/this.bboxSize*2):(w[0]=4,w[2]=B/this.bboxSize*2,w[3]=L/this.bboxSize*2),T=(Math.hypot(w[1],Math.max(Math.abs(w[2]),Math.abs(w[3])))+C/this.bboxSize*2)*Wl.x+A}else if(b?.type==="TorusGeometry"){if(w[0]=5,w[1]=(b.width-b.depth)/this.bboxSize,w[2]=b.depth/this.bboxSize,b.arc!==360){w[0]=6,w[3]=w[1],t[Nr*12+s*4+3]=w[2];let E=2*Math.atan2(w[2]/2,w[1]),B=b.arc*Math.PI/180/2-E;w[1]=Math.sin(B),w[2]=Math.cos(B)}T=b.width*Wl.x/this.bboxSize+A}else{let E=g.geometry;(l??(l=new Set)).add(E.uuid);let B=this._meshSdfBaked.get(E.uuid),L=VG(E);if((B===void 0||B.posVersion!==L)&&this._meshSdfWanted.set(E.uuid,E),B===void 0)return;w[0]=7,w[1]=B.slot,w[2]=B.boxHalf.x/this.bboxSize*2,w[3]=B.boxHalf.y/this.bboxSize*2,t[Nr*12+s*4+3]=B.boxHalf.z/this.bboxSize*2,T=Math.hypot(B.boxHalf.x,B.boxHalf.y,B.boxHalf.z)/this.bboxSize*2*Wl.x+A}t.set(w,Nr*8+s*4),e=Math.max(e,T),r=Math.max(r,A),this._reach[s]=T,t[Nr*12+s*4]=A,t[Nr*12+s*4+1]=C/this.bboxSize*2,t[Nr*12+s*4+2]=Wl.x;let M=Array.isArray(g.material)?g.material[0]:g.material,D=M,I,_;if(D?.getShapeBlendBaseColor){let E=D.getShapeBlendBaseColor();I=E,_=E.a}else M?.uniforms?.nodeU0!==void 0?(I=M.uniforms.nodeU0.node.value,_=M.uniforms.nodeU1?.value??1):(I={r:1,g:1,b:1},_=1);S.operation!==0&&!S.useColor&&(_=-1),t[Nr*16+s*4]=I.r,t[Nr*16+s*4+1]=I.g,t[Nr*16+s*4+2]=I.b,t[Nr*16+s*4+3]=_,_<1&&this.material.defines?.SHAPEBLEND_C===1&&this.material.setTransparent(!0),s++}),this._meshSdfBaked.size>0){let y=l??new Set;for(let g of this._meshSdfBaked.keys())y.has(g)||this._meshSdfBaked.delete(g)}this.npart=s,this._maxBlendK=r;let c=e*1.1+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=c;let d=this._prevShapeData,u=a!==s,p=d===null||this._prevSpan!==c||u,h=p||O1,f=this._fieldDirtyMin.set(1/0,1/0,1/0),m=this._fieldDirtyMax.set(-1/0,-1/0,-1/0);if(d!==null){let y=Math.max(s,a);for(let g=0;g<y;g++){let v=!1;for(let D=0;D<Na;D++){let I=Nr*4*D+g*4;if(t[I]!==d[I]||t[I+1]!==d[I+1]||t[I+2]!==d[I+2]||t[I+3]!==d[I+3]){v=!0;break}}if(!v)continue;if(p=!0,h)break;let b=t[g*4],S=t[g*4+1],x=t[g*4+2],A=d[g*4],w=d[g*4+1],C=d[g*4+2],T=this._reach[g],M=this._prevReach[g];if(!Number.isFinite(b+S+x+T)||!Number.isFinite(A+w+C+M)){h=!0;continue}f.x=Math.min(f.x,b-T,A-M),f.y=Math.min(f.y,S-T,w-M),f.z=Math.min(f.z,x-T,C-M),m.x=Math.max(m.x,b+T,A+M),m.y=Math.max(m.y,S+T,w+M),m.z=Math.max(m.z,x+T,C+M)}}return O1&&(p=!0),this._fieldDirtyFull=h||f.x===1/0,p&&(d===null?this._prevShapeData=new Float32Array(t):d.set(t),this._prevReach.set(this._reach),this._prevSpan=c,i.needsUpdate=!0),p}Fi("ShapeBlendGeometry",(i,t,e)=>new yh(i,t,e));Pe("shape-blends");var Rg=class extends tt{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let r=this.geometry.getAttribute("position");r!==void 0?Yp(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,t,e):super.updateEntityBoxSize(t,e)}};Fi("VectorGeometry",(i,t,e)=>new Rg(i,t,e));Pe("vector-shapes");var Bg=class extends tt{constructor(e,r,n){super(e,r,n);this.isPathObject=!0;this._shapeId=null;this._lastShapeParams=null;this._lastShape=null;this._context=n}get profileShape(){return this._lastShape??void 0}updateState(e,r){super.updateState(e,r),this.updateShape(),this.refreshAttachedCloners(r)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let o in e)typeof e[o]=="string"&&(e[o]=this._context.shared.getVariable(e[o],[this.uuid,"geometry","extrusion","shape",o]));let r;if(e.type==="Custom"){let o=e.shapeId;if(o!==this._shapeId&&this.detachShape(),o){this._shapeId=o;let a=this._context.scene.find(o);a?.data&&(a.attachedPaths.add(this),r=a.geometry.userData?.shape),r||this._context.scene.addPendingCommand(()=>this.updateShape())}}else if(this._lastShape!==null&&this._sameShapeParams(e))r=this._lastShape;else{let o;switch(e.type){case"Rectangle":o=wd;break;case"Ellipse":o=Sd;break;case"Polygon":o=ig;break;case"Star":o=og;break;default:throw new Error(`Unknown shape type: ${e.type}`)}r=o.create({parameters:e}).userData.shape,this._lastShapeParams=e,this._lastShape=r??null}let n=this.geometry;if(r&&n.inputs){if(this._lastShape=r,e.type==="Custom"&&(this._lastShapeParams=null),n.inputs.shapeData===r)return;n.inputs.shapeData=r,n.build()}}_sameShapeParams(e){let r=this._lastShapeParams;if(r===null)return!1;for(let n in e)if(!Object.is(e[n],r[n]))return!1;for(let n in r)if(!(n in e))return!1;return!0}detachShape(){this._shapeId!==null&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}supportsInPlaceGeometryUpdate(){return!1}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,r){return super.updateTransformState(e,r)}updateGeometryInteractions(e,r){super.updateGeometryInteractions(e,r),this.updateShape()}updateEntityBoxSize(e,r){let n=this.geometry.getAttribute("position");n!==void 0&&n.count>0?Yp(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,e,r):super.updateEntityBoxSize(e,r)}};var Fe=require("three");function xI(i,t){let e=2*Math.PI;return(i%e+e)%e===(t%e+e)%e}var SI=new Fe.Matrix4,WG=new Fe.Matrix4,qG=new Fe.Matrix4().makeScale(1,1,-1),AI=new Fe.Vector3,wI=new Fe.Vector3,D1=new Fe.Vector3,XG=new Fe.Vector3,YG=new Fe.Vector3,KG=new Fe.Vector3,QG=new Fe.Vector3,CI=new WeakMap,R1=new WeakMap;function ZG(i,t,e){let r=[new Fe.Vector3,new Fe.Vector3,new Fe.Vector3],n=[new Fe.Vector3,new Fe.Vector3,new Fe.Vector3];return i.extractBasis(r[0],r[1],r[2]),t.extractBasis(n[0],n[1],n[2]),r.forEach((o,a)=>{let s=n[a],l=Fe.MathUtils.lerp(o.length(),s.length(),e);o.lerp(s,e).setLength(l)}),new Fe.Matrix4().makeBasis(r[0],r[1],r[2])}function EI(i){i.setIndex(null),i.setAttribute("position",new Fe.BufferAttribute(new Float32Array(0),3)),i.setAttribute("normal",new Fe.BufferAttribute(new Float32Array(0),3)),i.setAttribute("uv",new Fe.BufferAttribute(new Float32Array(0),2)),i.setDrawRange(0,0)}var TI=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(e.width),n=Math.abs(e.height??e.width),o=Math.abs(e.depth??0),a=i.shapeData??t?.shapeData??Sd.create({parameters:{...Sl,width:typeof Sl.width=="number"?Sl.width:100,height:typeof Sl.height=="number"?Sl.height:100}}).userData.shape;return{ownerId:i.ownerId??t?.ownerId,path:i.path??_c.defaultData(),parameters:Object.assign(e,{width:r,height:n,depth:o,extrusion:{...Lm,...e.extrusion}}),shapeData:a}}static build(i){if(i.path.points.length>=2){let e=new B1(i);return Object.assign(e,{userData:{...i,type:"PathGeometry"}})}else{let e=new Fe.BufferGeometry;return EI(e),Object.assign(e,{userData:{...i,type:"PathGeometry"}})}}},B1=class extends Fe.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)||!xI(e.twist,0)||e.startScale!==e.endScale}build(){let{points:e,matrices:r}=this._getSampledPath();if(e.length<2){EI(this);return}let{depth:n,offset:o}=this.inputs.parameters.extrusion;n=Math.max(0,Math.min(n,1)),o=Math.max(0,Math.min(o,1));let a=this.inputs.path.isClosed?e.length:e.length-1,s=Math.floor(o*a),l=this.inputs.path.isClosed?Math.ceil((n+o)*a):Math.ceil(Math.min(1,n+o)*a),c=Math.min(Math.max(2,l-s+1),a+2),d=[],u=[];for(let Y=0;Y<c;Y++){let Q=this.inputs.path.isClosed?(Y+s)%e.length:Math.min(Y+s,e.length-1);d.push(e[Q].clone()),u.push(r[Q].clone())}let p=(Y,Q,te)=>{d[Y]=d[Y].clone().lerp(d[Q],te),u[Y]=ZG(u[Y],u[Q],te)},h=0,f=o*a%1;(!this.inputs.path.isClosed||n<=1)&&(f||o===0)&&(h=f,p(0,1,h));let m=0,y=(o+n)*a%1;if((this.inputs.path.isClosed&&n<=1||!this.inputs.path.isClosed&&o+n<1)&&y&&(m=y,p(d.length-1,d.length-2,1-m)),n===0){let Y=d.length-1;d[Y].copy(d[0]),u[Y].copy(u[0])}this._applyPathModifiers(u,h,m);let{bevel:g,bevelSides:v}=this.inputs.parameters.extrusion,b=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(b=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:S,infos:x,vertices:A}=this._getShapePoints(b),w=g>0?this.inputs.parameters.extrusion.capType:"flat",C=w==="round"?w2(this.inputs.shapeData,g,v,b,this.inputs.ownerId):void 0,T=C!==void 0&&this.inputs.parameters.extrusionVersion===1?Jy(C):C,M=w==="round"&&T===void 0?"flat":w,D=T!==void 0?T.positions.length/3:0,I=0,_=0;x.sort((Y,Q)=>Y.start-Q.start),x.forEach(Y=>{Y.verticesStart=I,Y.verticesCount=Y.continuous.reduce((Q,te,ue)=>Q+(ue===0||!te?2:1),0),_+=Y.verticesCount,I=_});let E=_*c,B,L=0;this._isOpenEnded()&&M==="flat"&&(B=this._getSurfaceTesselation(S),L=B.vertexCount);let k=E+2*L+D*2,F=E+2*L,W={positions:new Float32Array(k*3),normals:new Float32Array(k*3),uvs:new Float32Array(k*2)},U=0;x.forEach(Y=>{U+=Y.count});let G=U*(c-1)*6+(B?2*B.elementCount*3:0)+(T!==void 0?2*T.indices.length:0),q=new Uint32Array(G),X=0;if(x.forEach(Y=>{X=this._extrudeRegion(Y,A,u,d,W,q,X,this._isGeometryClosed()&&!this._isOpenEnded())}),B&&(X=this._closeEnd(B,E,q,X,W,u[0],d[0],!1),X=this._closeEnd(B,E+L,q,X,W,u[u.length-1],d[d.length-1],!0)),T!==void 0){let Y={positions:W.positions,normals:W.normals,uvs:W.uvs,indices:q};nh(T,Y,F,X,SI.copy(u[0]).setPosition(d[0]).multiply(qG),(Q,te,ue)=>[ue,1e-4]),X+=T.indices.length,F+=D,nh(T,Y,F,X,SI.copy(u[u.length-1]).setPosition(d[d.length-1]),(Q,te,ue)=>[ue,1]),X+=T.indices.length}this.setAttribute("position",new Fe.BufferAttribute(W.positions,3)),this.setAttribute("normal",new Fe.BufferAttribute(W.normals,3)),this.setAttribute("uv",new Fe.BufferAttribute(W.uvs,2)),this._setIndexFromUint32(q)}_setIndexFromUint32(e){let r=!1;for(let n=e.length-1;n>=0;--n)if(e[n]>=65535){r=!0;break}this.setIndex(new Fe.BufferAttribute(r?e:new Uint16Array(e),1))}_getSampledPath(){let e=this.inputs.path,r=by(e),n=CI.get(r);if(n===void 0||n.subdivisions!==e.subdivisions||n.subdivisionMode!==e.subdivisionMode){let o=this._extractPathPoints(r),a=o.length<2?[]:this._computeBasisMatrices(o);n={subdivisions:e.subdivisions,subdivisionMode:e.subdivisionMode,points:o,matrices:a},CI.set(r,n)}return n}_extractPathPoints(e){let r=this.inputs.path.subdivisions,n=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(r*4):e.getPoints(r);if(n.length<2)return[];let o=[n[0]];return n.forEach(s=>{o[o.length-1].distanceToSquared(s)>.001&&o.push(s)}),this.inputs.path.isClosed&&o[o.length-1].distanceTo(o[0])<.001&&o.pop(),o}_computeBasisMatrices(e){let r=[],n=e.length,o=this.inputs.path.isClosed,a=new Fe.Vector3,s=new Fe.Vector3,l=new Fe.Vector3,c=new Fe.Vector3,d=new Fe.Vector3(0,1,0);for(let y=0;y<n;y++){let g=e[y],v;y===0?v=o?e[n-1]:AI.copy(g).multiplyScalar(2).sub(e[1]):v=e[y-1];let b;y===n-1?b=o?e[0]:AI.copy(g).multiplyScalar(2).sub(e[y-1]):b=e[y+1],wI.subVectors(g,v).normalize(),D1.subVectors(b,g).normalize();let S=XG.addVectors(wI,D1);S.lengthSq()<1e-10&&(S.copy(D1),S.dot(l)<0&&S.negate()),S.normalize(),l.copy(S),y===0&&(S.equals(d)||YG.copy(S).negate().equals(d))&&d.set(0,0,1);let x=KG.crossVectors(d,S).normalize(),A=QG.crossVectors(S,x).normalize();d.copy(A),c.copy(x),y===0&&(a.copy(A),s.copy(S));let w=new Fe.Matrix4().makeBasis(x,A,S);r.push(w)}let u=o?s:l,p=o?a:new Fe.Vector3(0,1,0),h=u.clone().cross(c).normalize(),f=Math.acos(p.dot(h));if(isNaN(f))return r;let m=p.clone().cross(h);u.dot(m)>0&&(f*=-1);for(let y=1;y<r.length;y++)r[y].multiply(WG.makeRotationZ(f*y/r.length));return r}_applyPathModifiers(e,r,n){let o=e.length,{angle:a,twist:s,startScale:l,endScale:c}=this.inputs.parameters.extrusion,d=new Fe.Matrix4,u=new Fe.Matrix4;return e.forEach((p,h)=>{let f=h===0?0:h===o-1?1:(h-r)/(o-(n===0?0:1)-(r+(1-n)));d.makeRotationZ(Fe.MathUtils.lerp(a,a+s,f)*Fe.MathUtils.DEG2RAD);let m=Fe.MathUtils.lerp(l,c,f);u.makeScale(m,m,m),p.multiply(d).multiply(u)}),e}_getShapePoints(e,r=Ct.ODD){let n=this.inputs.shapeData,o=R1.get(n);return(o===void 0||o.curveSegments!==e||o.windingRule!==r)&&(o={curveSegments:e,windingRule:r,shapePoints:this._computeShapePoints(e,r)},R1.set(n,o)),o.shapePoints}_getSurfaceTesselation(e){let r=R1.get(this.inputs.shapeData);if(r?.surfaceTesselation!==void 0)return r.surfaceTesselation;let n;try{n=Ts({windingRule:Ct.ODD,elementType:Vr.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:e})}catch{n=Zy}return r!==void 0&&(r.surfaceTesselation=n),n}_computeShapePoints(e=12,r=Ct.ODD){let n=this.inputs.shapeData,o=n.extractShapePointsToFlatArray([],e),a=n.shapeHoles.map(m=>{let y=m.extractShapePointsToFlatArray([],e),g=[];for(let v=y.length-1;v>=1;v-=2){let b=y[v-1],S=y[v-0];g.push(b,S)}return g}),s;try{s=Ts({windingRule:r,elementType:Vr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o]})}catch{s=Qy}let l;try{l=Ts({windingRule:Ct.ODD,elementType:Vr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]})}catch{l=m2}if(!s)throw new Error("error generating geometry");let c=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 d=1/0,u=-1/0,p=1/0,h=-1/0;for(let m=0,y=s.vertexCount;m<y;m++){let g=m*2,v=s.vertices[g+0],b=s.vertices[g+1];v<d&&(d=v),v>u&&(u=v),b<p&&(p=b),b>h&&(h=b)}let f=[];for(let m=s.elementCount-1;m>=0;m--){let y=m>=c,g=m*2,v=s.elements[g+0],b=s.elements[g+1],S=v+b,x={start:v,count:b,normals:[],isHole:y,continuous:[],verticesStart:0,verticesCount:0};f.push(x);let A=v,w=S-1,C=v+1,T=n.roundedCurves.length;do{let M=A-v,D=s.vertices[w*2+0],I=s.vertices[w*2+1],_=s.vertices[A*2+0],E=s.vertices[A*2+1],B=s.vertices[C*2+0],L=s.vertices[C*2+1],k=_-D,F=E-I,W=Math.sqrt(k*k+F*F);k/=W,F/=W;let U=_-B,G=E-L,q=Math.sqrt(U*U+G*G);U/=q,G/=q,x.normals[M*2+0]=-G,x.normals[M*2+1]=U;let X=s.vertexIndices[A];if(Array.isArray(X))x.continuous[M]=!1;else{let[Y,Q]=n.getCurveIndexFromVertexId(X-1,!0);if(Q>0&&Q<1)x.continuous[M]=!0;else{let te=Q===1?Y+1:Y-1;te=(te+T)%T;let ue=Q===1?0:1,le=n.roundedCurves[Y].getTangent(Q),ce=n.roundedCurves[te].getTangent(ue);x.continuous[M]=le.dot(ce)>.95}}y&&(x.normals[M*2+0]*=-1,x.normals[M*2+1]*=-1),[w,A,C]=[A,C,C+1],C>=S&&(C-=b)}while(C!==v+1)}return{regions:[o,...a],infos:f,vertices:s.vertices}}_insertVertex(e,r,n,o,a){let s=r*2,l=r*3;e.positions[l+0]=n.x,e.positions[l+1]=n.y,e.positions[l+2]=n.z,e.normals[l+0]=o.x,e.normals[l+1]=o.y,e.normals[l+2]=o.z,e.uvs[s+0]=a.x,e.uvs[s+1]=a.y}_extrudeRegion(e,r,n,o,a,s,l,c){let d=e.wallTemplate;if(d===void 0){d=[];for(let S=0;S<e.count;S++){let x=(e.start+S)*2,A=r[x+0],w=r[x+1],C,T;if(e.continuous[S])C=e.normals[S*2+0],T=e.normals[S*2+1];else{let D=S===0?(e.start+e.count-1)*2:x-2,I=A-r[D+0];C=-(w-r[D+1]),T=I,e.isHole||(C=-C,T=-T)}let M=S===0?1:S/e.count;if(d.push(A,w,C,T,M,0),!e.continuous[S]||S===0)if(S===0)d.push(A,w,e.normals[0],e.normals[1],0,1);else{let D=S===e.count-1?e.start*2:x+2,I=r[D+0]-A;C=-(r[D+1]-w),T=I,e.isHole||(C=-C,T=-T),d.push(A,w,C,T,M,1)}}e.wallTemplate=d}let u=n.length,p=d.length,h=a.positions,f=a.normals,m=a.uvs;for(let S=0;S<u;S++){let x=n[S].elements,A=x[0],w=x[1],C=x[2],T=x[4],M=x[5],D=x[6],I=x[12],_=x[13],E=x[14],B=o[S],L=S/(u-1),k=0,F=0,W=0,U=e.verticesStart*u+e.verticesCount*S;for(let G=0;G<p;G+=6){if(d[G+5]===0){let de=d[G+0],ge=d[G+1];k=A*de+T*ge+I+B.x,F=w*de+M*ge+_+B.y,W=C*de+D*ge+E+B.z}let q=d[G+2],X=d[G+3],Y=A*q+T*X+I,Q=w*q+M*X+_,te=C*q+D*X+E,ue=1/(Math.sqrt(Y*Y+Q*Q+te*te)||1);Y*=ue,Q*=ue,te*=ue;let le=U*2,ce=U*3;h[ce+0]=k,h[ce+1]=F,h[ce+2]=W,f[ce+0]=Y,f[ce+1]=Q,f[ce+2]=te,m[le+0]=d[G+4],m[le+1]=L,U++}}let y=e.wallQuadPattern;if(y===void 0){y=[];let S=0;for(let x=0;x<e.count;x++)(!e.continuous[x]||x===0)&&S++,y.push(S,x===e.count-1?0:S+1),S++;e.wallQuadPattern=y}let g=u-1,v=y.length,b=e.isHole;for(let S=0;S<g;S++){let x=e.verticesStart*u+e.verticesCount*S,A=x+e.verticesCount;for(let w=0;w<v;w+=2){let C=x+y[w],T=x+y[w+1],M=A+y[w+1],D=A+y[w];b?(s[l++]=C,s[l++]=M,s[l++]=T,s[l++]=C,s[l++]=D,s[l++]=M):(s[l++]=C,s[l++]=T,s[l++]=M,s[l++]=C,s[l++]=M,s[l++]=D)}}return l}_closeEnd(e,r,n,o,a,s,l,c){let d=e.vertexCount,u=new Fe.Vector3(0,0,c?-1:1).applyMatrix4(s),p=new Fe.Vector3,h=new Fe.Vector2;for(let m=0;m<d;m++){let y=2*m;p.set(e.vertices[y+0],e.vertices[y+1],0).applyMatrix4(s).add(l),this._insertVertex(a,r+m,p,u,h)}let f=e.elements;for(let m=0;m<e.elementCount;m++){let y=3*m;n[o++]=f[y+0]+r,n[o++]=f[y+(c?1:2)]+r,n[o++]=f[y+(c?2:1)]+r}return o}};Fi("PathGeometry",(i,t,e)=>new Bg(i,t,e));zp("PathGeometry",TI);Pe("3d-paths");ki.Cloner=Tn;Pe("cloners");yt();var Nd=require("three");function gh(i){if(i.component){let t=i.component.instances.indexOf(i);t>=0&&i.component.instances.splice(t,1);for(let e of i.children)Ne.is(e)&&gh(e)}}var vh=class extends Wi(Nd.Group,Hi){constructor(e,r,n){super();this.isComponentObject=!0;r.type==="Instance"&&typeof e=="string"&&(r=this.transformAssignData(r,n)),this.super_Entity(e,r),this.objectHelper.update()}get isComponentRoot(){return this.data.type==="Component"&&typeof this.identity=="string"}get isInstanceRoot(){return this.data.type==="Instance"&&typeof this.identity=="string"}transformAssignData(e,r){let n=bs.getComponentData({scene:r.scene.data,shared:r.shared.data},e.component);if(n){let o,a;for(let s of Uo.rootOverrideProps)e[s]===void 0?(o===void 0&&(o={...e}),o[s]=n.data[s]):(a===void 0&&(a={}),a[s]=e[s],o===void 0&&(o={...e}),o[s]=Lo.apply(n.data[s],e[s]));return this.overrideData=a,o}else return{...vr.defaultData,...e,...Vp(vr.defaultData,Uo.rootOverrideProps)}}updateByOp(e,r,n,o){let a;if(this.isInstanceRoot&&!o){if(r=this.transformAssignData(r,n),e.type===0&&e.path.length===0&&this.component)for(let s of Uo.rootOverrideProps)s in e.props&&e.props[s]===void 0&&(a===void 0&&(a={...e,props:{...e.props}}),a.props[s]=this.component.data[s]);else if(e.type===0&&e.path.length>0&&Uo.rootOverrideProps.includes(e.path[0])){let s=e.path[0];a===void 0&&(a={...e,path:[],props:{[s]:r[s]}})}}super.updateByOp(a??e,r,n,o)}updateState(e,r){this.updateState_Entity(e,r)}expandInstanceChildren(e){let r=this.data;if(this.component===void 0){let n=e.scene.find(r.component)??null,o=!1;if(n!==this.oldComponent){if(this.oldComponent){let a=0;for(let s of this.children)if(Ne.is(s))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(s),gh(s),a+=1;else break;this.children.splice(0,a)}o=!0}if(n){let a={};MI(e,[this.uuid],r.overrides,this,n,n,0,o,a);for(let s of this.children)if(Ne.is(s)){let l=s.data;l.type==="Empty"&&l.animations&&s.traverseEntity(c=>{let d=c.dataPatched;if(c instanceof tt&&d.bones&&d.boneInverses){let u=c.dataPatched;if(u.bones&&u.boneInverses){let p=u.bones.map(m=>e.scene.find(a[m])),h=u.boneInverses.map(m=>new Nd.Matrix4().fromArray(m)),f=new Nd.Skeleton(p,h);c.bind(f,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}this.traverseEntity(s=>{s.isVirtualEntity&&e.scene.syncInstancePathConstraint(s)})}this.oldComponent=this.component}}};function PI(i,t,e,r){return i.component===t&&mo(i.identity,r)?i.overrideData===e?2:1:0}function MI(i,t,e,r,n,o,a,s,l){if(a>50)return!1;if(r.component!==n){if(r.component){let d=r.component.instances.indexOf(r);d>=0&&r.component.instances.splice(d,1)}n.instances.find(d=>d===r)||n.instances.push(r),r.component=n}n instanceof vh&&n.isInstanceRoot&&n.expandInstanceChildren(i);let c=0;for(let d of n.children)if(Ne.is(d)){let u=[...t,...typeof d.identity=="string"?[d.identity]:d.identity],p=Vc.resolve(e,u,1);p!=null&&!(p instanceof vt)&&(Object.setPrototypeOf(p,vt.prototype),console.error("wrong prototype"));let h=null,f;if(!s){let m=r.children[c];if(h=Ne.is(m)?m:null,h!==null){let y=PI(h,d,p,u);f=y>=1?h.stateSelection:void 0,y!==2&&(h=null)}if(h===null&&(h=i.scene.findInstance(u)??null,h!==null)){let y=PI(h,d,p,u);if(f=y>=1?h.stateSelection:void 0,y!==2)h=null;else{let g=h.parent.children.indexOf(h);h.parent.children.splice(g,1),r.children.splice(c,0,h),h.parent===r?(g<=c&&console.error("not possible"),void 0):(h.parent=r,h.matrixWorldNeedsUpdate=!0,h.resetBBoxNeedsUpdate(),h.updateVisible(),i.pendingDeletes.delete(h),void 0)}}}if(h===null){let m=p?Lo.apply(d.data,p):d.data;co.is(m.type)&&(m={...m,type:"Empty"}),h=ki.createEntity(u,m,i),h.overrideData=p,r.add(h),r.children.splice(r.children.length-1,1),r.children.splice(c,0,h),h.updateState(h.data,i),f&&h.changeSelectedState(f,i),i.scene.registerInstanceAndSetUuid(h)}if(h.isBone){let m=h.identity[h.identity.length-1];l[m]=h.uuid}c+=1,MI(i,t,e,h,d,o,a+1,s,l)}if(!s){let d=c;for(;;){let u=r.children[c];if(Ne.is(u))i.pendingDeletes.add(u);else break;c+=1}r.children.splice(d,c-d)}return!0}var OI=(i,t,e)=>new vh(i,t,e);Ol("Component",OI);Ol("Instance",OI);Pe("components");var N1=1e-10;function II(i){let t=i[0][0],e=i[1][0],r=i[0][1],n=i[1][1],o=Math.sqrt(t*t+e*e),a=o>N1?t/o:1,s=o>N1?e/o:0,l=a*t+s*e,c=a*n-s*r,d=a*r+s*n;return{rotation:Math.atan2(s,a),scale:[l,c],shear:[Math.abs(c)>N1?d/c:0,0]}}function DI({rotation:i,scale:t,shear:e}){let r=Math.cos(i),n=Math.sin(i),o=e[0]*t[1],a=e[1]*t[0];return[r*t[0]-n*a,n*t[0]+r*a,r*o-n*t[1],n*o+r*t[1]]}var Oe;(x=>{function i(){return[1,0,0,0,1,0,0,0,1]}x.identity=i;function t(A,w=x.identity()){for(let C=0,T=A.length;C<T;C++)w[C]=A[C];return w}x.copy=t;function e(A,w,C,T,M,D){return x.setAbcdef(x.identity(),A,w,C,T,M,D)}x.create=e;function r(A,w,C,T,M,D,I){return A[0]=w,A[1]=T,A[2]=D,A[3]=C,A[4]=M,A[5]=I,A}x.setAbcdef=r;function n(A,w){let[C,T,M,D,I,_]=a(A),[E,B,L,k,F,W]=a(w),U=E*C+B*M,G=E*T+B*D,q=L*C+k*M,X=L*T+k*D,Y=F*C+W*M+I,Q=F*T+W*D+_;return x.create(U,G,q,X,Y,Q)}x.append=n;function o(A,w){let[C,T,M,D,I,_]=a(A),[E,B,L,k,F,W]=a(w),U=C,G=T,q=M,X=D;(E!==1||B!==0||L!==0||k!==1)&&(U=C*E+T*L,G=C*B+T*k,q=M*E+D*L,X=M*B+D*k);let Y=I*E+_*L+F,Q=I*B+_*k+W;return x.create(U,G,q,X,Y,Q)}x.prepend=o;function a(A){return[A[0],A[3],A[1],A[4],A[2],A[5]]}x.getAbcdef=a;function s(A){let[w,C,T,M,D,I]=x.getAbcdef(A),_=w*M-C*T,E=M/_,B=-C/_,L=-T/_,k=w/_,F=(T*I-M*D)/_,W=-(w*I-C*D)/_;return x.create(E,B,L,k,F,W)}x.invert=s;function l([A,w],C){let[T,M,D,I,_,E]=x.getAbcdef(C);return[T*A+D*w+_,M*A+I*w+E]}x.apply=l;function c(A,w){let[C,T,M,D,I,_]=x.getAbcdef(w),E=1/(C*D+M*-T),[B,L]=A;return[D*E*B+-M*E*L+(_*M-I*D)*E,C*E*L+-T*E*B+(-_*C+I*T)*E]}x.applyInverse=c;function d(A,w,C=w){let[T,M,D,I,_,E]=x.getAbcdef(A);return x.setAbcdef(A,T*w,M*C,D*w,I*C,_*w,E*C),A}x.scale=d;function u(A,w){let C=Math.cos(w),T=Math.sin(w),[M,D,I,_,E,B]=x.getAbcdef(A);return x.setAbcdef(A,M*C-D*T,M*T+D*C,I*C-_*T,I*T+_*C,E*C-B*T,E*T+B*C),A}x.rotate=u;function p(A,w,C){let[T,M]=C,D=x.translate(A,-T,-M);return D=x.rotate(D,w),D=x.translate(D,T,M),D}x.rotateAround=p;function h(A,w,C){let[T,M,D,I,_,E]=x.getAbcdef(A);return x.setAbcdef(A,T,M,D,I,_+w,E+C),A}x.translate=h;function f(A,w,C){let[T,M,D,I]=x.getAbcdef(A);return x.setAbcdef(A,T,M,D,I,w,C),A}x.setTranslate=f;function m(A,w,C){let[T,M,D,I]=x.getAbcdef(A);return x.setAbcdef(A,T,M,D,I,w,C),A}x.setPosition=m;function y(A){let[w,C,T,M]=x.getAbcdef(A),D=Math.sqrt(w*w+C*C),I=Math.sqrt(T*T+M*M);return[D,I]}x.getScale=y;function g(A){let[,,,,w,C]=x.getAbcdef(A);return[w,C]}x.getPosition=g;function v(A,w){return x.decompose(A,w).rotation}x.getRotation=v;function b(A,w){let[C,T,M,D,I,_]=x.getAbcdef(A),{rotation:E,scale:B,shear:L}=II([[C,M],[T,D]]);return{position:[I+(w[0]*C+w[1]*M)-w[0],_+(w[0]*T+w[1]*D)-w[1]],scale:B,rotation:E,shear:L,pivot:w}}x.decompose=b;function S(A,w,C,T,M=[0,0]){let[D,I]=A,[_,E]=T,[B,L,k,F]=DI({rotation:C,scale:w,shear:M}),W=D-(_*B+E*k)+_,U=I-(_*L+E*F)+E;return x.create(B,L,k,F,W,U)}x.compose=S})(Oe||(Oe={}));function JG(i,t){let[[e,r],[n,o]]=i,[[a,s],[l,c]]=t,d=(e-n)*(s-c)-(r-o)*(a-l);if(d===0)return!1;let u=((e-a)*(s-c)-(r-s)*(a-l))/d,p=-((e-n)*(r-s)-(r-o)*(e-a))/d;return u>=0&&u<=1&&p>=0&&p<=1}var BI=[[-1,1],[-1,-1],[1,-1],[1,1]],RI=(i,t,e)=>{let r=i.getCenter(),n=i.getHalfSize(),o=Oe.append(t,i.worldMatrix);n[0]===0&&n[1]===0?e.push(Oe.apply(r,o)):BI.forEach(a=>{let s=[a[0]*n[0]+r[0],a[1]*n[1]+r[1]];e.push(Oe.apply(s,o))})},Rs=class{constructor(){this.matrix=Oe.identity();this.min=[1/0,1/0];this.max=[-1/0,-1/0];this.vertices=[];this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),Oe.copy(t.worldMatrix,this.matrix);let r=Oe.invert(t.worldMatrix);this.expandByObjectSize(t,r,e)}expandByObjectSize(t,e,r=!1){let n=[],o=t.isBaseGroup===!0?t:void 0;r===!0&&o!==void 0?o.traverse(a=>{a.visible&&RI(a,e,n)}):RI(t,e,n),this.setFromPoints(n)}setFromSize(t,e,r){this.makeEmpty(),Oe.copy(r,this.matrix),this.expandBySize(t,e,r)}expandBySize(t,e,r){[Oe.apply([0,0],r),Oe.apply([0,e],r),Oe.apply([t,e],r),Oe.apply([t,0],r)].forEach(o=>this.expandByPoint(o))}getCenter(){let[t,e]=this.min,[r,n]=this.getHalfSize();return Oe.apply([t+r,e+n],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),r=this.getCenter(),[n,o,a,s]=Oe.getAbcdef(this.matrix),l=Oe.create(n,o,a,s,r[0],r[1]);this.vertices=BI.map(([c,d])=>Oe.apply([c*t,d*e],l))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t<e;++t)this.edges.push([this.vertices[t],this.vertices[(t+1)%e]])}project(t,e){let r=this.matrix;return e&&(r=Oe.append(e.worldMatrix,r)),Oe.applyInverse(t,r)}intersects(t,e,r){return this.intersectsInLocalSpace(...this.project([t,e],r))}intersectsInLocalSpace(t,e){let{min:r,max:n}=this;return t>=r[0]&&t<=n[0]&&e>=r[1]&&e<=n[1]}containsPoint(t){let[e,r]=t,[n,o]=this.min,[a,s]=this.max;return e>=n&&e<=a&&r>=o&&r<=s}intersectsBBox2D(t){for(let e=0,r=this.edges.length;e<r;e++){let n=this.edges[e];for(let o=0,a=t.edges.length;o<a;o++){let s=t.edges[o];if(JG(n,s))return!0}}for(let e=0,r=t.vertices.length;e<r;e++){let n=t.vertices[e];if(this.containsPoint(n))return!0}return!1}ensureMinMax(){let t=this.min,e=this.max;this.min=[Math.min(t[0],e[0]),Math.min(t[1],e[1])],this.max=[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}copy(t){this.min=[...t.min],this.max=[...t.max],Oe.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new Rs;return t.copy(this),t}};var $G='{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}',NI=()=>JSON.parse($G);async function eU(i,t){return await i.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(i.Engine.prototype,"scene")||Object.defineProperty(i.Engine.prototype,"scene",{get:function(){let e=Object.create(i.SceneController.prototype);return e.__wbg_ptr=this.__wbg_ptr,e}}),{createEngine:e=>i.Engine.create(e,NI(),!0)}}var Ng,bh;function tU(i){Ng=i}function L1(){if(!bh){if(!Ng)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));bh=Ng(),bh.catch(()=>{bh=void 0})}return bh}var LI;function rU(){let i=typeof process<"u"?"2.0.122":void 0;return`https://cdn.spline.design/@splinetool/runtime${i?`@${i}`:""}/build/hana-ui.wasm`}function _I(i){LI=i}function Lg(){return Ng||tU(async()=>{let t=await import("./hana-ui.js");return eU(t,LI??rU())}),L1().then(()=>{})}var Fg=Ec(kg(),1);function GI(i){let t=[],e;try{e=(0,Fg.makeAbsolute)((0,Fg.parseSVG)(i))}catch(c){return console.error("[HanaRenderer] Failed to parse SVG path:",c),t}let r=0,n=0,o=0,a=0,s=null,l=null;for(let c of e){let d=null,u=null;switch(c.code){case"M":r=o=c.x,n=a=c.y,t.push({MoveTo:{x:r,y:n}});break;case"L":r=c.x,n=c.y,t.push({LineTo:{x:r,y:n}});break;case"H":r=c.x,t.push({LineTo:{x:r,y:n}});break;case"V":n=c.y,t.push({LineTo:{x:r,y:n}});break;case"C":{let p={x:c.x1,y:c.y1},h={x:c.x2,y:c.y2};r=c.x,n=c.y,t.push({CurveTo:[p,h,{x:r,y:n}]}),d=h;break}case"S":{let p=s?{x:2*r-s.x,y:2*n-s.y}:{x:r,y:n},h={x:c.x2,y:c.y2};r=c.x,n=c.y,t.push({CurveTo:[p,h,{x:r,y:n}]}),d=h;break}case"Q":{let p={x:c.x1,y:c.y1};r=c.x,n=c.y,t.push({QuadTo:[p,{x:r,y:n}]}),u=p;break}case"T":{let p=l?{x:2*r-l.x,y:2*n-l.y}:{x:r,y:n};r=c.x,n=c.y,t.push({QuadTo:[p,{x:r,y:n}]}),u=p;break}case"A":{let p=r,h=n;r=c.x,n=c.y,aU(t,p,h,c.rx,c.ry,c.xAxisRotation,c.largeArc,c.sweep,r,n);break}case"Z":r=o,n=a,t.push("ClosePath");break}s=d,l=u}return t}function aU(i,t,e,r,n,o,a,s,l,c){if(t===l&&e===c)return;if(r=Math.abs(r),n=Math.abs(n),r===0||n===0){i.push({LineTo:{x:l,y:c}});return}let d=o*Math.PI/180,u=Math.cos(d),p=Math.sin(d),h=(t-l)/2,f=(e-c)/2,m=u*h+p*f,y=-p*h+u*f,g=m*m/(r*r)+y*y/(n*n);if(g>1){let U=Math.sqrt(g);r*=U,n*=U}let v=r*r,b=n*n,S=v*b-v*y*y-b*m*m,x=v*y*y+b*m*m,A=(a!==s?1:-1)*Math.sqrt(Math.max(0,S/x)),w=A*(r*y)/n,C=A*(-n*m)/r,T=u*w-p*C+(t+l)/2,M=p*w+u*C+(e+c)/2,D=Math.atan2((y-C)/n,(m-w)/r),_=Math.atan2((-y-C)/n,(-m-w)/r)-D;!s&&_>0?_-=2*Math.PI:s&&_<0&&(_+=2*Math.PI);let E=Math.max(1,Math.ceil(Math.abs(_)/(Math.PI/2))),B=_/E,L=4/3*Math.tan(B/4),k=D,F=t,W=e;for(let U=0;U<E;U++){let G=k+B,q=Math.cos(k),X=Math.sin(k),Y=Math.cos(G),Q=Math.sin(G),te=T+r*Y*u-n*Q*p,ue=M+r*Y*p+n*Q*u,le=-r*X*u-n*q*p,ce=-r*X*p+n*q*u,de=-r*Q*u-n*Y*p,ge=-r*Q*p+n*Y*u;i.push({CurveTo:[{x:F+L*le,y:W+L*ce},{x:te-L*de,y:ue-L*ge},{x:te,y:ue}]}),k=G,F=te,W=ue}}var Gg=.5522847498307936,cU=150,dU=5*60*1e3,uU=1536/2816;function XI(i){let t=i.getUint32(0);if(t===65536||t===1330926671||t===1953658213)return 0;if(t===1953784678)return i.getUint32(8)>0?i.getUint32(12):void 0}function pU(i){try{return XI(new DataView(i))!==void 0}catch{return!1}}function hU(i){try{let t=new DataView(i),e=XI(t);if(e===void 0)return;let r=t.getUint16(e+4),n=-1,o=-1;for(let c=0;c<r;c++){let d=e+12+c*16,u=t.getUint32(d);u===1751474532&&(n=t.getUint32(d+8)),u===1330851634&&(o=t.getUint32(d+8))}if(n<0||o<0)return;let a=t.getUint16(n+18),s=t.getUint16(o);if(a===0||s<2)return;let l=t.getInt16(o+86);return l>0?l/a:void 0}catch{return}}var UI=!1;function zI(){UI||(UI=!0,console.warn("[HanaRenderer] clipRect: precise clipping of rotated/complex content is not supported by the Hana UI overlay yet; drawing unclipped. (Axis-aligned rectangles are clipped geometrically.)"))}var Ug=class{constructor(t,e=1){this.canvas=t;this._dpr=e;this._width=0;this._height=0;this._isSizeDirty=!1;this._crashed=!1;this._shapes=[];this._lastPushedJSON="";this._ctm=Oe.identity();this._stack=[];this._clips=[];this._pathEls=[];this._simpleShape=null;this._pathPrimitives=0;this._fillColor=Ve.transparent;this._strokeColor=Ve.transparent;this._lineWidth=1;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=Ve.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=Ve.transparent;this._fonts=new Map;this._fontsFlushed=new Set;this._engineFonts=new Set;this._fontXPerEm=new Map;this._measureCache=new Map;try{let r=t.getBoundingClientRect();t.width=r.width*e,t.height=r.height*e}catch{console.log(t.width,e)}}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}get width(){return this._width}get height(){return this._height}async init(){if(!(this._engine||this._crashed)){try{this._context=await L1(),this._engine=await this._context.createEngine(this.canvas)}catch(t){this._crashed=!0,console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t);return}if(this._width>0&&this._height>0)this._syncViewport();else{let t=this.canvas.getBoundingClientRect();t.width>0&&t.height>0&&(this._width=t.width,this._height=t.height,this._syncViewport())}this._flushFonts(),this.uiFontReady=this._watchUiFont()}}_watchUiFont(){return new Promise(t=>{let e=this._engine;if(!e||typeof e.scene.isUiFontLoaded!="function"){t();return}let r=()=>{let a=!1;return this._guard(()=>{a=e.scene.isUiFontLoaded()}),a};if(r()){t();return}let n=Date.now(),o=setInterval(()=>{if(this._crashed||Date.now()-n>dU){clearInterval(o);return}r()&&(clearInterval(o),t())},cU)})}_syncViewport(){let t=this._engine;if(!t||this._crashed)return;let e=this._width,r=this._height;this.canvas.style.width=e+"px",this.canvas.style.height=r+"px",this.canvas.width=Math.max(1,Math.ceil(e*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(r*this._dpr)),this._guard(()=>{t.resize([e,r],this._dpr),t.scene.updateCamera({position:[e/2,r/2],zoom:1})})}setSize(t,e){!this._isSizeDirty&&t===this._width&&e===this._height||(this._isSizeDirty=!1,this._width=t,this._height=e,this._engine?this._syncViewport():(this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",this.canvas.width=Math.max(1,Math.ceil(t*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(e*this._dpr))))}_guard(t){if(!this._crashed)try{t()}catch(e){this._crashed=!0,console.error("[HanaRenderer] Hana engine call failed; disabling this renderer instance.",e)}}async loadFont(t,e){try{let r=await fetch(t);if(!r.ok){console.error(`[HanaRenderer] loadFont: ${t} returned HTTP ${r.status}; skipping "${e}"`);return}let n=await r.arrayBuffer();if(n.byteLength===0){console.error(`[HanaRenderer] loadFont: ${t} was empty; skipping "${e}"`);return}this.registerFont(n,e)}catch(r){console.error(`[HanaRenderer] loadFont failed for "${e}" (${t}):`,r)}}registerFont(t,e){if(this._fonts.has(e))return;this._fonts.set(e,t),pU(t)&&this._engineFonts.add(e);let r=hU(t);r!==void 0&&this._fontXPerEm.set(e,r),this._flushFonts()}_flushFonts(){let t=this._engine;if(!!t)for(let[e,r]of this._fonts)this._fontsFlushed.has(e)||(this._fontsFlushed.add(e),this._guard(()=>{t.scene.addLocalFont(e,new Uint8Array(r))===!1&&this._engineFonts.delete(e)}))}set strokeColor(t){this._strokeColor=t}set fillColor(t){this._fillColor=t}set lineWidth(t){this._lineWidth=t}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}save(){this._stack.push({ctm:Oe.copy(this._ctm),clipLen:this._clips.length})}restore(){let t=this._stack.pop();!t||(this._ctm=t.ctm,this._clips.length=t.clipLen)}setTransform(t,e=!1){let r=Oe.identity();if(this.camera?.enabled&&(r=Oe.append(r,this.camera.worldMatrix),e)){let n=Oe.getScale(this.camera.worldMatrix);r=Oe.scale(r,1/n[0],1/n[1])}this._ctm=Oe.append(r,t)}transform(t){this._ctm=Oe.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){this._pathEls.length!==0&&this._pathEls[this._pathEls.length-1]!=="ClosePath"&&this._pathEls.push("ClosePath")}_startFreeform(){this._simpleShape=null,this._pathPrimitives++}moveTo(t,e){this._startFreeform(),this._pathEls.push({MoveTo:{x:t,y:e}})}lineTo(t,e){this._startFreeform(),this._pathEls.push({LineTo:{x:t,y:e}})}bezierCurveTo(t,e,r,n,o,a){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:r,y:n},{x:o,y:a}]})}quadraticCurveTo(t,e,r,n){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:r,y:n}]})}path(t){this._startFreeform(),this._pathEls.push(...GI(t))}rect(t,e,r,n,o=0,a=0,s=0,l=0){if(!WI([t,e,r,n]))return;let c={x:t,y:e,w:r,h:n,radii:[o,a,s,l]};this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"rect",rect:c,smoothing:0}:null,qI(this._pathEls,c)}ellipse(t,e,r,n,o,a,s,l){if(!!WI([t,e,r,n])){if(r<0||n<0)throw Error("radii cannot be negative");this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"ellipse",cx:t,cy:e,rx:r,ry:n}:null,gU(this._pathEls,t,e,r,n)}}clipRect(t,e,r,n,o=0,a=0,s=0,l=0){let c=Oe.invert(this._ctm);!c||this._clips.push({m:Oe.copy(this._ctm),inv:c,rect:{x:t,y:e,w:r,h:n,radii:[o,a,s,l]}})}fill(){this._emit(!0)}stroke(){this._strokeColor.a<=0||this._lineWidth<=0||this._emit(!1)}_emit(t){let e=this._effectChain(t);if(t&&this._fillColor.a<=0&&!e)return;let r=this._classifyShape();if(!r)return;let n=this._applyClips(r);if(n==="skip")return;if(!t&&n!==r){let a=xh(r);if(a){this._emitClippedRectStroke(a,e);return}}r=n;let o={shape:r,color:t?Ld(this._fillColor):[0,0,0,0],transform:Oe.getAbcdef(this._ctm)};t||(o.stroke=this._strokeDesc()),e&&(o.effect_chain=e),this._shapes.push(o)}_emitClippedRectStroke(t,e){let r=this._lineWidth,n=this._strokeMode==="outside"?r:this._strokeMode==="center"?r/2:0,o=r-n,a=Math.min(t.w,t.h)/2,s=t.radii.map(g=>Math.max(0,Math.min(g,a))),l={x:t.x-n,y:t.y-n,w:t.w+n*2,h:t.h+n*2,radii:s.map(g=>g>0?g+n:0)},c=t.w-o*2,d=t.h-o*2,u=c>0&&d>0?{x:t.x+o,y:t.y+o,w:c,h:d,radii:s.map(g=>Math.max(0,g-o))}:null,p=this._applyClips(Vg(l,0));if(p==="skip")return;let h=xh(p)??l,f=null;if(u){let g=this._applyClips(Vg(u,0));f=g==="skip"?null:xh(g)??u}let m=[];qI(m,h),f&&yU(m,f);let y={shape:{Custom:m},color:Ld(this._strokeColor),transform:Oe.getAbcdef(this._ctm)};e&&(y.effect_chain=e),this._shapes.push(y)}_classifyShape(){let t=this._simpleShape;return t?t.kind==="rect"?Vg(t.rect,t.smoothing):{Ellipse:{center_x:t.cx,center_y:t.cy,rx:t.rx,ry:t.ry}}:this._pathEls.length===0?null:{Custom:this._pathEls.slice()}}_strokeDesc(){return{width:this._lineWidth,line_join:"Miter",color:Ld(this._strokeColor),align:fU[this._strokeMode],cap:"Butt"}}_effectChain(t){let e=this.camera?.scale??1,r=[];if(t&&this._dropShadowColor.a>0&&r.push({DropShadow:{position:[this._dropShadowOffsetX*e,this._dropShadowOffsetY*e],blur:{Uniform:{size:2*this._dropShadowBlur*e}},spread:0,color:Ld(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[n,o]=Oe.getScale(this._ctm),a=(n+o)/2;r.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*a}}}})}if(this._layerBlur>0&&r.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[n,o,a,s]=Oe.getAbcdef(this._ctm),l=this._innerShadowOffsetX,c=this._innerShadowOffsetY;r.push({InnerShadow:{position:[n*l+a*c,o*l+s*c],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:Ld(this._innerShadowColor)}})}return r.length>0?r:void 0}_applyClips(t,e=this._ctm){if(this._clips.length===0)return t;let r=t;for(let n of this._clips){let o=Oe.append(n.inv,e),[a,s,l,c,d,u]=Oe.getAbcdef(o),p=Math.abs(s)<=1e-6*(Math.abs(a)+Math.abs(c))&&Math.abs(l)<=1e-6*(Math.abs(a)+Math.abs(c)),h=mU(r);if(!h)return r;if(!p){zI();continue}let f=a*h.minX+d,m=a*h.maxX+d,y=c*h.minY+u,g=c*h.maxY+u,v=Math.min(f,m),b=Math.max(f,m),S=Math.min(y,g),x=Math.max(y,g),A=n.rect,w=Math.max(v,A.x),C=Math.max(S,A.y),T=Math.min(b,A.x+A.w),M=Math.min(x,A.y+A.h);if(w>=T||C>=M)return"skip";if(w===v&&C===S&&T===b&&M===x)continue;let I=xh(r);if(!I||a===0||c===0){zI();continue}let _=(w-d)/a,E=(T-d)/a,B=(C-u)/c,L=(M-u)/c,k=Math.min(_,E),F=Math.min(B,L),W=Math.abs(E-_),U=Math.abs(L-B),[G,q,X,Y]=I.radii,Q=k!==I.x,te=F!==I.y,ue=k+W!==I.x+I.w,le=F+U!==I.y+I.h,ce=Math.min(W,U)/2,de=[Q||te?0:Math.min(G,ce),ue||te?0:Math.min(q,ce),ue||le?0:Math.min(X,ce),Q||le?0:Math.min(Y,ce)];r=Vg({x:k,y:F,w:W,h:U,radii:de},0)}return r}drawText(t,e){let r=this._engineFonts.has(e.font),n=this._fontXPerEm.get(e.font),o=!r&&n?n/uU:1,a={TextSimple:{text:t,font_size:e.fontSize*o,size:[e.width,e.height],horizontal_align:jI[e.horizontalAlign]??"Left",vertical_align:HI[e.verticalAlign]??"Top",line_height:e.lineHeight,letter_spacing:e.letterSpacing,...r?{font_id:e.font}:{}}},s=this._effectChain(!0),l=this._fillColor.a>0,c=this._strokeColor.a>0&&this._lineWidth>0;if(l||c||s){let d=Oe.append(this._ctm,Oe.translate(Oe.identity(),e.x,e.y));if(this._applyClips(a,d)!=="skip"){let u={shape:a,color:l?Ld(this._fillColor):[0,0,0,0],transform:Oe.getAbcdef(d)};c&&(u.stroke=this._strokeDesc()),s&&(u.effect_chain=s),this._shapes.push(u)}}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let r=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,n=this._measureCache.get(r);if(n!==void 0)return n;let o=0,a=this._engine;if(a&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,s]=a.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:jI[e.horizontalAlign]??"Left",verticalAlign:HI[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});o=s}catch{}if(!(o>0)){let s=e.fontSize*.55+Math.max(0,e.letterSpacing),l=Math.max(1,Math.floor(e.width/s)),c=0;for(let d of t.split(`
1311
+ `,r.pyramidTextureSize.value=new me.Vector2(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(o.uniforms,r)};this.material.shapeBlendhack=n,this.material.root.shapeBlendhack=n}dispose(){super.dispose(),UO()?.release(this)}},yh=I1;yh.streamCompaction=new Vy;var GG=new me.Matrix4,UG=new me.Matrix4,Bd=new me.Quaternion,Wl=new me.Vector3,Dg=new me.Vector3,zG=new me.Quaternion;function jG(i,t=0){let e=this.children.length;for(;e--;){let r=this.children[e];Ba.is(r)&&bI.call(r,i,t+1)}}function bI(i,t=0){if(i(this,t)!==!0){let r=this.children.length;for(;r--;){let n=this.children[r];Ba.is(n)&&bI.call(n,i,t+1)}}}function HG(){if(this.shapesDataTexture.value===void 0){let y=new me.DataTexture(new Float32Array(4*Nr*Na),Nr,Na,me.RGBAFormat,me.FloatType);this.shapesDataTexture.value=y}let i=this.shapesDataTexture.value,t=i.image.data,e=0,r=0,n=this.data.geometry.blendRange,o=GG.copy(this.matrixWorld).invert(),a=this._npart,s=0;this._meshSdfWanted.clear();let l=null;if(jG.call(this,y=>{if(y.visible===!1)return!0;let g;if(y instanceof Tn)return;if(y instanceof Id||Up(y))return;y instanceof lr?g=y.object:g=y;let v=y.data?.cloner;if(Ne.is(y)&&v&&!v.hideBase&&v.type!=="radial"&&v.disabled!==!0||!(g instanceof tt))return;let b=g.geometry.userData.parameters,S=b?.shapeBlendNode??g.dataPatched?.geometry?.shapeBlendNode;if(S===void 0)return;if(UG.multiplyMatrices(o,y.matrixWorld).decompose(Dg,Bd,Wl),b?.type==="TorusGeometry"&&b.arc!==360){let E=b.arc*Math.PI/180;E=E/4,Bd.multiply(zG.set(0,0,Math.sin(E),Math.cos(E)))}let A=S.overrideGlobalBlend?S.blendRange:n;A=A/this.bboxSize*2,t[s*4]=(Dg.x-this.bboxOffset)/this.bboxSize*2,t[s*4+1]=(Dg.y-this.bboxOffset)/this.bboxSize*2,t[s*4+2]=(Dg.z-this.bboxOffset)/this.bboxSize*2,t[s*4+3]=S.operation===0?1:S.operation===2?-1:-2,t[Nr*4+s*4]=-Bd.x,t[Nr*4+s*4+1]=-Bd.y,t[Nr*4+s*4+2]=-Bd.z,t[Nr*4+s*4+3]=Bd.w;let w=new Float32Array(4),C=0,T=A;if(b?.type==="SphereGeometry")b.width===b.height&&b.width===b.depth?w[0]=0:w[0]=1,w[1]=b.width/this.bboxSize,w[2]=b.height/this.bboxSize,w[3]=b.depth/this.bboxSize,T=Math.max(w[1],w[2],w[3])*Wl.x+A;else if(b?.type==="CubeGeometry"){C=b.cornerRadius;let E=b.width,B=b.height,L=b.depth;w[0]=2,w[1]=(E-2*C)/this.bboxSize,w[2]=(B-2*C)/this.bboxSize,w[3]=(L-2*C)/this.bboxSize,T=Math.sqrt(E**2+B**2+L**2)/this.bboxSize*Wl.x+A}else if(b?.type==="CylinderGeometry"){C=b.cornerRadius;let E=b.height,B=b.radiusBottom,L=b.radiusTop;if(L>=B){let k=Math.atan2(L-B,E),F=(Math.PI/2-k)/2;L-=C/Math.tan(F),B-=C*Math.tan(F)}else if(B>L){let k=Math.atan2(B-L,E),F=(Math.PI/2-k)/2;L-=C*Math.tan(F),B-=C/Math.tan(F)}w[1]=(b.height-2*C)/this.bboxSize,B===L?(w[0]=3,w[2]=B/this.bboxSize*2):(w[0]=4,w[2]=B/this.bboxSize*2,w[3]=L/this.bboxSize*2),T=(Math.hypot(w[1],Math.max(Math.abs(w[2]),Math.abs(w[3])))+C/this.bboxSize*2)*Wl.x+A}else if(b?.type==="TorusGeometry"){if(w[0]=5,w[1]=(b.width-b.depth)/this.bboxSize,w[2]=b.depth/this.bboxSize,b.arc!==360){w[0]=6,w[3]=w[1],t[Nr*12+s*4+3]=w[2];let E=2*Math.atan2(w[2]/2,w[1]),B=b.arc*Math.PI/180/2-E;w[1]=Math.sin(B),w[2]=Math.cos(B)}T=b.width*Wl.x/this.bboxSize+A}else{let E=g.geometry;(l??(l=new Set)).add(E.uuid);let B=this._meshSdfBaked.get(E.uuid),L=VG(E);if((B===void 0||B.posVersion!==L)&&this._meshSdfWanted.set(E.uuid,E),B===void 0)return;w[0]=7,w[1]=B.slot,w[2]=B.boxHalf.x/this.bboxSize*2,w[3]=B.boxHalf.y/this.bboxSize*2,t[Nr*12+s*4+3]=B.boxHalf.z/this.bboxSize*2,T=Math.hypot(B.boxHalf.x,B.boxHalf.y,B.boxHalf.z)/this.bboxSize*2*Wl.x+A}t.set(w,Nr*8+s*4),e=Math.max(e,T),r=Math.max(r,A),this._reach[s]=T,t[Nr*12+s*4]=A,t[Nr*12+s*4+1]=C/this.bboxSize*2,t[Nr*12+s*4+2]=Wl.x;let M=Array.isArray(g.material)?g.material[0]:g.material,D=M,I,_;if(D?.getShapeBlendBaseColor){let E=D.getShapeBlendBaseColor();I=E,_=E.a}else M?.uniforms?.nodeU0!==void 0?(I=M.uniforms.nodeU0.node.value,_=M.uniforms.nodeU1?.value??1):(I={r:1,g:1,b:1},_=1);S.operation!==0&&!S.useColor&&(_=-1),t[Nr*16+s*4]=I.r,t[Nr*16+s*4+1]=I.g,t[Nr*16+s*4+2]=I.b,t[Nr*16+s*4+3]=_,_<1&&this.material.defines?.SHAPEBLEND_C===1&&this.material.setTransparent(!0),s++}),this._meshSdfBaked.size>0){let y=l??new Set;for(let g of this._meshSdfBaked.keys())y.has(g)||this._meshSdfBaked.delete(g)}this.npart=s,this._maxBlendK=r;let c=e*1.1+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=c;let d=this._prevShapeData,u=a!==s,p=d===null||this._prevSpan!==c||u,h=p||O1,f=this._fieldDirtyMin.set(1/0,1/0,1/0),m=this._fieldDirtyMax.set(-1/0,-1/0,-1/0);if(d!==null){let y=Math.max(s,a);for(let g=0;g<y;g++){let v=!1;for(let D=0;D<Na;D++){let I=Nr*4*D+g*4;if(t[I]!==d[I]||t[I+1]!==d[I+1]||t[I+2]!==d[I+2]||t[I+3]!==d[I+3]){v=!0;break}}if(!v)continue;if(p=!0,h)break;let b=t[g*4],S=t[g*4+1],x=t[g*4+2],A=d[g*4],w=d[g*4+1],C=d[g*4+2],T=this._reach[g],M=this._prevReach[g];if(!Number.isFinite(b+S+x+T)||!Number.isFinite(A+w+C+M)){h=!0;continue}f.x=Math.min(f.x,b-T,A-M),f.y=Math.min(f.y,S-T,w-M),f.z=Math.min(f.z,x-T,C-M),m.x=Math.max(m.x,b+T,A+M),m.y=Math.max(m.y,S+T,w+M),m.z=Math.max(m.z,x+T,C+M)}}return O1&&(p=!0),this._fieldDirtyFull=h||f.x===1/0,p&&(d===null?this._prevShapeData=new Float32Array(t):d.set(t),this._prevReach.set(this._reach),this._prevSpan=c,i.needsUpdate=!0),p}Fi("ShapeBlendGeometry",(i,t,e)=>new yh(i,t,e));Pe("shape-blends");var Rg=class extends tt{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let r=this.geometry.getAttribute("position");r!==void 0?Yp(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,t,e):super.updateEntityBoxSize(t,e)}};Fi("VectorGeometry",(i,t,e)=>new Rg(i,t,e));Pe("vector-shapes");var Bg=class extends tt{constructor(e,r,n){super(e,r,n);this.isPathObject=!0;this._shapeId=null;this._lastShapeParams=null;this._lastShape=null;this._context=n}get profileShape(){return this._lastShape??void 0}updateState(e,r){super.updateState(e,r),this.updateShape(),this.refreshAttachedCloners(r)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let o in e)typeof e[o]=="string"&&(e[o]=this._context.shared.getVariable(e[o],[this.uuid,"geometry","extrusion","shape",o]));let r;if(e.type==="Custom"){let o=e.shapeId;if(o!==this._shapeId&&this.detachShape(),o){this._shapeId=o;let a=this._context.scene.find(o);a?.data&&(a.attachedPaths.add(this),r=a.geometry.userData?.shape),r||this._context.scene.addPendingCommand(()=>this.updateShape())}}else if(this._lastShape!==null&&this._sameShapeParams(e))r=this._lastShape;else{let o;switch(e.type){case"Rectangle":o=wd;break;case"Ellipse":o=Sd;break;case"Polygon":o=ig;break;case"Star":o=og;break;default:throw new Error(`Unknown shape type: ${e.type}`)}r=o.create({parameters:e}).userData.shape,this._lastShapeParams=e,this._lastShape=r??null}let n=this.geometry;if(r&&n.inputs){if(this._lastShape=r,e.type==="Custom"&&(this._lastShapeParams=null),n.inputs.shapeData===r)return;n.inputs.shapeData=r,n.build()}}_sameShapeParams(e){let r=this._lastShapeParams;if(r===null)return!1;for(let n in e)if(!Object.is(e[n],r[n]))return!1;for(let n in r)if(!(n in e))return!1;return!0}detachShape(){this._shapeId!==null&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}supportsInPlaceGeometryUpdate(){return!1}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,r){return super.updateTransformState(e,r)}updateGeometryInteractions(e,r){super.updateGeometryInteractions(e,r),this.updateShape()}updateEntityBoxSize(e,r){let n=this.geometry.getAttribute("position");n!==void 0&&n.count>0?Yp(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,e,r):super.updateEntityBoxSize(e,r)}};var Fe=require("three");function xI(i,t){let e=2*Math.PI;return(i%e+e)%e===(t%e+e)%e}var SI=new Fe.Matrix4,WG=new Fe.Matrix4,qG=new Fe.Matrix4().makeScale(1,1,-1),AI=new Fe.Vector3,wI=new Fe.Vector3,D1=new Fe.Vector3,XG=new Fe.Vector3,YG=new Fe.Vector3,KG=new Fe.Vector3,QG=new Fe.Vector3,CI=new WeakMap,R1=new WeakMap;function ZG(i,t,e){let r=[new Fe.Vector3,new Fe.Vector3,new Fe.Vector3],n=[new Fe.Vector3,new Fe.Vector3,new Fe.Vector3];return i.extractBasis(r[0],r[1],r[2]),t.extractBasis(n[0],n[1],n[2]),r.forEach((o,a)=>{let s=n[a],l=Fe.MathUtils.lerp(o.length(),s.length(),e);o.lerp(s,e).setLength(l)}),new Fe.Matrix4().makeBasis(r[0],r[1],r[2])}function EI(i){i.setIndex(null),i.setAttribute("position",new Fe.BufferAttribute(new Float32Array(0),3)),i.setAttribute("normal",new Fe.BufferAttribute(new Float32Array(0),3)),i.setAttribute("uv",new Fe.BufferAttribute(new Float32Array(0),2)),i.setDrawRange(0,0)}var TI=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(e.width),n=Math.abs(e.height??e.width),o=Math.abs(e.depth??0),a=i.shapeData??t?.shapeData??Sd.create({parameters:{...Sl,width:typeof Sl.width=="number"?Sl.width:100,height:typeof Sl.height=="number"?Sl.height:100}}).userData.shape;return{ownerId:i.ownerId??t?.ownerId,path:i.path??_c.defaultData(),parameters:Object.assign(e,{width:r,height:n,depth:o,extrusion:{...Lm,...e.extrusion}}),shapeData:a}}static build(i){if(i.path.points.length>=2){let e=new B1(i);return Object.assign(e,{userData:{...i,type:"PathGeometry"}})}else{let e=new Fe.BufferGeometry;return EI(e),Object.assign(e,{userData:{...i,type:"PathGeometry"}})}}},B1=class extends Fe.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)||!xI(e.twist,0)||e.startScale!==e.endScale}build(){let{points:e,matrices:r}=this._getSampledPath();if(e.length<2){EI(this);return}let{depth:n,offset:o}=this.inputs.parameters.extrusion;n=Math.max(0,Math.min(n,1)),o=Math.max(0,Math.min(o,1));let a=this.inputs.path.isClosed?e.length:e.length-1,s=Math.floor(o*a),l=this.inputs.path.isClosed?Math.ceil((n+o)*a):Math.ceil(Math.min(1,n+o)*a),c=Math.min(Math.max(2,l-s+1),a+2),d=[],u=[];for(let Y=0;Y<c;Y++){let Q=this.inputs.path.isClosed?(Y+s)%e.length:Math.min(Y+s,e.length-1);d.push(e[Q].clone()),u.push(r[Q].clone())}let p=(Y,Q,te)=>{d[Y]=d[Y].clone().lerp(d[Q],te),u[Y]=ZG(u[Y],u[Q],te)},h=0,f=o*a%1;(!this.inputs.path.isClosed||n<=1)&&(f||o===0)&&(h=f,p(0,1,h));let m=0,y=(o+n)*a%1;if((this.inputs.path.isClosed&&n<=1||!this.inputs.path.isClosed&&o+n<1)&&y&&(m=y,p(d.length-1,d.length-2,1-m)),n===0){let Y=d.length-1;d[Y].copy(d[0]),u[Y].copy(u[0])}this._applyPathModifiers(u,h,m);let{bevel:g,bevelSides:v}=this.inputs.parameters.extrusion,b=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(b=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:S,infos:x,vertices:A}=this._getShapePoints(b),w=g>0?this.inputs.parameters.extrusion.capType:"flat",C=w==="round"?w2(this.inputs.shapeData,g,v,b,this.inputs.ownerId):void 0,T=C!==void 0&&this.inputs.parameters.extrusionVersion===1?Jy(C):C,M=w==="round"&&T===void 0?"flat":w,D=T!==void 0?T.positions.length/3:0,I=0,_=0;x.sort((Y,Q)=>Y.start-Q.start),x.forEach(Y=>{Y.verticesStart=I,Y.verticesCount=Y.continuous.reduce((Q,te,ue)=>Q+(ue===0||!te?2:1),0),_+=Y.verticesCount,I=_});let E=_*c,B,L=0;this._isOpenEnded()&&M==="flat"&&(B=this._getSurfaceTesselation(S),L=B.vertexCount);let k=E+2*L+D*2,F=E+2*L,W={positions:new Float32Array(k*3),normals:new Float32Array(k*3),uvs:new Float32Array(k*2)},U=0;x.forEach(Y=>{U+=Y.count});let G=U*(c-1)*6+(B?2*B.elementCount*3:0)+(T!==void 0?2*T.indices.length:0),q=new Uint32Array(G),X=0;if(x.forEach(Y=>{X=this._extrudeRegion(Y,A,u,d,W,q,X,this._isGeometryClosed()&&!this._isOpenEnded())}),B&&(X=this._closeEnd(B,E,q,X,W,u[0],d[0],!1),X=this._closeEnd(B,E+L,q,X,W,u[u.length-1],d[d.length-1],!0)),T!==void 0){let Y={positions:W.positions,normals:W.normals,uvs:W.uvs,indices:q};nh(T,Y,F,X,SI.copy(u[0]).setPosition(d[0]).multiply(qG),(Q,te,ue)=>[ue,1e-4]),X+=T.indices.length,F+=D,nh(T,Y,F,X,SI.copy(u[u.length-1]).setPosition(d[d.length-1]),(Q,te,ue)=>[ue,1]),X+=T.indices.length}this.setAttribute("position",new Fe.BufferAttribute(W.positions,3)),this.setAttribute("normal",new Fe.BufferAttribute(W.normals,3)),this.setAttribute("uv",new Fe.BufferAttribute(W.uvs,2)),this._setIndexFromUint32(q)}_setIndexFromUint32(e){let r=!1;for(let n=e.length-1;n>=0;--n)if(e[n]>=65535){r=!0;break}this.setIndex(new Fe.BufferAttribute(r?e:new Uint16Array(e),1))}_getSampledPath(){let e=this.inputs.path,r=by(e),n=CI.get(r);if(n===void 0||n.subdivisions!==e.subdivisions||n.subdivisionMode!==e.subdivisionMode){let o=this._extractPathPoints(r),a=o.length<2?[]:this._computeBasisMatrices(o);n={subdivisions:e.subdivisions,subdivisionMode:e.subdivisionMode,points:o,matrices:a},CI.set(r,n)}return n}_extractPathPoints(e){let r=this.inputs.path.subdivisions,n=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(r*4):e.getPoints(r);if(n.length<2)return[];let o=[n[0]];return n.forEach(s=>{o[o.length-1].distanceToSquared(s)>.001&&o.push(s)}),this.inputs.path.isClosed&&o[o.length-1].distanceTo(o[0])<.001&&o.pop(),o}_computeBasisMatrices(e){let r=[],n=e.length,o=this.inputs.path.isClosed,a=new Fe.Vector3,s=new Fe.Vector3,l=new Fe.Vector3,c=new Fe.Vector3,d=new Fe.Vector3(0,1,0);for(let y=0;y<n;y++){let g=e[y],v;y===0?v=o?e[n-1]:AI.copy(g).multiplyScalar(2).sub(e[1]):v=e[y-1];let b;y===n-1?b=o?e[0]:AI.copy(g).multiplyScalar(2).sub(e[y-1]):b=e[y+1],wI.subVectors(g,v).normalize(),D1.subVectors(b,g).normalize();let S=XG.addVectors(wI,D1);S.lengthSq()<1e-10&&(S.copy(D1),S.dot(l)<0&&S.negate()),S.normalize(),l.copy(S),y===0&&(S.equals(d)||YG.copy(S).negate().equals(d))&&d.set(0,0,1);let x=KG.crossVectors(d,S).normalize(),A=QG.crossVectors(S,x).normalize();d.copy(A),c.copy(x),y===0&&(a.copy(A),s.copy(S));let w=new Fe.Matrix4().makeBasis(x,A,S);r.push(w)}let u=o?s:l,p=o?a:new Fe.Vector3(0,1,0),h=u.clone().cross(c).normalize(),f=Math.acos(p.dot(h));if(isNaN(f))return r;let m=p.clone().cross(h);u.dot(m)>0&&(f*=-1);for(let y=1;y<r.length;y++)r[y].multiply(WG.makeRotationZ(f*y/r.length));return r}_applyPathModifiers(e,r,n){let o=e.length,{angle:a,twist:s,startScale:l,endScale:c}=this.inputs.parameters.extrusion,d=new Fe.Matrix4,u=new Fe.Matrix4;return e.forEach((p,h)=>{let f=h===0?0:h===o-1?1:(h-r)/(o-(n===0?0:1)-(r+(1-n)));d.makeRotationZ(Fe.MathUtils.lerp(a,a+s,f)*Fe.MathUtils.DEG2RAD);let m=Fe.MathUtils.lerp(l,c,f);u.makeScale(m,m,m),p.multiply(d).multiply(u)}),e}_getShapePoints(e,r=Ct.ODD){let n=this.inputs.shapeData,o=R1.get(n);return(o===void 0||o.curveSegments!==e||o.windingRule!==r)&&(o={curveSegments:e,windingRule:r,shapePoints:this._computeShapePoints(e,r)},R1.set(n,o)),o.shapePoints}_getSurfaceTesselation(e){let r=R1.get(this.inputs.shapeData);if(r?.surfaceTesselation!==void 0)return r.surfaceTesselation;let n;try{n=Ts({windingRule:Ct.ODD,elementType:Vr.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:e})}catch{n=Zy}return r!==void 0&&(r.surfaceTesselation=n),n}_computeShapePoints(e=12,r=Ct.ODD){let n=this.inputs.shapeData,o=n.extractShapePointsToFlatArray([],e),a=n.shapeHoles.map(m=>{let y=m.extractShapePointsToFlatArray([],e),g=[];for(let v=y.length-1;v>=1;v-=2){let b=y[v-1],S=y[v-0];g.push(b,S)}return g}),s;try{s=Ts({windingRule:r,elementType:Vr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o]})}catch{s=Qy}let l;try{l=Ts({windingRule:Ct.ODD,elementType:Vr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]})}catch{l=m2}if(!s)throw new Error("error generating geometry");let c=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 d=1/0,u=-1/0,p=1/0,h=-1/0;for(let m=0,y=s.vertexCount;m<y;m++){let g=m*2,v=s.vertices[g+0],b=s.vertices[g+1];v<d&&(d=v),v>u&&(u=v),b<p&&(p=b),b>h&&(h=b)}let f=[];for(let m=s.elementCount-1;m>=0;m--){let y=m>=c,g=m*2,v=s.elements[g+0],b=s.elements[g+1],S=v+b,x={start:v,count:b,normals:[],isHole:y,continuous:[],verticesStart:0,verticesCount:0};f.push(x);let A=v,w=S-1,C=v+1,T=n.roundedCurves.length;do{let M=A-v,D=s.vertices[w*2+0],I=s.vertices[w*2+1],_=s.vertices[A*2+0],E=s.vertices[A*2+1],B=s.vertices[C*2+0],L=s.vertices[C*2+1],k=_-D,F=E-I,W=Math.sqrt(k*k+F*F);k/=W,F/=W;let U=_-B,G=E-L,q=Math.sqrt(U*U+G*G);U/=q,G/=q,x.normals[M*2+0]=-G,x.normals[M*2+1]=U;let X=s.vertexIndices[A];if(Array.isArray(X))x.continuous[M]=!1;else{let[Y,Q]=n.getCurveIndexFromVertexId(X-1,!0);if(Q>0&&Q<1)x.continuous[M]=!0;else{let te=Q===1?Y+1:Y-1;te=(te+T)%T;let ue=Q===1?0:1,le=n.roundedCurves[Y].getTangent(Q),ce=n.roundedCurves[te].getTangent(ue);x.continuous[M]=le.dot(ce)>.95}}y&&(x.normals[M*2+0]*=-1,x.normals[M*2+1]*=-1),[w,A,C]=[A,C,C+1],C>=S&&(C-=b)}while(C!==v+1)}return{regions:[o,...a],infos:f,vertices:s.vertices}}_insertVertex(e,r,n,o,a){let s=r*2,l=r*3;e.positions[l+0]=n.x,e.positions[l+1]=n.y,e.positions[l+2]=n.z,e.normals[l+0]=o.x,e.normals[l+1]=o.y,e.normals[l+2]=o.z,e.uvs[s+0]=a.x,e.uvs[s+1]=a.y}_extrudeRegion(e,r,n,o,a,s,l,c){let d=e.wallTemplate;if(d===void 0){d=[];for(let S=0;S<e.count;S++){let x=(e.start+S)*2,A=r[x+0],w=r[x+1],C,T;if(e.continuous[S])C=e.normals[S*2+0],T=e.normals[S*2+1];else{let D=S===0?(e.start+e.count-1)*2:x-2,I=A-r[D+0];C=-(w-r[D+1]),T=I,e.isHole||(C=-C,T=-T)}let M=S===0?1:S/e.count;if(d.push(A,w,C,T,M,0),!e.continuous[S]||S===0)if(S===0)d.push(A,w,e.normals[0],e.normals[1],0,1);else{let D=S===e.count-1?e.start*2:x+2,I=r[D+0]-A;C=-(r[D+1]-w),T=I,e.isHole||(C=-C,T=-T),d.push(A,w,C,T,M,1)}}e.wallTemplate=d}let u=n.length,p=d.length,h=a.positions,f=a.normals,m=a.uvs;for(let S=0;S<u;S++){let x=n[S].elements,A=x[0],w=x[1],C=x[2],T=x[4],M=x[5],D=x[6],I=x[12],_=x[13],E=x[14],B=o[S],L=S/(u-1),k=0,F=0,W=0,U=e.verticesStart*u+e.verticesCount*S;for(let G=0;G<p;G+=6){if(d[G+5]===0){let de=d[G+0],ge=d[G+1];k=A*de+T*ge+I+B.x,F=w*de+M*ge+_+B.y,W=C*de+D*ge+E+B.z}let q=d[G+2],X=d[G+3],Y=A*q+T*X+I,Q=w*q+M*X+_,te=C*q+D*X+E,ue=1/(Math.sqrt(Y*Y+Q*Q+te*te)||1);Y*=ue,Q*=ue,te*=ue;let le=U*2,ce=U*3;h[ce+0]=k,h[ce+1]=F,h[ce+2]=W,f[ce+0]=Y,f[ce+1]=Q,f[ce+2]=te,m[le+0]=d[G+4],m[le+1]=L,U++}}let y=e.wallQuadPattern;if(y===void 0){y=[];let S=0;for(let x=0;x<e.count;x++)(!e.continuous[x]||x===0)&&S++,y.push(S,x===e.count-1?0:S+1),S++;e.wallQuadPattern=y}let g=u-1,v=y.length,b=e.isHole;for(let S=0;S<g;S++){let x=e.verticesStart*u+e.verticesCount*S,A=x+e.verticesCount;for(let w=0;w<v;w+=2){let C=x+y[w],T=x+y[w+1],M=A+y[w+1],D=A+y[w];b?(s[l++]=C,s[l++]=M,s[l++]=T,s[l++]=C,s[l++]=D,s[l++]=M):(s[l++]=C,s[l++]=T,s[l++]=M,s[l++]=C,s[l++]=M,s[l++]=D)}}return l}_closeEnd(e,r,n,o,a,s,l,c){let d=e.vertexCount,u=new Fe.Vector3(0,0,c?-1:1).applyMatrix4(s),p=new Fe.Vector3,h=new Fe.Vector2;for(let m=0;m<d;m++){let y=2*m;p.set(e.vertices[y+0],e.vertices[y+1],0).applyMatrix4(s).add(l),this._insertVertex(a,r+m,p,u,h)}let f=e.elements;for(let m=0;m<e.elementCount;m++){let y=3*m;n[o++]=f[y+0]+r,n[o++]=f[y+(c?1:2)]+r,n[o++]=f[y+(c?2:1)]+r}return o}};Fi("PathGeometry",(i,t,e)=>new Bg(i,t,e));zp("PathGeometry",TI);Pe("3d-paths");ki.Cloner=Tn;Pe("cloners");yt();var Nd=require("three");function gh(i){if(i.component){let t=i.component.instances.indexOf(i);t>=0&&i.component.instances.splice(t,1);for(let e of i.children)Ne.is(e)&&gh(e)}}var vh=class extends Wi(Nd.Group,Hi){constructor(e,r,n){super();this.isComponentObject=!0;r.type==="Instance"&&typeof e=="string"&&(r=this.transformAssignData(r,n)),this.super_Entity(e,r),this.objectHelper.update()}get isComponentRoot(){return this.data.type==="Component"&&typeof this.identity=="string"}get isInstanceRoot(){return this.data.type==="Instance"&&typeof this.identity=="string"}transformAssignData(e,r){let n=bs.getComponentData({scene:r.scene.data,shared:r.shared.data},e.component);if(n){let o,a;for(let s of Uo.rootOverrideProps)e[s]===void 0?(o===void 0&&(o={...e}),o[s]=n.data[s]):(a===void 0&&(a={}),a[s]=e[s],o===void 0&&(o={...e}),o[s]=Lo.apply(n.data[s],e[s]));return this.overrideData=a,o}else return{...vr.defaultData,...e,...Vp(vr.defaultData,Uo.rootOverrideProps)}}updateByOp(e,r,n,o){let a;if(this.isInstanceRoot&&!o){if(r=this.transformAssignData(r,n),e.type===0&&e.path.length===0&&this.component)for(let s of Uo.rootOverrideProps)s in e.props&&e.props[s]===void 0&&(a===void 0&&(a={...e,props:{...e.props}}),a.props[s]=this.component.data[s]);else if(e.type===0&&e.path.length>0&&Uo.rootOverrideProps.includes(e.path[0])){let s=e.path[0];a===void 0&&(a={...e,path:[],props:{[s]:r[s]}})}}super.updateByOp(a??e,r,n,o)}updateState(e,r){this.updateState_Entity(e,r)}expandInstanceChildren(e){let r=this.data;if(this.component===void 0){let n=e.scene.find(r.component)??null,o=!1;if(n!==this.oldComponent){if(this.oldComponent){let a=0;for(let s of this.children)if(Ne.is(s))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(s),gh(s),a+=1;else break;this.children.splice(0,a)}o=!0}if(n){let a={};MI(e,[this.uuid],r.overrides,this,n,n,0,o,a);for(let s of this.children)if(Ne.is(s)){let l=s.data;l.type==="Empty"&&l.animations&&s.traverseEntity(c=>{let d=c.dataPatched;if(c instanceof tt&&d.bones&&d.boneInverses){let u=c.dataPatched;if(u.bones&&u.boneInverses){let p=u.bones.map(m=>e.scene.find(a[m])),h=u.boneInverses.map(m=>new Nd.Matrix4().fromArray(m)),f=new Nd.Skeleton(p,h);c.bind(f,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}this.traverseEntity(s=>{s.isVirtualEntity&&e.scene.syncInstancePathConstraint(s)})}this.oldComponent=this.component}}};function PI(i,t,e,r){return i.component===t&&mo(i.identity,r)?i.overrideData===e?2:1:0}function MI(i,t,e,r,n,o,a,s,l){if(a>50)return!1;if(r.component!==n){if(r.component){let d=r.component.instances.indexOf(r);d>=0&&r.component.instances.splice(d,1)}n.instances.find(d=>d===r)||n.instances.push(r),r.component=n}n instanceof vh&&n.isInstanceRoot&&n.expandInstanceChildren(i);let c=0;for(let d of n.children)if(Ne.is(d)){let u=[...t,...typeof d.identity=="string"?[d.identity]:d.identity],p=Vc.resolve(e,u,1);p!=null&&!(p instanceof vt)&&(Object.setPrototypeOf(p,vt.prototype),console.error("wrong prototype"));let h=null,f;if(!s){let m=r.children[c];if(h=Ne.is(m)?m:null,h!==null){let y=PI(h,d,p,u);f=y>=1?h.stateSelection:void 0,y!==2&&(h=null)}if(h===null&&(h=i.scene.findInstance(u)??null,h!==null)){let y=PI(h,d,p,u);if(f=y>=1?h.stateSelection:void 0,y!==2)h=null;else{let g=h.parent.children.indexOf(h);h.parent.children.splice(g,1),r.children.splice(c,0,h),h.parent===r?(g<=c&&console.error("not possible"),void 0):(h.parent=r,h.matrixWorldNeedsUpdate=!0,h.resetBBoxNeedsUpdate(),h.updateVisible(),i.pendingDeletes.delete(h),void 0)}}}if(h===null){let m=p?Lo.apply(d.data,p):d.data;co.is(m.type)&&(m={...m,type:"Empty"}),h=ki.createEntity(u,m,i),h.overrideData=p,r.add(h),r.children.splice(r.children.length-1,1),r.children.splice(c,0,h),h.updateState(h.data,i),f&&h.changeSelectedState(f,i),i.scene.registerInstanceAndSetUuid(h)}if(h.isBone){let m=h.identity[h.identity.length-1];l[m]=h.uuid}c+=1,MI(i,t,e,h,d,o,a+1,s,l)}if(!s){let d=c;for(;;){let u=r.children[c];if(Ne.is(u))i.pendingDeletes.add(u);else break;c+=1}r.children.splice(d,c-d)}return!0}var OI=(i,t,e)=>new vh(i,t,e);Ol("Component",OI);Ol("Instance",OI);Pe("components");var N1=1e-10;function II(i){let t=i[0][0],e=i[1][0],r=i[0][1],n=i[1][1],o=Math.sqrt(t*t+e*e),a=o>N1?t/o:1,s=o>N1?e/o:0,l=a*t+s*e,c=a*n-s*r,d=a*r+s*n;return{rotation:Math.atan2(s,a),scale:[l,c],shear:[Math.abs(c)>N1?d/c:0,0]}}function DI({rotation:i,scale:t,shear:e}){let r=Math.cos(i),n=Math.sin(i),o=e[0]*t[1],a=e[1]*t[0];return[r*t[0]-n*a,n*t[0]+r*a,r*o-n*t[1],n*o+r*t[1]]}var Oe;(x=>{function i(){return[1,0,0,0,1,0,0,0,1]}x.identity=i;function t(A,w=x.identity()){for(let C=0,T=A.length;C<T;C++)w[C]=A[C];return w}x.copy=t;function e(A,w,C,T,M,D){return x.setAbcdef(x.identity(),A,w,C,T,M,D)}x.create=e;function r(A,w,C,T,M,D,I){return A[0]=w,A[1]=T,A[2]=D,A[3]=C,A[4]=M,A[5]=I,A}x.setAbcdef=r;function n(A,w){let[C,T,M,D,I,_]=a(A),[E,B,L,k,F,W]=a(w),U=E*C+B*M,G=E*T+B*D,q=L*C+k*M,X=L*T+k*D,Y=F*C+W*M+I,Q=F*T+W*D+_;return x.create(U,G,q,X,Y,Q)}x.append=n;function o(A,w){let[C,T,M,D,I,_]=a(A),[E,B,L,k,F,W]=a(w),U=C,G=T,q=M,X=D;(E!==1||B!==0||L!==0||k!==1)&&(U=C*E+T*L,G=C*B+T*k,q=M*E+D*L,X=M*B+D*k);let Y=I*E+_*L+F,Q=I*B+_*k+W;return x.create(U,G,q,X,Y,Q)}x.prepend=o;function a(A){return[A[0],A[3],A[1],A[4],A[2],A[5]]}x.getAbcdef=a;function s(A){let[w,C,T,M,D,I]=x.getAbcdef(A),_=w*M-C*T,E=M/_,B=-C/_,L=-T/_,k=w/_,F=(T*I-M*D)/_,W=-(w*I-C*D)/_;return x.create(E,B,L,k,F,W)}x.invert=s;function l([A,w],C){let[T,M,D,I,_,E]=x.getAbcdef(C);return[T*A+D*w+_,M*A+I*w+E]}x.apply=l;function c(A,w){let[C,T,M,D,I,_]=x.getAbcdef(w),E=1/(C*D+M*-T),[B,L]=A;return[D*E*B+-M*E*L+(_*M-I*D)*E,C*E*L+-T*E*B+(-_*C+I*T)*E]}x.applyInverse=c;function d(A,w,C=w){let[T,M,D,I,_,E]=x.getAbcdef(A);return x.setAbcdef(A,T*w,M*C,D*w,I*C,_*w,E*C),A}x.scale=d;function u(A,w){let C=Math.cos(w),T=Math.sin(w),[M,D,I,_,E,B]=x.getAbcdef(A);return x.setAbcdef(A,M*C-D*T,M*T+D*C,I*C-_*T,I*T+_*C,E*C-B*T,E*T+B*C),A}x.rotate=u;function p(A,w,C){let[T,M]=C,D=x.translate(A,-T,-M);return D=x.rotate(D,w),D=x.translate(D,T,M),D}x.rotateAround=p;function h(A,w,C){let[T,M,D,I,_,E]=x.getAbcdef(A);return x.setAbcdef(A,T,M,D,I,_+w,E+C),A}x.translate=h;function f(A,w,C){let[T,M,D,I]=x.getAbcdef(A);return x.setAbcdef(A,T,M,D,I,w,C),A}x.setTranslate=f;function m(A,w,C){let[T,M,D,I]=x.getAbcdef(A);return x.setAbcdef(A,T,M,D,I,w,C),A}x.setPosition=m;function y(A){let[w,C,T,M]=x.getAbcdef(A),D=Math.sqrt(w*w+C*C),I=Math.sqrt(T*T+M*M);return[D,I]}x.getScale=y;function g(A){let[,,,,w,C]=x.getAbcdef(A);return[w,C]}x.getPosition=g;function v(A,w){return x.decompose(A,w).rotation}x.getRotation=v;function b(A,w){let[C,T,M,D,I,_]=x.getAbcdef(A),{rotation:E,scale:B,shear:L}=II([[C,M],[T,D]]);return{position:[I+(w[0]*C+w[1]*M)-w[0],_+(w[0]*T+w[1]*D)-w[1]],scale:B,rotation:E,shear:L,pivot:w}}x.decompose=b;function S(A,w,C,T,M=[0,0]){let[D,I]=A,[_,E]=T,[B,L,k,F]=DI({rotation:C,scale:w,shear:M}),W=D-(_*B+E*k)+_,U=I-(_*L+E*F)+E;return x.create(B,L,k,F,W,U)}x.compose=S})(Oe||(Oe={}));function JG(i,t){let[[e,r],[n,o]]=i,[[a,s],[l,c]]=t,d=(e-n)*(s-c)-(r-o)*(a-l);if(d===0)return!1;let u=((e-a)*(s-c)-(r-s)*(a-l))/d,p=-((e-n)*(r-s)-(r-o)*(e-a))/d;return u>=0&&u<=1&&p>=0&&p<=1}var BI=[[-1,1],[-1,-1],[1,-1],[1,1]],RI=(i,t,e)=>{let r=i.getCenter(),n=i.getHalfSize(),o=Oe.append(t,i.worldMatrix);n[0]===0&&n[1]===0?e.push(Oe.apply(r,o)):BI.forEach(a=>{let s=[a[0]*n[0]+r[0],a[1]*n[1]+r[1]];e.push(Oe.apply(s,o))})},Rs=class{constructor(){this.matrix=Oe.identity();this.min=[1/0,1/0];this.max=[-1/0,-1/0];this.vertices=[];this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),Oe.copy(t.worldMatrix,this.matrix);let r=Oe.invert(t.worldMatrix);this.expandByObjectSize(t,r,e)}expandByObjectSize(t,e,r=!1){let n=[],o=t.isBaseGroup===!0?t:void 0;r===!0&&o!==void 0?o.traverse(a=>{a.visible&&RI(a,e,n)}):RI(t,e,n),this.setFromPoints(n)}setFromSize(t,e,r){this.makeEmpty(),Oe.copy(r,this.matrix),this.expandBySize(t,e,r)}expandBySize(t,e,r){[Oe.apply([0,0],r),Oe.apply([0,e],r),Oe.apply([t,e],r),Oe.apply([t,0],r)].forEach(o=>this.expandByPoint(o))}getCenter(){let[t,e]=this.min,[r,n]=this.getHalfSize();return Oe.apply([t+r,e+n],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),r=this.getCenter(),[n,o,a,s]=Oe.getAbcdef(this.matrix),l=Oe.create(n,o,a,s,r[0],r[1]);this.vertices=BI.map(([c,d])=>Oe.apply([c*t,d*e],l))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t<e;++t)this.edges.push([this.vertices[t],this.vertices[(t+1)%e]])}project(t,e){let r=this.matrix;return e&&(r=Oe.append(e.worldMatrix,r)),Oe.applyInverse(t,r)}intersects(t,e,r){return this.intersectsInLocalSpace(...this.project([t,e],r))}intersectsInLocalSpace(t,e){let{min:r,max:n}=this;return t>=r[0]&&t<=n[0]&&e>=r[1]&&e<=n[1]}containsPoint(t){let[e,r]=t,[n,o]=this.min,[a,s]=this.max;return e>=n&&e<=a&&r>=o&&r<=s}intersectsBBox2D(t){for(let e=0,r=this.edges.length;e<r;e++){let n=this.edges[e];for(let o=0,a=t.edges.length;o<a;o++){let s=t.edges[o];if(JG(n,s))return!0}}for(let e=0,r=t.vertices.length;e<r;e++){let n=t.vertices[e];if(this.containsPoint(n))return!0}return!1}ensureMinMax(){let t=this.min,e=this.max;this.min=[Math.min(t[0],e[0]),Math.min(t[1],e[1])],this.max=[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}copy(t){this.min=[...t.min],this.max=[...t.max],Oe.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new Rs;return t.copy(this),t}};var $G='{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}',NI=()=>JSON.parse($G);async function eU(i,t){return await i.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(i.Engine.prototype,"scene")||Object.defineProperty(i.Engine.prototype,"scene",{get:function(){let e=Object.create(i.SceneController.prototype);return e.__wbg_ptr=this.__wbg_ptr,e}}),{createEngine:e=>i.Engine.create(e,NI(),!0)}}var Ng,bh;function tU(i){Ng=i}function L1(){if(!bh){if(!Ng)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));bh=Ng(),bh.catch(()=>{bh=void 0})}return bh}var LI;function rU(){let i=typeof process<"u"?"2.0.124":void 0;return`https://cdn.spline.design/@splinetool/runtime${i?`@${i}`:""}/build/hana-ui.wasm`}function _I(i){LI=i}function Lg(){return Ng||tU(async()=>{let t=await import("./hana-ui.js");return eU(t,LI??rU())}),L1().then(()=>{})}var Fg=Ec(kg(),1);function GI(i){let t=[],e;try{e=(0,Fg.makeAbsolute)((0,Fg.parseSVG)(i))}catch(c){return console.error("[HanaRenderer] Failed to parse SVG path:",c),t}let r=0,n=0,o=0,a=0,s=null,l=null;for(let c of e){let d=null,u=null;switch(c.code){case"M":r=o=c.x,n=a=c.y,t.push({MoveTo:{x:r,y:n}});break;case"L":r=c.x,n=c.y,t.push({LineTo:{x:r,y:n}});break;case"H":r=c.x,t.push({LineTo:{x:r,y:n}});break;case"V":n=c.y,t.push({LineTo:{x:r,y:n}});break;case"C":{let p={x:c.x1,y:c.y1},h={x:c.x2,y:c.y2};r=c.x,n=c.y,t.push({CurveTo:[p,h,{x:r,y:n}]}),d=h;break}case"S":{let p=s?{x:2*r-s.x,y:2*n-s.y}:{x:r,y:n},h={x:c.x2,y:c.y2};r=c.x,n=c.y,t.push({CurveTo:[p,h,{x:r,y:n}]}),d=h;break}case"Q":{let p={x:c.x1,y:c.y1};r=c.x,n=c.y,t.push({QuadTo:[p,{x:r,y:n}]}),u=p;break}case"T":{let p=l?{x:2*r-l.x,y:2*n-l.y}:{x:r,y:n};r=c.x,n=c.y,t.push({QuadTo:[p,{x:r,y:n}]}),u=p;break}case"A":{let p=r,h=n;r=c.x,n=c.y,aU(t,p,h,c.rx,c.ry,c.xAxisRotation,c.largeArc,c.sweep,r,n);break}case"Z":r=o,n=a,t.push("ClosePath");break}s=d,l=u}return t}function aU(i,t,e,r,n,o,a,s,l,c){if(t===l&&e===c)return;if(r=Math.abs(r),n=Math.abs(n),r===0||n===0){i.push({LineTo:{x:l,y:c}});return}let d=o*Math.PI/180,u=Math.cos(d),p=Math.sin(d),h=(t-l)/2,f=(e-c)/2,m=u*h+p*f,y=-p*h+u*f,g=m*m/(r*r)+y*y/(n*n);if(g>1){let U=Math.sqrt(g);r*=U,n*=U}let v=r*r,b=n*n,S=v*b-v*y*y-b*m*m,x=v*y*y+b*m*m,A=(a!==s?1:-1)*Math.sqrt(Math.max(0,S/x)),w=A*(r*y)/n,C=A*(-n*m)/r,T=u*w-p*C+(t+l)/2,M=p*w+u*C+(e+c)/2,D=Math.atan2((y-C)/n,(m-w)/r),_=Math.atan2((-y-C)/n,(-m-w)/r)-D;!s&&_>0?_-=2*Math.PI:s&&_<0&&(_+=2*Math.PI);let E=Math.max(1,Math.ceil(Math.abs(_)/(Math.PI/2))),B=_/E,L=4/3*Math.tan(B/4),k=D,F=t,W=e;for(let U=0;U<E;U++){let G=k+B,q=Math.cos(k),X=Math.sin(k),Y=Math.cos(G),Q=Math.sin(G),te=T+r*Y*u-n*Q*p,ue=M+r*Y*p+n*Q*u,le=-r*X*u-n*q*p,ce=-r*X*p+n*q*u,de=-r*Q*u-n*Y*p,ge=-r*Q*p+n*Y*u;i.push({CurveTo:[{x:F+L*le,y:W+L*ce},{x:te-L*de,y:ue-L*ge},{x:te,y:ue}]}),k=G,F=te,W=ue}}var Gg=.5522847498307936,cU=150,dU=5*60*1e3,uU=1536/2816;function XI(i){let t=i.getUint32(0);if(t===65536||t===1330926671||t===1953658213)return 0;if(t===1953784678)return i.getUint32(8)>0?i.getUint32(12):void 0}function pU(i){try{return XI(new DataView(i))!==void 0}catch{return!1}}function hU(i){try{let t=new DataView(i),e=XI(t);if(e===void 0)return;let r=t.getUint16(e+4),n=-1,o=-1;for(let c=0;c<r;c++){let d=e+12+c*16,u=t.getUint32(d);u===1751474532&&(n=t.getUint32(d+8)),u===1330851634&&(o=t.getUint32(d+8))}if(n<0||o<0)return;let a=t.getUint16(n+18),s=t.getUint16(o);if(a===0||s<2)return;let l=t.getInt16(o+86);return l>0?l/a:void 0}catch{return}}var UI=!1;function zI(){UI||(UI=!0,console.warn("[HanaRenderer] clipRect: precise clipping of rotated/complex content is not supported by the Hana UI overlay yet; drawing unclipped. (Axis-aligned rectangles are clipped geometrically.)"))}var Ug=class{constructor(t,e=1){this.canvas=t;this._dpr=e;this._width=0;this._height=0;this._isSizeDirty=!1;this._crashed=!1;this._shapes=[];this._lastPushedJSON="";this._ctm=Oe.identity();this._stack=[];this._clips=[];this._pathEls=[];this._simpleShape=null;this._pathPrimitives=0;this._fillColor=Ve.transparent;this._strokeColor=Ve.transparent;this._lineWidth=1;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=Ve.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=Ve.transparent;this._fonts=new Map;this._fontsFlushed=new Set;this._engineFonts=new Set;this._fontXPerEm=new Map;this._measureCache=new Map;try{let r=t.getBoundingClientRect();t.width=r.width*e,t.height=r.height*e}catch{console.log(t.width,e)}}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}get width(){return this._width}get height(){return this._height}async init(){if(!(this._engine||this._crashed)){try{this._context=await L1(),this._engine=await this._context.createEngine(this.canvas)}catch(t){this._crashed=!0,console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t);return}if(this._width>0&&this._height>0)this._syncViewport();else{let t=this.canvas.getBoundingClientRect();t.width>0&&t.height>0&&(this._width=t.width,this._height=t.height,this._syncViewport())}this._flushFonts(),this.uiFontReady=this._watchUiFont()}}_watchUiFont(){return new Promise(t=>{let e=this._engine;if(!e||typeof e.scene.isUiFontLoaded!="function"){t();return}let r=()=>{let a=!1;return this._guard(()=>{a=e.scene.isUiFontLoaded()}),a};if(r()){t();return}let n=Date.now(),o=setInterval(()=>{if(this._crashed||Date.now()-n>dU){clearInterval(o);return}r()&&(clearInterval(o),t())},cU)})}_syncViewport(){let t=this._engine;if(!t||this._crashed)return;let e=this._width,r=this._height;this.canvas.style.width=e+"px",this.canvas.style.height=r+"px",this.canvas.width=Math.max(1,Math.ceil(e*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(r*this._dpr)),this._guard(()=>{t.resize([e,r],this._dpr),t.scene.updateCamera({position:[e/2,r/2],zoom:1})})}setSize(t,e){!this._isSizeDirty&&t===this._width&&e===this._height||(this._isSizeDirty=!1,this._width=t,this._height=e,this._engine?this._syncViewport():(this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",this.canvas.width=Math.max(1,Math.ceil(t*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(e*this._dpr))))}_guard(t){if(!this._crashed)try{t()}catch(e){this._crashed=!0,console.error("[HanaRenderer] Hana engine call failed; disabling this renderer instance.",e)}}async loadFont(t,e){try{let r=await fetch(t);if(!r.ok){console.error(`[HanaRenderer] loadFont: ${t} returned HTTP ${r.status}; skipping "${e}"`);return}let n=await r.arrayBuffer();if(n.byteLength===0){console.error(`[HanaRenderer] loadFont: ${t} was empty; skipping "${e}"`);return}this.registerFont(n,e)}catch(r){console.error(`[HanaRenderer] loadFont failed for "${e}" (${t}):`,r)}}registerFont(t,e){if(this._fonts.has(e))return;this._fonts.set(e,t),pU(t)&&this._engineFonts.add(e);let r=hU(t);r!==void 0&&this._fontXPerEm.set(e,r),this._flushFonts()}_flushFonts(){let t=this._engine;if(!!t)for(let[e,r]of this._fonts)this._fontsFlushed.has(e)||(this._fontsFlushed.add(e),this._guard(()=>{t.scene.addLocalFont(e,new Uint8Array(r))===!1&&this._engineFonts.delete(e)}))}set strokeColor(t){this._strokeColor=t}set fillColor(t){this._fillColor=t}set lineWidth(t){this._lineWidth=t}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}save(){this._stack.push({ctm:Oe.copy(this._ctm),clipLen:this._clips.length})}restore(){let t=this._stack.pop();!t||(this._ctm=t.ctm,this._clips.length=t.clipLen)}setTransform(t,e=!1){let r=Oe.identity();if(this.camera?.enabled&&(r=Oe.append(r,this.camera.worldMatrix),e)){let n=Oe.getScale(this.camera.worldMatrix);r=Oe.scale(r,1/n[0],1/n[1])}this._ctm=Oe.append(r,t)}transform(t){this._ctm=Oe.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){this._pathEls.length!==0&&this._pathEls[this._pathEls.length-1]!=="ClosePath"&&this._pathEls.push("ClosePath")}_startFreeform(){this._simpleShape=null,this._pathPrimitives++}moveTo(t,e){this._startFreeform(),this._pathEls.push({MoveTo:{x:t,y:e}})}lineTo(t,e){this._startFreeform(),this._pathEls.push({LineTo:{x:t,y:e}})}bezierCurveTo(t,e,r,n,o,a){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:r,y:n},{x:o,y:a}]})}quadraticCurveTo(t,e,r,n){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:r,y:n}]})}path(t){this._startFreeform(),this._pathEls.push(...GI(t))}rect(t,e,r,n,o=0,a=0,s=0,l=0){if(!WI([t,e,r,n]))return;let c={x:t,y:e,w:r,h:n,radii:[o,a,s,l]};this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"rect",rect:c,smoothing:0}:null,qI(this._pathEls,c)}ellipse(t,e,r,n,o,a,s,l){if(!!WI([t,e,r,n])){if(r<0||n<0)throw Error("radii cannot be negative");this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"ellipse",cx:t,cy:e,rx:r,ry:n}:null,gU(this._pathEls,t,e,r,n)}}clipRect(t,e,r,n,o=0,a=0,s=0,l=0){let c=Oe.invert(this._ctm);!c||this._clips.push({m:Oe.copy(this._ctm),inv:c,rect:{x:t,y:e,w:r,h:n,radii:[o,a,s,l]}})}fill(){this._emit(!0)}stroke(){this._strokeColor.a<=0||this._lineWidth<=0||this._emit(!1)}_emit(t){let e=this._effectChain(t);if(t&&this._fillColor.a<=0&&!e)return;let r=this._classifyShape();if(!r)return;let n=this._applyClips(r);if(n==="skip")return;if(!t&&n!==r){let a=xh(r);if(a){this._emitClippedRectStroke(a,e);return}}r=n;let o={shape:r,color:t?Ld(this._fillColor):[0,0,0,0],transform:Oe.getAbcdef(this._ctm)};t||(o.stroke=this._strokeDesc()),e&&(o.effect_chain=e),this._shapes.push(o)}_emitClippedRectStroke(t,e){let r=this._lineWidth,n=this._strokeMode==="outside"?r:this._strokeMode==="center"?r/2:0,o=r-n,a=Math.min(t.w,t.h)/2,s=t.radii.map(g=>Math.max(0,Math.min(g,a))),l={x:t.x-n,y:t.y-n,w:t.w+n*2,h:t.h+n*2,radii:s.map(g=>g>0?g+n:0)},c=t.w-o*2,d=t.h-o*2,u=c>0&&d>0?{x:t.x+o,y:t.y+o,w:c,h:d,radii:s.map(g=>Math.max(0,g-o))}:null,p=this._applyClips(Vg(l,0));if(p==="skip")return;let h=xh(p)??l,f=null;if(u){let g=this._applyClips(Vg(u,0));f=g==="skip"?null:xh(g)??u}let m=[];qI(m,h),f&&yU(m,f);let y={shape:{Custom:m},color:Ld(this._strokeColor),transform:Oe.getAbcdef(this._ctm)};e&&(y.effect_chain=e),this._shapes.push(y)}_classifyShape(){let t=this._simpleShape;return t?t.kind==="rect"?Vg(t.rect,t.smoothing):{Ellipse:{center_x:t.cx,center_y:t.cy,rx:t.rx,ry:t.ry}}:this._pathEls.length===0?null:{Custom:this._pathEls.slice()}}_strokeDesc(){return{width:this._lineWidth,line_join:"Miter",color:Ld(this._strokeColor),align:fU[this._strokeMode],cap:"Butt"}}_effectChain(t){let e=this.camera?.scale??1,r=[];if(t&&this._dropShadowColor.a>0&&r.push({DropShadow:{position:[this._dropShadowOffsetX*e,this._dropShadowOffsetY*e],blur:{Uniform:{size:2*this._dropShadowBlur*e}},spread:0,color:Ld(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[n,o]=Oe.getScale(this._ctm),a=(n+o)/2;r.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*a}}}})}if(this._layerBlur>0&&r.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[n,o,a,s]=Oe.getAbcdef(this._ctm),l=this._innerShadowOffsetX,c=this._innerShadowOffsetY;r.push({InnerShadow:{position:[n*l+a*c,o*l+s*c],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:Ld(this._innerShadowColor)}})}return r.length>0?r:void 0}_applyClips(t,e=this._ctm){if(this._clips.length===0)return t;let r=t;for(let n of this._clips){let o=Oe.append(n.inv,e),[a,s,l,c,d,u]=Oe.getAbcdef(o),p=Math.abs(s)<=1e-6*(Math.abs(a)+Math.abs(c))&&Math.abs(l)<=1e-6*(Math.abs(a)+Math.abs(c)),h=mU(r);if(!h)return r;if(!p){zI();continue}let f=a*h.minX+d,m=a*h.maxX+d,y=c*h.minY+u,g=c*h.maxY+u,v=Math.min(f,m),b=Math.max(f,m),S=Math.min(y,g),x=Math.max(y,g),A=n.rect,w=Math.max(v,A.x),C=Math.max(S,A.y),T=Math.min(b,A.x+A.w),M=Math.min(x,A.y+A.h);if(w>=T||C>=M)return"skip";if(w===v&&C===S&&T===b&&M===x)continue;let I=xh(r);if(!I||a===0||c===0){zI();continue}let _=(w-d)/a,E=(T-d)/a,B=(C-u)/c,L=(M-u)/c,k=Math.min(_,E),F=Math.min(B,L),W=Math.abs(E-_),U=Math.abs(L-B),[G,q,X,Y]=I.radii,Q=k!==I.x,te=F!==I.y,ue=k+W!==I.x+I.w,le=F+U!==I.y+I.h,ce=Math.min(W,U)/2,de=[Q||te?0:Math.min(G,ce),ue||te?0:Math.min(q,ce),ue||le?0:Math.min(X,ce),Q||le?0:Math.min(Y,ce)];r=Vg({x:k,y:F,w:W,h:U,radii:de},0)}return r}drawText(t,e){let r=this._engineFonts.has(e.font),n=this._fontXPerEm.get(e.font),o=!r&&n?n/uU:1,a={TextSimple:{text:t,font_size:e.fontSize*o,size:[e.width,e.height],horizontal_align:jI[e.horizontalAlign]??"Left",vertical_align:HI[e.verticalAlign]??"Top",line_height:e.lineHeight,letter_spacing:e.letterSpacing,...r?{font_id:e.font}:{}}},s=this._effectChain(!0),l=this._fillColor.a>0,c=this._strokeColor.a>0&&this._lineWidth>0;if(l||c||s){let d=Oe.append(this._ctm,Oe.translate(Oe.identity(),e.x,e.y));if(this._applyClips(a,d)!=="skip"){let u={shape:a,color:l?Ld(this._fillColor):[0,0,0,0],transform:Oe.getAbcdef(d)};c&&(u.stroke=this._strokeDesc()),s&&(u.effect_chain=s),this._shapes.push(u)}}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let r=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,n=this._measureCache.get(r);if(n!==void 0)return n;let o=0,a=this._engine;if(a&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,s]=a.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:jI[e.horizontalAlign]??"Left",verticalAlign:HI[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});o=s}catch{}if(!(o>0)){let s=e.fontSize*.55+Math.max(0,e.letterSpacing),l=Math.max(1,Math.floor(e.width/s)),c=0;for(let d of t.split(`
1312
1312
  `))c+=Math.max(1,Math.ceil(d.length/l));o=c*e.fontSize*e.lineHeight}return this._measureCache.size>512&&this._measureCache.clear(),this._measureCache.set(r,o),o}clear(){this._shapes=[],this._ctm=Oe.identity(),this._stack.length=0,this._clips.length=0}render(){let t=this._engine;if(!t||this._crashed)return;let e=JSON.stringify(this._shapes);e!==this._lastPushedJSON&&(this._guard(()=>t.scene.updateUiShapes(this._shapes)),this._lastPushedJSON=e),this._guard(()=>t.onFrame())}},fU={inside:"Inside",outside:"Outside",center:"Center"},jI={[1]:"Left",[2]:"Right",[3]:"Center",[4]:"Justify"},HI={[1]:"Top",[2]:"Center",[3]:"Bottom"};function Ld({r:i,g:t,b:e,a:r}){return[i,t,e,r]}function WI(i){for(let t=0;t<i.length;t++)if(i[t]!==void 0&&!Number.isFinite(i[t]))return!1;return!0}function Vg(i,t){let[e,r,n,o]=i.radii;return e===0&&r===0&&n===0&&o===0?{Rectangle:{x:i.x,y:i.y,width:i.w,height:i.h}}:{RoundedRectangle:{x:i.x,y:i.y,width:i.w,height:i.h,radius:[e,r,n,o],corner_smoothing:t}}}function xh(i){if("Rectangle"in i){let t=i.Rectangle;return{x:t.x,y:t.y,w:t.width,h:t.height,radii:[0,0,0,0]}}if("RoundedRectangle"in i){let t=i.RoundedRectangle;return{x:t.x,y:t.y,w:t.width,h:t.height,radii:[t.radius[0],t.radius[1],t.radius[2],t.radius[3]]}}return null}function mU(i){let t=xh(i);if(t)return{minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h};if("Ellipse"in i){let e=i.Ellipse;return{minX:e.center_x-e.rx,minY:e.center_y-e.ry,maxX:e.center_x+e.rx,maxY:e.center_y+e.ry}}if("TextSimple"in i){let e=i.TextSimple;return{minX:0,minY:0,maxX:e.size[0],maxY:e.size[1]}}if("Custom"in i){let e=1/0,r=1/0,n=-1/0,o=-1/0,a=s=>{s.x<e&&(e=s.x),s.y<r&&(r=s.y),s.x>n&&(n=s.x),s.y>o&&(o=s.y)};for(let s of i.Custom)s!=="ClosePath"&&("MoveTo"in s?a(s.MoveTo):"LineTo"in s?a(s.LineTo):"QuadTo"in s?s.QuadTo.forEach(a):"CurveTo"in s&&s.CurveTo.forEach(a));return e===1/0?null:{minX:e,minY:r,maxX:n,maxY:o}}return null}function qI(i,t){let{x:e,y:r,w:n,h:o}=t,a=Math.min(n,o)/2,[s,l,c,d]=t.radii.map(p=>Math.max(0,Math.min(p,a)));if(s===0&&l===0&&c===0&&d===0){i.push({MoveTo:{x:e,y:r}},{LineTo:{x:e+n,y:r}},{LineTo:{x:e+n,y:r+o}},{LineTo:{x:e,y:r+o}},"ClosePath");return}let u=1-Gg;i.push({MoveTo:{x:e+s,y:r}}),i.push({LineTo:{x:e+n-l,y:r}}),l>0&&i.push({CurveTo:[{x:e+n-l*u,y:r},{x:e+n,y:r+l*u},{x:e+n,y:r+l}]}),i.push({LineTo:{x:e+n,y:r+o-c}}),c>0&&i.push({CurveTo:[{x:e+n,y:r+o-c*u},{x:e+n-c*u,y:r+o},{x:e+n-c,y:r+o}]}),i.push({LineTo:{x:e+d,y:r+o}}),d>0&&i.push({CurveTo:[{x:e+d*u,y:r+o},{x:e,y:r+o-d*u},{x:e,y:r+o-d}]}),i.push({LineTo:{x:e,y:r+s}}),s>0&&i.push({CurveTo:[{x:e,y:r+s*u},{x:e+s*u,y:r},{x:e+s,y:r}]}),i.push("ClosePath")}function yU(i,t){let{x:e,y:r,w:n,h:o}=t,a=Math.min(n,o)/2,[s,l,c,d]=t.radii.map(p=>Math.max(0,Math.min(p,a)));if(s===0&&l===0&&c===0&&d===0){i.push({MoveTo:{x:e,y:r}},{LineTo:{x:e,y:r+o}},{LineTo:{x:e+n,y:r+o}},{LineTo:{x:e+n,y:r}},"ClosePath");return}let u=1-Gg;i.push({MoveTo:{x:e+s,y:r}}),s>0&&i.push({CurveTo:[{x:e+s*u,y:r},{x:e,y:r+s*u},{x:e,y:r+s}]}),i.push({LineTo:{x:e,y:r+o-d}}),d>0&&i.push({CurveTo:[{x:e,y:r+o-d*u},{x:e+d*u,y:r+o},{x:e+d,y:r+o}]}),i.push({LineTo:{x:e+n-c,y:r+o}}),c>0&&i.push({CurveTo:[{x:e+n-c*u,y:r+o},{x:e+n,y:r+o-c*u},{x:e+n,y:r+o-c}]}),i.push({LineTo:{x:e+n,y:r+l}}),l>0&&i.push({CurveTo:[{x:e+n,y:r+l*u},{x:e+n-l*u,y:r},{x:e+n-l,y:r}]}),i.push("ClosePath")}function gU(i,t,e,r,n){let o=r*Gg,a=n*Gg;i.push({MoveTo:{x:t+r,y:e}},{CurveTo:[{x:t+r,y:e+a},{x:t+o,y:e+n},{x:t,y:e+n}]},{CurveTo:[{x:t-o,y:e+n},{x:t-r,y:e+a},{x:t-r,y:e}]},{CurveTo:[{x:t-r,y:e-a},{x:t-o,y:e-n},{x:t,y:e-n}]},{CurveTo:[{x:t+o,y:e-n},{x:t+r,y:e-a},{x:t+r,y:e}]},"ClosePath")}function YI(i){let t=!1;return i.scene.objects.traverse((e,r)=>{(r.type==="Mesh"&&r.geometry.type==="UIGeometry"||r.type==="Page"&&r.uiFrame!==void 0)&&(t=!0)}),t}var vU=Math.PI/180,nae=180/Math.PI;function KI(i,t,e,r,n,o){let a=i-e,s=t-r;return a*a/(n*n)+s*s/(o*o)<=1}function QI(i){return i*vU}yt();function Ua(i){return{all:i=i||new Map,on:function(t,e){var r=i.get(t);r?r.push(e):i.set(t,[e])},off:function(t,e){var r=i.get(t);r&&(e?r.splice(r.indexOf(e)>>>0,1):i.set(t,[]))},emit:function(t,e){var r=i.get(t);r&&r.slice().map(function(n){n(e)}),(r=i.get("*"))&&r.slice().map(function(n){n(t,e)})}}}var za=class{constructor(t,e,r){this.uuid=t;this.data=e;this.isObject2D=!0;this.localMatrix=Oe.identity();this.worldMatrix=Oe.identity();this.ignoreCameraZoom=!1;this.visible=!0;this._singleBBox=new Rs;this._recursiveBBox=new Rs;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.stateSelection=null;this.prevState=null;this.currentState=null;this.reversibleToState=null;this.currentTransitionEvent=null;this.previousAction=null;this.name="";this.position=[0,0];this.scale=[1,1];this.rotation=0;this.shear=[0,0];this.emitter=Ua();this.dpr=r.dpr??1,this.dataPatched=e}project(t,e){let r=this.worldMatrix;return e&&(r=Oe.append(e.worldMatrix,r)),Oe.applyInverse(t,r)}intersects(t,e,r,n=!1){return this.visible&&!this.data.raycastLock&&this.intersectsInLocalSpace(...this.project([t,e],r),n)}intersectsInLocalSpace(t,e,r=!1){let{min:n,max:o}=r?this.recursiveBBox:this.singleBBox;return t>=n[0]&&t<=o[0]&&e>=n[1]&&e<=o[1]}applyTransforms(t){t.setTransform(this.worldMatrix,this.ignoreCameraZoom)}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges()),this._recursiveBBox}updateLocalMatrix(){this.localMatrix=Oe.compose(this.position,this.scale,QI(this.rotation),Ra.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(t,e,r){let n=this.parent;e&&n!==null&&n!==void 0&&n.updateWorldMatrix(t,!0,!1),t&&this.updateLocalMatrix(),this.parent?this.worldMatrix=Oe.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=Oe.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return Ra.getPivot(this.data)}getCenter(){return[0,0]}getHalfSize(){return[0,0]}get id(){return this.uuid}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{t.resetBBoxNeedsUpdateSelf()})}updateTransformState(t){let e=!1;t.position!==void 0&&(e=!0,this.position=t.position),t.rotation!==void 0&&(e=!0,this.rotation=t.rotation),t.scale!==void 0&&(e=!0,this.scale=t.scale),t.shear!==void 0&&(e=!0,this.shear=t.shear),e&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(t,e,r){t.type===0&&t.props.visible!==void 0&&(this.visible=t.props.visible),this.data=e,this.data=e;let n=t,o=Ye(t.path,["states","*"]);if(o!==null){if(t.type===0){let[a]=o;if(this?.stateSelection===a){let s={...t.props};if(delete s.name,Object.values(t.props).some(l=>l===void 0)){let l=this.data;if(l!==void 0){let c=jt.zoom(l,t.path.slice(2));if(c)for(let d in t.props)t.props[d]===void 0&&d in c&&(s[d]=c[d])}}n={...t,props:s,path:t.path.slice(2)}}}}else if(t.type===0){let a=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(a!==void 0){if(t.props.name!==void 0&&a.name){let{name:l,...c}=a;a=c}let s=jt.removeOverridden(t.path,t.props,a);n={...t,props:s}}}this.updateByPatchedOpBase(n,Da.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r)}changeSelectedState(t,e,r=!1){if(!(this.data.states.length===0&&!r)){for(let n of this.data.states)Da.toOps(this.data,n.data).forEach(a=>{let s=Mc.replaceProps(a,this.data);this.dataPatched=this.data,this.updateByPatchedOp(s,this.data,e)});if(t!==null){let n=this.data.states.data(t);n&&(this.dataPatched=Da.patch(this.data,n),Da.toOps(this.data,n).forEach(a=>{this.updateByPatchedOp(a,this.dataPatched,e)}))}r&&this.updateTransformState(this.dataPatched),this.stateSelection=t}}updateState(t,e){t.name!==void 0&&(this.name=t.name),t.visible!==void 0&&(this.visible=t.visible),this.updateTransformState(t)}updateByPatchedOpBase(t,e,r){this.dataPatched=e,this.updateByPatchedOp(t,e,r)}updateByPatchedOp(t,e,r){t.path.length===0&&t.type===0&&this.updateState(t.props,r),this.requestRender()}traverseFrameAncestors(t){this.traverseAncestors(e=>{e.data.type==="frame2d"&&t(e)})}traverseAncestors(t){let e=this.parent;for(;e;)t(e),e=e.parent}requestRender(){this.traverseFrameAncestors(t=>{t.requestRender()})}clone(t){let e=new za(this.uuid,this.data,t);return e.parent=void 0,e}addEventListener(t,e){this.emitter.on(t,e)}removeEventListener(t,e){this.emitter.off(t,e)}dispatchEvent(t){this.emitter.emit(t.type,{...t,target:t.target??this})}traverseSortNextHelper(){let t=this.parent;if(t){let e=t.children;if(e){let r=e.indexOf(this)+1;return e[r]?e[r]:t.traverseSortNextHelper()}}}sortNext(){let t=this.children;return t&&t.length>0&&t[0]?t[0]:this.traverseSortNextHelper()}isDescendantOf(t){t instanceof za&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}};yt();var Sh=class{constructor(t,e,r){this.uuid=t;this.data=e;this.enabled=!1;this.color=Ve.transparent;this.blurRadius=0;this.offset=[0,0];this.spread=0;this.update(e)}update(t){t.color!==void 0&&(this.color=t.color),t.enabled!==void 0&&(this.enabled=t.enabled),t.blurRadius!==void 0&&(this.blurRadius=t.blurRadius),t.offset!==void 0&&(this.offset=t.offset),t.spread!==void 0&&(this.spread=t.spread)}};var Ah=class{constructor(t,e,r){this.uuid=t;this.data=e;this.enabled=!1;this.radius=0;this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.radius!==void 0&&(this.radius=t.radius)}};var zg=class{constructor(t,e,r){this.uuid=t;this.data=e;this.enabled=!1;this.color=Ve.transparent;this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.color!==void 0&&(this.color=t.color)}};var jg=class{constructor(t,e,r){this.uuid=t;this.data=e;this.enabled=!1;this.color=Ve.transparent;this.thickness=0;this.mode="inside";this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.color!==void 0&&(this.color=t.color),t.thickness!==void 0&&(this.thickness=t.thickness),t.mode!==void 0&&(this.mode=t.mode)}};var Xt=class extends za{constructor(e,r,n){super(e,r,n);this.uuid=e;this.data=r;this.autoClose=!0;this.fill=new zg(e+"-fill",r.fill,n),this.stroke=new jg(e+"-stroke",r.stroke,n),this.dropShadow=new Sh(e+"-dropShadow",r.dropShadow,n),this.innerShadow=new Sh(e+"-innerShadow",r.innerShadow,n),this.backgroundBlur=new Ah(e+"-backgroundBlur",r.backgroundBlur,n),this.layerBlur=new Ah(e+"-layerBlur",r.layerBlur,n)}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:Ve.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Ve.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}applyFilters(e){this.layerBlur.enabled?e.layerBlur=this.layerBlur.radius*5:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=this.backgroundBlur.radius*5:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=this.dropShadow.blurRadius*5,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=Ve.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=this.innerShadow.blurRadius*5,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=Ve.transparent}innerDraw(e){}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.applyFilters(e),this.applyFillStroke(e),e.beginPath(),this.innerDraw(e),this.autoClose&&e.closePath(),this.fill.enabled&&e.fill(),this.stroke.enabled&&e.stroke(),e.restore())}updateByPatchedOp(e,r,n){super.updateByPatchedOp(e,r,n),e.type===0&&(Ye(e.path,["fill"])?this.fill.update(e.props):Ye(e.path,["stroke"])?this.stroke.update(e.props):Ye(e.path,["dropShadow"])?this.dropShadow.update(e.props):Ye(e.path,["innerShadow"])?this.innerShadow.update(e.props):Ye(e.path,["layerBlur"])?this.layerBlur.update(e.props):Ye(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}updateState(e,r){super.updateState(e,r),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur)}clone(e){let r=new Xt(this.uuid,this.data,e);return r.parent=void 0,r}};var Bs=class extends Xt{constructor(e,r,n){super(e,r,n);this.uuid=e;this.data=r;this.width=0;this.height=0;this.updateState(r,n)}innerDraw(e){e.ellipse(this.width*.5,this.height*.5,this.width*.5,this.height*.5,0,0,Math.PI*2)}intersectsInLocalSpace(e,r){return KI(e,r,this.width*.5,this.height*.5,this.width*.5,this.height*.5)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let r=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,r=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,r=!0),r&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,r){super.updateState(e,r),this.updateSizeState(e)}clone(e){let r=new Bs(this.uuid,this.data,e);return r.parent=void 0,r}};var Xi=class extends Xt{constructor(e,r,n){super(e,r,n);this.uuid=e;this.data=r;this.width=0;this.height=0;this.cornerRadius=[0,0,0,0];this.updateState(r,n)}innerDraw(e){e.rect(0,0,this.width,this.height,...this.cornerRadius)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let r=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,r=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,r=!0),r&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,r){super.updateState(e,r),this.updateSizeState(e),this.updateCornerState(e)}clone(e){let r=new Xi(this.uuid,this.data,e);return r.parent=void 0,r}};var Ns=class extends Xt{constructor(e,r,n){super(e,r,n);this.uuid=e;this.data=r;this._textHeight=0;this._textHeightDirty=!0;this.width=0;this.height=0;this.updateState(r,n)}get textHeight(){return this._textHeight}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:Ve.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Ve.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);let r=this.data.textTransform,n=this.data.text.textValue.toString(),o=r===2?n.toUpperCase():r===3?n.toLowerCase():n,{height:a}=e.drawText(o,{x:0,y:0,width:this.width,height:this.height,fontSize:this.data.fontSize,lineHeight:this.data.lineHeight??1,letterSpacing:this.data.letterSpacing??0,horizontalAlign:this.data.horizontalAlign,verticalAlign:this.data.verticalAlign,font:this.data.font});this._textHeight=a}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let r=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,r=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,r=!0),r&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(e,{shared:r}){e.font!==void 0&&(this._fontHolder=r.getFont(e.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(e,r){super.updateState(e,r),this.updateSizeState(e),this.updateFontState(e,r)}clone(e){let r=new Ns(this.uuid,this.data,e);return r.parent=void 0,r}};var _d=class extends Xt{constructor(e,r,n){super(e,r,n);this.uuid=e;this.data=r;this.curves=[];this.extremasBBox={min:[0,0],max:[0,0]};this.updateState(r,n)}computeExtremas(){this.curves.length===0&&this.computeCurves();let e=this.curves.map(o=>Hg.extremas(o)),r=[1/0,1/0],n=[-1/0,-1/0];for(let o=0,a=e.length;o<a;o++){let s=e[o];s[0][0]<r[0]&&(r[0]=s[0][0]),s[0][1]<r[1]&&(r[1]=s[0][1]),s[1][0]>n[0]&&(n[0]=s[1][0]),s[1][1]>n[1]&&(n[1]=s[1][1])}return this.extremasBBox.min=[r[0],r[1]],this.extremasBBox.max=[n[0],n[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let n=1,o=this.data.points.length;n<o;n++){let a=this.data.points[n].data,s=this.data.points[n-1].data,l={start:s.position,cp1:s.controlNext.position,cp2:a.controlPrevious.position,end:a.position};this.curves.push(l)}let e=this.data.points[0].data,r=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let n={start:r.position,cp1:r.controlNext.position,cp2:e.controlPrevious.position,end:e.position};this.curves.push(n)}}getCenter(){let[e,r]=this.extremasBBox.min,[n,o]=this.getHalfSize();return[e+n,r+o]}getHalfSize(){let{min:e,max:r}=this.extremasBBox;return[(r[0]-e[0])*.5,(r[1]-e[1])*.5]}innerDraw(e){for(let o=0,a=this.data.points.length;o<a;o++){let s=this.data.points[o].data;if(o===0){let[l,c]=s.position;e.moveTo(l,c)}else{let l=this.data.points[o-1].data,[c,d]=l.controlNext.position,[u,p]=s.controlPrevious.position,[h,f]=s.position,m={start:l.position,cp1:l.controlNext.position,cp2:s.controlPrevious.position,end:s.position};Hg.derive(m),e.bezierCurveTo(c,d,u,p,h,f)}}let r=this.data.points[0].data,n=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let[o,a]=n.controlNext.position,[s,l]=r.controlPrevious.position,[c,d]=r.position;e.bezierCurveTo(o,a,s,l,c,d)}}updateState(e,r){super.updateState(e,r),this.computeExtremas()}clone(e){let r=new _d(this.uuid,this.data,e);return r.parent=void 0,r}},Hg;(o=>{function i(a){let s=a.start,l=a.cp1,c=a.cp2,d=a.end,u=[3*(l[0]-s[0]),3*(l[1]-s[1])],p=[3*(c[0]-l[0]),3*(c[1]-l[1])],h=[3*(d[0]-c[0]),3*(d[1]-c[1])],f={start:u,cp:p,end:h};return a.derivative=f,f.derivative=_1.derive(f),f}o.derive=i;function t(a,s,l,c=!1){let d=a-2*s+l;if(d!==0){let u=-Math.sqrt(Math.abs(s*s-a*l)),p=-a+s,h=-(u+p)/d,f=-(-u+p)/d;return[h,f]}else if(s!==l&&d===0)return[(2*s-l)/(2*(s-l))];return[]}function e(a){let s=a.derivative??o.derive(a),l=s.start,c=s.cp,d=s.end;return[t(l[0],c[0],d[0]),t(l[1],c[1],d[1])]}o.droot=e;function r(a){let[s,l]=o.droot(a),c=[a.start[0],a.end[0]],d=[a.start[1],a.end[1]];for(let u of s)c.push(o.compute(a,Math.min(1,Math.max(0,u)))[0]);for(let u of l)d.push(o.compute(a,Math.min(1,Math.max(0,u)))[1]);return c.sort((u,p)=>u-p),d.sort((u,p)=>u-p),[[c[0],d[0]],[c[c.length-1],d[d.length-1]]]}o.extremas=r;function n(a,s){if(s===0)return[...a.start];if(s===1)return[...a.end];let l=1-s,c=l*l,d=s*s,u=c*l,p=c*s*3,h=l*d*3,f=s*d;return[u*a.start[0]+p*a.cp1[0]+h*a.cp2[0]+f*a.end[0],u*a.start[1]+p*a.cp1[1]+h*a.cp2[1]+f*a.end[1]]}o.compute=n})(Hg||(Hg={}));var _1;(r=>{function i(n){let o=n.start,a=n.cp,s=n.end,l=[2*(a[0]-o[0]),2*(a[1]-o[1])],c=[2*(s[0]-a[0]),2*(s[1]-a[1])],d={start:l,end:c};return d.derivative=k1.derive(d),n.derivative=d,d}r.derive=i;function t(n){let o=n.derivative??r.derive(n),a=o.start,s=o.end;return[a[0]!==s[0]?a[0]/(a[0]-s[0]):0,a[1]!==s[1]?a[1]/(a[1]-s[1]):0]}r.droot=t;function e(n,o){if(o===0)return[...n.start];if(o===1)return[...n.end];let a=1-o,s=a*a,l=o*o,c=s,d=a*o*2,u=l;return[c*n.start[0]+d*n.cp[0]+u*n.end[0],c*n.start[1]+d*n.cp[1]+u*n.end[1]]}r.compute=e})(_1||(_1={}));var k1;(e=>{function i(r){let n=r.start,o=r.end,a=[o[0]-n[0],o[1]-n[1]];return r.derivative=a,r.derivative}e.derive=i;function t(r,n){if(n===0)return[...r.start];if(n===1)return[...r.end];let o=r.start,a=r.end;return[o[0]+(a[0]-o[0])*n,o[1]+(a[1]-o[1])*n]}e.compute=t})(k1||(k1={}));var zn=class extends za{constructor(e,r,n){super(e,r,n);this.uuid=e;this.data=r;this.context=n;this.isBaseGroup=!0;this.children=[]}add(e){e.parent&&e.parent instanceof zn&&e.parent.remove(e),this.children.push(e),e.parent=this}remove(e){let r=this.children.indexOf(e);r>=0&&(this.children.splice(r,1),e.parent=void 0)}traverse(e){let r=e(this);if(r!==!0)for(let n of this.children)n instanceof zn?n.traverse(e):r=e(n)}intersectsChildrenHelper(e,r,n,o,a){for(let s of this.children)if(s.intersects(e,r,n,!1)&&(a.push(s),o)||s instanceof zn&&s.intersectsChildrenHelper(e,r,n,o,a))return!0;return!1}intersectsChildren(e,r,n,o=!1,a=[],s=!1){return this.intersectsChildrenHelper(e,r,n,o,a),a}intersectsChildrenHelperReverse(e,r,n,o,a){for(let s of this.children)if(s instanceof zn&&s.intersectsChildrenHelperReverse(e,r,n,o,a)||s.intersects(e,r,n,!1)&&(a.push(s),o))return!0;return!1}intersectsChildrenReverse(e,r,n,o=!1,a=[],s=!1){return this.intersectsChildrenHelperReverse(e,r,n,o,a),a}updateWorldMatrix(e,r,n){if(super.updateWorldMatrix(e,r,n),n&&this.children)for(let o of this.children)o.updateWorldMatrix(e,!1,!0)}find(e){let r;return this.traverse(n=>{n.uuid===e&&(r=n)}),r}innerDrawChildren(e){for(let r=this.children.length-1;r>=0;r--)this.children[r].draw(e)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(e=>{e.resetBBoxNeedsUpdateSelf()})}clone(e){let r=new zn(this.uuid,this.data,e);r.parent=void 0;for(let n of this.children)r.add(n.clone(e));return r}},ri=class extends zn{constructor(e,r,n){super(e,r,n);this.uuid=e;this.data=r;this.updateState(r,n)}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.innerDrawChildren(e),e.restore())}clone(e){let r=new ri(this.uuid,this.data,e);r.parent=void 0;for(let n of this.children)r.add(n.clone(e));return r}};yt();var un=class extends zn{constructor(e,r,n){super(e,r,n);this.uuid=e;this.width=0;this.height=0;this.clipped=!0;this.background=new Xi(e+"-background",Qc.defaultData,n),this.background.parent=this,this.updateState(r,n)}get fill(){return this.background.fill}get stroke(){return this.background.stroke}get backgroundBlur(){return this.background.backgroundBlur}get layerBlur(){return this.background.layerBlur}get dropShadow(){return this.background.dropShadow}get innerShadow(){return this.background.innerShadow}get cornerRadius(){return this.background.cornerRadius}set cornerRadius(e){this.background.cornerRadius=e}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(e,r,n){super.updateWorldMatrix(e,r,n),this.background?.updateWorldMatrix(e,r,n)}draw(e){if(!this.visible)return;e.save();let r=this.width,n=this.height;this.applyTransforms(e),this.background.width=r,this.background.height=n,this.background.draw(e),this.clipped&&e.clipRect(0,0,r,n,...this.cornerRadius),this.innerDrawChildren(e),e.restore()}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let r=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,r=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,r=!0),r&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,r){super.updateState(e,r),this.updateSizeState(e),this.updateCornerState(e),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur),e.clipped!==void 0&&(this.clipped=e.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(e,r,n){super.updateByPatchedOp(e,r,n),e.type===0&&(Ye(e.path,["fill"])?this.fill.update(e.props):Ye(e.path,["stroke"])?this.stroke.update(e.props):Ye(e.path,["dropShadow"])?this.dropShadow.update(e.props):Ye(e.path,["innerShadow"])?this.innerShadow.update(e.props):Ye(e.path,["layerBlur"])?this.layerBlur.update(e.props):Ye(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let r=new un(this.uuid,this.data,e);r.parent=void 0;for(let n of this.children)r.add(n.clone(e));return r}};var ZI=Ec(kg(),1),Wg=new Map,bU=4096,kd=null;function xU(i){let t=Wg.get(i);if(t!==void 0)return t;if(kd===null||!kd.isConnected){let r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true"),r.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none",kd=document.createElementNS("http://www.w3.org/2000/svg","path"),r.appendChild(kd),document.body.appendChild(r)}kd.setAttribute("d",i);let e=kd.getBBox();return Wg.size>=bU&&Wg.clear(),Wg.set(i,e),e}var ja=class extends Xt{constructor(e,r,n){super(e,r,n);this.uuid=e;this.data=r;this._pathBBox=new DOMRect;this.path="";this.updateState(r,n),this.autoClose=!1,this.computeSVGBBox()}computeSVGBBox(){let e=this.path;JI(this.path)&&(console.warn("Invalid SVG path",this.uuid),e=""),this._pathBBox=xU(e)}innerDraw(e){e.path(this.path)}intersectsInLocalSpace(e,r){return e>=this._pathBBox.x&&e<=this._pathBBox.x+this._pathBBox.width&&r>=this._pathBBox.y&&r<=this._pathBBox.y+this._pathBBox.height}getCenter(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}getHalfSize(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}updateState(e,r){super.updateState(e,r),e.path!==void 0&&(this.path=e.path,this.computeSVGBBox())}clone(e){let r=new ja(this.uuid,this.data,e);return r.parent=void 0,r}};function JI(i){return/NaN/.test(i)}function $I(i,t=1,e=1){if(t<=0||e<=0)return i;if(JI(i))return console.warn("Cannot scale invalid path",i),qg([]);if(t===1&&e===1)return i;try{let n=(0,ZI.parseSVG)(i).map(o=>{let a={...o};return"x"in a&&(a.x=a.x*t),"y"in a&&(a.y=a.y*e),"x1"in a&&(a.x1=a.x1*t),"x2"in a&&(a.x2=a.x2*t),"y1"in a&&(a.y1=a.y1*e),"y2"in a&&(a.y2=a.y2*e),"rx"in a&&(a.rx=a.rx*t),"ry"in a&&(a.ry=a.ry*e),a});return qg(n)}catch(r){return console.warn("Error parsing SVG path",r),qg([])}}function qg(i){let t=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"],e;return i.map(r=>{let n=[];t.forEach(a=>{if(a in r){let s=r[a]*1;n.length&&s>=0&&n.push(","),n.push(s)}});let o=(e===r.code?n[0]<0?"":",":r.code)+n.join("");return e=r.code,o}).join("")}function eD(i,t,e){switch(t.type){case"ellipse2d":return new Bs(i,t,e);case"rectangle2d":return new Xi(i,t,e);case"text2d":return new Ns(i,t,e);case"vector2d":return new _d(i,t,e);case"path2d":return new ja(i,t,e);case"frame2d":return new un(i,t,e);case"group2d":default:return new ri(i,t,e)}}gr();var F1=class{constructor(t,e,r){this.uuid=t;this.data=e;this.group=new ri(F1.GROUP_ID,{...kp.defaultData},r),this.createChildrenObjects(e.objects,this.group,r)}createObject(t,e,r,n,o,a){let s=eD(t,e,a);s&&(n.add(s),n.children.splice(o,0,n.children.pop()),s.updateWorldMatrix(),r.length>0&&(s instanceof ri||s instanceof un)&&this.createChildrenObjects(r,s,a))}createChildrenObjects(t,e,r){let n=0;for(let o of t)this.createObject(o.id,o.data,o.children,e,n,r),n+=1}draw(t){this.group.draw(t)}updateEntityByOp(t,e,r,n){let o=this.find(t);if(o)try{o.updateByOp(e,r,{shared:n})}catch(a){console.error(a)}}updateTreeByOp(t,e){if(t.path.length===0&&t.type===7){let r=t.parent===null?this.group:this.find(t.parent);r!==void 0&&r instanceof zn&&(this.createObject(t.id,t.data,t.children,r,t.localIndex,e),r.requestRender())}else if(t.path.length===0&&t.type===8){let r=this.find(t.id);if(r!==void 0&&r.parent!==void 0&&r.parent instanceof zn){let n=r.parent;r.resetBBoxNeedsUpdate(),n?.remove(r),n?.requestRender()}}else if(t.path.length===0&&t.type===9){let r=this.find(t.id);if(r!==void 0){let n=r.parent,o=t.parent===null?this:this.find(t.parent);if(o===void 0&&!1&&console.error("unexpected",o,t),o instanceof zn||o===this){o.add(r);let a=t.localIndex;o.children.splice(a,0,o.children.pop()),r.updateWorldMatrix(!0,!1,!0),n?.requestRender(),r.requestRender()}r.resetBBoxNeedsUpdate()}}}add(t){this.group.add(t)}remove(t){this.group.remove(t)}traverse(t){this.group.traverse(e=>{e!==this.group&&t(e)})}intersectsChildren(t,e,r,n=!1,o=[]){return this.group.intersectsChildren(t,e,r,n,o,!0)}intersectsChildrenReverse(t,e,r,n=!1,o=[]){return this.group.intersectsChildrenReverse(t,e,r,n,o,!0)}find(t){return this.group.find(t)}get children(){return this.group.children}project(t,e){return this.group.project(t,e)}getWithSortKey(t){let e=this.find(t);if(e===void 0)return;let r=[],n=e;for(;n!==this.group;){let o=n;n=n.parent;let a=n.children.indexOf(o);r.splice(0,0,a)}return{entity:e,sortKey:r}}getAllSorted(t){let e=[];for(let r of t){let n=this.getWithSortKey(r.id);n!==void 0&&e.push(n)}return e.sort((r,n)=>ll(r.sortKey,n.sortKey)),e.map(r=>r.entity)}},Xl=F1;Xl.GROUP_ID="scene2d";function V1({constraints:i,newParentWidth:t,newParentHeight:e,initialParentWidth:r,initialParentHeight:n,objectInitialWidth:o,objectInitialHeight:a,objectInitialPosition:s}){let{horizontalConstraint:l,verticalConstraint:c}=i,d=t-r,u=e-n,p=o,h=a,f=s[0],m=s[1];if(l!==0){if(l===1)f+=d;else if(l===3)f+=d/2;else if(l===2)p=Math.max(1,p+d);else if(l===4){let y=t/r;p*=y,f*=y}}if(c!==0){if(c===1)m+=u;else if(c===3)m+=u/2;else if(c===2)h=Math.max(1,h+u);else if(c===4){let y=e/n;h*=y,m*=y}}return{width:p,height:h,position:[f,m]}}var SU=Ec(kg(),1);var ale={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{mm:1,px:1,cm:1,in:1,pt:1,pc:1}};yt();var Lr=require("three");var AU=new Set;function tD(i){AU.add(i)}function G1(i,t,e,r){return r?e:2048/Math.max(1,i,t)}function rD(i,t,e,r){let n=G1(i,t,e,r),o=Math.max(e,512/Math.min(i,t)),a=Math.min(o,n);return{width:Math.max(1,Math.ceil(i*a)),height:Math.max(1,Math.ceil(t*a))}}var wU=`
1313
1313
  varying vec2 vUv;
1314
1314
  void main() {
@@ -1324,7 +1324,7 @@ void main() {
1324
1324
  `,e),u=e.horizontalAlign===1?d:0,p=this.getLineInitialOffsetX(s[0],l,e.horizontalAlign,t[0],d),h=this.getLineInitialOffsetY(a,t.length,c,o,e.verticalAlign),f=[],m=t.map(()=>[]),y=t.map(()=>[]);for(let v=0;v<t.length;v++){let b=t[v],S={features:{liga:!0},letterSpacing:e.letterSpacing},x=[];try{x=n.stringToGlyphs(b,S)}catch(M){this.warnLayoutError(M)}p=this.getLineInitialOffsetX(s[v],l,e.horizontalAlign,b,d);let A=[];try{A=this.reverseLigaturesTable(n,b,x)}catch(M){this.warnLayoutError(M)}let w=this.computeSpaceWidthForLine(t,v,e,r),C=0,T=x[0];T&&e.horizontalAlign===2&&T.leftSideBearing!==void 0&&(p-=T.leftSideBearing*o);try{this.font?.forEachGlyph(b,p,h,e.fontSize,S,(M,D,I,_,E)=>{let B=M.index===0?`
1325
1325
  `:M.unicode?String.fromCharCode(M.unicode):void 0,L=A[C],k=0;if(B===`
1326
1326
  `)k=u;else if(B===" ")k=w;else{let F=this.createPath(M,o,D,I,e);F&&(k=F.offsetX,f.push(F.path))}if(!L||L.replacements.length===1)y[v].push([D,I]),m[v].push(k);else{let F=L.replacements.map(q=>(n.glyphs.get(q).advanceWidth??0)*o),W=F.reduce((q,X)=>q+=X,0),U=F.map(q=>q/W),G=D;for(let q=0;q<U.length;q++){let X=k*U[q];y[v].push([G,I]),m[v].push(X),G+=X}}C++})}catch(M){this.warnLayoutError(M)}h-=a}let g=[];for(let v=0,b=f.length;v<b;v++)g.push(...f[v].toShapes());return{shapes:g,charWidths:m,lineWidths:s,charCoords:y}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,r,n,o){return(r===3||r===2)&&n.indexOf(`
1327
- `)>=0&&(t-=o),r===3?e*.5-t*.5:r===2?e-t:0}getLineInitialOffsetY(t,e,r,n,o){let a=e*t,s=Math.abs(this.ascender-this.descender)*n,l=t-s,c=-this.ascender*n-l/2;return o===3?-(r-a-c):o===2?-(r*.5-a*.5-c):c}createPath(t,e,r,n,o){let a=t.getPath(r,-n,o.fontSize,{kerning:!1,letterSpacing:o.letterSpacing});if(!a){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let s=new Yg,l=(t.advanceWidth??1)*e;if(t)for(let c of a.commands){let d=s.currentPath?.currentPoint;if(!(d&&c.type!=="Z"&&d.x===c.x&&-d.y===c.y))switch(c.type){case"M":s.moveTo(c.x,-c.y);break;case"L":s.lineTo(c.x,-c.y);break;case"Q":s.quadraticCurveTo(c.x1,-c.y1,c.x,-c.y);break;case"C":s.bezierCurveTo(c.x1,-c.y1,c.x2,-c.y2,c.x,-c.y);break}}return s.subPaths.forEach(c=>{let d=kU(c.curves);d!==void 0&&c.currentPoint.distanceTo(d)>0&&c.lineTo(d.x,d.y)}),{offsetX:l,path:s}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(r){return this.warnLayoutError(r),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(r){return this.warnLayoutError(r),0}}computeSpaceWidthForLine(t,e,r,n){let o=this.getCharWidth(" ",r),a=t[e];if(a){let s=this.countSpaces(a.trimEnd());if(r.horizontalAlign===4&&e<t.length-1&&s){let l=typeof r.width=="string"?Number(n.getVariable(r.width)):r.width,c=this.getTextWidth(a,r);return(l-(c-s*o))/s}}return o}countSpaces(t){return(t.match(/ /g)||[]).length}};function kU(i){if(i.length){let t=i[0];if(t instanceof Vd.LineCurve)return t.v1;if(t instanceof Vd.CubicBezierCurve||t instanceof Vd.QuadraticBezierCurve)return t.v0}}Fi("TextGeometry",(i,t,e)=>new Is(i,t,e));var cD={create:(i,t)=>new Ed(i,t)};zp("TextGeometry",cD);zp("InputGeometry",cD);jM(Qg);Pe("text");var dD=200,FU=null;function uD(i){FU=i}var Ch=(i,t)=>{let e=t.x-i.x,r=t.y-i.y;return Math.sqrt(e*e+r*r)},pD=(i,t)=>{let e=t.x-i.x,r=t.y-i.y;return VU(Math.atan2(r,e))},hD=(i,t,e)=>{let r={x:0,y:0};return e=Jg(e),r.x=i.x-t*Math.cos(e),r.y=i.y-t*Math.sin(e),r},Jg=i=>i*(Math.PI/180),VU=i=>i*(180/Math.PI),fD=i=>isNaN(i.buttons)?i.pressure!==0:i.buttons!==0,Zg=new Map,mD=i=>{Zg.has(i)&&clearTimeout(Zg.get(i)),Zg.set(i,setTimeout(function(){Zg.delete(i),i()},100))},Gd=(i,t,e)=>{let r=t.split(/[ ,]+/g),n;for(let o=0;o<r.length;o+=1)n=r[o],i.addEventListener?i.addEventListener(n,e,!1):i.attachEvent&&i.attachEvent(n,e)},Ud=(i,t,e)=>{let r=t.split(/[ ,]+/g),n;for(let o=0;o<r.length;o+=1)n=r[o],i.removeEventListener?i.removeEventListener(n,e):i.detachEvent&&i.detachEvent(n,e)};var $g=i=>(i.preventDefault(),i.type.match(/^touch/)?i.changedTouches:i),Y1=()=>{if(typeof window>"u")return;let i=window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t=window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{x:i,y:t}},ev=(i,t)=>{t.top||t.right||t.bottom||t.left?(i.style.top=t.top,i.style.right=t.right,i.style.bottom=t.bottom,i.style.left=t.left):(i.style.left=t.x+"px",i.style.top=t.y+"px")},tv=(i,t,e)=>{let r=gD(i);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))if(typeof t=="string")r[n]=t+" "+e;else{let o="";for(let a=0,s=t.length;a<s;a+=1)o+=t[a]+" "+e+", ";r[n]=o.slice(0,-2)}return r},yD=(i,t)=>{let e=gD(i);for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=t);return e},gD=i=>{let t={};return t[i]="",["webkit","Moz","o"].forEach(function(r){t[r+i.charAt(0).toUpperCase()+i.slice(1)]=""}),t},rv=(i,t)=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i},vD=(i,t)=>{let e={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&Object.prototype.hasOwnProperty.call(t,r)?e[r]=t[r]:Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);return e},Eh=(i,t)=>{if(i.length)for(let e=0,r=i.length;e<r;e+=1)t(i[e]);else t(i)},bD=(i,t,e)=>({x:Math.min(Math.max(i.x,t.x-e),t.x+e),y:Math.min(Math.max(i.y,t.y-e),t.y+e)});typeof window<"u"&&(xD="ontouchstart"in window,SD=!!window.PointerEvent,AD=!!window.MSPointerEvent);var xD,SD,AD,Th={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},zd,Ph={};SD?zd=Th.pointer:AD?zd=Th.MSPointer:xD?(zd=Th.touch,Ph=Th.mouse):zd=Th.mouse;function Yl(){}Yl.prototype.on=function(i,t){var e=this,r=i.split(/[ ,]+/g),n;e._handlers_=e._handlers_||{};for(var o=0;o<r.length;o+=1)n=r[o],e._handlers_[n]=e._handlers_[n]||[],e._handlers_[n].push(t);return e};Yl.prototype.off=function(i,t){var e=this;return e._handlers_=e._handlers_||{},i===void 0?e._handlers_={}:t===void 0?e._handlers_[i]=null:e._handlers_[i]&&e._handlers_[i].indexOf(t)>=0&&e._handlers_[i].splice(e._handlers_[i].indexOf(t),1),e};Yl.prototype.trigger=function(i,t){var e=this,r=i.split(/[ ,]+/g),n;e._handlers_=e._handlers_||{};for(var o=0;o<r.length;o+=1)n=r[o],e._handlers_[n]&&e._handlers_[n].length&&e._handlers_[n].forEach(function(a){a.call(e,{type:n,target:e},t)})};Yl.prototype.config=function(i){var t=this;t.options=t.defaults||{},i&&(t.options=vD(t.options,i))};Yl.prototype.bindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},e._domHandlers_[t]=function(){typeof e["on"+t]=="function"?e["on"+t].apply(e,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},Gd(i,zd[t],e._domHandlers_[t]),Ph[t]&&Gd(i,Ph[t],e._domHandlers_[t]),e};Yl.prototype.unbindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},Ud(i,zd[t],e._domHandlers_[t]),Ph[t]&&Ud(i,Ph[t],e._domHandlers_[t]),delete e._domHandlers_[t],this};var jd=Yl;function Xr(i,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=i,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Xr.id,Xr.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Xr.prototype=new jd;Xr.constructor=Xr;Xr.id=0;Xr.prototype.buildEl=function(i){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};Xr.prototype.stylize=function(){if(this.options.dataOnly)return this;var i=this.options.fadeTime+"ms",t=yD("borderRadius","50%"),e=tv("transition","opacity",i),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},r.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},rv(r.el,e),this.options.shape==="circle"&&rv(r.back,t),rv(r.front,t),this.applyStyles(r),this};Xr.prototype.applyStyles=function(i){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var e in i[t])this.ui[t].style[e]=i[t][e];return this};Xr.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};Xr.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};Xr.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};Xr.prototype.show=function(i){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof i=="function"&&i.call(this)},t.options.fadeTime)),t};Xr.prototype.hide=function(i){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var e=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=e,typeof i=="function"&&i.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let e=t.options.restJoystick,r={};r.x=e===!0||e.x!==!1?0:t.instance.frontPosition.x,r.y=e===!0||e.y!==!1?0:t.instance.frontPosition.y,t.setPosition(i,r)}return t};Xr.prototype.setPosition=function(i,t){var e=this;e.frontPosition={x:t.x,y:t.y};var r=e.options.fadeTime+"ms",n={};n.front=tv("transition",["top","left"],r);var o={front:{}};o.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(n),e.applyStyles(o),e.restTimeout=setTimeout(function(){typeof i=="function"&&i.call(e),e.restCallback()},e.options.fadeTime)};Xr.prototype.restCallback=function(){var i=this,t={};t.front=tv("transition","none",""),i.applyStyles(t),i.trigger("rested",i.instance)};Xr.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};Xr.prototype.computeDirection=function(i){var t=i.angle.radian,e=Math.PI/4,r=Math.PI/2,n,o,a;if(t>e&&t<e*3&&!i.lockX?n="up":t>-e&&t<=e&&!i.lockY?n="left":t>-e*3&&t<=-e&&!i.lockX?n="down":i.lockY||(n="right"),i.lockY||(t>-r&&t<r?o="left":o="right"),i.lockX||(t>0?a="up":a="down"),i.force>this.options.threshold){var s={},l;for(l in this.direction)Object.prototype.hasOwnProperty.call(this.direction,l)&&(s[l]=this.direction[l]);var c={};this.direction={x:o,y:a,angle:n},i.direction=this.direction;for(l in s)s[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return i;(!c.x||!c.y)&&this.trigger("plain",i),c.x||this.trigger("plain:"+o,i),c.y||this.trigger("plain:"+a,i),c.angle||this.trigger("dir dir:"+n,i)}else this.resetDirection();return i};var wD=Xr;function _r(i,t){var e=this;e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.pressureIntervals={},e.manager=i,e.id=_r.id,_r.id+=1,e.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},e.config(t),(e.options.mode==="static"||e.options.mode==="semi")&&(e.options.multitouch=!1),e.options.multitouch||(e.options.maxNumberOfNipples=1);let r=getComputedStyle(e.options.zone.parentElement);return r&&r.display==="flex"&&(e.parentIsFlex=!0),e.updateBox(),e.prepareNipples(),e.bindings(),e.begin(),e.nipples}_r.prototype=new jd;_r.constructor=_r;_r.id=0;_r.prototype.prepareNipples=function(){var i=this,t=i.nipples;t.on=i.on.bind(i),t.off=i.off.bind(i),t.options=i.options,t.destroy=i.destroy.bind(i),t.ids=i.ids,t.id=i.id,t.processOnMove=i.processOnMove.bind(i),t.processOnEnd=i.processOnEnd.bind(i),t.get=function(e){if(e===void 0)return t[0];for(var r=0,n=t.length;r<n;r+=1)if(t[r].identifier===e)return t[r];return!1}};_r.prototype.bindings=function(){var i=this;i.bindEvt(i.options.zone,"start"),i.options.zone.style.touchAction="none",i.options.zone.style.msTouchAction="none"};_r.prototype.begin=function(){var i=this,t=i.options;if(t.mode==="static"){var e=i.createNipple(t.position,i.manager.getIdentifier());e.add(),i.idles.push(e)}};_r.prototype.createNipple=function(i,t){var e=this,r=e.manager.scroll,n={},o=e.options,a={x:e.parentIsFlex?r.x:r.x+e.box.left,y:e.parentIsFlex?r.y:r.y+e.box.top};if(i.x&&i.y)n={x:i.x-a.x,y:i.y-a.y};else if(i.top||i.right||i.bottom||i.left){var s=document.createElement("DIV");s.style.display="hidden",s.style.top=i.top,s.style.right=i.right,s.style.bottom=i.bottom,s.style.left=i.left,s.style.position="absolute",o.zone.appendChild(s);var l=s.getBoundingClientRect();o.zone.removeChild(s),n=i,i={x:l.left+r.x,y:l.top+r.y}}var c=new wD(e,{color:o.color,size:o.size,threshold:o.threshold,fadeTime:o.fadeTime,dataOnly:o.dataOnly,restJoystick:o.restJoystick,restOpacity:o.restOpacity,mode:o.mode,identifier:t,position:i,zone:o.zone,frontPosition:{x:0,y:0},shape:o.shape});return o.dataOnly||(ev(c.ui.el,n),ev(c.ui.front,c.frontPosition)),e.nipples.push(c),e.trigger("added "+c.identifier+":added",c),e.manager.trigger("added "+c.identifier+":added",c),e.bindNipple(c),c};_r.prototype.updateBox=function(){var i=this;i.box=i.options.zone.getBoundingClientRect()};_r.prototype.bindNipple=function(i){var t=this,e,r=function(n,o){e=n.type+" "+o.id+":"+n.type,t.trigger(e,o)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",r),i.on("dir:up dir:right dir:down dir:left",r),i.on("plain:up plain:right plain:down plain:left",r)};_r.prototype.pressureFn=function(i,t,e){var r=this,n=0;clearInterval(r.pressureIntervals[e]),r.pressureIntervals[e]=setInterval(function(){var o=i.force||i.pressure||i.webkitForce||0;o!==n&&(t.trigger("pressure",o),r.trigger("pressure "+t.identifier+":pressure",o),n=o)}.bind(r),100)};_r.prototype.onstart=function(i){var t=this,e=t.options,r=i;i=$g(i),t.updateBox();var n=function(o){t.actives.length<e.maxNumberOfNipples?t.processOnStart(o):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(a){if(Object.values(r.touches).findIndex(function(l){return l.identifier===a})<0){var s=[i[0]];s.identifier=a,t.processOnEnd(s)}}),t.actives.length<e.maxNumberOfNipples&&t.processOnStart(o))};return Eh(i,n),t.manager.bindDocument(),!1};_r.prototype.processOnStart=function(i){var t=this,e=t.options,r,n=t.manager.getIdentifier(i),o=i.force||i.pressure||i.webkitForce||0,a={x:i.pageX,y:i.pageY},s=t.getOrCreate(n,a);s.identifier!==n&&t.manager.removeIdentifier(s.identifier),s.identifier=n;var l=function(d){d.trigger("start",d),t.trigger("start "+d.id+":start",d),d.show(),o>0&&t.pressureFn(i,d,d.identifier),t.processOnMove(i)};if((r=t.idles.indexOf(s))>=0&&t.idles.splice(r,1),t.actives.push(s),t.ids.push(s.identifier),e.mode!=="semi")l(s);else{var c=Ch(a,s.position);if(c<=e.catchDistance)l(s);else{s.destroy(),t.processOnStart(i);return}}return s};_r.prototype.getOrCreate=function(i,t){var e=this,r=e.options,n;return/(semi|static)/.test(r.mode)?(n=e.idles[0],n?(e.idles.splice(0,1),n):r.mode==="semi"?e.createNipple(t,i):(console.warn("Coudln't find the needed nipple."),!1)):(n=e.createNipple(t,i),n)};_r.prototype.processOnMove=function(i){var t=this,e=t.options,r=t.manager.getIdentifier(i),n=t.nipples.get(r),o=t.manager.scroll;if(!fD(i)){this.processOnEnd(i);return}if(!n){console.error("Found zombie joystick with ID "+r),t.manager.removeIdentifier(r);return}if(e.dynamicPage){var a=n.el.getBoundingClientRect();n.position={x:o.x+a.left,y:o.y+a.top}}n.identifier=r;var s=n.options.size/2,l={x:i.pageX,y:i.pageY};e.lockX&&(l.y=n.position.y),e.lockY&&(l.x=n.position.x);var c=Ch(l,n.position),d=pD(l,n.position),u=Jg(d),p=c/s,h={distance:c,position:l},f,m;if(n.options.shape==="circle"?(f=Math.min(c,s),m=hD(n.position,f,d)):(m=bD(l,n.position,s),f=Ch(m,n.position)),e.follow){if(c>s){let b=l.x-m.x,S=l.y-m.y;n.position.x+=b,n.position.y+=S,n.el.style.top=n.position.y-(t.box.top+o.y)+"px",n.el.style.left=n.position.x-(t.box.left+o.x)+"px",c=Ch(l,n.position)}}else l=m,c=f;var y=l.x-n.position.x,g=l.y-n.position.y;n.frontPosition={x:y,y:g},e.dataOnly||ev(n.ui.front,n.frontPosition);var v={identifier:n.identifier,position:l,force:p,pressure:i.force||i.pressure||i.webkitForce||0,distance:c,angle:{radian:u,degree:d},vector:{x:y/s,y:-g/s},raw:h,instance:n,lockX:e.lockX,lockY:e.lockY};v=n.computeDirection(v),v.angle={radian:Jg(180-d),degree:180-d},n.trigger("move",v),t.trigger("move "+n.id+":move",v)};_r.prototype.processOnEnd=function(i){var t=this,e=t.options,r=t.manager.getIdentifier(i),n=t.nipples.get(r),o=t.manager.removeIdentifier(n.identifier);!n||(e.dataOnly||n.hide(function(){e.mode==="dynamic"&&(n.trigger("removed",n),t.trigger("removed "+n.id+":removed",n),t.manager.trigger("removed "+n.id+":removed",n),n.destroy())}),clearInterval(t.pressureIntervals[n.identifier]),n.resetDirection(),n.trigger("end",n),t.trigger("end "+n.id+":end",n),t.ids.indexOf(n.identifier)>=0&&t.ids.splice(t.ids.indexOf(n.identifier),1),t.actives.indexOf(n)>=0&&t.actives.splice(t.actives.indexOf(n),1),/(semi|static)/.test(e.mode)?t.idles.push(n):t.nipples.indexOf(n)>=0&&t.nipples.splice(t.nipples.indexOf(n),1),t.manager.unbindDocument(),/(semi|static)/.test(e.mode)&&(t.manager.ids[o.id]=o.identifier))};_r.prototype.onDestroyed=function(i,t){var e=this;e.nipples.indexOf(t)>=0&&e.nipples.splice(e.nipples.indexOf(t),1),e.actives.indexOf(t)>=0&&e.actives.splice(e.actives.indexOf(t),1),e.idles.indexOf(t)>=0&&e.idles.splice(e.idles.indexOf(t),1),e.ids.indexOf(t.identifier)>=0&&e.ids.splice(e.ids.indexOf(t.identifier),1),e.manager.removeIdentifier(t.identifier),e.manager.unbindDocument()};_r.prototype.destroy=function(){var i=this;i.unbindEvt(i.options.zone,"start"),i.nipples.forEach(function(e){e.destroy()});for(var t in i.pressureIntervals)Object.prototype.hasOwnProperty.call(i.pressureIntervals,t)&&clearInterval(i.pressureIntervals[t]);i.trigger("destroyed",i.nipples),i.manager.unbindDocument(),i.off(),i.pressureIntervals={},i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.manager=null};var CD=_r;function Gr(i){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=Y1(),t._windowBound=!1,t.config(i),t.prepareCollections();var e=function(){var r;t.collections.forEach(function(n){n.forEach(function(o){r=o.el.getBoundingClientRect(),o.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){mD(e)},t._onScroll=function(){t.scroll=Y1()},t.collections}Gr.prototype=new jd;Gr.constructor=Gr;Gr.prototype.prepareCollections=function(){var i=this;i.collections.create=i.create.bind(i),i.collections.on=i.on.bind(i),i.collections.off=i.off.bind(i),i.collections.destroy=i.destroy.bind(i),i.collections.get=function(t){var e;return i.collections.every(function(r){return e=r.get(t),!e}),e}};Gr.prototype.create=function(i){return this.createCollection(i)};Gr.prototype.bindWindowEvents=function(){var i=this;i._windowBound||typeof window>"u"||(i._windowBound=!0,Gd(window,"resize",i._onResize),Gd(window,"scroll",i._onScroll))};Gr.prototype.unbindWindowEvents=function(){var i=this;!i._windowBound||typeof window>"u"||(i._windowBound=!1,Ud(window,"resize",i._onResize),Ud(window,"scroll",i._onScroll))};Gr.prototype.createCollection=function(i){var t=this,e=new CD(t,i);return t.bindCollection(e),t.collections.push(e),t.bindWindowEvents(),e};Gr.prototype.bindCollection=function(i){var t=this,e,r=function(n,o){e=n.type+" "+o.id+":"+n.type,t.trigger(e,o)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",r),i.on("dir:up dir:right dir:down dir:left",r),i.on("plain:up plain:right plain:down plain:left",r)};Gr.prototype.bindDocument=function(){var i=this;i.binded||(i.bindEvt(document,"move").bindEvt(document,"end"),i.binded=!0)};Gr.prototype.unbindDocument=function(i){var t=this;(!Object.keys(t.ids).length||i===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};Gr.prototype.getIdentifier=function(i){var t;return i?(t=i.identifier===void 0?i.pointerId:i.identifier,t===void 0&&(t=this.latest||0)):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]};Gr.prototype.removeIdentifier=function(i){var t={};for(var e in this.ids)if(this.ids[e]===i){t.id=e,t.identifier=this.ids[e],delete this.ids[e];break}return t};Gr.prototype.onmove=function(i){var t=this;return t.onAny("move",i),!1};Gr.prototype.onend=function(i){var t=this;return t.onAny("end",i),!1};Gr.prototype.oncancel=function(i){var t=this;return t.onAny("end",i),!1};Gr.prototype.onAny=function(i,t){var e=this,r,n="processOn"+i.charAt(0).toUpperCase()+i.slice(1);t=$g(t);var o=function(s,l,c){c.ids.indexOf(l)>=0&&(c[n](s),s._found_=!0)},a=function(s){r=e.getIdentifier(s),Eh(e.collections,o.bind(null,s,r)),s._found_||e.removeIdentifier(r)};return Eh(t,a),!1};Gr.prototype.destroy=function(){var i=this;i.unbindDocument(!0),i.unbindWindowEvents(),i.ids={},i.index=0,i.collections.forEach(function(t){t.destroy()}),i.collections=[],i.off()};Gr.prototype.onDestroyed=function(i,t){var e=this;if(e.collections.indexOf(t)<0)return!1;e.collections.splice(e.collections.indexOf(t),1),e.collections.length===0&&e.unbindWindowEvents()};var ED=Gr;var Hd=null;function TD(){return Hd||(Hd=new ED),Hd}var GU={create:function(i){return TD().create(i)},destroy:function(){Hd&&(Hd.destroy(),Hd=null)},get factory(){return TD()}},PD=GU;var ne=require("three");var xt=require("three");var pn=require("three");var iv=new pn.Vector3,Yi=new pn.Camera,K1=class extends pn.LineSegments{constructor(e){let r=new pn.BufferGeometry,n=new pn.LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),o=[],a=[],s={},l=new pn.Color(15711266),c=new pn.Color(15711266),d=new pn.Color(2857471);u("n1","n2",l),u("n2","n4",l),u("n4","n3",l),u("n3","n1",l),u("f1","f2",l),u("f2","f4",l),u("f4","f3",l),u("f3","f1",l),u("n1","f1",l),u("n2","f2",l),u("n3","f3",l),u("n4","f4",l),u("p","n1",c),u("p","n2",c),u("p","n3",c),u("p","n4",c),u("u1","u2",d),u("u2","u3",d),u("u3","u1",d);function u(h,f,m){p(h,m),p(f,m)}function p(h,f){o.push(0,0,0),a.push(f.r,f.g,f.b),s[h]===void 0&&(s[h]=[]),s[h].push(o.length/3-1)}r.setAttribute("position",new pn.Float32BufferAttribute(o,3)),r.setAttribute("color",new pn.Float32BufferAttribute(a,3));super(r,n);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let e=this.geometry,r=this.pointMap,n=!0;Yi.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let o=1,a=1,s=n?.8:1e-4;wo("n1",r,e,Yi,-o,-a,s),wo("n2",r,e,Yi,o,-a,s),wo("n3",r,e,Yi,-o,a,s),wo("n4",r,e,Yi,o,a,s);let l=s;wo("f1",r,e,Yi,-o,-a,l),wo("f2",r,e,Yi,o,-a,l),wo("f3",r,e,Yi,-o,a,l),wo("f4",r,e,Yi,o,a,l);let c=l,d=.5;wo("u1",r,e,Yi,o*.7*d,a*1.1,c),wo("u2",r,e,Yi,-o*.7*d,a*1.1,c),wo("u3",r,e,Yi,0,a*(1.1+.9*d),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function wo(i,t,e,r,n,o,a){iv.set(n,o,a).unproject(r);let s=t[i];if(s!==void 0){let l=e.getAttribute("position");for(let c=0,d=s.length;c<d;c++)l.setXYZ(s[c],iv.x,iv.y,iv.z)}}var ov=class extends Qo(K1){constructor(e){super(e);this.object=e;this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,r){Zo(this.object,this.geometry,e,r,!0)}};var av=790;function MD(i){return 1-Math.pow(1-i,3)}var Wd=new xt.Vector3,Q1=new xt.Vector3,Z1=new xt.Quaternion,J1=new xt.Vector3,Mh=new xt.Vector3,$1=new xt.Vector3,aa=class extends Wi(xt.Camera,ov){constructor(e="",r={...Al.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=uo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.wasMovedByUser=!1;this.wasMovedBySwitchCameraAction=!1;this._createdAt=typeof performance<"u"?performance.now():0;this._tickProjectionTransition=()=>{let e=this._projectionTransition;if(e===void 0)return;if(this.disposed){this._endProjectionTransition();return}e.raf=requestAnimationFrame(this._tickProjectionTransition);let r=aa.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),r?.()};this.super_Entity(e,r),this.previousProjectionMatrix=new xt.Matrix4,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let n=this.width,o=this.height;this.orthoCamera=new xt.OrthographicCamera(n*-.5,n*.5,o*.5,o*-.5,-5e4,1e4),this.perspCamera=new xt.PerspectiveCamera(45,n/o,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(e){let r=aa.projectionTransitionsEnabled;aa.projectionTransitionsEnabled=!1;try{return e()}finally{aa.projectionTransitionsEnabled=r}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,r,n){typeof e=="number"&&(e=new xt.Vector3(e,r,n)),super.lookAt(e),this.getWorldPosition(Wd),this.targetOffset=Wd.distanceTo(e)}getTarget(e=new xt.Vector3){return this.getWorldDirection(Q1),this.getWorldPosition(Wd),Q1.multiplyScalar(this.targetOffset),e.copy(Wd).add(Q1),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Wd),Wd.distanceTo(e)}updateUp(){this.getWorldQuaternion(Z1),J1.set(0,0,1).applyQuaternion(Z1),Mh.copy(xt.Object3D.DEFAULT_UP),this.isUpVectorFlipped&&Mh.negate(),Mh.applyQuaternion(Z1),$1.copy(xt.Object3D.DEFAULT_UP).projectOnPlane(J1),this.angleOffsetFromUp=$1.angleTo(Mh),this.angleOffsetFromUp*=$1.cross(Mh).dot(J1)>=0?1:-1}updateTransformState(e,r){let n=super.updateTransformState(e,r);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),n}getViewFrontToObject(e){let r=e.getWorldPosition(new xt.Vector3),o=e.getWorldDirection(new xt.Vector3).multiplyScalar(this.targetOffset);return{position:r.clone().add(o),target:r}}getViewToTarget(e){let n=this.getWorldDirection(new xt.Vector3).multiplyScalar(this.targetOffset);return{position:e.clone().sub(n),target:e}}getViewToObject(e){let r=new xt.Vector3;return e.getWorldPosition(r),this.getViewToTarget(r)}setViewplaneSize(e,r,n=!1){if(this.aspect=e/r,n){let o=e>r?this.aspect:1,a=e>r?1:this.aspect;this.left=-av*.5*o,this.right=av*.5*o,this.top=av*.5*(1/a),this.bottom=-av*.5*(1/a)}else this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let e=this._projectionTransition;if(e===void 0)return 1;let r=(performance.now()-e.start)/e.duration;return r>=1?1:r<=0?0:MD(r)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return aa.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=aa.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let r=this._projectionTransition;r===void 0&&(r={from:new xt.Matrix4,blend:new xt.Matrix4,blendInverse:new xt.Matrix4,start:0,duration:aa.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=r),r.from.copy(this.projectionMatrix),r.start=performance.now(),r.duration=aa.projectionTransitionDuration,r.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(r.requestRender=e),r.raf!==0&&cancelAnimationFrame(r.raf),r.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let r=(performance.now()-e.start)/e.duration;if(r>=1){this._endProjectionTransition();return}let n=MD(r),o=e.from.elements,a=this._activeSubCamera.projectionMatrix.elements,s=e.blend.elements,l=e.referenceDepth,c=Math.max(1e-6,o[15]-o[11]*l),d=Math.max(1e-6,a[15]-a[11]*l),u=n*c/(n*c+(1-n)*d);for(let p=0;p<16;p++)s[p]=o[p]+(a[p]-o[p])*u;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let r=this._activeSubCamera;this.projectionMatrix=r.projectionMatrix,this.projectionMatrixInverse=r.projectionMatrixInverse}_syncProjectionTransition(e){let r=e._projectionTransition;if(r===void 0){this._projectionTransition!==void 0&&this._endProjectionTransition();return}let n=this._projectionTransition;n===void 0?(n={from:new xt.Matrix4,blend:new xt.Matrix4,blendInverse:new xt.Matrix4,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=n):n.raf!==0&&(cancelAnimationFrame(n.raf),n.raf=0),n.requestRender=void 0,n.from.copy(r.from),n.start=r.start,n.duration=r.duration,n.referenceDepth=r.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,n,o,a,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,n,o,a,s):this.orthoCamera.setViewOffset(e,r,n,o,a,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=uo.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Gp(r,e)}updateCameraSubtype(e,r){let n=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";r.zoom!==void 0&&this.setZoom(n,r.zoom),r.near!==void 0&&this.setNear(n,r.near),r.fov!==void 0&&n==="PerspectiveCamera"&&(this.fov=r.fov)}updateState(e,r){this.updateCameraState(e,r)}updateCameraState(e,r){this.updateState_Entity(e,r),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(r?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(n=>typeof n=="number"?n:0)),e.targetOffset!==void 0&&(this.targetOffset=uo.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,r,n){super.updateByPatchedOp(e,r,n),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},St=aa;St.projectionTransitionsEnabled=!1,St.projectionTransitionDuration=350,St.projectionTransitionMinAgeMs=1e3;var Yd=require("three");function jU(i,t){try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(i),r=n=>Number(e.find(o=>o.type===n)?.value);return new Date(r("year"),r("month")-1,r("day"),r("hour"),r("minute"),r("second"),i.getMilliseconds())}catch{return new Date(NaN)}}function Yr(i,t){return t.color(i)}function eA(i=new Date,t){let e=t.format,r=i.getSeconds(),n=i;t&&t.timeZone!==null&&(n=jU(new Date,t.timeZone));let o=n.getHours(),a=n.getMinutes(),s;t.format12h24h==="12ampm"&&(s=o>=12?"PM":"AM");let l=o;t.format12h24h!=="24"&&(l=o%12,l===0&&(l=12));let c,d;switch(e){case"HH:mm:ss":c=[l,a,r];break;case"HH:mm":c=[l,a];break;case"HH":c=[l],s=void 0;break;case"mm":c=[a],s=void 0;break;case"ss":c=[r],s=void 0;break;case"year":d=n.getFullYear();break;case"month":d=n.getMonth()+1;break;case"dayOfYear":d=Math.floor((n.getTime()-new Date(n.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":d=n.getDate();break;case"secondOfDay":d=o*60*60+a*60+r;break;default:console.error("Unknown time format",e),d=0;break}return c!==void 0?{textValue:c,suffix:s}:d}var Oh=require("three");var OD=require("three");var qd=class extends Qo(OD.DirectionalLightHelper){constructor(e,r=15,n=10066329){super(e,r,n);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,r){Zo(this.object,qd.geometryHelper,e,r)}};var DD=require("three");var HU=new WeakSet;function ID(i){HU.delete(i)}var sv;(t=>{function i(e){return Ne.is(e)&&e instanceof DD.Light}t.is=i})(sv||(sv={}));var Xd=(i,t)=>class extends Wi(i,t){updateState_Light(r,n){if(this.updateState_Entity(r,n),r.color!==void 0&&(this.color=n.shared.color(r.color)),r.intensity!==void 0&&(this.intensity=r.intensity*Math.PI),r.depth!==void 0){let o=this.shadow;o.camera.far=r.depth,o.needsUpdate=!0}r.shadows!==void 0&&(ID(this),this.castShadow=r.shadows)}};function WU(i,t){i.shadow.camera.right=t/2,i.shadow.camera.left=-t/2,i.shadow.camera.top=t/2,i.shadow.camera.bottom=-t/2,i.shadow.needsUpdate=!0}var Ha=class extends Xd(Oh.DirectionalLight,qd){constructor(t,e,r){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.top=1250,o.bottom=-1250,o.right=1250,o.left=-1250,o.near=-1e4,o.far=2500;let a=new Oh.CameraHelper(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Oh.CameraHelper&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let r=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&WU(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),r&&this.update()}};yt();var XD=require("three");var YU=require("three");var Ki=require("three");var Ls=new Ki.Matrix4,qU=new Ki.Matrix4,RD=new Ki.Matrix4,BD=new Ki.Matrix4,tA=new Ki.Matrix4;function XU(i,t){let e=i.cloner;return e!==void 0&&e.parent===t?e:void 0}var lv=new Float32Array(0);function ND(i,t,e,r){let n=(t.children.length+1)*16;lv.length<n&&(lv=new Float32Array(n));let o=0,a=l=>{l.toArray(lv,o*16),o++},s=t.parameters.hideBase!==!0;s&&a(r),RD.copy(i.matrix);for(let l of t.children)!td(l)||l.playModeVisible===!1||(BD.copy(l.matrix).multiply(l.pivotMatrix),tA.multiplyMatrices(RD,BD),!(s&&tA.equals(r))&&a(tA));try{return o===0?0:eM(e,lv.subarray(0,o*16))}finally{Ty(e)}}var ni=class extends Ar{constructor(e,r,n){super(e,r);this.data=r;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new Ki.BufferGeometry;this.onAfterRender=(e,r,n,o,a,s)=>{super.onAfterRender(e,r,n,o,a,s),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,r,n){super.updateByPatchedOp(e,r,n),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,r=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let o=0;o<this.children.length;o++){let a=this.children[o];a instanceof ni&&a.dataPatched.visible===!0&&a.recomputeBoolean(e===!0,r)}this.meshSetAddresses=[];for(let o=0;o<this.children.length;o++){let a=this.children[o];if(a instanceof it&&a.dataPatched.visible===!0&&a.geometry.attributes.position?.count>0&&a.geometry.drawRange.count>0&&a.booleanMeshSetAddress!==0){Ls.copy(a.matrix).multiply(a.pivotMatrix);try{let s=XU(a,this);if(a.booleanMeshSetAddress===-1){if((a.geometry.index??a.geometry.getAttribute("position")).count/3<15e5){let l=QP(a.geometry,e===!0,r);a.booleanMeshSetAddress=s===void 0||l===-1?l:ND(a,s,l,Ls)}if(a.booleanMeshSetAddress===-1)return;s===void 0&&Ey(a.booleanMeshSetAddress,Ls),a.booleanMatrixInvOld.copy(Ls).invert(),a.booleanWasTransformed=!1}else a instanceof ni&&a.needsTransformForDownstream===!0?(s===void 0?Ey(a.booleanMeshSetAddress,Ls):a.booleanMeshSetAddress=ND(a,s,a.booleanMeshSetAddress,Ls),a.needsTransformForDownstream=!1):a.booleanWasTransformed===!0&&(Ey(a.booleanMeshSetAddress,qU.multiplyMatrices(Ls,a.booleanMatrixInvOld)),a.booleanMatrixInvOld.copy(Ls).invert(),a.booleanWasTransformed=!1)}catch(s){console.error(s),a.booleanMeshSetAddress=0,a.geometry.userData.booleanOperationDidFail=!0;continue}if(a.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(a.booleanMeshSetAddress),a.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let o=this.geometry;o.dispose(),this.geometry=new Ki.BufferGeometry,this.geometry.userData=o.userData,this.geometry.boundingSphere=o.boundingSphere,this.geometry.setAttribute("position",new Ki.Float32BufferAttribute([],3))}this.geometry.setDrawRange(0,0);return}if(e===!0)return $P(this.meshSetAddresses,this.booleanOp);let n=this.geometry;n.dispose(),this.geometry=new Ki.BufferGeometry,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere;try{this.booleanMeshSetAddress=JP(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(o){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(o)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,ea(this),ta(this)}dispose(){super.dispose(),this.geometry.dispose()}};var ii=i=>i instanceof it,Si=i=>i!==null&&i instanceof ni;var Ih=i=>xg.is(i);var sa=require("three");var rA=1<<9;function nA(i){return i instanceof Ar&&i.needsAO&&!fi(i)&&i.isDecalObject!==!0}function iA(i){let t=i.cloner;if(!(!t||!Array.isArray(t.children)))for(let e of t.children)e?.layers&&(e.layers.mask=i.layers.mask)}function oA(i){return i.getLayersOfType("reflection").filter(t=>t.data.visible).length}function LD(i,t){let e={outline:!1,cavity:!1},r=i.layers.mask&rA,n=t.getLayersOfType("transmission"),o=t.getLayersOfType("outline"),a=oA(t),s=t.getLayersOfType("cavity");return(o.length>0||s.length>0)&&(i.layers.set(8),n.length>0&&i.layers.enable(3),a>0&&i.layers.enable(4),e.outline=o.length>0,e.cavity=s.length>0,ta(i),ea(i)),n.length===0&&o.length===0&&s.length===0&&a===0&&i.layers.set(0),r&&i.layers.set(9),!r&&nA(i)&&i.layers.enable(5),iA(i),e}function _D(i,t){if(!t.layers)return!1;let e=i.layers.mask&rA,r=!1,n=t.getLayersOfType("transmission").filter(l=>l.data.visible),o=t.getLayersOfType("outline").filter(l=>l.data.visible),a=oA(t),s=t.getLayersOfType("cavity").filter(l=>l.data.visible);return n.length>0&&(i.layers.set(3),(o.length>0||s.length>0)&&i.layers.enable(8),a>0&&i.layers.enable(4),r=!0),n.length===0&&o.length===0&&s.length===0&&a===0&&i.layers.set(0),e&&i.layers.set(9),!e&&nA(i)&&i.layers.enable(5),iA(i),r}function kD(i,t){var l;if(!t.layers)return!1;let e=i.layers.mask&rA,r=!1,n=oA(t),o=t.getLayersOfType("transmission").filter(c=>c.data.visible),a=t.getLayersOfType("outline").filter(c=>c.data.visible),s=t.getLayersOfType("cavity").filter(c=>c.data.visible);return n>0&&((l=i.userData).__splinePlanarMirror??(l.__splinePlanarMirror=0),i.layers.set(4),o.length>0&&i.layers.enable(3),(a.length>0||s.length>0)&&i.layers.enable(8),r=!0),n===0&&o.length===0&&a.length===0&&s.length===0&&i.layers.set(0),e&&i.layers.set(9),!e&&nA(i)&&i.layers.enable(5),iA(i),r}function UD(i){let t={outline:!1,cavity:!1},e=r=>{t.outline=t.outline||r.outline,t.cavity=t.cavity||r.cavity};return i.traverseEntity(r=>{if(r instanceof Ar)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)e(LD(r,r.material[n]));else e(LD(r,r.material))}),t}function zD(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Ar)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)_D(e,e.material[r])&&(t=!0);else _D(e,e.material)&&(t=!0)}),t}function jD(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Ar)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)kD(e,e.material[r])&&(t=!0);else kD(e,e.material)&&(t=!0)}),t}var KU=new sa.Raycaster,QU=new sa.Matrix4,ZU=new sa.Ray,FD=new sa.Sphere;function Dh(i,t,e,r=!1){let n=i.cloner;if(n){let o=null;if((i.raycast===sa.Mesh.prototype.raycast||i.raycast===it.prototype.raycast)&&i.isSkinnedMesh!==!0){let a=i.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),o=a.boundingSphere)}for(let a of n.children){if(o!==null&&(FD.copy(o).applyMatrix4(a.matrixWorld),!t.ray.intersectsSphere(FD)))continue;let s=QU.copy(a.matrixWorld).invert(),l=ZU.copy(t.ray).applyMatrix4(s),c=i.matrixWorld;l.applyMatrix4(c);let d=KU;d.set(l.origin,l.direction),d.near=t.near,d.far=t.far,d.layers.mask=t.layers.mask;let u=d.intersectObject(i,!1);u.length>0&&e.push({...u[0],object:r?a:i})}}}var Qi=require("three");var dv=require("three");var cv=class extends Qo(dv.SpotLightHelper){constructor(e,r=6710886){super(e,r);this.object=e;this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,r){Zo(this.object,cv.geometryHelper,e,r)}update(){if(this.object!==void 0){let e=cv._vector,r=this.object.distance?this.object.distance:1e3,n=r*Math.tan(this.object.angle);this.cone.scale.set(n,n,r),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let o=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let a=0,s=this.cone.material.length;a<s;a++)this.cone.material[a].color.set(o);else this.cone.material.color.set(o)}}},Rh=cv;Rh._vector=new dv.Vector3;var HD=new Qi.Vector3,WD=new Qi.Vector3,qD=new Qi.Quaternion,Wa=class extends Xd(Qi.SpotLight,Rh){constructor(t,e,r){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=Qi.MathUtils.RAD2DEG*2*this.angle,o.aspect=1,o.near=100,o.far=2500;let a=new Qi.CameraHelper(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Qi.CameraHelper&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),WD.setFromMatrixPosition(this.matrixWorld),qD.setFromRotationMatrix(this.matrixWorld),HD.copy(this.up).applyQuaternion(qD).negate().multiplyScalar(this.distance),this.target.position.copy(WD).add(HD),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}};var Gt=class extends ad(XD.Scene){constructor(e,r,n){super();this.data=r;this.bgColor=new Vt(1,1,1,1);this.fog=null;this.backupFog=new Yd.Fog(16777215,.1,2e3);this.fogUseBGColor=!1;this.fogMode="linear";this.fogDensity=Ii.getDensity({});this.fogHeightFalloff=Ii.getHeightFalloff({});this.fogHeightBase=Ii.getHeightBase({});this.isActive=!1;this.skyState=null;this.skyStateVersion=0;this.gradingState=null;this.skyHdriHolder=null;this.aoColor=new Yd.Color;this.penumbraSizeArrayCache=null;if(this.super_Entity(e,r),this.personalCamera=new St(ko,{...Al.defaultData,...r.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new Yd.HemisphereLight(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),r.uiScene){let o=pS();o===null?xr("ui-2d","a page's 2D scene"):this.uiScene=new o.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",r.uiScene,{dpr:window.devicePixelRatio,shared:n.shared})}else r.uiFrame&&this.createUICanvas(r.uiFrame,n)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,r){let n=pS();if(n===null){xr("ui-2d","a page's UI canvas");return}this.uiCanvas=new n.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,r),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,r){e.color!==void 0&&(this.ambientLight.color=Yr(e.color,r)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(r=>{r instanceof ni&&r.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Ar)if(Array.isArray(e.material))for(let r of e.material)r.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let r=this.data.shadow,n=Pp.isSoft(r);dO(n,r?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,r){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let n=this.scene;n.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Yr(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Ii.getMode(e),this.fogDensity=Ii.getDensity(e),this.fogHeightFalloff=Ii.getHeightFalloff(e),this.fogHeightBase=Ii.getHeightBase(e)}updateSky(e,r){this.skyState=e??null,this.skyStateVersion++;let n=e?.hdri?.image;this.skyHdriHolder=n!=null?r.image(n):null}updateAo(e,r){e.aoColor!==void 0&&(this.aoColor=Yr(e.aoColor,r))}updateByOp(e,r,n,o){let a=this.data.uiFrame;super.updateByOp(e,r,n,o);let s=r;Ye(e.path,["fog"])?this.updateFog(s.fog,n.shared):Ye(e.path,["sky"])?this.updateSky(s.sky,n.shared):Ye(e.path,["grading"])?this.gradingState=s.grading??null:Ye(e.path,["ao"])?this.updateAo(s.ao,n.shared):Ye(e.path,["ambient"])?this.updateAmbientLight(s.ambient,n.shared):Ye(e.path,["shadow"])?this.updateShadow(s.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||a!==s.uiFrame)&&this.updateUIFrame(e.props.uiFrame,n)}updateUIFrame(e,r){e?(this.uiCanvas||this.createUICanvas(e,r),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,r){this.updateState_Entity(e,r),e.backgroundColor!==void 0&&this.setBackgroundColor(Yr(e.backgroundColor,r.shared)),e.fog!==void 0&&this.updateFog(e.fog,r.shared),e.sky!==void 0&&this.updateSky(e.sky,r.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,r.shared),e.ao!==void 0&&this.updateAo(e.ao,r.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,r){}raycast(e,r){super.raycast(e,r)}switchActiveCamera(e){e instanceof St&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){let e=this.scene?.find(this.data.publish.playCamera);return e instanceof St?e:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(Gn).fill(.5);let e=0,r=0;this.traverseEntity(n=>{if(!n.visible)return!0;n instanceof Ha&&n.visible&&e<Md&&(this.penumbraSizeArrayCache[e]=n.data.penumbraSize??.5,e+=1),n instanceof Wa&&n.visible&&e<Gn-Md&&(this.penumbraSizeArrayCache[Md+r]=n.data.penumbraSize??.5,r+=1)})}raycastWithClones(e){let r=[],n=o=>{for(let a of o.children){let s=a.cloner;Ne.is(a)&&(a.visible||s?.object.data.visible)&&((ii(a)||Ih(a)&&this.scene.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,r),Dh(a,e,r,!0)),n(a))}};return n(this),r}updateEntity2DByOp(e,r,n,o){this.uiCanvas?.updateEntity2DByOp(e,r,n,o)}};var JU=null;function YD(i){JU=i}var $U,KD=new Promise(i=>{$U=i});var Kr=require("three");var Kd=require("three");function ez(i){let t=i.elements,e=t[0]**2+t[1]**2+t[2]**2,r=t[4]**2+t[5]**2+t[6]**2,n=t[8]**2+t[9]**2+t[10]**2,o=t[0]**2+t[4]**2+t[8]**2,a=t[1]**2+t[5]**2+t[9]**2,s=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return e<l||r<l||n<l||o<l||a<l||s<l}function uv(i,t){let e=new Kd.BufferGeometry;if(t&&ez(t))return e.setAttribute("position",new Kd.Float32BufferAttribute([],3)),e.setIndex([]),e;if(!i.getAttribute("position"))return e.setAttribute("position",new Kd.Float32BufferAttribute([],3)),e.setIndex([]),e;let{positions:r,triIndices:n}=sh(i.getAttribute("position"),i.getIndex());return e.setAttribute("position",new Kd.Float32BufferAttribute(r,3)),e.setIndex(n),t&&e.applyMatrix4(t),e}var tz=require("three/examples/jsm/utils/BufferGeometryUtils.js");var rz;KD.then(i=>rz=i);var Eue=new Kr.Vector3,Tue=new Kr.Quaternion,Pue=new Kr.Vector3,Mue=new Kr.Vector3(1,1,1),Oue=new Kr.Euler(0,0,0,"YXZ"),Iue=new Kr.Euler(0,0,0,"XYZ"),Due=new Kr.Vector3,Rue=new Kr.Vector3,Bue=new Kr.Quaternion,Nue=new Kr.Matrix4,Lue=new Kr.Matrix4;var _ue=new Kr.Quaternion,kue=new Kr.Sphere;var aA={type:"beginEvent",eventName:"Collision"};var sA=i=>i.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.shear!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);var oR=require("three");yt();Np();var QD=4,lA=8;var cA=.02,dA=.3,nz=65,ZD=new ne.Vector3,JD=new ne.Vector3,iz=new ne.Vector3,Pn=new ne.Vector3,qa=new ne.Vector3,Qd=new ne.Vector3,uA=new ne.Matrix4,$D=new ne.Matrix4,oz=new ne.Matrix4,Ai=new ne.Quaternion,Ql=new ne.Quaternion,Zd=new ne.Euler(0,0,0,"YXZ"),az=new ne.Vector3(1,0,0),la=new ne.Vector3(0,1,0),sz=new ne.Vector3(0,0,1),eR=new ne.Vector3(1,1,1),pA=[],tR=i=>pA[i]??(pA[i]=new ne.Vector3),hA=new ne.Vector3,lz=new ne.Vector3,cz=new ne.Vector3,dz=new ne.Vector3,rR=new ne.Quaternion,uz=new ne.Vector3,nR=new ne.Quaternion,pz=1,hz=.025,fz=16e-6,iR=12,mz=20,nn=new ne.Line3,Zi=new ne.Box3,yz={type:"requestRender"},gz={type:"updateMatrix"},pv=class extends ne.EventDispatcher{constructor(e,r,n,o,a,s,l,c,d){super();this.object=e;this.domElement=r;this.data=n;this.gloabalPhysics=o;this.controlsManager=a;this.cameraFollow=s;this.camera=l;this.page=c;this.sharedAssets=d;this.enableDamping=!0;this.target0=new ne.Vector3;this.zoom0=1;this.rotForce=1;this.moveForce=1;this.pixelsPerMeter=dD;this.euler0=new ne.Euler(0,0,0,"YXZ");this.shearMatrix0=new ne.Matrix4;this.cameraShearMatrix0=new ne.Matrix4;this.position0Cam=new ne.Vector3;this.quat0Cam=new ne.Quaternion;this.scale0Cam=new ne.Vector3;this.threshEndTranslate=.01;this.threshEndRotate=1e-8;this.threshEndRotVel=.005;this.collider={type:"capsule",radius:40,segment:new ne.Line3(new ne.Vector3(0,-40,0),new ne.Vector3(0,40,0)),matrix:new ne.Matrix4,position:new ne.Vector3,rotation:new ne.Quaternion};this.euler=new ne.Euler(0,0,0,"YXZ");this.eulerDelta=new ne.Vector3;this.lastPosition=new ne.Vector3;this.lastCameraQuaternion=new ne.Quaternion;this.lastCameraPosition=new ne.Vector3;this.PI_2=Math.PI/2;this.prevMouse=new ne.Vector2;this.velocityTarget=new ne.Vector3;this.velocity=new ne.Vector3;this.directionXZ=new ne.Vector3;this.rotVelocityStick=new ne.Vector3;this.rotVelocityTarget=new ne.Vector3;this.rotVelocity=new ne.Vector3;this.rotDirection=new ne.Vector3;this.nonColliderRotOffset=new ne.Matrix4;this.nonColliderPosOffset=new ne.Matrix4;this.firstPointerId=-1;this.rot=new ne.Vector3;this.path=[];this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0};this.onObject=!1;this.actionState={};this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]];this.collisionEnabled=!0;this.offsetMatrix=new ne.Matrix4;this.objectToTarget=new ne.Vector3;this.objectToTarget0=new ne.Vector3;this.objectToCamXZ=new ne.Vector3;this.objectToCamXZ0=new ne.Vector3;this.targetToCamera=new ne.Vector3;this.targetToCamera0=new ne.Vector3;this.cameraPolarAxis0=new ne.Vector3;this.targetPos=new ne.Vector3;this.targetQuat=new ne.Quaternion;this.lerpFactorPos=new ne.Vector3().setScalar(.3);this.lerpFactorPosStart=.3;this.lerpFactorPosEnd=.3;this.lerpFactorRotStart=.3;this.lerpFactorRotEnd=.3;this.lerpFactorPosCamera=.3;this.lerpFactorRotCamera=.3;this.objXZQuat=new ne.Quaternion;this.objXZQuatInv=new ne.Quaternion;this.objXZRotMat=new ne.Matrix4;this.isFirstPerson=!1;this.didHit=!1;this.groundVelocity=new ne.Vector3;this.pushedVelocity=new ne.Vector3;this.groundYRotation=0;this.objectRealQuat=new ne.Quaternion;this.colliderWorldQuat=new ne.Quaternion;this.groundNormal=new ne.Vector3;this.groundTilt=new ne.Quaternion;this.groundTiltInv=new ne.Quaternion;this.lastHitObj=null;this.isFirstFrame=!0;this.rotationAccumWhenOrientWithCamera=0;this.navMeshPathDest=null;this.position=new ne.Vector3;this.quaternion=new ne.Quaternion;this.scale=new ne.Vector3;this.initialAction=!0;this.onPointerDown=e=>{!(e.target===this.domElement||e.target instanceof HTMLElement&&e.target.tagName==="SPLINE-VIEWER"&&e.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Zn&&!dS&&this.domElement.requestPointerLock(),this.prevMouse.set(e.clientX,e.clientY))};this.onPointerUp=e=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),e.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()};this.onPointerMove=e=>{if(e.pointerId!==this.firstPointerId)return;let r=e.clientX-this.prevMouse.x,n=e.clientY-this.prevMouse.y;this.prevMouse.set(e.clientX,e.clientY),e.pointerType==="mouse"&&this.rotBy!=="keys"&&(dS&&TP<15.5&&!Zn?(this.eulerDelta.y=-r*this.mouseOrbitSensitivity,this.eulerDelta.x=-n*this.mouseOrbitSensitivity):(this.eulerDelta.y=-e.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-e.movementY*this.mouseOrbitSensitivity)),e.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-r*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-n*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()};this.onPointerlockChange=e=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?pv.isLocked=!0:pv.isLocked=!1};this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")};this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0};this.onKeyDown=e=>{!(e.target instanceof HTMLInputElement)&&(e.code==="ArrowLeft"||e.code==="ArrowUp"||e.code==="ArrowRight"||e.code==="ArrowDown"||e.code==="Space")&&e.preventDefault();for(let r of this.keyAssignments)if(e.key.toUpperCase()===r[1]||e.key===r[1]){this.movementState[r[0]]=1;break}this.controlsManager.requestRender()};this.onKeyUp=e=>{for(let r of this.keyAssignments)if(e.key.toUpperCase()===r[1]||e.key===r[1]||e.code.slice(3,e.code.length).toUpperCase()===r[1]){this.movementState[r[0]]=0;break}};this.copyVRGamePadValues=(e,r)=>{for(let n=2;n<4;n++){let o=e.axes[n];r===0?n===2?this.movementState.movePosX=o:this.movementState.movePosZ=o:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,n===2?this.movementState.rotPosY=o:this.moveMode==="fly"&&(this.movementState.moveNegY=o))}};this.sharedGameControlGlobals=a.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.object.parent instanceof Gt||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),this.shearMatrix0.copy(this.object.shearMatrix),Ia(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix}),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let u=this.euler0.clone(),p=u.y;if(this.objectRealQuat.copy(this.quaternion),u.y=0,this.quaternion.setFromEuler(u),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),u.set(0,p,0),this.quaternion.setFromEuler(u),this.rot.setFromEuler(u),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.camera.parent instanceof Gt||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),this.cameraShearMatrix0.copy(this.camera.shearMatrix),Ia(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix})),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let y=new ne.Vector3(0,0,-1).applyQuaternion(this.camera.quaternion),g=new ne.Vector3().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(g),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let v;Math.abs(y.y)<1e-6?(g.y=0,y.y=0,v=g.projectOnVector(y)):g.y/y.y>0?v=y.multiplyScalar(g.y/y.y):v=y.multiplyScalar(g.length()),this.targetToCamera0.copy(v).negate();let b=this.camera.position.clone().add(v);this.objectToTarget0.subVectors(b,this.position);let S=new ne.Euler().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-S.x,S.x=0,S.z=0,S.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(S)}if(this.object instanceof St&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=n.rotByTouch??"joystick",this.rotBy=n.rotBy??"keys",this.rotationMode=n.rotationMode??"normal",this.moveMode=n.moveMode??"walk",this.collisionEnabled=n.collisionEnabled,this.speedTranslate=(n.speedTranslate??250)*pz,this.speedOrbit=(n.speedRotate??100)*hz,this.mouseOrbitSensitivity=(n.speedRotate??100)*fz,this.keyAssignments=n.keyAssignments.map(y=>{let g=[y[0],y[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),n.rotBy==="mouse"){let y;y=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),y!==-1&&(this.keyAssignments[y][1]=""),y=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),y!==-1&&(this.keyAssignments[y][1]=""),y=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),y!==-1&&(this.keyAssignments[y][1]=""),y=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),y!==-1&&(this.keyAssignments[y][1]="")}this.lerpFactorPosStart=1-.02**(1/((n.delayPos[0]??.3)*60)),this.lerpFactorPosEnd=1-.02**(1/((n.delayPos[1]??.3)*60)),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/((n.delayRot[0]??.3)*60)),this.lerpFactorRotEnd=1-.02**(1/((n.delayRot[1]??.3)*60)),this.lerpFactorPosCamera=1-.02**(1/((n.delayPosCamera??.3)*60)),this.lerpFactorRotCamera=1-.02**(1/((n.delayRotCamera??.3)*60)),this.gravity=(this.gloabalPhysics.gravity??vs.defaultData.gravity)*iR,this.usePhysics=this.gloabalPhysics.usePhysics??vs.defaultData.usePhysics,this.jumpPower=n.jumpPower*mz,this.resetYPosition=this.position.y+Math.abs(n.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=n.alignToGround??!1,this.orientMode=n.autoOrientMove?n.orientMode:"none",this.orientWith=n.orientWith??Wc.defaultDataThirdPerson.orientWith,this.slopeThresh=nz*Math.PI/180,n.collider.type==="capsule"?(this.collider.radius=n.collider.radius,this.collider.segment.start.y=n.collider.height/2-n.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=n.collider.height*cA/this.pixelsPerMeter,this.stepThresh=n.collider.height*dA/this.pixelsPerMeter,this.colliderHeight=n.collider.height):n.collider.type==="sphere"?(this.collider.radius=n.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*n.collider.radius*cA/this.pixelsPerMeter,this.stepThresh=2*n.collider.radius*dA/this.pixelsPerMeter,this.colliderHeight=n.collider.radius*2):(this.offset=n.collider.height*cA/this.pixelsPerMeter,this.stepThresh=n.collider.height*dA/this.pixelsPerMeter,this.colliderHeight=n.collider.height),this.collider.type=n.collider.type;let h=new ne.Vector3().fromArray(n.collider.position.map(y=>typeof y=="number"?y:0)),f=new ne.Quaternion().setFromEuler(new ne.Euler().fromArray([...n.collider.rotation.map(y=>typeof y=="number"?y:0),"XYZ"]));this.collider.position.copy(h).multiply(this.scale),this.collider.rotation.copy(f),this.collider.matrix.compose(h,f,eR),n.cameraXAxis!==void 0&&(this.cameraXAxis=n.cameraXAxis,this.cameraYAxis=n.cameraYAxis,this.minPolarAngle=n.cameraRotXLimits[0],this.maxPolarAngle=n.cameraRotXLimits[1],this.minAzimuthAngleRel=n.cameraRotYLimits[0],this.maxAzimuthAngleRel=n.cameraRotYLimits[1]),this.forwardDir=n.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=n.runMultiplier??2;let m=n.navmesh.destinationHelperRadius*2;if(m>0){let y=new oe;y.push({fi:0,data:{...qt.defaultData("light","phong"),alpha:0},id:"layer1"}),y.push({fi:0,data:{...qt.defaultData("color"),color:n.navmesh.destinationHelperColor,alpha:n.navmesh.destinationHelperColor.a},id:"layer2"});let g=fg({layers:y},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new oR.Mesh(Hy.create({parameters:{width:m,height:m/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=n.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.matrixWorldAutoUpdate=!0,this.camera.matrixWorldAutoUpdate=!0,this.object.shearMatrix.copy(this.shearMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.parent instanceof Gt||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),Ia(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix});let r=new ne.Euler().setFromQuaternion(this.quaternion,"YXZ"),n=r.y;this.objectRealQuat.copy(this.quaternion),r.y=0,this.quaternion.setFromEuler(r),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),r.set(0,n,0),this.quaternion.setFromEuler(r),this.rot.setFromEuler(r),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof St?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.shearMatrix.copy(this.cameraShearMatrix0),e?(this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.parent instanceof Gt||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),Ia(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix}))):this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,r=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},Hc.list.forEach(n=>{this.actions[n]=Ft({...e,disabled:!1,type:"GameControl"},e.gameActions[n],this.page,r,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),Sr(this.actions.idle),Sr(this.actions.move),Sr(this.actions.run),Sr(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(r=>{r.play()}),this.actions[e].Animation.forEach(r=>{r.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(r=>{r.play()}),this.actions[e].Create.forEach(r=>{r.dispatchStart()}),this.actions[e].Audio.forEach(r=>{r.dispatchGameControl("start")}),this.actions[e].Particles.forEach(r=>{r.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(r=>{r.stop(),r.object.currentState!==null&&r.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(r=>{r.stop()}),this.actions[e].Create.forEach(r=>{r.dispatchStop()}),this.actions[e].Audio.forEach(r=>{r.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(r=>{r.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Pn.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let r=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let n=r*60,o=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=qa.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*iR),1)*(this.gravity>0?1:-1):this.velocity.y)*r,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,lA,void 0,void 0,this.object.rigidBody);if(l){this.onObject=!0,this.groundNormal.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(o=!0),l.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let c=l.collider.parent(),d=c!==null&&c.isKinematic()?c:null,u=d===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(d.handle);if(d!==null&&u?.userData.isFollowingObj!==this.object.uuid){let p=this.object.getWorldPosition(Pn).add(this.collider.position).divideScalar(this.pixelsPerMeter),h=d.velocityAtPoint(p);this.groundVelocity.set(h.x,h.y,h.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=d.angvel().y*r}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*n),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=Pn.subVectors(this.path[1],this.position),c=qa.subVectors(this.path[1],this.path[0]);l.dot(c)<0?this.path.shift():(this.directionXZ.x=c.x,this.directionXZ.z=c.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**n),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**n),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**n)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let a=iz.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=qa.copy(a);s.y=0,a.set(0,a.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=Pn;this.camera.getWorldDirection(s);let l=Qd.copy(la).multiplyScalar(s.dot(la));s.sub(l);let c=qa.copy(this.directionXZ);c.x*=-1,this.rot.y=s.angleTo(c)*(s.cross(c).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(Zd.setFromVector3(this.rot),this.moveMode==="walk"&&(Zd.x=0),a.applyEuler(Zd),o&&(Ql.setFromUnitVectors(la,this.groundNormal),a.applyQuaternion(Ql)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(l.rigidBody===void 0||l.prevQ===void 0)continue;(l.hasNonUniformScale?l.matrixWorldRigid:l.matrixWorld).decompose(hA,rR,lz);let c=this.object.getWorldPosition(cz).add(this.collider.position).sub(hA);nR.copy(l.prevQ).invert().premultiply(rR);let d=Qd.subVectors(hA,l.prevT).add(dz.copy(c).applyQuaternion(nR).sub(c)).divideScalar(r).divideScalar(this.pixelsPerMeter),u=l.rigidBody.collider(0).castCollider(d,this.object.rigidBody.collider(0),Pn.copy(a).divideScalar(this.pixelsPerMeter),0,r,!1);d.multiplyScalar(this.pixelsPerMeter);let p=Ne.is(l)?l:l.object;if(u!==null&&this.lastHitObj!==p){let h;l instanceof lr&&(h=l);let f=this.sharedGameControlGlobals.entityToCollisionEvents[p.uuid];if(f)for(let m of f)m.data.target==="character"&&(m.dispatch(h),p.dispatchEvent(aA));this.lastHitObj=p}u!==null&&(Math.abs(d.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=d.x),Math.abs(d.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=d.y),Math.abs(d.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=d.z),tR(s++).copy(u.normal1).applyQuaternion(l.quaternion))}if(s>0){for(let l=0;l<s;l++){let c=tR(l),d=c.dot(a);d<0&&a.addScaledVector(c,-d)}a.add(this.pushedVelocity)}else a.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(r),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**n):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**n),this.euler.x+=this.rotVelocity.x*r,this.euler.y+=this.rotVelocity.y*r+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*r),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(la,this.euler.y-this.euler0.y);let s=qa.copy(this.objectToCamXZ).normalize(),l=Qd.copy(a).multiplyScalar(r);l.y=0;let c=l.sub(Pn.copy(s).multiplyScalar(l.dot(s))).cross(s).y;this.euler.y-=Math.atan2(c,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*r+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=ne.MathUtils.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=ne.MathUtils.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=ne.MathUtils.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(Zd.copy(this.euler),Zd.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Zd)),Ai.setFromAxisAngle(az,this.rot.x),Ql.setFromAxisAngle(la,this.rot.y),Ql.multiply(Ai),Ai.setFromAxisAngle(sz,this.rot.z),Ql.multiply(Ai),this.quaternion.copy(Ql),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=qa.copy(a).multiplyScalar(r/this.pixelsPerMeter),l=null;this.didHit=!1;let c=new ne.Vector3;for(let p=0;p<5;p++){let h=s.length(),f=Qd.copy(s).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),this.colliderWorldQuat,f,this.object.rigidBody.collider(0).shape,0,h,!1,lA|QD,void 0,void 0,this.object.rigidBody),l!==null){this.didHit=!0;let m=this.sharedGameControlGlobals.colliderToEntity.get(l.collider.handle);if(m!==this.lastHitObj&&p===0){this.lastHitObj=m;let b=this.sharedGameControlGlobals.entityToCollisionEvents[m?.uuid];if(b){for(let S of b)if(S.data.target==="character"){let x=(this.sharedGameControlGlobals.rapierWorld?.getCollider(l.collider.handle))._parent,A;if(m.cloner){for(let w of m.cloner.children)if(w.rigidBody===x){A=w;break}}S.dispatch(A),m.dispatchEvent(aA)}}}let y=ZD.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),g=JD.copy(f).multiplyScalar(l.time_of_impact).dot(y),v=l.time_of_impact;if(v===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(v=l.time_of_impact*(g-this.offset)/g,c.addScaledVector(f,v)),s.copy(f).multiplyScalar(h-v),Math.acos(-y.y)>this.slopeThresh){let b=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),S=Qd.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);S.y=0;let x=b.add(S);x.y+=this.stepThresh;let A=this.sharedGameControlGlobals.rapierWorld.castShape(x,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,lA|QD,void 0,void 0,this.object.rigidBody);A!==null&&A.time_of_impact===0&&(y.y=0,y.normalize())}s.addScaledVector(y,-s.dot(y))}else{p===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),c.add(s);break}}this.position.addScaledVector(c,this.pixelsPerMeter),Pn.copy(this.position).divideScalar(this.pixelsPerMeter),Ai.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let d=this.object.rigidBody,u=d!==void 0&&uz.copy(Pn).sub(d.translation()).lengthSq()>1;d!==void 0&&(u?(d.setTranslation(Pn,!0),d.setRotation(Ai,!0)):(d.setNextKinematicTranslation(Pn),d.setNextKinematicRotation(Ai)))}else{let s=this.onObject?1:5,l=a.multiplyScalar(r/s);for(let c=0;c<s;c++)this.position.add(l),this.collisionAdjustment(r/s)}else this.position.addScaledVector(a,r);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),hS(this.position,this.quaternion,this.object.shearMatrix,this.scale,this.object.matrix).multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.object.parent instanceof Gt?this.object.matrixWorld.multiplyMatrices(this.object.parent.matrixWorld,this.object.matrix).multiply(this.object.pivotMatrix):this.object.matrixWorld.copy(this.object.matrix),this.object.children.forEach(s=>{s.updateMatrixWorld(!0)}),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),l=this.targetToCamera.add(s);uA.lookAt(l,s,la).setPosition(l),uA.decompose(this.targetPos,this.targetQuat,Pn),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**n),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**n),this.camera.updateMatrix(),this.camera.matrixWorld.copy(this.camera.matrix),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=ne.MathUtils.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=ne.MathUtils.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(gz),this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)?!1:(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(yz),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Ai.setFromAxisAngle(la,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?ne.MathUtils.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e);let r;this.cameraXAxis==="Limit"?r=ne.MathUtils.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):r=ne.MathUtils.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let n=Pn.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&n.applyQuaternion(e);let o=Ql.setFromAxisAngle(n,r);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(o)}groundTiltAdjustment(e){la.angleTo(e)*180/Math.PI<15||la.angleTo(e)*180/Math.PI>85?Ai.identity():Ai.setFromUnitVectors(la,e),this.groundTilt.slerp(Ai,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let r=JD.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let n=uA.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Pn,Ai,qa).compose(Pn,Ai,eR);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(a=>{if(a===this.object||a.isDescendantOf(this.object)||!a.bvhGeometry||!a.bvhGeometry.boundsTree)return;Zi.makeEmpty(),a.updateMatrixWorldRigid();let s=a.matrixWorldRigid,l=$D.copy(s).invert(),c=oz.copy($D).multiply(n);nn.copy(this.collider.segment),nn.start.applyMatrix4(c),nn.end.applyMatrix4(c);let d=ZD.copy(this.position).applyMatrix4(l);Zi.expandByPoint(nn.start),Zi.expandByPoint(nn.end),Zi.min.addScalar(-this.collider.radius),Zi.max.addScalar(this.collider.radius),a.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder(u){return u.distanceToPoint(nn.end)},intersectsBounds:u=>u.intersectsBox(Zi),intersectsTriangle:u=>{let p=Pn,h=qa,f=u.closestPointToSegment(nn,p,h);if(f<this.collider.radius){let m=this.collider.radius-f,y=h.sub(p).normalize(),g=Qd.copy(d);g.addScaledVector(y,m);let v=g.applyMatrix4(s).sub(this.position);r.add(v),nn.start.addScaledVector(y,m),nn.end.addScaledVector(y,m)}}})}),Zi.makeEmpty(),nn.copy(this.collider.segment),nn.start.applyMatrix4(n),nn.end.applyMatrix4(n),Zi.expandByPoint(nn.start),Zi.expandByPoint(nn.end),Zi.min.addScalar(-this.collider.radius),Zi.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder(a){return a.distanceToPoint(nn.end)},intersectsBounds:a=>a.intersectsBox(Zi),intersectsTriangle:a=>{let s=Pn,l=qa,c=a.closestPointToSegment(nn,s,l);if(c<this.collider.radius){let d=this.collider.radius-c,u=l.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(u),r.addScaledVector(u,d),nn.start.addScaledVector(u,d),nn.end.addScaledVector(u,d)}}}),this.onObject=Math.abs(r.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let o=Math.max(0,r.length()-1e-5);r.normalize().multiplyScalar(o),this.position.add(r)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},Bh=pv;Bh.isLocked=!1;var Co=require("three"),cR=require("three/examples/jsm/utils/BufferGeometryUtils.js");var vz,aR=new Promise(i=>{vz=i});var sR;var bz=!1?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.122/build/",xz=i=>`
1327
+ `)>=0&&(t-=o),r===3?e*.5-t*.5:r===2?e-t:0}getLineInitialOffsetY(t,e,r,n,o){let a=e*t,s=Math.abs(this.ascender-this.descender)*n,l=t-s,c=-this.ascender*n-l/2;return o===3?-(r-a-c):o===2?-(r*.5-a*.5-c):c}createPath(t,e,r,n,o){let a=t.getPath(r,-n,o.fontSize,{kerning:!1,letterSpacing:o.letterSpacing});if(!a){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let s=new Yg,l=(t.advanceWidth??1)*e;if(t)for(let c of a.commands){let d=s.currentPath?.currentPoint;if(!(d&&c.type!=="Z"&&d.x===c.x&&-d.y===c.y))switch(c.type){case"M":s.moveTo(c.x,-c.y);break;case"L":s.lineTo(c.x,-c.y);break;case"Q":s.quadraticCurveTo(c.x1,-c.y1,c.x,-c.y);break;case"C":s.bezierCurveTo(c.x1,-c.y1,c.x2,-c.y2,c.x,-c.y);break}}return s.subPaths.forEach(c=>{let d=kU(c.curves);d!==void 0&&c.currentPoint.distanceTo(d)>0&&c.lineTo(d.x,d.y)}),{offsetX:l,path:s}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(r){return this.warnLayoutError(r),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(r){return this.warnLayoutError(r),0}}computeSpaceWidthForLine(t,e,r,n){let o=this.getCharWidth(" ",r),a=t[e];if(a){let s=this.countSpaces(a.trimEnd());if(r.horizontalAlign===4&&e<t.length-1&&s){let l=typeof r.width=="string"?Number(n.getVariable(r.width)):r.width,c=this.getTextWidth(a,r);return(l-(c-s*o))/s}}return o}countSpaces(t){return(t.match(/ /g)||[]).length}};function kU(i){if(i.length){let t=i[0];if(t instanceof Vd.LineCurve)return t.v1;if(t instanceof Vd.CubicBezierCurve||t instanceof Vd.QuadraticBezierCurve)return t.v0}}Fi("TextGeometry",(i,t,e)=>new Is(i,t,e));var cD={create:(i,t)=>new Ed(i,t)};zp("TextGeometry",cD);zp("InputGeometry",cD);jM(Qg);Pe("text");var dD=200,FU=null;function uD(i){FU=i}var Ch=(i,t)=>{let e=t.x-i.x,r=t.y-i.y;return Math.sqrt(e*e+r*r)},pD=(i,t)=>{let e=t.x-i.x,r=t.y-i.y;return VU(Math.atan2(r,e))},hD=(i,t,e)=>{let r={x:0,y:0};return e=Jg(e),r.x=i.x-t*Math.cos(e),r.y=i.y-t*Math.sin(e),r},Jg=i=>i*(Math.PI/180),VU=i=>i*(180/Math.PI),fD=i=>isNaN(i.buttons)?i.pressure!==0:i.buttons!==0,Zg=new Map,mD=i=>{Zg.has(i)&&clearTimeout(Zg.get(i)),Zg.set(i,setTimeout(function(){Zg.delete(i),i()},100))},Gd=(i,t,e)=>{let r=t.split(/[ ,]+/g),n;for(let o=0;o<r.length;o+=1)n=r[o],i.addEventListener?i.addEventListener(n,e,!1):i.attachEvent&&i.attachEvent(n,e)},Ud=(i,t,e)=>{let r=t.split(/[ ,]+/g),n;for(let o=0;o<r.length;o+=1)n=r[o],i.removeEventListener?i.removeEventListener(n,e):i.detachEvent&&i.detachEvent(n,e)};var $g=i=>(i.preventDefault(),i.type.match(/^touch/)?i.changedTouches:i),Y1=()=>{if(typeof window>"u")return;let i=window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t=window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{x:i,y:t}},ev=(i,t)=>{t.top||t.right||t.bottom||t.left?(i.style.top=t.top,i.style.right=t.right,i.style.bottom=t.bottom,i.style.left=t.left):(i.style.left=t.x+"px",i.style.top=t.y+"px")},tv=(i,t,e)=>{let r=gD(i);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))if(typeof t=="string")r[n]=t+" "+e;else{let o="";for(let a=0,s=t.length;a<s;a+=1)o+=t[a]+" "+e+", ";r[n]=o.slice(0,-2)}return r},yD=(i,t)=>{let e=gD(i);for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=t);return e},gD=i=>{let t={};return t[i]="",["webkit","Moz","o"].forEach(function(r){t[r+i.charAt(0).toUpperCase()+i.slice(1)]=""}),t},rv=(i,t)=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i},vD=(i,t)=>{let e={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&Object.prototype.hasOwnProperty.call(t,r)?e[r]=t[r]:Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);return e},Eh=(i,t)=>{if(i.length)for(let e=0,r=i.length;e<r;e+=1)t(i[e]);else t(i)},bD=(i,t,e)=>({x:Math.min(Math.max(i.x,t.x-e),t.x+e),y:Math.min(Math.max(i.y,t.y-e),t.y+e)});typeof window<"u"&&(xD="ontouchstart"in window,SD=!!window.PointerEvent,AD=!!window.MSPointerEvent);var xD,SD,AD,Th={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},zd,Ph={};SD?zd=Th.pointer:AD?zd=Th.MSPointer:xD?(zd=Th.touch,Ph=Th.mouse):zd=Th.mouse;function Yl(){}Yl.prototype.on=function(i,t){var e=this,r=i.split(/[ ,]+/g),n;e._handlers_=e._handlers_||{};for(var o=0;o<r.length;o+=1)n=r[o],e._handlers_[n]=e._handlers_[n]||[],e._handlers_[n].push(t);return e};Yl.prototype.off=function(i,t){var e=this;return e._handlers_=e._handlers_||{},i===void 0?e._handlers_={}:t===void 0?e._handlers_[i]=null:e._handlers_[i]&&e._handlers_[i].indexOf(t)>=0&&e._handlers_[i].splice(e._handlers_[i].indexOf(t),1),e};Yl.prototype.trigger=function(i,t){var e=this,r=i.split(/[ ,]+/g),n;e._handlers_=e._handlers_||{};for(var o=0;o<r.length;o+=1)n=r[o],e._handlers_[n]&&e._handlers_[n].length&&e._handlers_[n].forEach(function(a){a.call(e,{type:n,target:e},t)})};Yl.prototype.config=function(i){var t=this;t.options=t.defaults||{},i&&(t.options=vD(t.options,i))};Yl.prototype.bindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},e._domHandlers_[t]=function(){typeof e["on"+t]=="function"?e["on"+t].apply(e,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},Gd(i,zd[t],e._domHandlers_[t]),Ph[t]&&Gd(i,Ph[t],e._domHandlers_[t]),e};Yl.prototype.unbindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},Ud(i,zd[t],e._domHandlers_[t]),Ph[t]&&Ud(i,Ph[t],e._domHandlers_[t]),delete e._domHandlers_[t],this};var jd=Yl;function Xr(i,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=i,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Xr.id,Xr.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Xr.prototype=new jd;Xr.constructor=Xr;Xr.id=0;Xr.prototype.buildEl=function(i){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};Xr.prototype.stylize=function(){if(this.options.dataOnly)return this;var i=this.options.fadeTime+"ms",t=yD("borderRadius","50%"),e=tv("transition","opacity",i),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},r.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},rv(r.el,e),this.options.shape==="circle"&&rv(r.back,t),rv(r.front,t),this.applyStyles(r),this};Xr.prototype.applyStyles=function(i){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var e in i[t])this.ui[t].style[e]=i[t][e];return this};Xr.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};Xr.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};Xr.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};Xr.prototype.show=function(i){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof i=="function"&&i.call(this)},t.options.fadeTime)),t};Xr.prototype.hide=function(i){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var e=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=e,typeof i=="function"&&i.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let e=t.options.restJoystick,r={};r.x=e===!0||e.x!==!1?0:t.instance.frontPosition.x,r.y=e===!0||e.y!==!1?0:t.instance.frontPosition.y,t.setPosition(i,r)}return t};Xr.prototype.setPosition=function(i,t){var e=this;e.frontPosition={x:t.x,y:t.y};var r=e.options.fadeTime+"ms",n={};n.front=tv("transition",["top","left"],r);var o={front:{}};o.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(n),e.applyStyles(o),e.restTimeout=setTimeout(function(){typeof i=="function"&&i.call(e),e.restCallback()},e.options.fadeTime)};Xr.prototype.restCallback=function(){var i=this,t={};t.front=tv("transition","none",""),i.applyStyles(t),i.trigger("rested",i.instance)};Xr.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};Xr.prototype.computeDirection=function(i){var t=i.angle.radian,e=Math.PI/4,r=Math.PI/2,n,o,a;if(t>e&&t<e*3&&!i.lockX?n="up":t>-e&&t<=e&&!i.lockY?n="left":t>-e*3&&t<=-e&&!i.lockX?n="down":i.lockY||(n="right"),i.lockY||(t>-r&&t<r?o="left":o="right"),i.lockX||(t>0?a="up":a="down"),i.force>this.options.threshold){var s={},l;for(l in this.direction)Object.prototype.hasOwnProperty.call(this.direction,l)&&(s[l]=this.direction[l]);var c={};this.direction={x:o,y:a,angle:n},i.direction=this.direction;for(l in s)s[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return i;(!c.x||!c.y)&&this.trigger("plain",i),c.x||this.trigger("plain:"+o,i),c.y||this.trigger("plain:"+a,i),c.angle||this.trigger("dir dir:"+n,i)}else this.resetDirection();return i};var wD=Xr;function _r(i,t){var e=this;e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.pressureIntervals={},e.manager=i,e.id=_r.id,_r.id+=1,e.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},e.config(t),(e.options.mode==="static"||e.options.mode==="semi")&&(e.options.multitouch=!1),e.options.multitouch||(e.options.maxNumberOfNipples=1);let r=getComputedStyle(e.options.zone.parentElement);return r&&r.display==="flex"&&(e.parentIsFlex=!0),e.updateBox(),e.prepareNipples(),e.bindings(),e.begin(),e.nipples}_r.prototype=new jd;_r.constructor=_r;_r.id=0;_r.prototype.prepareNipples=function(){var i=this,t=i.nipples;t.on=i.on.bind(i),t.off=i.off.bind(i),t.options=i.options,t.destroy=i.destroy.bind(i),t.ids=i.ids,t.id=i.id,t.processOnMove=i.processOnMove.bind(i),t.processOnEnd=i.processOnEnd.bind(i),t.get=function(e){if(e===void 0)return t[0];for(var r=0,n=t.length;r<n;r+=1)if(t[r].identifier===e)return t[r];return!1}};_r.prototype.bindings=function(){var i=this;i.bindEvt(i.options.zone,"start"),i.options.zone.style.touchAction="none",i.options.zone.style.msTouchAction="none"};_r.prototype.begin=function(){var i=this,t=i.options;if(t.mode==="static"){var e=i.createNipple(t.position,i.manager.getIdentifier());e.add(),i.idles.push(e)}};_r.prototype.createNipple=function(i,t){var e=this,r=e.manager.scroll,n={},o=e.options,a={x:e.parentIsFlex?r.x:r.x+e.box.left,y:e.parentIsFlex?r.y:r.y+e.box.top};if(i.x&&i.y)n={x:i.x-a.x,y:i.y-a.y};else if(i.top||i.right||i.bottom||i.left){var s=document.createElement("DIV");s.style.display="hidden",s.style.top=i.top,s.style.right=i.right,s.style.bottom=i.bottom,s.style.left=i.left,s.style.position="absolute",o.zone.appendChild(s);var l=s.getBoundingClientRect();o.zone.removeChild(s),n=i,i={x:l.left+r.x,y:l.top+r.y}}var c=new wD(e,{color:o.color,size:o.size,threshold:o.threshold,fadeTime:o.fadeTime,dataOnly:o.dataOnly,restJoystick:o.restJoystick,restOpacity:o.restOpacity,mode:o.mode,identifier:t,position:i,zone:o.zone,frontPosition:{x:0,y:0},shape:o.shape});return o.dataOnly||(ev(c.ui.el,n),ev(c.ui.front,c.frontPosition)),e.nipples.push(c),e.trigger("added "+c.identifier+":added",c),e.manager.trigger("added "+c.identifier+":added",c),e.bindNipple(c),c};_r.prototype.updateBox=function(){var i=this;i.box=i.options.zone.getBoundingClientRect()};_r.prototype.bindNipple=function(i){var t=this,e,r=function(n,o){e=n.type+" "+o.id+":"+n.type,t.trigger(e,o)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",r),i.on("dir:up dir:right dir:down dir:left",r),i.on("plain:up plain:right plain:down plain:left",r)};_r.prototype.pressureFn=function(i,t,e){var r=this,n=0;clearInterval(r.pressureIntervals[e]),r.pressureIntervals[e]=setInterval(function(){var o=i.force||i.pressure||i.webkitForce||0;o!==n&&(t.trigger("pressure",o),r.trigger("pressure "+t.identifier+":pressure",o),n=o)}.bind(r),100)};_r.prototype.onstart=function(i){var t=this,e=t.options,r=i;i=$g(i),t.updateBox();var n=function(o){t.actives.length<e.maxNumberOfNipples?t.processOnStart(o):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(a){if(Object.values(r.touches).findIndex(function(l){return l.identifier===a})<0){var s=[i[0]];s.identifier=a,t.processOnEnd(s)}}),t.actives.length<e.maxNumberOfNipples&&t.processOnStart(o))};return Eh(i,n),t.manager.bindDocument(),!1};_r.prototype.processOnStart=function(i){var t=this,e=t.options,r,n=t.manager.getIdentifier(i),o=i.force||i.pressure||i.webkitForce||0,a={x:i.pageX,y:i.pageY},s=t.getOrCreate(n,a);s.identifier!==n&&t.manager.removeIdentifier(s.identifier),s.identifier=n;var l=function(d){d.trigger("start",d),t.trigger("start "+d.id+":start",d),d.show(),o>0&&t.pressureFn(i,d,d.identifier),t.processOnMove(i)};if((r=t.idles.indexOf(s))>=0&&t.idles.splice(r,1),t.actives.push(s),t.ids.push(s.identifier),e.mode!=="semi")l(s);else{var c=Ch(a,s.position);if(c<=e.catchDistance)l(s);else{s.destroy(),t.processOnStart(i);return}}return s};_r.prototype.getOrCreate=function(i,t){var e=this,r=e.options,n;return/(semi|static)/.test(r.mode)?(n=e.idles[0],n?(e.idles.splice(0,1),n):r.mode==="semi"?e.createNipple(t,i):(console.warn("Coudln't find the needed nipple."),!1)):(n=e.createNipple(t,i),n)};_r.prototype.processOnMove=function(i){var t=this,e=t.options,r=t.manager.getIdentifier(i),n=t.nipples.get(r),o=t.manager.scroll;if(!fD(i)){this.processOnEnd(i);return}if(!n){console.error("Found zombie joystick with ID "+r),t.manager.removeIdentifier(r);return}if(e.dynamicPage){var a=n.el.getBoundingClientRect();n.position={x:o.x+a.left,y:o.y+a.top}}n.identifier=r;var s=n.options.size/2,l={x:i.pageX,y:i.pageY};e.lockX&&(l.y=n.position.y),e.lockY&&(l.x=n.position.x);var c=Ch(l,n.position),d=pD(l,n.position),u=Jg(d),p=c/s,h={distance:c,position:l},f,m;if(n.options.shape==="circle"?(f=Math.min(c,s),m=hD(n.position,f,d)):(m=bD(l,n.position,s),f=Ch(m,n.position)),e.follow){if(c>s){let b=l.x-m.x,S=l.y-m.y;n.position.x+=b,n.position.y+=S,n.el.style.top=n.position.y-(t.box.top+o.y)+"px",n.el.style.left=n.position.x-(t.box.left+o.x)+"px",c=Ch(l,n.position)}}else l=m,c=f;var y=l.x-n.position.x,g=l.y-n.position.y;n.frontPosition={x:y,y:g},e.dataOnly||ev(n.ui.front,n.frontPosition);var v={identifier:n.identifier,position:l,force:p,pressure:i.force||i.pressure||i.webkitForce||0,distance:c,angle:{radian:u,degree:d},vector:{x:y/s,y:-g/s},raw:h,instance:n,lockX:e.lockX,lockY:e.lockY};v=n.computeDirection(v),v.angle={radian:Jg(180-d),degree:180-d},n.trigger("move",v),t.trigger("move "+n.id+":move",v)};_r.prototype.processOnEnd=function(i){var t=this,e=t.options,r=t.manager.getIdentifier(i),n=t.nipples.get(r),o=t.manager.removeIdentifier(n.identifier);!n||(e.dataOnly||n.hide(function(){e.mode==="dynamic"&&(n.trigger("removed",n),t.trigger("removed "+n.id+":removed",n),t.manager.trigger("removed "+n.id+":removed",n),n.destroy())}),clearInterval(t.pressureIntervals[n.identifier]),n.resetDirection(),n.trigger("end",n),t.trigger("end "+n.id+":end",n),t.ids.indexOf(n.identifier)>=0&&t.ids.splice(t.ids.indexOf(n.identifier),1),t.actives.indexOf(n)>=0&&t.actives.splice(t.actives.indexOf(n),1),/(semi|static)/.test(e.mode)?t.idles.push(n):t.nipples.indexOf(n)>=0&&t.nipples.splice(t.nipples.indexOf(n),1),t.manager.unbindDocument(),/(semi|static)/.test(e.mode)&&(t.manager.ids[o.id]=o.identifier))};_r.prototype.onDestroyed=function(i,t){var e=this;e.nipples.indexOf(t)>=0&&e.nipples.splice(e.nipples.indexOf(t),1),e.actives.indexOf(t)>=0&&e.actives.splice(e.actives.indexOf(t),1),e.idles.indexOf(t)>=0&&e.idles.splice(e.idles.indexOf(t),1),e.ids.indexOf(t.identifier)>=0&&e.ids.splice(e.ids.indexOf(t.identifier),1),e.manager.removeIdentifier(t.identifier),e.manager.unbindDocument()};_r.prototype.destroy=function(){var i=this;i.unbindEvt(i.options.zone,"start"),i.nipples.forEach(function(e){e.destroy()});for(var t in i.pressureIntervals)Object.prototype.hasOwnProperty.call(i.pressureIntervals,t)&&clearInterval(i.pressureIntervals[t]);i.trigger("destroyed",i.nipples),i.manager.unbindDocument(),i.off(),i.pressureIntervals={},i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.manager=null};var CD=_r;function Gr(i){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=Y1(),t._windowBound=!1,t.config(i),t.prepareCollections();var e=function(){var r;t.collections.forEach(function(n){n.forEach(function(o){r=o.el.getBoundingClientRect(),o.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){mD(e)},t._onScroll=function(){t.scroll=Y1()},t.collections}Gr.prototype=new jd;Gr.constructor=Gr;Gr.prototype.prepareCollections=function(){var i=this;i.collections.create=i.create.bind(i),i.collections.on=i.on.bind(i),i.collections.off=i.off.bind(i),i.collections.destroy=i.destroy.bind(i),i.collections.get=function(t){var e;return i.collections.every(function(r){return e=r.get(t),!e}),e}};Gr.prototype.create=function(i){return this.createCollection(i)};Gr.prototype.bindWindowEvents=function(){var i=this;i._windowBound||typeof window>"u"||(i._windowBound=!0,Gd(window,"resize",i._onResize),Gd(window,"scroll",i._onScroll))};Gr.prototype.unbindWindowEvents=function(){var i=this;!i._windowBound||typeof window>"u"||(i._windowBound=!1,Ud(window,"resize",i._onResize),Ud(window,"scroll",i._onScroll))};Gr.prototype.createCollection=function(i){var t=this,e=new CD(t,i);return t.bindCollection(e),t.collections.push(e),t.bindWindowEvents(),e};Gr.prototype.bindCollection=function(i){var t=this,e,r=function(n,o){e=n.type+" "+o.id+":"+n.type,t.trigger(e,o)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",r),i.on("dir:up dir:right dir:down dir:left",r),i.on("plain:up plain:right plain:down plain:left",r)};Gr.prototype.bindDocument=function(){var i=this;i.binded||(i.bindEvt(document,"move").bindEvt(document,"end"),i.binded=!0)};Gr.prototype.unbindDocument=function(i){var t=this;(!Object.keys(t.ids).length||i===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};Gr.prototype.getIdentifier=function(i){var t;return i?(t=i.identifier===void 0?i.pointerId:i.identifier,t===void 0&&(t=this.latest||0)):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]};Gr.prototype.removeIdentifier=function(i){var t={};for(var e in this.ids)if(this.ids[e]===i){t.id=e,t.identifier=this.ids[e],delete this.ids[e];break}return t};Gr.prototype.onmove=function(i){var t=this;return t.onAny("move",i),!1};Gr.prototype.onend=function(i){var t=this;return t.onAny("end",i),!1};Gr.prototype.oncancel=function(i){var t=this;return t.onAny("end",i),!1};Gr.prototype.onAny=function(i,t){var e=this,r,n="processOn"+i.charAt(0).toUpperCase()+i.slice(1);t=$g(t);var o=function(s,l,c){c.ids.indexOf(l)>=0&&(c[n](s),s._found_=!0)},a=function(s){r=e.getIdentifier(s),Eh(e.collections,o.bind(null,s,r)),s._found_||e.removeIdentifier(r)};return Eh(t,a),!1};Gr.prototype.destroy=function(){var i=this;i.unbindDocument(!0),i.unbindWindowEvents(),i.ids={},i.index=0,i.collections.forEach(function(t){t.destroy()}),i.collections=[],i.off()};Gr.prototype.onDestroyed=function(i,t){var e=this;if(e.collections.indexOf(t)<0)return!1;e.collections.splice(e.collections.indexOf(t),1),e.collections.length===0&&e.unbindWindowEvents()};var ED=Gr;var Hd=null;function TD(){return Hd||(Hd=new ED),Hd}var GU={create:function(i){return TD().create(i)},destroy:function(){Hd&&(Hd.destroy(),Hd=null)},get factory(){return TD()}},PD=GU;var ne=require("three");var xt=require("three");var pn=require("three");var iv=new pn.Vector3,Yi=new pn.Camera,K1=class extends pn.LineSegments{constructor(e){let r=new pn.BufferGeometry,n=new pn.LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),o=[],a=[],s={},l=new pn.Color(15711266),c=new pn.Color(15711266),d=new pn.Color(2857471);u("n1","n2",l),u("n2","n4",l),u("n4","n3",l),u("n3","n1",l),u("f1","f2",l),u("f2","f4",l),u("f4","f3",l),u("f3","f1",l),u("n1","f1",l),u("n2","f2",l),u("n3","f3",l),u("n4","f4",l),u("p","n1",c),u("p","n2",c),u("p","n3",c),u("p","n4",c),u("u1","u2",d),u("u2","u3",d),u("u3","u1",d);function u(h,f,m){p(h,m),p(f,m)}function p(h,f){o.push(0,0,0),a.push(f.r,f.g,f.b),s[h]===void 0&&(s[h]=[]),s[h].push(o.length/3-1)}r.setAttribute("position",new pn.Float32BufferAttribute(o,3)),r.setAttribute("color",new pn.Float32BufferAttribute(a,3));super(r,n);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let e=this.geometry,r=this.pointMap,n=!0;Yi.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let o=1,a=1,s=n?.8:1e-4;wo("n1",r,e,Yi,-o,-a,s),wo("n2",r,e,Yi,o,-a,s),wo("n3",r,e,Yi,-o,a,s),wo("n4",r,e,Yi,o,a,s);let l=s;wo("f1",r,e,Yi,-o,-a,l),wo("f2",r,e,Yi,o,-a,l),wo("f3",r,e,Yi,-o,a,l),wo("f4",r,e,Yi,o,a,l);let c=l,d=.5;wo("u1",r,e,Yi,o*.7*d,a*1.1,c),wo("u2",r,e,Yi,-o*.7*d,a*1.1,c),wo("u3",r,e,Yi,0,a*(1.1+.9*d),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function wo(i,t,e,r,n,o,a){iv.set(n,o,a).unproject(r);let s=t[i];if(s!==void 0){let l=e.getAttribute("position");for(let c=0,d=s.length;c<d;c++)l.setXYZ(s[c],iv.x,iv.y,iv.z)}}var ov=class extends Qo(K1){constructor(e){super(e);this.object=e;this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,r){Zo(this.object,this.geometry,e,r,!0)}};var av=790;function MD(i){return 1-Math.pow(1-i,3)}var Wd=new xt.Vector3,Q1=new xt.Vector3,Z1=new xt.Quaternion,J1=new xt.Vector3,Mh=new xt.Vector3,$1=new xt.Vector3,aa=class extends Wi(xt.Camera,ov){constructor(e="",r={...Al.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=uo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.wasMovedByUser=!1;this.wasMovedBySwitchCameraAction=!1;this._createdAt=typeof performance<"u"?performance.now():0;this._tickProjectionTransition=()=>{let e=this._projectionTransition;if(e===void 0)return;if(this.disposed){this._endProjectionTransition();return}e.raf=requestAnimationFrame(this._tickProjectionTransition);let r=aa.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),r?.()};this.super_Entity(e,r),this.previousProjectionMatrix=new xt.Matrix4,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let n=this.width,o=this.height;this.orthoCamera=new xt.OrthographicCamera(n*-.5,n*.5,o*.5,o*-.5,-5e4,1e4),this.perspCamera=new xt.PerspectiveCamera(45,n/o,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(e){let r=aa.projectionTransitionsEnabled;aa.projectionTransitionsEnabled=!1;try{return e()}finally{aa.projectionTransitionsEnabled=r}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,r,n){typeof e=="number"&&(e=new xt.Vector3(e,r,n)),super.lookAt(e),this.getWorldPosition(Wd),this.targetOffset=Wd.distanceTo(e)}getTarget(e=new xt.Vector3){return this.getWorldDirection(Q1),this.getWorldPosition(Wd),Q1.multiplyScalar(this.targetOffset),e.copy(Wd).add(Q1),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Wd),Wd.distanceTo(e)}updateUp(){this.getWorldQuaternion(Z1),J1.set(0,0,1).applyQuaternion(Z1),Mh.copy(xt.Object3D.DEFAULT_UP),this.isUpVectorFlipped&&Mh.negate(),Mh.applyQuaternion(Z1),$1.copy(xt.Object3D.DEFAULT_UP).projectOnPlane(J1),this.angleOffsetFromUp=$1.angleTo(Mh),this.angleOffsetFromUp*=$1.cross(Mh).dot(J1)>=0?1:-1}updateTransformState(e,r){let n=super.updateTransformState(e,r);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),n}getViewFrontToObject(e){let r=e.getWorldPosition(new xt.Vector3),o=e.getWorldDirection(new xt.Vector3).multiplyScalar(this.targetOffset);return{position:r.clone().add(o),target:r}}getViewToTarget(e){let n=this.getWorldDirection(new xt.Vector3).multiplyScalar(this.targetOffset);return{position:e.clone().sub(n),target:e}}getViewToObject(e){let r=new xt.Vector3;return e.getWorldPosition(r),this.getViewToTarget(r)}setViewplaneSize(e,r,n=!1){if(this.aspect=e/r,n){let o=e>r?this.aspect:1,a=e>r?1:this.aspect;this.left=-av*.5*o,this.right=av*.5*o,this.top=av*.5*(1/a),this.bottom=-av*.5*(1/a)}else this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let e=this._projectionTransition;if(e===void 0)return 1;let r=(performance.now()-e.start)/e.duration;return r>=1?1:r<=0?0:MD(r)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return aa.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=aa.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let r=this._projectionTransition;r===void 0&&(r={from:new xt.Matrix4,blend:new xt.Matrix4,blendInverse:new xt.Matrix4,start:0,duration:aa.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=r),r.from.copy(this.projectionMatrix),r.start=performance.now(),r.duration=aa.projectionTransitionDuration,r.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(r.requestRender=e),r.raf!==0&&cancelAnimationFrame(r.raf),r.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let r=(performance.now()-e.start)/e.duration;if(r>=1){this._endProjectionTransition();return}let n=MD(r),o=e.from.elements,a=this._activeSubCamera.projectionMatrix.elements,s=e.blend.elements,l=e.referenceDepth,c=Math.max(1e-6,o[15]-o[11]*l),d=Math.max(1e-6,a[15]-a[11]*l),u=n*c/(n*c+(1-n)*d);for(let p=0;p<16;p++)s[p]=o[p]+(a[p]-o[p])*u;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let r=this._activeSubCamera;this.projectionMatrix=r.projectionMatrix,this.projectionMatrixInverse=r.projectionMatrixInverse}_syncProjectionTransition(e){let r=e._projectionTransition;if(r===void 0){this._projectionTransition!==void 0&&this._endProjectionTransition();return}let n=this._projectionTransition;n===void 0?(n={from:new xt.Matrix4,blend:new xt.Matrix4,blendInverse:new xt.Matrix4,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=n):n.raf!==0&&(cancelAnimationFrame(n.raf),n.raf=0),n.requestRender=void 0,n.from.copy(r.from),n.start=r.start,n.duration=r.duration,n.referenceDepth=r.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,n,o,a,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,n,o,a,s):this.orthoCamera.setViewOffset(e,r,n,o,a,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=uo.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Gp(r,e)}updateCameraSubtype(e,r){let n=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";r.zoom!==void 0&&this.setZoom(n,r.zoom),r.near!==void 0&&this.setNear(n,r.near),r.fov!==void 0&&n==="PerspectiveCamera"&&(this.fov=r.fov)}updateState(e,r){this.updateCameraState(e,r)}updateCameraState(e,r){this.updateState_Entity(e,r),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(r?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(n=>typeof n=="number"?n:0)),e.targetOffset!==void 0&&(this.targetOffset=uo.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,r,n){super.updateByPatchedOp(e,r,n),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},St=aa;St.projectionTransitionsEnabled=!1,St.projectionTransitionDuration=350,St.projectionTransitionMinAgeMs=1e3;var Yd=require("three");function jU(i,t){try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(i),r=n=>Number(e.find(o=>o.type===n)?.value);return new Date(r("year"),r("month")-1,r("day"),r("hour"),r("minute"),r("second"),i.getMilliseconds())}catch{return new Date(NaN)}}function Yr(i,t){return t.color(i)}function eA(i=new Date,t){let e=t.format,r=i.getSeconds(),n=i;t&&t.timeZone!==null&&(n=jU(new Date,t.timeZone));let o=n.getHours(),a=n.getMinutes(),s;t.format12h24h==="12ampm"&&(s=o>=12?"PM":"AM");let l=o;t.format12h24h!=="24"&&(l=o%12,l===0&&(l=12));let c,d;switch(e){case"HH:mm:ss":c=[l,a,r];break;case"HH:mm":c=[l,a];break;case"HH":c=[l],s=void 0;break;case"mm":c=[a],s=void 0;break;case"ss":c=[r],s=void 0;break;case"year":d=n.getFullYear();break;case"month":d=n.getMonth()+1;break;case"dayOfYear":d=Math.floor((n.getTime()-new Date(n.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":d=n.getDate();break;case"secondOfDay":d=o*60*60+a*60+r;break;default:console.error("Unknown time format",e),d=0;break}return c!==void 0?{textValue:c,suffix:s}:d}var Oh=require("three");var OD=require("three");var qd=class extends Qo(OD.DirectionalLightHelper){constructor(e,r=15,n=10066329){super(e,r,n);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,r){Zo(this.object,qd.geometryHelper,e,r)}};var DD=require("three");var HU=new WeakSet;function ID(i){HU.delete(i)}var sv;(t=>{function i(e){return Ne.is(e)&&e instanceof DD.Light}t.is=i})(sv||(sv={}));var Xd=(i,t)=>class extends Wi(i,t){updateState_Light(r,n){if(this.updateState_Entity(r,n),r.color!==void 0&&(this.color=n.shared.color(r.color)),r.intensity!==void 0&&(this.intensity=r.intensity*Math.PI),r.depth!==void 0){let o=this.shadow;o.camera.far=r.depth,o.needsUpdate=!0}r.shadows!==void 0&&(ID(this),this.castShadow=r.shadows)}};function WU(i,t){i.shadow.camera.right=t/2,i.shadow.camera.left=-t/2,i.shadow.camera.top=t/2,i.shadow.camera.bottom=-t/2,i.shadow.needsUpdate=!0}var Ha=class extends Xd(Oh.DirectionalLight,qd){constructor(t,e,r){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.top=1250,o.bottom=-1250,o.right=1250,o.left=-1250,o.near=-1e4,o.far=2500;let a=new Oh.CameraHelper(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Oh.CameraHelper&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let r=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&WU(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),r&&this.update()}};yt();var XD=require("three");var YU=require("three");var Ki=require("three");var Ls=new Ki.Matrix4,qU=new Ki.Matrix4,RD=new Ki.Matrix4,BD=new Ki.Matrix4,tA=new Ki.Matrix4;function XU(i,t){let e=i.cloner;return e!==void 0&&e.parent===t?e:void 0}var lv=new Float32Array(0);function ND(i,t,e,r){let n=(t.children.length+1)*16;lv.length<n&&(lv=new Float32Array(n));let o=0,a=l=>{l.toArray(lv,o*16),o++},s=t.parameters.hideBase!==!0;s&&a(r),RD.copy(i.matrix);for(let l of t.children)!td(l)||l.playModeVisible===!1||(BD.copy(l.matrix).multiply(l.pivotMatrix),tA.multiplyMatrices(RD,BD),!(s&&tA.equals(r))&&a(tA));try{return o===0?0:eM(e,lv.subarray(0,o*16))}finally{Ty(e)}}var ni=class extends Ar{constructor(e,r,n){super(e,r);this.data=r;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new Ki.BufferGeometry;this.onAfterRender=(e,r,n,o,a,s)=>{super.onAfterRender(e,r,n,o,a,s),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,r,n){super.updateByPatchedOp(e,r,n),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,r=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let o=0;o<this.children.length;o++){let a=this.children[o];a instanceof ni&&a.dataPatched.visible===!0&&a.recomputeBoolean(e===!0,r)}this.meshSetAddresses=[];for(let o=0;o<this.children.length;o++){let a=this.children[o];if(a instanceof it&&a.dataPatched.visible===!0&&a.geometry.attributes.position?.count>0&&a.geometry.drawRange.count>0&&a.booleanMeshSetAddress!==0){Ls.copy(a.matrix).multiply(a.pivotMatrix);try{let s=XU(a,this);if(a.booleanMeshSetAddress===-1){if((a.geometry.index??a.geometry.getAttribute("position")).count/3<15e5){let l=QP(a.geometry,e===!0,r);a.booleanMeshSetAddress=s===void 0||l===-1?l:ND(a,s,l,Ls)}if(a.booleanMeshSetAddress===-1)return;s===void 0&&Ey(a.booleanMeshSetAddress,Ls),a.booleanMatrixInvOld.copy(Ls).invert(),a.booleanWasTransformed=!1}else a instanceof ni&&a.needsTransformForDownstream===!0?(s===void 0?Ey(a.booleanMeshSetAddress,Ls):a.booleanMeshSetAddress=ND(a,s,a.booleanMeshSetAddress,Ls),a.needsTransformForDownstream=!1):a.booleanWasTransformed===!0&&(Ey(a.booleanMeshSetAddress,qU.multiplyMatrices(Ls,a.booleanMatrixInvOld)),a.booleanMatrixInvOld.copy(Ls).invert(),a.booleanWasTransformed=!1)}catch(s){console.error(s),a.booleanMeshSetAddress=0,a.geometry.userData.booleanOperationDidFail=!0;continue}if(a.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(a.booleanMeshSetAddress),a.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let o=this.geometry;o.dispose(),this.geometry=new Ki.BufferGeometry,this.geometry.userData=o.userData,this.geometry.boundingSphere=o.boundingSphere,this.geometry.setAttribute("position",new Ki.Float32BufferAttribute([],3))}this.geometry.setDrawRange(0,0);return}if(e===!0)return $P(this.meshSetAddresses,this.booleanOp);let n=this.geometry;n.dispose(),this.geometry=new Ki.BufferGeometry,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere;try{this.booleanMeshSetAddress=JP(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(o){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(o)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,ea(this),ta(this)}dispose(){super.dispose(),this.geometry.dispose()}};var ii=i=>i instanceof it,Si=i=>i!==null&&i instanceof ni;var Ih=i=>xg.is(i);var sa=require("three");var rA=1<<9;function nA(i){return i instanceof Ar&&i.needsAO&&!fi(i)&&i.isDecalObject!==!0}function iA(i){let t=i.cloner;if(!(!t||!Array.isArray(t.children)))for(let e of t.children)e?.layers&&(e.layers.mask=i.layers.mask)}function oA(i){return i.getLayersOfType("reflection").filter(t=>t.data.visible).length}function LD(i,t){let e={outline:!1,cavity:!1},r=i.layers.mask&rA,n=t.getLayersOfType("transmission"),o=t.getLayersOfType("outline"),a=oA(t),s=t.getLayersOfType("cavity");return(o.length>0||s.length>0)&&(i.layers.set(8),n.length>0&&i.layers.enable(3),a>0&&i.layers.enable(4),e.outline=o.length>0,e.cavity=s.length>0,ta(i),ea(i)),n.length===0&&o.length===0&&s.length===0&&a===0&&i.layers.set(0),r&&i.layers.set(9),!r&&nA(i)&&i.layers.enable(5),iA(i),e}function _D(i,t){if(!t.layers)return!1;let e=i.layers.mask&rA,r=!1,n=t.getLayersOfType("transmission").filter(l=>l.data.visible),o=t.getLayersOfType("outline").filter(l=>l.data.visible),a=oA(t),s=t.getLayersOfType("cavity").filter(l=>l.data.visible);return n.length>0&&(i.layers.set(3),(o.length>0||s.length>0)&&i.layers.enable(8),a>0&&i.layers.enable(4),r=!0),n.length===0&&o.length===0&&s.length===0&&a===0&&i.layers.set(0),e&&i.layers.set(9),!e&&nA(i)&&i.layers.enable(5),iA(i),r}function kD(i,t){var l;if(!t.layers)return!1;let e=i.layers.mask&rA,r=!1,n=oA(t),o=t.getLayersOfType("transmission").filter(c=>c.data.visible),a=t.getLayersOfType("outline").filter(c=>c.data.visible),s=t.getLayersOfType("cavity").filter(c=>c.data.visible);return n>0&&((l=i.userData).__splinePlanarMirror??(l.__splinePlanarMirror=0),i.layers.set(4),o.length>0&&i.layers.enable(3),(a.length>0||s.length>0)&&i.layers.enable(8),r=!0),n===0&&o.length===0&&a.length===0&&s.length===0&&i.layers.set(0),e&&i.layers.set(9),!e&&nA(i)&&i.layers.enable(5),iA(i),r}function UD(i){let t={outline:!1,cavity:!1},e=r=>{t.outline=t.outline||r.outline,t.cavity=t.cavity||r.cavity};return i.traverseEntity(r=>{if(r instanceof Ar)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)e(LD(r,r.material[n]));else e(LD(r,r.material))}),t}function zD(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Ar)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)_D(e,e.material[r])&&(t=!0);else _D(e,e.material)&&(t=!0)}),t}function jD(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Ar)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)kD(e,e.material[r])&&(t=!0);else kD(e,e.material)&&(t=!0)}),t}var KU=new sa.Raycaster,QU=new sa.Matrix4,ZU=new sa.Ray,FD=new sa.Sphere;function Dh(i,t,e,r=!1){let n=i.cloner;if(n){let o=null;if((i.raycast===sa.Mesh.prototype.raycast||i.raycast===it.prototype.raycast)&&i.isSkinnedMesh!==!0){let a=i.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),o=a.boundingSphere)}for(let a of n.children){if(o!==null&&(FD.copy(o).applyMatrix4(a.matrixWorld),!t.ray.intersectsSphere(FD)))continue;let s=QU.copy(a.matrixWorld).invert(),l=ZU.copy(t.ray).applyMatrix4(s),c=i.matrixWorld;l.applyMatrix4(c);let d=KU;d.set(l.origin,l.direction),d.near=t.near,d.far=t.far,d.layers.mask=t.layers.mask;let u=d.intersectObject(i,!1);u.length>0&&e.push({...u[0],object:r?a:i})}}}var Qi=require("three");var dv=require("three");var cv=class extends Qo(dv.SpotLightHelper){constructor(e,r=6710886){super(e,r);this.object=e;this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,r){Zo(this.object,cv.geometryHelper,e,r)}update(){if(this.object!==void 0){let e=cv._vector,r=this.object.distance?this.object.distance:1e3,n=r*Math.tan(this.object.angle);this.cone.scale.set(n,n,r),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let o=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let a=0,s=this.cone.material.length;a<s;a++)this.cone.material[a].color.set(o);else this.cone.material.color.set(o)}}},Rh=cv;Rh._vector=new dv.Vector3;var HD=new Qi.Vector3,WD=new Qi.Vector3,qD=new Qi.Quaternion,Wa=class extends Xd(Qi.SpotLight,Rh){constructor(t,e,r){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=Qi.MathUtils.RAD2DEG*2*this.angle,o.aspect=1,o.near=100,o.far=2500;let a=new Qi.CameraHelper(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Qi.CameraHelper&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),WD.setFromMatrixPosition(this.matrixWorld),qD.setFromRotationMatrix(this.matrixWorld),HD.copy(this.up).applyQuaternion(qD).negate().multiplyScalar(this.distance),this.target.position.copy(WD).add(HD),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}};var Gt=class extends ad(XD.Scene){constructor(e,r,n){super();this.data=r;this.bgColor=new Vt(1,1,1,1);this.fog=null;this.backupFog=new Yd.Fog(16777215,.1,2e3);this.fogUseBGColor=!1;this.fogMode="linear";this.fogDensity=Ii.getDensity({});this.fogHeightFalloff=Ii.getHeightFalloff({});this.fogHeightBase=Ii.getHeightBase({});this.isActive=!1;this.skyState=null;this.skyStateVersion=0;this.gradingState=null;this.skyHdriHolder=null;this.aoColor=new Yd.Color;this.penumbraSizeArrayCache=null;if(this.super_Entity(e,r),this.personalCamera=new St(ko,{...Al.defaultData,...r.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new Yd.HemisphereLight(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),r.uiScene){let o=pS();o===null?xr("ui-2d","a page's 2D scene"):this.uiScene=new o.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",r.uiScene,{dpr:window.devicePixelRatio,shared:n.shared})}else r.uiFrame&&this.createUICanvas(r.uiFrame,n)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,r){let n=pS();if(n===null){xr("ui-2d","a page's UI canvas");return}this.uiCanvas=new n.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,r),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,r){e.color!==void 0&&(this.ambientLight.color=Yr(e.color,r)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(r=>{r instanceof ni&&r.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Ar)if(Array.isArray(e.material))for(let r of e.material)r.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let r=this.data.shadow,n=Pp.isSoft(r);dO(n,r?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,r){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let n=this.scene;n.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Yr(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Ii.getMode(e),this.fogDensity=Ii.getDensity(e),this.fogHeightFalloff=Ii.getHeightFalloff(e),this.fogHeightBase=Ii.getHeightBase(e)}updateSky(e,r){this.skyState=e??null,this.skyStateVersion++;let n=e?.hdri?.image;this.skyHdriHolder=n!=null?r.image(n):null}updateAo(e,r){e.aoColor!==void 0&&(this.aoColor=Yr(e.aoColor,r))}updateByOp(e,r,n,o){let a=this.data.uiFrame;super.updateByOp(e,r,n,o);let s=r;Ye(e.path,["fog"])?this.updateFog(s.fog,n.shared):Ye(e.path,["sky"])?this.updateSky(s.sky,n.shared):Ye(e.path,["grading"])?this.gradingState=s.grading??null:Ye(e.path,["ao"])?this.updateAo(s.ao,n.shared):Ye(e.path,["ambient"])?this.updateAmbientLight(s.ambient,n.shared):Ye(e.path,["shadow"])?this.updateShadow(s.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||a!==s.uiFrame)&&this.updateUIFrame(e.props.uiFrame,n)}updateUIFrame(e,r){e?(this.uiCanvas||this.createUICanvas(e,r),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,r){this.updateState_Entity(e,r),e.backgroundColor!==void 0&&this.setBackgroundColor(Yr(e.backgroundColor,r.shared)),e.fog!==void 0&&this.updateFog(e.fog,r.shared),e.sky!==void 0&&this.updateSky(e.sky,r.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,r.shared),e.ao!==void 0&&this.updateAo(e.ao,r.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,r){}raycast(e,r){super.raycast(e,r)}switchActiveCamera(e){e instanceof St&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){let e=this.scene?.find(this.data.publish.playCamera);return e instanceof St?e:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(Gn).fill(.5);let e=0,r=0;this.traverseEntity(n=>{if(!n.visible)return!0;n instanceof Ha&&n.visible&&e<Md&&(this.penumbraSizeArrayCache[e]=n.data.penumbraSize??.5,e+=1),n instanceof Wa&&n.visible&&e<Gn-Md&&(this.penumbraSizeArrayCache[Md+r]=n.data.penumbraSize??.5,r+=1)})}raycastWithClones(e){let r=[],n=o=>{for(let a of o.children){let s=a.cloner;Ne.is(a)&&(a.visible||s?.object.data.visible)&&((ii(a)||Ih(a)&&this.scene.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,r),Dh(a,e,r,!0)),n(a))}};return n(this),r}updateEntity2DByOp(e,r,n,o){this.uiCanvas?.updateEntity2DByOp(e,r,n,o)}};var JU=null;function YD(i){JU=i}var $U,KD=new Promise(i=>{$U=i});var Kr=require("three");var Kd=require("three");function ez(i){let t=i.elements,e=t[0]**2+t[1]**2+t[2]**2,r=t[4]**2+t[5]**2+t[6]**2,n=t[8]**2+t[9]**2+t[10]**2,o=t[0]**2+t[4]**2+t[8]**2,a=t[1]**2+t[5]**2+t[9]**2,s=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return e<l||r<l||n<l||o<l||a<l||s<l}function uv(i,t){let e=new Kd.BufferGeometry;if(t&&ez(t))return e.setAttribute("position",new Kd.Float32BufferAttribute([],3)),e.setIndex([]),e;if(!i.getAttribute("position"))return e.setAttribute("position",new Kd.Float32BufferAttribute([],3)),e.setIndex([]),e;let{positions:r,triIndices:n}=sh(i.getAttribute("position"),i.getIndex());return e.setAttribute("position",new Kd.Float32BufferAttribute(r,3)),e.setIndex(n),t&&e.applyMatrix4(t),e}var tz=require("three/examples/jsm/utils/BufferGeometryUtils.js");var rz;KD.then(i=>rz=i);var Eue=new Kr.Vector3,Tue=new Kr.Quaternion,Pue=new Kr.Vector3,Mue=new Kr.Vector3(1,1,1),Oue=new Kr.Euler(0,0,0,"YXZ"),Iue=new Kr.Euler(0,0,0,"XYZ"),Due=new Kr.Vector3,Rue=new Kr.Vector3,Bue=new Kr.Quaternion,Nue=new Kr.Matrix4,Lue=new Kr.Matrix4;var _ue=new Kr.Quaternion,kue=new Kr.Sphere;var aA={type:"beginEvent",eventName:"Collision"};var sA=i=>i.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.shear!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);var oR=require("three");yt();Np();var QD=4,lA=8;var cA=.02,dA=.3,nz=65,ZD=new ne.Vector3,JD=new ne.Vector3,iz=new ne.Vector3,Pn=new ne.Vector3,qa=new ne.Vector3,Qd=new ne.Vector3,uA=new ne.Matrix4,$D=new ne.Matrix4,oz=new ne.Matrix4,Ai=new ne.Quaternion,Ql=new ne.Quaternion,Zd=new ne.Euler(0,0,0,"YXZ"),az=new ne.Vector3(1,0,0),la=new ne.Vector3(0,1,0),sz=new ne.Vector3(0,0,1),eR=new ne.Vector3(1,1,1),pA=[],tR=i=>pA[i]??(pA[i]=new ne.Vector3),hA=new ne.Vector3,lz=new ne.Vector3,cz=new ne.Vector3,dz=new ne.Vector3,rR=new ne.Quaternion,uz=new ne.Vector3,nR=new ne.Quaternion,pz=1,hz=.025,fz=16e-6,iR=12,mz=20,nn=new ne.Line3,Zi=new ne.Box3,yz={type:"requestRender"},gz={type:"updateMatrix"},pv=class extends ne.EventDispatcher{constructor(e,r,n,o,a,s,l,c,d){super();this.object=e;this.domElement=r;this.data=n;this.gloabalPhysics=o;this.controlsManager=a;this.cameraFollow=s;this.camera=l;this.page=c;this.sharedAssets=d;this.enableDamping=!0;this.target0=new ne.Vector3;this.zoom0=1;this.rotForce=1;this.moveForce=1;this.pixelsPerMeter=dD;this.euler0=new ne.Euler(0,0,0,"YXZ");this.shearMatrix0=new ne.Matrix4;this.cameraShearMatrix0=new ne.Matrix4;this.position0Cam=new ne.Vector3;this.quat0Cam=new ne.Quaternion;this.scale0Cam=new ne.Vector3;this.threshEndTranslate=.01;this.threshEndRotate=1e-8;this.threshEndRotVel=.005;this.collider={type:"capsule",radius:40,segment:new ne.Line3(new ne.Vector3(0,-40,0),new ne.Vector3(0,40,0)),matrix:new ne.Matrix4,position:new ne.Vector3,rotation:new ne.Quaternion};this.euler=new ne.Euler(0,0,0,"YXZ");this.eulerDelta=new ne.Vector3;this.lastPosition=new ne.Vector3;this.lastCameraQuaternion=new ne.Quaternion;this.lastCameraPosition=new ne.Vector3;this.PI_2=Math.PI/2;this.prevMouse=new ne.Vector2;this.velocityTarget=new ne.Vector3;this.velocity=new ne.Vector3;this.directionXZ=new ne.Vector3;this.rotVelocityStick=new ne.Vector3;this.rotVelocityTarget=new ne.Vector3;this.rotVelocity=new ne.Vector3;this.rotDirection=new ne.Vector3;this.nonColliderRotOffset=new ne.Matrix4;this.nonColliderPosOffset=new ne.Matrix4;this.firstPointerId=-1;this.rot=new ne.Vector3;this.path=[];this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0};this.onObject=!1;this.actionState={};this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]];this.collisionEnabled=!0;this.offsetMatrix=new ne.Matrix4;this.objectToTarget=new ne.Vector3;this.objectToTarget0=new ne.Vector3;this.objectToCamXZ=new ne.Vector3;this.objectToCamXZ0=new ne.Vector3;this.targetToCamera=new ne.Vector3;this.targetToCamera0=new ne.Vector3;this.cameraPolarAxis0=new ne.Vector3;this.targetPos=new ne.Vector3;this.targetQuat=new ne.Quaternion;this.lerpFactorPos=new ne.Vector3().setScalar(.3);this.lerpFactorPosStart=.3;this.lerpFactorPosEnd=.3;this.lerpFactorRotStart=.3;this.lerpFactorRotEnd=.3;this.lerpFactorPosCamera=.3;this.lerpFactorRotCamera=.3;this.objXZQuat=new ne.Quaternion;this.objXZQuatInv=new ne.Quaternion;this.objXZRotMat=new ne.Matrix4;this.isFirstPerson=!1;this.didHit=!1;this.groundVelocity=new ne.Vector3;this.pushedVelocity=new ne.Vector3;this.groundYRotation=0;this.objectRealQuat=new ne.Quaternion;this.colliderWorldQuat=new ne.Quaternion;this.groundNormal=new ne.Vector3;this.groundTilt=new ne.Quaternion;this.groundTiltInv=new ne.Quaternion;this.lastHitObj=null;this.isFirstFrame=!0;this.rotationAccumWhenOrientWithCamera=0;this.navMeshPathDest=null;this.position=new ne.Vector3;this.quaternion=new ne.Quaternion;this.scale=new ne.Vector3;this.initialAction=!0;this.onPointerDown=e=>{!(e.target===this.domElement||e.target instanceof HTMLElement&&e.target.tagName==="SPLINE-VIEWER"&&e.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Zn&&!dS&&this.domElement.requestPointerLock(),this.prevMouse.set(e.clientX,e.clientY))};this.onPointerUp=e=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),e.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()};this.onPointerMove=e=>{if(e.pointerId!==this.firstPointerId)return;let r=e.clientX-this.prevMouse.x,n=e.clientY-this.prevMouse.y;this.prevMouse.set(e.clientX,e.clientY),e.pointerType==="mouse"&&this.rotBy!=="keys"&&(dS&&TP<15.5&&!Zn?(this.eulerDelta.y=-r*this.mouseOrbitSensitivity,this.eulerDelta.x=-n*this.mouseOrbitSensitivity):(this.eulerDelta.y=-e.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-e.movementY*this.mouseOrbitSensitivity)),e.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-r*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-n*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()};this.onPointerlockChange=e=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?pv.isLocked=!0:pv.isLocked=!1};this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")};this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0};this.onKeyDown=e=>{!(e.target instanceof HTMLInputElement)&&(e.code==="ArrowLeft"||e.code==="ArrowUp"||e.code==="ArrowRight"||e.code==="ArrowDown"||e.code==="Space")&&e.preventDefault();for(let r of this.keyAssignments)if(e.key.toUpperCase()===r[1]||e.key===r[1]){this.movementState[r[0]]=1;break}this.controlsManager.requestRender()};this.onKeyUp=e=>{for(let r of this.keyAssignments)if(e.key.toUpperCase()===r[1]||e.key===r[1]||e.code.slice(3,e.code.length).toUpperCase()===r[1]){this.movementState[r[0]]=0;break}};this.copyVRGamePadValues=(e,r)=>{for(let n=2;n<4;n++){let o=e.axes[n];r===0?n===2?this.movementState.movePosX=o:this.movementState.movePosZ=o:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,n===2?this.movementState.rotPosY=o:this.moveMode==="fly"&&(this.movementState.moveNegY=o))}};this.sharedGameControlGlobals=a.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.object.parent instanceof Gt||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),this.shearMatrix0.copy(this.object.shearMatrix),Ia(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix}),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let u=this.euler0.clone(),p=u.y;if(this.objectRealQuat.copy(this.quaternion),u.y=0,this.quaternion.setFromEuler(u),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),u.set(0,p,0),this.quaternion.setFromEuler(u),this.rot.setFromEuler(u),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.camera.parent instanceof Gt||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),this.cameraShearMatrix0.copy(this.camera.shearMatrix),Ia(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix})),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let y=new ne.Vector3(0,0,-1).applyQuaternion(this.camera.quaternion),g=new ne.Vector3().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(g),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let v;Math.abs(y.y)<1e-6?(g.y=0,y.y=0,v=g.projectOnVector(y)):g.y/y.y>0?v=y.multiplyScalar(g.y/y.y):v=y.multiplyScalar(g.length()),this.targetToCamera0.copy(v).negate();let b=this.camera.position.clone().add(v);this.objectToTarget0.subVectors(b,this.position);let S=new ne.Euler().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-S.x,S.x=0,S.z=0,S.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(S)}if(this.object instanceof St&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=n.rotByTouch??"joystick",this.rotBy=n.rotBy??"keys",this.rotationMode=n.rotationMode??"normal",this.moveMode=n.moveMode??"walk",this.collisionEnabled=n.collisionEnabled,this.speedTranslate=(n.speedTranslate??250)*pz,this.speedOrbit=(n.speedRotate??100)*hz,this.mouseOrbitSensitivity=(n.speedRotate??100)*fz,this.keyAssignments=n.keyAssignments.map(y=>{let g=[y[0],y[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),n.rotBy==="mouse"){let y;y=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),y!==-1&&(this.keyAssignments[y][1]=""),y=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),y!==-1&&(this.keyAssignments[y][1]=""),y=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),y!==-1&&(this.keyAssignments[y][1]=""),y=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),y!==-1&&(this.keyAssignments[y][1]="")}this.lerpFactorPosStart=1-.02**(1/((n.delayPos[0]??.3)*60)),this.lerpFactorPosEnd=1-.02**(1/((n.delayPos[1]??.3)*60)),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/((n.delayRot[0]??.3)*60)),this.lerpFactorRotEnd=1-.02**(1/((n.delayRot[1]??.3)*60)),this.lerpFactorPosCamera=1-.02**(1/((n.delayPosCamera??.3)*60)),this.lerpFactorRotCamera=1-.02**(1/((n.delayRotCamera??.3)*60)),this.gravity=(this.gloabalPhysics.gravity??vs.defaultData.gravity)*iR,this.usePhysics=this.gloabalPhysics.usePhysics??vs.defaultData.usePhysics,this.jumpPower=n.jumpPower*mz,this.resetYPosition=this.position.y+Math.abs(n.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=n.alignToGround??!1,this.orientMode=n.autoOrientMove?n.orientMode:"none",this.orientWith=n.orientWith??Wc.defaultDataThirdPerson.orientWith,this.slopeThresh=nz*Math.PI/180,n.collider.type==="capsule"?(this.collider.radius=n.collider.radius,this.collider.segment.start.y=n.collider.height/2-n.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=n.collider.height*cA/this.pixelsPerMeter,this.stepThresh=n.collider.height*dA/this.pixelsPerMeter,this.colliderHeight=n.collider.height):n.collider.type==="sphere"?(this.collider.radius=n.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*n.collider.radius*cA/this.pixelsPerMeter,this.stepThresh=2*n.collider.radius*dA/this.pixelsPerMeter,this.colliderHeight=n.collider.radius*2):(this.offset=n.collider.height*cA/this.pixelsPerMeter,this.stepThresh=n.collider.height*dA/this.pixelsPerMeter,this.colliderHeight=n.collider.height),this.collider.type=n.collider.type;let h=new ne.Vector3().fromArray(n.collider.position.map(y=>typeof y=="number"?y:0)),f=new ne.Quaternion().setFromEuler(new ne.Euler().fromArray([...n.collider.rotation.map(y=>typeof y=="number"?y:0),"XYZ"]));this.collider.position.copy(h).multiply(this.scale),this.collider.rotation.copy(f),this.collider.matrix.compose(h,f,eR),n.cameraXAxis!==void 0&&(this.cameraXAxis=n.cameraXAxis,this.cameraYAxis=n.cameraYAxis,this.minPolarAngle=n.cameraRotXLimits[0],this.maxPolarAngle=n.cameraRotXLimits[1],this.minAzimuthAngleRel=n.cameraRotYLimits[0],this.maxAzimuthAngleRel=n.cameraRotYLimits[1]),this.forwardDir=n.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=n.runMultiplier??2;let m=n.navmesh.destinationHelperRadius*2;if(m>0){let y=new oe;y.push({fi:0,data:{...qt.defaultData("light","phong"),alpha:0},id:"layer1"}),y.push({fi:0,data:{...qt.defaultData("color"),color:n.navmesh.destinationHelperColor,alpha:n.navmesh.destinationHelperColor.a},id:"layer2"});let g=fg({layers:y},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new oR.Mesh(Hy.create({parameters:{width:m,height:m/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=n.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.matrixWorldAutoUpdate=!0,this.camera.matrixWorldAutoUpdate=!0,this.object.shearMatrix.copy(this.shearMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.parent instanceof Gt||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),Ia(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix});let r=new ne.Euler().setFromQuaternion(this.quaternion,"YXZ"),n=r.y;this.objectRealQuat.copy(this.quaternion),r.y=0,this.quaternion.setFromEuler(r),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),r.set(0,n,0),this.quaternion.setFromEuler(r),this.rot.setFromEuler(r),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof St?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.shearMatrix.copy(this.cameraShearMatrix0),e?(this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.parent instanceof Gt||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),Ia(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix}))):this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,r=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},Hc.list.forEach(n=>{this.actions[n]=Ft({...e,disabled:!1,type:"GameControl"},e.gameActions[n],this.page,r,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),Sr(this.actions.idle),Sr(this.actions.move),Sr(this.actions.run),Sr(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(r=>{r.play()}),this.actions[e].Animation.forEach(r=>{r.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(r=>{r.play()}),this.actions[e].Create.forEach(r=>{r.dispatchStart()}),this.actions[e].Audio.forEach(r=>{r.dispatchGameControl("start")}),this.actions[e].Particles.forEach(r=>{r.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(r=>{r.stop(),r.object.currentState!==null&&r.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(r=>{r.stop()}),this.actions[e].Create.forEach(r=>{r.dispatchStop()}),this.actions[e].Audio.forEach(r=>{r.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(r=>{r.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Pn.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let r=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let n=r*60,o=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=qa.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*iR),1)*(this.gravity>0?1:-1):this.velocity.y)*r,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,lA,void 0,void 0,this.object.rigidBody);if(l){this.onObject=!0,this.groundNormal.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(o=!0),l.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let c=l.collider.parent(),d=c!==null&&c.isKinematic()?c:null,u=d===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(d.handle);if(d!==null&&u?.userData.isFollowingObj!==this.object.uuid){let p=this.object.getWorldPosition(Pn).add(this.collider.position).divideScalar(this.pixelsPerMeter),h=d.velocityAtPoint(p);this.groundVelocity.set(h.x,h.y,h.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=d.angvel().y*r}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*n),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=Pn.subVectors(this.path[1],this.position),c=qa.subVectors(this.path[1],this.path[0]);l.dot(c)<0?this.path.shift():(this.directionXZ.x=c.x,this.directionXZ.z=c.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**n),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**n),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**n)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let a=iz.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=qa.copy(a);s.y=0,a.set(0,a.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=Pn;this.camera.getWorldDirection(s);let l=Qd.copy(la).multiplyScalar(s.dot(la));s.sub(l);let c=qa.copy(this.directionXZ);c.x*=-1,this.rot.y=s.angleTo(c)*(s.cross(c).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(Zd.setFromVector3(this.rot),this.moveMode==="walk"&&(Zd.x=0),a.applyEuler(Zd),o&&(Ql.setFromUnitVectors(la,this.groundNormal),a.applyQuaternion(Ql)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(l.rigidBody===void 0||l.prevQ===void 0)continue;(l.hasNonUniformScale?l.matrixWorldRigid:l.matrixWorld).decompose(hA,rR,lz);let c=this.object.getWorldPosition(cz).add(this.collider.position).sub(hA);nR.copy(l.prevQ).invert().premultiply(rR);let d=Qd.subVectors(hA,l.prevT).add(dz.copy(c).applyQuaternion(nR).sub(c)).divideScalar(r).divideScalar(this.pixelsPerMeter),u=l.rigidBody.collider(0).castCollider(d,this.object.rigidBody.collider(0),Pn.copy(a).divideScalar(this.pixelsPerMeter),0,r,!1);d.multiplyScalar(this.pixelsPerMeter);let p=Ne.is(l)?l:l.object;if(u!==null&&this.lastHitObj!==p){let h;l instanceof lr&&(h=l);let f=this.sharedGameControlGlobals.entityToCollisionEvents[p.uuid];if(f)for(let m of f)m.data.target==="character"&&(m.dispatch(h),p.dispatchEvent(aA));this.lastHitObj=p}u!==null&&(Math.abs(d.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=d.x),Math.abs(d.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=d.y),Math.abs(d.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=d.z),tR(s++).copy(u.normal1).applyQuaternion(l.quaternion))}if(s>0){for(let l=0;l<s;l++){let c=tR(l),d=c.dot(a);d<0&&a.addScaledVector(c,-d)}a.add(this.pushedVelocity)}else a.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(r),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**n):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**n),this.euler.x+=this.rotVelocity.x*r,this.euler.y+=this.rotVelocity.y*r+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*r),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(la,this.euler.y-this.euler0.y);let s=qa.copy(this.objectToCamXZ).normalize(),l=Qd.copy(a).multiplyScalar(r);l.y=0;let c=l.sub(Pn.copy(s).multiplyScalar(l.dot(s))).cross(s).y;this.euler.y-=Math.atan2(c,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*r+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=ne.MathUtils.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=ne.MathUtils.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=ne.MathUtils.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(Zd.copy(this.euler),Zd.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Zd)),Ai.setFromAxisAngle(az,this.rot.x),Ql.setFromAxisAngle(la,this.rot.y),Ql.multiply(Ai),Ai.setFromAxisAngle(sz,this.rot.z),Ql.multiply(Ai),this.quaternion.copy(Ql),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=qa.copy(a).multiplyScalar(r/this.pixelsPerMeter),l=null;this.didHit=!1;let c=new ne.Vector3;for(let p=0;p<5;p++){let h=s.length(),f=Qd.copy(s).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),this.colliderWorldQuat,f,this.object.rigidBody.collider(0).shape,0,h,!1,lA|QD,void 0,void 0,this.object.rigidBody),l!==null){this.didHit=!0;let m=this.sharedGameControlGlobals.colliderToEntity.get(l.collider.handle);if(m!==this.lastHitObj&&p===0){this.lastHitObj=m;let b=this.sharedGameControlGlobals.entityToCollisionEvents[m?.uuid];if(b){for(let S of b)if(S.data.target==="character"){let x=(this.sharedGameControlGlobals.rapierWorld?.getCollider(l.collider.handle))._parent,A;if(m.cloner){for(let w of m.cloner.children)if(w.rigidBody===x){A=w;break}}S.dispatch(A),m.dispatchEvent(aA)}}}let y=ZD.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),g=JD.copy(f).multiplyScalar(l.time_of_impact).dot(y),v=l.time_of_impact;if(v===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(v=l.time_of_impact*(g-this.offset)/g,c.addScaledVector(f,v)),s.copy(f).multiplyScalar(h-v),Math.acos(-y.y)>this.slopeThresh){let b=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),S=Qd.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);S.y=0;let x=b.add(S);x.y+=this.stepThresh;let A=this.sharedGameControlGlobals.rapierWorld.castShape(x,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,lA|QD,void 0,void 0,this.object.rigidBody);A!==null&&A.time_of_impact===0&&(y.y=0,y.normalize())}s.addScaledVector(y,-s.dot(y))}else{p===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),c.add(s);break}}this.position.addScaledVector(c,this.pixelsPerMeter),Pn.copy(this.position).divideScalar(this.pixelsPerMeter),Ai.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let d=this.object.rigidBody,u=d!==void 0&&uz.copy(Pn).sub(d.translation()).lengthSq()>1;d!==void 0&&(u?(d.setTranslation(Pn,!0),d.setRotation(Ai,!0)):(d.setNextKinematicTranslation(Pn),d.setNextKinematicRotation(Ai)))}else{let s=this.onObject?1:5,l=a.multiplyScalar(r/s);for(let c=0;c<s;c++)this.position.add(l),this.collisionAdjustment(r/s)}else this.position.addScaledVector(a,r);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),hS(this.position,this.quaternion,this.object.shearMatrix,this.scale,this.object.matrix).multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.object.parent instanceof Gt?this.object.matrixWorld.multiplyMatrices(this.object.parent.matrixWorld,this.object.matrix).multiply(this.object.pivotMatrix):this.object.matrixWorld.copy(this.object.matrix),this.object.children.forEach(s=>{s.updateMatrixWorld(!0)}),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),l=this.targetToCamera.add(s);uA.lookAt(l,s,la).setPosition(l),uA.decompose(this.targetPos,this.targetQuat,Pn),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**n),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**n),this.camera.updateMatrix(),this.camera.matrixWorld.copy(this.camera.matrix),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=ne.MathUtils.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=ne.MathUtils.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(gz),this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)?!1:(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(yz),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Ai.setFromAxisAngle(la,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?ne.MathUtils.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e);let r;this.cameraXAxis==="Limit"?r=ne.MathUtils.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):r=ne.MathUtils.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let n=Pn.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&n.applyQuaternion(e);let o=Ql.setFromAxisAngle(n,r);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(o)}groundTiltAdjustment(e){la.angleTo(e)*180/Math.PI<15||la.angleTo(e)*180/Math.PI>85?Ai.identity():Ai.setFromUnitVectors(la,e),this.groundTilt.slerp(Ai,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let r=JD.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let n=uA.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Pn,Ai,qa).compose(Pn,Ai,eR);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(a=>{if(a===this.object||a.isDescendantOf(this.object)||!a.bvhGeometry||!a.bvhGeometry.boundsTree)return;Zi.makeEmpty(),a.updateMatrixWorldRigid();let s=a.matrixWorldRigid,l=$D.copy(s).invert(),c=oz.copy($D).multiply(n);nn.copy(this.collider.segment),nn.start.applyMatrix4(c),nn.end.applyMatrix4(c);let d=ZD.copy(this.position).applyMatrix4(l);Zi.expandByPoint(nn.start),Zi.expandByPoint(nn.end),Zi.min.addScalar(-this.collider.radius),Zi.max.addScalar(this.collider.radius),a.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder(u){return u.distanceToPoint(nn.end)},intersectsBounds:u=>u.intersectsBox(Zi),intersectsTriangle:u=>{let p=Pn,h=qa,f=u.closestPointToSegment(nn,p,h);if(f<this.collider.radius){let m=this.collider.radius-f,y=h.sub(p).normalize(),g=Qd.copy(d);g.addScaledVector(y,m);let v=g.applyMatrix4(s).sub(this.position);r.add(v),nn.start.addScaledVector(y,m),nn.end.addScaledVector(y,m)}}})}),Zi.makeEmpty(),nn.copy(this.collider.segment),nn.start.applyMatrix4(n),nn.end.applyMatrix4(n),Zi.expandByPoint(nn.start),Zi.expandByPoint(nn.end),Zi.min.addScalar(-this.collider.radius),Zi.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder(a){return a.distanceToPoint(nn.end)},intersectsBounds:a=>a.intersectsBox(Zi),intersectsTriangle:a=>{let s=Pn,l=qa,c=a.closestPointToSegment(nn,s,l);if(c<this.collider.radius){let d=this.collider.radius-c,u=l.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(u),r.addScaledVector(u,d),nn.start.addScaledVector(u,d),nn.end.addScaledVector(u,d)}}}),this.onObject=Math.abs(r.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let o=Math.max(0,r.length()-1e-5);r.normalize().multiplyScalar(o),this.position.add(r)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},Bh=pv;Bh.isLocked=!1;var Co=require("three"),cR=require("three/examples/jsm/utils/BufferGeometryUtils.js");var vz,aR=new Promise(i=>{vz=i});var sR;var bz=!1?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.124/build/",xz=i=>`
1328
1328
  (async function() {
1329
1329
  const [wasmImport, wasmBinary] = await Promise.all([
1330
1330
  import('${i}' + 'navmesh.js'),
@@ -1548,7 +1548,7 @@ outputColor=vec4(color,inputColor.a);}`,Fb={DEFAULT:0,ESKIL:1},ZN=class extends
1548
1548
 
1549
1549
  return 1.0;
1550
1550
 
1551
- }`,tL=/float getDistanceAttenuation\([^)]*\)\s*\{[\s\S]*?\n\}/,rL=()=>{if(!tL.test(Tf.ShaderChunk.lights_pars_begin)){if(Tf.ShaderChunk.lights_pars_begin.includes(eL))return;throw new Error("spe: could not find getDistanceAttenuation in lights_pars_begin \u2014 three shader chunk layout changed")}Tf.ShaderChunk.lights_pars_begin=Tf.ShaderChunk.lights_pars_begin.replace(tL,eL)};yt();var Qb="vertexOrder";function nL(i){let t=i.attributes.find(s=>s.name===Qb);if(!t)return i;let e=t.array,r=e.length,n=0;for(let s=0;s<r;s++)n=Math.max(n,e[s]+1);let o=i.attributes.filter(s=>s!==t).map(({name:s,itemSize:l,array:c})=>{let d=new Float32Array(n*l);for(let u=0;u<r;u++){let p=e[u]*l,h=u*l;for(let f=0;f<l;f++)d[p+f]=c[h+f]}return{name:s,itemSize:l,array:d}}),a;if(i.index){let s=i.index.array,l=new Uint32Array(s.length);for(let c=0;c<s.length;c++)l[c]=e[s[c]];a={array:l}}return{index:a,attributes:o}}var fc,Gw;function iL(i){return Gw||(Gw=import("three/examples/jsm/loaders/DRACOLoader.js").then(({DRACOLoader:t})=>(fc=new t,fc.setDecoderPath(i!==void 0?`${i}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),fc.decoderPending))),Gw}async function PH(i){if(fc){let t={attributeIDs:{...fc.defaultAttributeIDs,[Qb]:"GENERIC"},attributeTypes:{...fc.defaultAttributeTypes,[Qb]:"Uint32Array"},useUniqueIDs:!1},e;try{e=await fc.decodeGeometry(new Int8Array(i).buffer,t)}catch(r){console.error(r)}if(e)return nL({index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([r,n])=>({name:r,itemSize:n.itemSize,array:n.array}))})}return null}async function oL(i,t){let[e,r]=qx(gl.deserialize(new Uint8Array(i)));if((e.schema??0)!==135){let{updateDocumentSchema:n}=await Promise.resolve().then(()=>(ly(),bP));n(e)}return t&&t(e),r.result().data}function aL(i){let t=[];return i.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&r.geometry.type==="NonParametricGeometry"&&r.geometry.data.draco!==void 0&&t.push(r)}),t}async function sL(i){for(let t of i){let e=await PH(t.geometry.data.draco);if(e){let r=t.geometry.data;e.index&&(r.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let n={};e.attributes.forEach(({name:o,array:a,itemSize:s})=>{n[o]={array:a,itemSize:s,type:"Float32Array",normalized:!1}}),r.attributes=n,r.draco=void 0}}}var cx=require("three");function MH(i){let t=i?.layers;if(!t)return!1;for(let e of t)if(e.data.type==="transmission"&&e.data.visible)return!0;return!1}var lL=!0;try{lL=new URLSearchParams(window.location.search).get("dbgdepthprepass")!=="0"}catch{}function cL(i){return lL&&i.transparent&&i.depthTest&&!i.wireframe&&!i.shapeBlend&&!MH(i.data)}var ns=class{constructor(t){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};if(ns.uuidContext===null)throw new Error("plz startContext");ns.uuidContext===ns.globalContext?this.uuid="_gid"+ns.uuidContext.nodeContextUuid++:this.uuid="_uid"+ns.uuidContext.nodeContextUuid++,this.type=t,this.name=""}static startContext(t){this.uuidContext===null||this.uuidContext===ns.globalContext?this.uuidContext=t:console.error("Can't start context twice")}static endContext(t){this.uuidContext!==t&&console.error("Can't end context twice"),this.uuidContext=null}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 n={result:this.build(t,e),code:t.clearNodeCode(),extra:t.context.extra};return t.removeFlow(),n}build(t,e,r){e=e??this.getType(t,e);let n=t.getNodeData(r??this);return t.analyzing&&this.appendDepsNode(t,n,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,n,o,a){return""}generate(t,e,r,n,o){return""}parse(t,e,r,n){}appendDepsNode(t,e,r){e.deps=(e.deps||0)+1;let n=t.getTypeLength(r);(n>(e.outputMax||0)||this.getType(t,r))&&(e.outputMax=n,e.output=r)}setName(t){this.name=t}getName(){return this.name}getType(t,e){return e==="sampler2D"||e==="samplerCube"?e:this.type}},gt=ns;gt.globalContext={nodeContextUuid:0},gt.uuidContext=ns.globalContext;var _u=require("three");var Uw=require("three"),Iu=3e3,Pf=3001;function dL(i){return i===Uw.SRGBColorSpace?Pf:Iu}var Mf=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 zw=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}},Zr=new zw;var jw=require("three");var uL=require("three"),we=class extends gt{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,n,o){if(r=r??this.getType(e),this.getShared(e,r)){let a=this.getUnique(e,r);a&&this.uuid===void 0&&(this.uuid=uL.MathUtils.generateUUID()),n=e.getUUID(n??this.getUUID(),!a);let s=e.getNodeData(n),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,n)):super.build(e,r,n);if(a)return s.name=s.name||super.build(e,r,n),s.name;if(!this.getLabel()&&(!this.getShared(e,l)||e.context.ignoreCache||s.deps===1))return super.build(e,r,n);n=this.getUUID(!1);let c=this.getTemp(e,n);if(c)return e.format(c,l,r);{c=super.generate(e,r,n,s.output,o);let d=this.generate(e,l,n);return e.addNodeCode(c+" = "+d+";"),e.format(c,l,r)}}return super.build(e,r,n)}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 n=e.getVars()[r];return n?n.name:void 0}generate(e,r,n,o,a){return this.getShared(e,r)||console.error("TempNode is not shared"),n=n??this.uuid,e.getTempVar(n,o??this.getType(e),a,this.getLabel()).name}};var Mt=class extends we{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,n,o,a,s){n=e.getUUID(n??this.getUUID()),o=o??this.getType(e);let l=e.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,r,n,o,a,s):e.isShader("vertex")?(l.vertex||(l.vertex=e.createVertexUniform(o,this,a,s,this.getLabel())),e.format(l.vertex.name,o,r)):(l.fragment||(l.fragment=e.createFragmentUniform(o,this,a,s,this.getLabel())),e.format(l.fragment.name,o,r))}};var Zt=class extends Mt{constructor(e=0,r){super("v2");this.nodeType="Vector2";this.value=e instanceof jw.Vector2?e:new jw.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,n,o,a,s){return e.format("vec2("+this.value.x+", "+this.value.y+")",o,r)}};var Hw=require("three");var mr=class extends Mt{constructor(e=0,r,n){super("v3");this.nodeType="Vector3";this.value=e instanceof Hw.Vector3?e:new Hw.Vector3(e,r,n)}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,n,o,a,s){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",o,r)}};var Rn=class extends Mt{constructor(e){super("v4");this.nodeType="Vector4";this.value=e instanceof Vt?e:new Vt(e.r,e.g,e.b,e.a)}generateReadonly(e,r,n,o,a,s){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",o,r)}};var ee=class extends Mt{constructor(e){super("f");this.nodeType="Float";this.value=e??0}generateReadonly(e,r,n,o,a,s){return e.format(this.value+(this.value%1?"":".0"),o,r)}};var OH=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,pL=/[a-z_0-9]+/gi,$=class extends we{constructor(e,r,n,o,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,n,o)}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,n,o,a){let s,l=0,c=this.src;if(this.includes)for(let u=0;u<this.includes.length;u++)e.include(this.includes[u],this);for(let u in this.extensions)e.extensions[u]=!0;let d=[];for(;s=pL.exec(this.src);)d.push(s);for(let u=0;u<d.length;u++){let p=d[u],h=p[0],f=this.isMethod?!this.getInputByName(h):!0,m=h;if(this.keywords[h]||this.useKeywords&&f&&Zr.containsKeyword(h)){let y=this.keywords[h];if(!y){let g=Zr.getKeywordData(h);g.cache&&(y=e.keywords[h]),y=y||Zr.getKeyword(h,e),g.cache&&(e.keywords[h]=y)}m=y.build(e)}h!==m&&c[p.index+l-1]!=="."&&(c=c.substring(0,p.index+l)+m+c.substring(p.index+h.length+l),l+=m.length-h.length),this.getIncludeByName(m)===void 0&&Zr.contains(m)&&e.include(Zr.get(m))}return r==="source"?c:this.isMethod?(this.isInterface||e.include(this,void 0,c),this.name):e.format("( "+c+" )",this.getType(e),r)}parse(e,r,n,o){if(this.src=e||"",this.includes=r??[],this.extensions=n??{},this.keywords=o??{},this.isMethod){let a=OH.exec(this.src);if(this.inputs=[],a&&a.length==4){this.type=a[1],this.name=a[2];let s=a[3].match(pL);if(s){let l=0;for(;l<s.length;){let c=s[l++],d;c==="in"||c==="out"||c==="inout"?d=s[l++]:(d=c,c="");let u=s[l++];this.inputs.push({name:u,type:d,qualifier:c})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}};var IH=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?=?\s?(.*?)(;|$)/i,Ww=class extends we{constructor(e="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||Ww.PI,void 0,void 0,void 0,r)}getType(e){return e.getTypeByFormat(this.type)}parse(e,r,n,o,a){this.src=e||"";let s,l,c="",d=IH.exec(e);this.useDefine=a??this.src.charAt(0)==="#",d&&d.length>1?(l=d[1],s=d[2],c=d[3]):(s=this.src,l="f"),this.name=s,this.type=l,this.value=c}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,n,o,a){return e.format(this.name,this.getType(e),r)}},lt=Ww;lt.PI="PI",lt.PI2="PI2",lt.RECIPROCAL_PI="RECIPROCAL_PI",lt.RECIPROCAL_PI2="RECIPROCAL_PI2",lt.LOG2="LOG2",lt.EPSILON="EPSILON";var DH=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
1551
+ }`,tL=/float getDistanceAttenuation\([^)]*\)\s*\{[\s\S]*?\n\}/,rL=()=>{if(!tL.test(Tf.ShaderChunk.lights_pars_begin)){if(Tf.ShaderChunk.lights_pars_begin.includes(eL))return;throw new Error("spe: could not find getDistanceAttenuation in lights_pars_begin \u2014 three shader chunk layout changed")}Tf.ShaderChunk.lights_pars_begin=Tf.ShaderChunk.lights_pars_begin.replace(tL,eL)};yt();var Qb="vertexOrder";function nL(i){let t=i.attributes.find(s=>s.name===Qb);if(!t)return i;let e=t.array,r=e.length,n=0;for(let s=0;s<r;s++)n=Math.max(n,e[s]+1);let o=i.attributes.filter(s=>s!==t).map(({name:s,itemSize:l,array:c})=>{let d=new Float32Array(n*l);for(let u=0;u<d.length;u++)d[u]=c[u%l];for(let u=0;u<r;u++){let p=e[u]*l,h=u*l;for(let f=0;f<l;f++)d[p+f]=c[h+f]}return{name:s,itemSize:l,array:d}}),a;if(i.index){let s=i.index.array,l=new Uint32Array(s.length);for(let c=0;c<s.length;c++)l[c]=e[s[c]];a={array:l}}return{index:a,attributes:o}}var fc,Gw;function iL(i){return Gw||(Gw=import("three/examples/jsm/loaders/DRACOLoader.js").then(({DRACOLoader:t})=>(fc=new t,fc.setDecoderPath(i!==void 0?`${i}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),fc.decoderPending))),Gw}async function PH(i){if(fc){let t={attributeIDs:{...fc.defaultAttributeIDs,[Qb]:"GENERIC"},attributeTypes:{...fc.defaultAttributeTypes,[Qb]:"Uint32Array"},useUniqueIDs:!1},e;try{e=await fc.decodeGeometry(new Int8Array(i).buffer,t)}catch(r){console.error(r)}if(e)return nL({index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([r,n])=>({name:r,itemSize:n.itemSize,array:n.array}))})}return null}async function oL(i,t){let[e,r]=qx(gl.deserialize(new Uint8Array(i)));if((e.schema??0)!==135){let{updateDocumentSchema:n}=await Promise.resolve().then(()=>(ly(),bP));n(e)}return t&&t(e),r.result().data}function aL(i){let t=[];return i.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&r.geometry.type==="NonParametricGeometry"&&r.geometry.data.draco!==void 0&&t.push(r)}),t}async function sL(i){for(let t of i){let e=await PH(t.geometry.data.draco);if(e){let r=t.geometry.data;e.index&&(r.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let n={};e.attributes.forEach(({name:o,array:a,itemSize:s})=>{n[o]={array:a,itemSize:s,type:"Float32Array",normalized:!1}}),r.attributes=n,r.draco=void 0}}}var cx=require("three");function MH(i){let t=i?.layers;if(!t)return!1;for(let e of t)if(e.data.type==="transmission"&&e.data.visible)return!0;return!1}var lL=!0;try{lL=new URLSearchParams(window.location.search).get("dbgdepthprepass")!=="0"}catch{}function cL(i){return lL&&i.transparent&&i.depthTest&&!i.wireframe&&!i.shapeBlend&&!MH(i.data)}var ns=class{constructor(t){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};if(ns.uuidContext===null)throw new Error("plz startContext");ns.uuidContext===ns.globalContext?this.uuid="_gid"+ns.uuidContext.nodeContextUuid++:this.uuid="_uid"+ns.uuidContext.nodeContextUuid++,this.type=t,this.name=""}static startContext(t){this.uuidContext===null||this.uuidContext===ns.globalContext?this.uuidContext=t:console.error("Can't start context twice")}static endContext(t){this.uuidContext!==t&&console.error("Can't end context twice"),this.uuidContext=null}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 n={result:this.build(t,e),code:t.clearNodeCode(),extra:t.context.extra};return t.removeFlow(),n}build(t,e,r){e=e??this.getType(t,e);let n=t.getNodeData(r??this);return t.analyzing&&this.appendDepsNode(t,n,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,n,o,a){return""}generate(t,e,r,n,o){return""}parse(t,e,r,n){}appendDepsNode(t,e,r){e.deps=(e.deps||0)+1;let n=t.getTypeLength(r);(n>(e.outputMax||0)||this.getType(t,r))&&(e.outputMax=n,e.output=r)}setName(t){this.name=t}getName(){return this.name}getType(t,e){return e==="sampler2D"||e==="samplerCube"?e:this.type}},gt=ns;gt.globalContext={nodeContextUuid:0},gt.uuidContext=ns.globalContext;var _u=require("three");var Uw=require("three"),Iu=3e3,Pf=3001;function dL(i){return i===Uw.SRGBColorSpace?Pf:Iu}var Mf=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 zw=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}},Zr=new zw;var jw=require("three");var uL=require("three"),we=class extends gt{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,n,o){if(r=r??this.getType(e),this.getShared(e,r)){let a=this.getUnique(e,r);a&&this.uuid===void 0&&(this.uuid=uL.MathUtils.generateUUID()),n=e.getUUID(n??this.getUUID(),!a);let s=e.getNodeData(n),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,n)):super.build(e,r,n);if(a)return s.name=s.name||super.build(e,r,n),s.name;if(!this.getLabel()&&(!this.getShared(e,l)||e.context.ignoreCache||s.deps===1))return super.build(e,r,n);n=this.getUUID(!1);let c=this.getTemp(e,n);if(c)return e.format(c,l,r);{c=super.generate(e,r,n,s.output,o);let d=this.generate(e,l,n);return e.addNodeCode(c+" = "+d+";"),e.format(c,l,r)}}return super.build(e,r,n)}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 n=e.getVars()[r];return n?n.name:void 0}generate(e,r,n,o,a){return this.getShared(e,r)||console.error("TempNode is not shared"),n=n??this.uuid,e.getTempVar(n,o??this.getType(e),a,this.getLabel()).name}};var Mt=class extends we{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,n,o,a,s){n=e.getUUID(n??this.getUUID()),o=o??this.getType(e);let l=e.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,r,n,o,a,s):e.isShader("vertex")?(l.vertex||(l.vertex=e.createVertexUniform(o,this,a,s,this.getLabel())),e.format(l.vertex.name,o,r)):(l.fragment||(l.fragment=e.createFragmentUniform(o,this,a,s,this.getLabel())),e.format(l.fragment.name,o,r))}};var Zt=class extends Mt{constructor(e=0,r){super("v2");this.nodeType="Vector2";this.value=e instanceof jw.Vector2?e:new jw.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,n,o,a,s){return e.format("vec2("+this.value.x+", "+this.value.y+")",o,r)}};var Hw=require("three");var mr=class extends Mt{constructor(e=0,r,n){super("v3");this.nodeType="Vector3";this.value=e instanceof Hw.Vector3?e:new Hw.Vector3(e,r,n)}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,n,o,a,s){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",o,r)}};var Rn=class extends Mt{constructor(e){super("v4");this.nodeType="Vector4";this.value=e instanceof Vt?e:new Vt(e.r,e.g,e.b,e.a)}generateReadonly(e,r,n,o,a,s){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",o,r)}};var ee=class extends Mt{constructor(e){super("f");this.nodeType="Float";this.value=e??0}generateReadonly(e,r,n,o,a,s){return e.format(this.value+(this.value%1?"":".0"),o,r)}};var OH=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,pL=/[a-z_0-9]+/gi,$=class extends we{constructor(e,r,n,o,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,n,o)}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,n,o,a){let s,l=0,c=this.src;if(this.includes)for(let u=0;u<this.includes.length;u++)e.include(this.includes[u],this);for(let u in this.extensions)e.extensions[u]=!0;let d=[];for(;s=pL.exec(this.src);)d.push(s);for(let u=0;u<d.length;u++){let p=d[u],h=p[0],f=this.isMethod?!this.getInputByName(h):!0,m=h;if(this.keywords[h]||this.useKeywords&&f&&Zr.containsKeyword(h)){let y=this.keywords[h];if(!y){let g=Zr.getKeywordData(h);g.cache&&(y=e.keywords[h]),y=y||Zr.getKeyword(h,e),g.cache&&(e.keywords[h]=y)}m=y.build(e)}h!==m&&c[p.index+l-1]!=="."&&(c=c.substring(0,p.index+l)+m+c.substring(p.index+h.length+l),l+=m.length-h.length),this.getIncludeByName(m)===void 0&&Zr.contains(m)&&e.include(Zr.get(m))}return r==="source"?c:this.isMethod?(this.isInterface||e.include(this,void 0,c),this.name):e.format("( "+c+" )",this.getType(e),r)}parse(e,r,n,o){if(this.src=e||"",this.includes=r??[],this.extensions=n??{},this.keywords=o??{},this.isMethod){let a=OH.exec(this.src);if(this.inputs=[],a&&a.length==4){this.type=a[1],this.name=a[2];let s=a[3].match(pL);if(s){let l=0;for(;l<s.length;){let c=s[l++],d;c==="in"||c==="out"||c==="inout"?d=s[l++]:(d=c,c="");let u=s[l++];this.inputs.push({name:u,type:d,qualifier:c})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}};var IH=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?=?\s?(.*?)(;|$)/i,Ww=class extends we{constructor(e="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||Ww.PI,void 0,void 0,void 0,r)}getType(e){return e.getTypeByFormat(this.type)}parse(e,r,n,o,a){this.src=e||"";let s,l,c="",d=IH.exec(e);this.useDefine=a??this.src.charAt(0)==="#",d&&d.length>1?(l=d[1],s=d[2],c=d[3]):(s=this.src,l="f"),this.name=s,this.type=l,this.value=c}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,n,o,a){return e.format(this.name,this.getType(e),r)}},lt=Ww;lt.PI="PI",lt.PI2="PI2",lt.RECIPROCAL_PI="RECIPROCAL_PI",lt.RECIPROCAL_PI2="RECIPROCAL_PI2",lt.LOG2="LOG2",lt.EPSILON="EPSILON";var DH=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
1552
1552
  )*?)}`,"gim"),RH=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),Du=class extends we{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,n,o,a){return r==="source"?this.src+";":e.format("( "+this.src+" )",this.getType(e),r)}parse(e=""){this.src=e,this.inputs=[];let r=DH.exec(e);if(r){let n=r[2],o;for(;o=RH.exec(n);)this.inputs.push({type:o[1],name:o[2]});this.name=r[1]}else this.name="";this.type=this.name}};var Ru=class extends we{constructor(e){super("v2",{shared:!1});this.nodeType="UV";this.index=e??0}generate(e,r){e.requires.uv[this.index]=!0;let n=this.index>0?this.index+1:"",o=e.isShader("vertex")?"uv"+n:"vUv"+n;return e.format(o,this.getType(e),r)}};Zr.addKeyword("uv",function(){return new Ru});Zr.addKeyword("uv2",function(){return new Ru(1)});var mc=class extends we{constructor(e,r){super("v4");this.nodeType="ColorSpace";this.input=e,this.method=r??mc.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case Iu:return["Linear"];case Pf:return["sRGB"];default:return[]}}generate(e,r){let n=this.input.build(e,"v4"),o=this.getType(e),a=mc.Nodes[this.method],s=e.include(a);if(s===mc.LINEAR_TO_LINEAR)return e.format(n,o,r);if(a.inputs?.length===2){let l=this.factor.build(e,"f");return e.format(s+"( "+n+", "+l+" )",o,r)}else return e.format(s+"( "+n+" )",o,r)}fromEncoding(e){let r=mc.getEncodingComponents(e);this.method="LinearTo"+r[0],this.factor=r[1]}fromDecoding(e){let r=mc.getEncodingComponents(e);this.method=r[0]+"ToLinear",this.factor=r[1]}},qn=mc;qn.Nodes={LinearToLinear:new $(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(`
1553
1553
  `)),sRGBToLinear:new $(["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(`
1554
1554
  `)),LinearTosRGB:new $(["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(`
@@ -5248,4 +5248,4 @@ vec3 lab2rgb (in vec3 lab) {
5248
5248
 
5249
5249
  `;var Cx=class extends O3.ShaderMaterial{constructor(e,r){super();this.needsJitter=!0;this.type="ParticleMaterial";this.nodeExtensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1};this.easeOpacity="linearFadeIn";this.easeSize="linearFadeIn";this.useSizeEnd=!1;this.isColoringRandom=!1;this.init(e,r),this.context=r}reset(){}init(e,r){this.transparent=!0,this.depthTest=!0,this.depthWrite=!1,this.easeOpacity=e.ease,this.easeSize=e.easeSize,this.layers=[],gt.startContext(gt.globalContext),this.lightLayer=new Yn(0,"",{...qt.defaultData("light","phong"),visible:!1},new $s,{},r.shared),gt.endContext(gt.globalContext),this.build()}updateState(e){e.coloring!==void 0&&(this.isColoringRandom=e.coloring==="random"),e.color!==void 0&&(e.color instanceof Array?this.uniforms.uColor.value=e.color:this.uniforms.uColor.value=this.context.shared.color(e.color)),e.color2!==void 0&&(e.color2 instanceof Array?this.uniforms.uColor2.value=e.color2:this.uniforms.uColor2.value=this.context.shared.color(e.color2)),e.size!==void 0&&(this.uniforms.uSize.value=e.size[0],this.uniforms.uSizeEnd.value=e.size[1],e.size[0]!==e.size[1]?this.useSizeEnd=!0:this.useSizeEnd=!1),e.ease!==void 0&&(this.easeOpacity=e.ease,this.build()),e.easeSize!==void 0&&(this.easeSize=e.easeSize,this.build()),this.needsUpdate=!0}onBeforeCompile(e){this.build(),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader}build(){let e=new Lu;return e.needsJitter=this.needsJitter,e.addFragmentParsCode(bL),e.buildShader("vertex",this.fragment),e.buildShader("fragment",this.fragment),e.addFragmentFinalCode(xL),this.isColoringRandom&&e.define("USE_RANDOM_COLORING"),this.useSizeEnd&&e.define("USE_SIZE_END"),e.addVertexParsCode(E3),e.addFragmentParsCode(P3),e.addVertexFinalCode(T3({easeSize:this.easeSize})),e.addFragmentFinalCode(M3({easeOpacity:this.easeOpacity})),this.vertexShader=e.getCode("vertex"),this.fragmentShader=e.getCode("fragment"),this.defines=e.defines,this.uniforms={...e.uniforms,...this.uniforms},this.nodeExtensions=e.extensions,this}get nodeMaterial(){return this}get fragment(){return this.lightLayer.node}getDefines(){return this.defines}nodeMaterialDispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}};var I3=require("three/examples/jsm/misc/GPUComputationRenderer.js");fM({createMaterial:(i,t)=>new Cx(i,t),createComputation:(i,t,e)=>new I3.GPUComputationRenderer(i,t,e)});var SC=require("three");function D3(i,t,e,r){let n=e,o=n.type==="texture"?n.texture.image!=null?r.uiBuffer(n.texture.image)??r.image(n.texture.image):r.getImage(""):r.video(n.texture.video),a=new is(o,n.texture.wrapping??(n.type==="texture"?1e3:1001),n.texture.minFilter??1008,n.texture.magFilter??1006),s=new $b(o),l=new ex(vc(n.texture.repeat??[1,1],r),vc(n.texture.offset??[0,0],r),he(n.texture.rotation??0,r)),c=new ee(n.crop?1:0),d=new ke(n.projection??0),u=new ke(["x","y","z"].indexOf(n.axis)??0),p=n.projectionAxis?["x","y","z"].indexOf(n.projectionAxis):-1,h=new ke(n.side??0),f=new Zt(n.size?new SC.Vector2(...vc(n.size,r)):new SC.Vector2(100,100)),m=new ee(n.blending??0),y=new ee(ji(n.alpha,r)),g=new ke(n.mode??0),v=new _t(n.isMask??!1),b=new as(a,s,c,d,u,h,f,m,l,y,g,v,p),S=new Re(b.calpha,"f");return new He(i,t,n,{texture:a,textureSize:s,crop:c,projection:d,axis:u,side:h,size:f,blending:m,mat:l,alpha:y,mode:g,isMask:v},b,g,S,v,r)}ut("texture",D3);ut("video",D3);var R3=require("three");ut("matcap",(i,t,e,r)=>{let n=e,o=n.texture.image!=null?r.image(n.texture.image):r.getImage(""),a=new is(o,n.texture.wrapping??1001,n.texture.minFilter??1008,n.texture.magFilter??1006),s=new ee(ji(n.alpha,r)),l=new ke(n.mode??0),c=new _t(n.isMask??!1),d=new ee((he(n.texture.rotation??0,r)??0)*R3.MathUtils.DEG2RAD),u=new Wu(a,s,l,c,d),p=new Re(u.calpha,"f");return new He(i,t,n,{texture:a,alpha:s,mode:l,isMask:c,rotation:d},u,l,p,c,r)});var B3=require("three");ut("displace",(i,t,e,r)=>{let n=e;if(n.displacementType==="noise"){let o=new mr(new B3.Vector3(...n.offset.map(g=>he(g,r)??0))),a=new ee(he(n.scale,r)??10),s=new ee(he(n.intensity,r)??8),l=new ee(he(n.movement,r)??1),c=new ke(n.noiseType??0),d=new ke(n.voronoiStyle??0),u=new ee(he(n.smoothness,r)??.5),p=new ee(he(n.seed,r)??0),h=new ee(he(n.highCut,r)??1),f=new ee(he(n.lowCut,r)??0),m=new ke(he(n.quality,r)??1),y=new $u(s,l,o,d,u,p,h,f,m,a,c);return new tp(i,t,n,{offset:o,scale:a,intensity:s,movement:l,noiseType:c,voronoiStyle:d,smoothness:u,seed:p,highCut:h,lowCut:f,quality:m},y,r)}else throw new Error});ut("cavity",(i,t,e,r)=>{let n=It(e,r),o=new ee(he(n.ridge,r)??1),a=new ee(he(n.valley,r)??1),s=Dt(n),l=new zu(o,a,je.normalViewRenderTarget,je.resolution,s.alpha,s.mode,s.isMask),c=new Re(l.calpha,"f");return new He(i,t,e,{ridge:o,valley:a,...s},l,s.mode,c,s.isMask,r)});ut("dust",(i,t,e,r)=>{let n=It(e,r),o=new ot(n.color??10323813),a=new ee(n.coverage??.2),s=new ee(n.softness??.2),l=new ee(n.noiseStrength??.2),c=new ee(n.noiseScale??1),d=Dt(n),u=new ju(o,a,s,l,c,d.alpha,d.isMask),p=new Re(u.calpha,"f");return new He(i,t,e,{color:o,coverage:a,softness:s,noiseStrength:l,noiseScale:c,...d},u,d.mode,p,d.isMask,r)});ut("fresnel",(i,t,e,r)=>{let n=It(e,r),o=new ot(n.color??16777215),a=new ee(he(n.bias,r)??.1),s=new ee(he(n.scale,r)??1),l=new ee(he(n.intensity,r)??2),c=new ee(he(n.factor,r)??1),d=Dt(n),u=new Df(o,a,s,l,c,d.alpha,d.mode,d.isMask),p=new Re(u.calpha,"f");return new He(i,t,e,{color:o,bias:a,scale:s,intensity:l,factor:c,...d},u,d.mode,p,d.isMask,r)});var np=require("three");ut("gradient",(i,t,e,r)=>{let n=It(e,r),o=new ke(n.gradientType??0),a=new _t(n.smooth??!1),s;n.colors?s=new Ei(n.colors.length,n.colors):(s=new Ei(10,new np.Vector4(0,0,0,1)),s.value[1]=new np.Vector4(1,1,1,1));let l;n.steps?l=new Ci(n.steps.length,n.steps):(l=new Ci(10,1),l.value[0]=0);let c=new Zt(vi(n.offset??new np.Vector2(0,0),r)),d=new Zt(vi(n.morph??new np.Vector2(0,0),r)),u=new ee(he(n.angle??0,r)),p=Dt(n),h=new Hu(o,a,s,l,c,d,u,p.alpha,p.isMask),f=new Re(h.calpha,"f");return new He(i,t,e,{gradientType:o,smooth:a,colors:s,steps:l,offset:c,morph:d,angle:u,...p},h,p.mode,f,p.isMask,r)});var AC=require("three");ut("depth",(i,t,e,r)=>{let n=It(e,r),o=new ke(n.gradientType??0),a=new _t(n.smooth??!1),s=new ee(he(n.near,r)??50),l=new ee(he(n.far,r)??200),c=new ee(n.isVector??1),d=new ee(n.isWorldSpace??0),u=new mr(ti(n.origin,r)),p=new mr(ti(n.direction,r)),h;n.colors?h=new Ei(n.colors.length,n.colors):(h=new Ei(2,new AC.Vector4(0,0,0,1)),h.value[1]=new AC.Vector4(1,1,1,1));let f;n.steps?f=new Ci(n.steps.length,n.steps):(f=new Ci(2,1),f.value[0]=0);let m=Dt(n),y=new Uu(o,a,s,l,c,d,u,p,h,f,m.alpha,m.isMask),g=new Re(y.calpha,"f");return new He(i,t,e,{gradientType:o,smooth:a,near:s,far:l,isVector:c,isWorldSpace:d,origin:u,direction:p,colors:h,steps:f,...m},y,m.mode,g,m.isMask,r)});var N3=require("three");ut("normal",(i,t,e,r)=>{let n=It(e,r),o=new mr(n.cnormal??new N3.Vector3(1,1,1)),a=Dt(n),s=new Vu(o,a.alpha),l=new Re(s.calpha,"f");return new He(i,t,e,{cnormal:o,...a},s,a.mode,l,a.isMask,r)});var ip=require("three");ut("noise",(i,t,e,r)=>{let n=It(e,r),o=new ee(he(n.scale,r)??1),a=new mr(ti(n.size??new ip.Vector3(100,100,100),r)),s=new ee(he(n.move,r)??1),l=new Zt(vi(n.fA??new ip.Vector2(1.7,9.2),r)),c=new Zt(vi(n.fB??new ip.Vector2(8.3,2.8),r)),d=new Zt(vi(n.distortion??new ip.Vector2(1,1),r)),u=new Rn(n.colorA),p=new Rn(n.colorB),h=new Rn(n.colorC),f=new Rn(n.colorD),m=new ke(n.noiseType??0),y=new ke(n.voronoiStyle??0),g=new ee(he(n.highCut,r)??1),v=new ee(he(n.lowCut,r)??0),b=new ee(he(n.smoothness,r)??.5),S=new ee(he(n.seed,r)??.5),x=new ke(n.quality??1),A=Dt(n),w=new qu(o,a,s,l,c,d,u,p,h,f,A.alpha,m,A.isMask,y,g,v,b,S,x),C=new Re(w.calpha,"f");return new He(i,t,e,{scale:o,size:a,move:s,fA:l,fB:c,distortion:d,colorA:u,colorB:p,colorC:h,colorD:f,noiseType:m,...A,voronoiStyle:y,highCut:g,lowCut:v,smoothness:b,seed:S,quality:x},w,A.mode,C,A.isMask,r)});ut("rainbow",(i,t,e,r,n)=>{let o=It(e,r),a=new ee(he(o.filmThickness,r)??30),s=new ee(he(o.movement,r)??0),l=new mr(ti(o.wavelengths,r)),c=new ee(he(o.noiseStrength,r)??0),d=new ee(he(o.noiseScale,r)??1),u=new mr(ti(o.offset,r)),p=Dt(o),h=n?.forceRainbowNoise===!0,f=h||bo(o.noiseStrength),m=new Ku(a,s,l,c,d,u,p.alpha,p.isMask,f),y=new Re(m.calpha,"f"),g=new He(i,t,e,{filmThickness:a,movement:s,wavelengths:l,noiseStrength:c,noiseScale:d,offset:u,...p},m,p.mode,y,p.isMask,r);return g.noiseCompiledIn=f,g.noiseForced=h,g});var op=require("three");ut("toon",(i,t,e,r)=>{let n=It(e,r),o=new ke(n.positioning??0),a;n.colors?a=new Ei(n.colors.length,n.colors):(a=new Ei(10,new op.Vector4(0,0,0,1)),a.value[1]=new op.Vector4(1,1,1,1));let s;n.steps?s=new Ci(n.steps.length,n.steps):(s=new Ci(10,1),s.value[0]=0);let l=new mr(ti(n.source??new op.Vector3(0,0,0),r)),c=new _t(n.isWorldSpace??!0),d=new ee(he(n.noiseStrength??0,r)),u=new ee(he(n.noiseScale??1,r)),p=new Rn(n.shadowColor),h=new mr(ti(n.offset??new op.Vector3(0,0,0),r)),f=Dt(n),m=new Qu(o,a,s,l,c,d,u,p,h,f.alpha),y=new Re(m.calpha,"f");return new He(i,t,e,{positioning:o,colors:a,steps:s,source:l,isWorldSpace:c,noiseStrength:d,noiseScale:u,shadowColor:p,offset:h,...f},m,f.mode,y,f.isMask,r)});var L3=require("three");ut("outline",(i,t,e,r)=>{let n=It(e,r),o=new ot(n.outlineColor??16777215),a=new ot(n.contourColor??16777215),s=new ee(he(n.outlineWidth??.1,r)),l=new ee(he(n.contourWidth??.1,r)),c=new ee(he(n.outlineThreshold??.1,r)),d=new ee(he(n.contourThreshold??.1,r)),u=new ee(he(n.outlineSmoothing??.1,r)),p=new ee(he(n.contourFrequency??.1,r)),h=new mr(ti(n.contourDirection??new L3.Vector3(0,1,0),r)),f=new _t(n.positionalLines??!1),m=new _t(n.compensation??!0),y=je.normalRenderTarget,g=je.normalRenderTargetDepth,v=je.pixelRatioNode,b=je.resolution,S=Dt(n),x=new Xu(o,a,s,l,c,d,u,p,h,f,m,b,y,g,v,S.alpha),A=new Re(x.calpha,"f");return new He(i,t,e,{outlineColor:o,contourColor:a,outlineWidth:s,contourWidth:l,outlineThreshold:c,contourThreshold:d,outlineSmoothing:u,contourFrequency:p,contourDirection:h,positionalLines:f,compensation:m,...S},x,S.mode,A,S.isMask,r)});ut("transmission",(i,t,e,r)=>{let n=It(e,r),o=new ee(he(n.thickness??10,r)),a=new ee(he(n.ior??1.5,r)),s=new ee(he(n.roughness??.5,r)),l=je.transmissionSize,c=je.transmissionRenderTarget,d=je.transmissionRenderTargetDepth,u=window.innerWidth,p=window.innerHeight,h=u>=p?new Zt(p/u,1):new Zt(1,u/p),f=Dt(n),m=new Zu(o,a,s,l,c,d,h,f.alpha),y=new Re(m.calpha,"f");return new He(i,t,e,{thickness:o,ior:a,roughness:s,aspectRatio:h,...f},m,f.mode,y,f.isMask,r)});var _3=!1;function E5(){_3||(_3=!0,console.warn("[spline] The reflection material layer requires the WebGPU renderer \u2014 it renders as invisible on the classic WebGL pipeline."))}ut("reflection",(i,t,e,r)=>{E5();let n=It(e,r),o=new ee(n.blur??0),a=new ee(n.thickness??10/1e4),s=new ke(n.steps??60),l=new ee(n.stepSize??5/1e3),c=new ke(n.tracingMode??1),d=Dt(n),u=new ot(0,0,0,1),p=new ee(0),h=new os(u,p),f=new Re(h.calpha,"f");return new He(i,t,e,{blur:o,thickness:a,steps:s,stepSize:l,tracingMode:c,...d},h,d.mode,f,d.isMask,r)});var Ex=require("three");ut("pattern",(i,t,e,r)=>{let n=It(e,r),o=new ke(n.style??0),a=new ke(n.projection??0),s=new ke(["x","y","z"].indexOf(n.axis)??0),l=new ee(he(n.blending??0,r)),c=new Zt(vi(n.offset,r)),d=new Rn(n.colorA),u=new Rn(n.colorB),p=new Zt(vi(n.frequency??new Ex.Vector2(10,10),r)),h=new ee(he(n.size??.5,r)),f=new ee(he(n.variation??0,r)),m=new ee(he(n.smoothness??.5,r)),y=new ee(he(n.zigzag??0,r)),g=new ee(he(n.rotation??0,r)),v=new Zt(vi(n.vertical??new Ex.Vector2(0,1),r)),b=new Zt(vi(n.horizontal??new Ex.Vector2(0,1),r)),S=new ke(n.sides??6),x=Dt(n),A=new Yu(o,a,s,l,c,d,u,p,h,f,m,y,g,v,b,S,x.alpha,x.isMask),w=new Re(A.calpha,"f");return new He(i,t,e,{style:o,projection:a,axis:s,blending:l,offset:c,colorA:d,colorB:u,frequency:p,size:h,variation:f,smoothness:m,zigzag:y,rotation:g,vertical:v,horizontal:b,sides:S,...x},A,x.mode,w,x.isMask,r)});ut("vertexColor",(i,t,e,r)=>{let n=It(e,r),o=Dt(n),a=new Ju(o.alpha),s=new Re(a.calpha,"f");return new He(i,t,e,{...o},a,o.mode,s,o.isMask,r)});iO({createRootMaterial:(i,t)=>new rp(i,t),createSharedMaterial:(i,t,e)=>new wx(i,t,e)});cO((i,t)=>i?GL(t):UL());sO(()=>{let i=new k3.ShadowMaterial;return i.depthWrite=!1,i.opacity=.5,i.onBeforeCompile=t=>{t.fragmentShader=`layout(location = 1) out vec4 gVelocity;
5250
5250
  `+t.fragmentShader.replace("void main() {",`void main() {
5251
- gVelocity = vec4(0.0);`)},i});var F3="The SplineLoader only accepts .splinecode files that are generated from Spline export panel.",Tx=class extends Px.Loader{load(t,e,r,n=console.error){let o=new Px.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),t.endsWith(".spline")?console.warn(F3+" The .spline files are only meant to be used by the Editor."):t.endsWith(".splinecode")||console.warn(F3),o.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){n(s)}},r,a=>n(a))}async parse(t){let e=await oL(t,x3),r=aL(e);e.version&&"2.0.122"&&(0,V3.default)(e.version,"2.0.122")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/loader to the latest version."),await Promise.allSettled([r.length&&iL(),KO(e)&&Y2(),NS(e)&&sD(),YI(e)&&Lg(),bx(e)&&vC()].filter(Boolean)),r.length&&await sL(r);let n=!1,o=new Ms(e.shared,{},n);Object.values(o.getMaterials()).forEach(l=>Object.assign(l,{isAsset:!0}));let a=new Ax(e.scene,o);bx(e)&&a.initializeSplatViewer();let s=a.activeCamera;return s&&Object.assign(s,{makeDefault:!0}),a=v3(a),a=f3(a),a=m3(a),a=y3(a),a=b3(a),a}};
5251
+ gVelocity = vec4(0.0);`)},i});var F3="The SplineLoader only accepts .splinecode files that are generated from Spline export panel.",Tx=class extends Px.Loader{load(t,e,r,n=console.error){let o=new Px.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),t.endsWith(".spline")?console.warn(F3+" The .spline files are only meant to be used by the Editor."):t.endsWith(".splinecode")||console.warn(F3),o.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){n(s)}},r,a=>n(a))}async parse(t){let e=await oL(t,x3),r=aL(e);e.version&&"2.0.124"&&(0,V3.default)(e.version,"2.0.124")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/loader to the latest version."),await Promise.allSettled([r.length&&iL(),KO(e)&&Y2(),NS(e)&&sD(),YI(e)&&Lg(),bx(e)&&vC()].filter(Boolean)),r.length&&await sL(r);let n=!1,o=new Ms(e.shared,{},n);Object.values(o.getMaterials()).forEach(l=>Object.assign(l,{isAsset:!0}));let a=new Ax(e.scene,o);bx(e)&&a.initializeSplatViewer();let s=a.activeCamera;return s&&Object.assign(s,{makeDefault:!0}),a=v3(a),a=f3(a),a=m3(a),a=y3(a),a=b3(a),a}};